From 6b80dec84d82ae38010eb6f1cce9e2ebd8d1a1a8 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. Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- 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 43ee3dbe1b..5d432b4f80 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 8c35b822eb..185a5488db 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -1729,6 +1729,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",