View | Details | Raw Unified | Return to bug 37354
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js (-4 / +14 lines)
Lines 132-139 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
132
    // Lead and Trail days syncing
132
    // Lead and Trail days syncing
133
    let leadDays = 0;
133
    let leadDays = 0;
134
    let trailDays = 0;
134
    let trailDays = 0;
135
    let lengthDays;
135
    function getCirculationRules() {
136
    function getCirculationRules() {
136
        let rules_url = "/api/v1/circulation_rules";
137
        $.ajax({
137
        $.ajax({
138
            url: rules_url,
138
            url: rules_url,
139
            type: "GET",
139
            type: "GET",
Lines 142-151 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
142
                patron_category_id: booking_patron.category_id,
142
                patron_category_id: booking_patron.category_id,
143
                item_type_id: booking_itemtype_id,
143
                item_type_id: booking_itemtype_id,
144
                library_id: pickup_library_id,
144
                library_id: pickup_library_id,
145
                rules: "bookings_lead_period,bookings_trail_period",
145
                rules: "bookings_lead_period,bookings_trail_period,issuelength,renewalsallowed,renewalperiod"
146
            },
146
            },
147
            success: function (response) {
147
            success: function (response) {
148
                let rules = response[0];
148
                let rules = response[0];
149
                let renewalLength = rules.renewalsallowed * rules.renewalperiod;
150
                lengthDays = rules.issuelength + renewalLength;
149
                leadDays = rules.bookings_lead_period;
151
                leadDays = rules.bookings_lead_period;
150
                trailDays = rules.bookings_trail_period;
152
                trailDays = rules.bookings_trail_period;
151
153
Lines 672-679 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
672
                        dateStr,
674
                        dateStr,
673
                        instance
675
                        instance
674
                    ) {
676
                    ) {
677
                        // Start date selected
678
                        if (selectedDates[0] && !selectedDates[1]) {
679
                            // Calculate the maximum date based on the selected start date
680
                            const maxDate = new Date(selectedDates[0]);
681
                            maxDate.setDate(maxDate.getDate() + lengthDays );
682
683
                            // Update the maxDate option of the flatpickr instance
684
                            instance.set('maxDate', maxDate);
685
                        }
675
                        // Range set, update hidden fields and set available items
686
                        // Range set, update hidden fields and set available items
676
                        if (selectedDates[0] && selectedDates[1]) {
687
                        else if (selectedDates[0] && selectedDates[1]) {
677
                            // set form fields from picker
688
                            // set form fields from picker
678
                            let picker_start = dayjs(selectedDates[0]);
689
                            let picker_start = dayjs(selectedDates[0]);
679
                            let picker_end = dayjs(selectedDates[1]).endOf(
690
                            let picker_end = dayjs(selectedDates[1]).endOf(
680
- 

Return to bug 37354