Bug 29369 added Flatpickr to the "Date acquired" field When creating items at receival time in Acquisitions, the item info should be cloned/prefilled for the next item after adding an item. However, if you've added a value to "Date acquired", it will trigger a Javascript error that stops the clone/prefill from working. This is because the "input[name='field_value']" element is wrapped by '<span class="flatpickr_wrapper">' which creates a problematic inconsistency with the HTML structure...
(Looks like PrefillItem is also broken for regular cataloguing in 21.11 at least.. fun)
I don't know how widely used this cloneItemBlock function is... although it looks like it might not be working correctly in other parts of Koha. I'm tempted to just handle the error, although that means "Date acquired" won't be cloned...
Created attachment 143738 [details] [review] Bug 32175: Prevent Javascript error by checking for kohafield sibling This patch checks for kohafield sibling before proceeding with data clone when creating items during receival. If the kohafield sibling is not available, don't try to clone the value. Test plan: 1. Create a test vendor 2. Create a test basket (create item on receival) 3. Create a test order for 3 items 4. Close the test basket 5. Receive the order 6. Fill out many item fields including "Date acquired" 7. Click "Add item" 8. Note that the fields aren't cloned and there is a Javascript error in the console 9. Apply the patch 10. Refresh the page 11. Fill out many item fields including "Date acquired" 12. Click "Add item" 13. Note that the fields are cloned, except "Date acquired"
Note that not cloning "Date acquired" isn't too big of a deal, as it will automatically be set (these days) when saving the item.
I had a go at testing a couple of times, but I couldn't replicate the issue (on current master just updated, using Firefox).
(In reply to David Nind from comment #5) > I had a go at testing a couple of times, but I couldn't replicate the issue > (on current master just updated, using Firefox). Hmm, ok, I'll have another look at this one
Same, I cannot recreate on master.
This sounds a bit similar to bug 23202 we encountered after the switch to flatpickr for 'items on ordering'. I also had no issues testing this on current master.
Closing, please reopen if needed. *** This bug has been marked as a duplicate of bug 23202 ***