From 676e01d346cd6722abbce372e721d726b38b036b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Rodr=C3=ADguez?= Date: Thu, 11 Jun 2026 12:59:53 +0200 Subject: [PATCH] Bug 42825: ERM Local Title - Start date (started_on) not saved for package resources The started_on field inside relationshipFields was missing indexRequired: true, which is required to generate a unique DOM id per row and correctly bind the flatpickr input to the Vue data model. The date_to componentProp also needs indexRequired: true so it references the correct indexed id of the ended_on field. Additionally, add a null check in calendar.inc before accessing ._flatpickr on the end date element to prevent a TypeError when the linked element is not found. To reproduce: 1. Go to ERM > eHoldings > Local > Titles 2. Create or edit a local title 3. Link it to a package and enter a Start date, End date and Proxy 4. Save 5. Reopen the title and click on the linked package row => Start date is empty; End date and Proxy are saved correctly Apply patch, then: 1. Go to ERM > eHoldings > Local > Titles 2. Create or edit a local title 3. Link it to a package and enter a Start date, End date and Proxy 4. Save 5. Reopen the title and click on the linked package row => Start date is now saved and displayed correctly => No TypeError in the browser console when selecting a start date Signed-off-by: David Nind Signed-off-by: Paul Derscheid Signed-off-by: Pedro Amorim --- koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 6 ++++-- .../js/vue/components/ERM/EHoldingsLocalTitleResource.vue | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index 8082107bd5..07125a6faa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -158,8 +158,10 @@ validate_date( dateText, instance ); var thisInput = instance.input; if ( thisInput.hasAttribute('data-date_to') ) { - var endPicker = document.querySelector("#"+thisInput.dataset.date_to)._flatpickr; - endPicker.set('minDate', selectedDates[0]); + var endPickerEl = document.querySelector("#"+thisInput.dataset.date_to); + if (endPickerEl && endPickerEl._flatpickr) { + endPickerEl._flatpickr.set('minDate', selectedDates[0]); + } } let = on_close_focus = $(thisInput).data('flatpickr-on-close-focus'); diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitleResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitleResource.vue index b8d89d9f36..4b72d2282b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitleResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitleResource.vue @@ -416,6 +416,7 @@ export default { name: "started_on", type: "date", label: $__("Start date"), + indexRequired: true, componentProps: { date_to: { type: "string", @@ -428,6 +429,7 @@ export default { name: "ended_on", type: "date", label: $__("End date"), + indexRequired: true, }, { name: "proxy",