Bug 8367: (follow-up) Fix for circ rules editor

Make sure holds pickup period field is empty when editing a 'default' rule.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Aleisha Amohia 2023-10-18 01:38:54 +00:00 committed by Tomas Cohen Arazi
parent fff910fc56
commit c654932f0c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -1531,6 +1531,7 @@
$(this).attr('selected', 'selected');
}
});
var current_input_id = $(current_column).children('input').first().attr('id');
if ( i == 0 || i == 1 ) {
// Disable the 2 first columns, we cannot update them.
var val = $(current_column).find("select option:selected").val();
@ -1541,13 +1542,14 @@
// Remove potential previous input added
$(current_column).find("input").remove();
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
} else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 ) {
} else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 || current_input_id === "holds_pickup_period" ) {
// If the value is not an integer for
// - "Current checkouts allowed"
// - "Current on-site checkouts allowed"
// - "Holds allowed (total)"
// - "Holds allowed (daily)"
// - "Holds per record (count)"
// - "Holds pickup period (day)"
// The value is "Unlimited" (or an equivalent translated string)
// an it should be set to an empty string
if( !((parseFloat(itm_text) == parseInt(itm_text)) && !isNaN(itm_text)) ) {