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

(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js (-6 / +21 lines)
Lines 1113-1118 function setFormValues( Link Here
1113
        });
1113
        });
1114
    }
1114
    }
1115
1115
1116
    // If passed an itemnumber, pre-select
1117
    if (booking_item_id) {
1118
        // Wait a bit for the item options to be fully created with data attributes
1119
        setTimeout(function() {
1120
            $("#booking_item_id").val(booking_item_id).trigger("change");
1121
            // Also trigger the select2:select event with proper data
1122
            let selectedOption = $("#booking_item_id option:selected")[0];
1123
            if (selectedOption) {
1124
                $("#booking_item_id").trigger({
1125
                    type: "select2:select",
1126
                    params: {
1127
                        data: {
1128
                            id: booking_item_id,
1129
                            element: selectedOption
1130
                        }
1131
                    }
1132
                });
1133
            }
1134
        }, 100);
1135
    }
1136
1116
    // Set booking start & end if this is an edit
1137
    // Set booking start & end if this is an edit
1117
    if (start_date) {
1138
    if (start_date) {
1118
        // Allow invalid pre-load so setDate can set date range
1139
        // Allow invalid pre-load so setDate can set date range
Lines 1128-1138 function setFormValues( Link Here
1128
    else {
1149
    else {
1129
        periodPicker.redraw();
1150
        periodPicker.redraw();
1130
    }
1151
    }
1131
1132
    // If passed an itemnumber, pre-select
1133
    if (booking_item_id) {
1134
        $("#booking_item_id").val(booking_item_id).trigger("change");
1135
    }
1136
}
1152
}
1137
1153
1138
$("#placeBookingForm").on("submit", function (e) {
1154
$("#placeBookingForm").on("submit", function (e) {
1139
- 

Return to bug 39916