[Koha-bugs] [Bug 35341] Circulation rule dates are being overwritten

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Dec 20 16:35:28 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35341

--- Comment #22 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Hmm. This comes from flatpickr instantiation etc. Not my favorite waste of
time:

Calendar.inc contains:
         onReady: function( selectedDates, dateStr, instance ){
             /* When flatpickr instance is created, automatically append a
"clear date" link */

This onReady is called too often.
Flatpickr says that onReady gets triggered once the calendar is in a ready
state.
What happens now, is that the edit of a circulation rule triggers this onReady
again and keeps adding buttons.

Sounds easy to fix but the automagical duplication of flatpickr inputs somehow
interferes.
In the current codebase the second input gets wrapped into the
flatpickr_wrapper class.
But if I move the onReady code to document.ready level only, somehow this
second input is no longer wrapped into that span? Although the control works,
you will see it wrap after clearing a date.

Not sure how to continue here.

Jonathan: do you have a suggestion here?

I tried several things including a filter like:

-            $(instance.input).find('~input.flatpickr:first')
+            $(instance.input)
+                .filter( function () { return $(this).siblings('span').length
== 0 } )
+                .find('~input.flatpickr:first')

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list