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 <david@davidnind.com> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
3bfd382566
commit
676e01d346
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue