From 83302926754cdc44efdca356d886fbefd6dec968 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 15 Nov 2023 11:14:09 +0000 Subject: [PATCH] Bug 35341: Fix ciruclation rule dates being overwritten This patch correctly sets the values of the date fields so that they are not overwritten when only one is amended. It also amends the collumn indexes being used in the click event as new columns have been added without these being updated Test plan: 1) Navigate to Administration > Circulation and fine rules 2) Add a new circulation rule for a category of your choice 3) For the "All" rule, add the date 31/12/2023 to both the Hard due date and No automatic renewal after (hard limit) (NARAHL) columns and save 4) Now edit the rule that you created. 5) Change the two columns above to 01/12/2023 and click save 6) Edit the rule again and change the Hard due date to 15/12/2023. Click save 7) Note that the date for your rule in the NARAHL has changed to 31/12/2023 despite not being edited 8) Click edit again, and change the NARAHL date to 15/12/2023 and save. 9) This time the date in Hard due date will have changed to 31/12/2023 10) Apply patch 11) Edit the dates individually a few times and this time your rule should update correctly --- .../prog/en/modules/admin/smart-rules.tt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 00de0896bc..55e68aee2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -284,12 +284,15 @@ [% IF ( hardduedatecompare == '-1' ) %] before [% hardduedate | $KohaDates %] + [% ELSIF ( hardduedatecompare == '0' ) %] on [% hardduedate | $KohaDates %] + [% ELSIF ( hardduedatecompare == '1' ) %] after [% hardduedate | $KohaDates %] + [% END %] [% ELSE %] None defined @@ -332,7 +335,10 @@ [% END %] [% no_auto_renewal_after | html %] - [% no_auto_renewal_after_hard_limit | $KohaDates %] + + [% no_auto_renewal_after_hard_limit | $KohaDates %] + + [% IF reservesallowed.defined && reservesallowed != '' %] [% reservesallowed | html %] @@ -1505,14 +1511,21 @@ } else if ( i == 9 ) { // specific processing for the Hard due date column var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val(); + var hardduedate = $(this).find("input[type='hidden'][name='hardduedatebackup']").val(); var input_value = ''; if (typeof select_value === 'undefined'){ select_value = '-1'; }else { input_value = itm_text.split(' ')[1]; } + $(current_column).find("input[type='hidden']").val(hardduedate); $(current_column).find("input[type='text']").val(input_value); $(current_column).find("select").val(select_value); + } else if ( i == 26 ) { + // specific processing for the No automatic renewal after (hard limit) column + var date = $(this).find("input[type='hidden'][name='no_auto_renewal_after_hard_limit_backup']").val(); + $(current_column).find("input[type='hidden']").val(date); + $(current_column).find("input[type='text']").val(itm_text); } else if ( i == 16 ) { // specific processing for cap_fine_to_replacement_price var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']"); @@ -1542,7 +1555,7 @@ // Remove potential previous input added $(current_column).find("input").remove(); $(current_column).append(""); - } else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 || current_input_id === "holds_pickup_period" ) { + } else if ( i == 5 || i == 6 || i == 27 || i == 28 || i == 29 || current_input_id === "holds_pickup_period" ) { // If the value is not an integer for // - "Current checkouts allowed" // - "Current on-site checkouts allowed" -- 2.37.1 (Apple Git-137.1)