From edfe388f51580ac4b41bf80ca518507246b84cca Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 3 Nov 2023 15:24:49 +0000 Subject: [PATCH] Bug 35068: (follow-up): Make sure renew/checkin selections get retained on reload Content-Type: text/plain; charset=utf-8 To test: 1. Have two checkouts. Click one for Renew and one for Checkin. Click on Check in selected items. 2. When the table reloads the 'renew' selections should be retained 3. Have two checkouts. Click one for Renew and one for Checkin. Click on Renew selected items. 4. When the table reloads the 'check in' selections should be retained Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Marcel de Rooy --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 22f1f1a2b4..7fb8e89d73 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -249,7 +249,6 @@ $(document).ready(function() { if ( refresh_table ) { RefreshIssuesTable(); } - $('#RenewChecked, #CheckinChecked').prop('disabled' , true ); // Prevent form submit return false; }); @@ -297,7 +296,27 @@ $(document).ready(function() { function RefreshIssuesTable() { var table = $('#issues-table').DataTable(); - table.ajax.reload(); + var renewchecked = $('input[name=renew]:checked').map(function(){ + return this.value; + }).get(); + var checkinchecked = $('input[name=checkin]:checked').map(function(){ + return this.value; + }).get(); + table.ajax.reload( function() { + $('#RenewChecked, #CheckinChecked').prop('disabled' , true ); + if ( renewchecked.length ) { + $('#RenewChecked').prop('disabled' , false ); + renewchecked.forEach( function(checked) { + $('.renew[value="'+checked+'"]').prop('checked' , true ); + }); + } + if ( checkinchecked.length ) { + $('#CheckinChecked').prop('disabled' , false ); + checkinchecked.forEach( function(checked) { + $('.checkin[value="'+checked+'"]').prop('checked' , true ); + }); + } + }); } function LoadIssuesTable() { -- 2.30.2