From 444a852320092875736a18aaf38e0bafd97879cd Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 14 Apr 2025 17:45:18 +0000 Subject: [PATCH] Bug 39604: Remember cancelreserve choice when remembering patron for session To test: 1. Put a few items on hold and make note of the barcodes. 2. Check out one of the items to a patron who doesn't have the hold 3. Check the cancel hold radio button 4. Also check the Remember for the session for this patron 5. Click 'Yes, check out' 6. Notice the item is checked out and the hold is cancelled 7. No checkout another on hold item to the same patron 8. No confirm screen ( good ) 9. The item is checked out ( good ) 10. The hold is not cancelled. ( bad ) 11. APPLY PATCH and restart all 12. Try steps 1 - 9 again. This time the 2nd hold should be cancelled. --- circ/circulation.pl | 3 +++ koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/circ/circulation.pl b/circ/circulation.pl index e7732bfdc7b..0b0b756254d 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -487,6 +487,9 @@ if ( @$barcodes && $op eq 'cud-checkout' ) { my ( $patron_for_session, $session_confirmations ) = split( /:/, $patron_session_confirmation, 2 ); my $patron_match = $borrowernumber == $patron_for_session; my @conf_keys = split( /\|/, $session_confirmations ); + if ( $patron_match && grep { $_ eq 'cancelreserve' } @conf_keys ) { + $cancelreserve = 1; + } $template_params->{sessionConfirmationKeys} = (); # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index f11f755964a..38fa105147a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -1747,6 +1747,12 @@ $(document).ready(function () { sessionConfirmations.push($(this).val()); }); + // Add cancelreserve checkbox state if it's checked + if (rememberForSession) { + if ($("#cancelreserve").is(":checked")) { + sessionConfirmations.push("cancelreserve"); + } + } if (currentPatron != borrowernumber && !rememberForSession) { Cookies.set("patronSessionConfirmation", borrowernumber + ":", { sameSite: "Lax", -- 2.39.5