From f27dd94697462130826c0bb096e1c20f5c7ae9ce Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 5 Dec 2025 13:45:08 +0000 Subject: [PATCH] Bug 41090: Handle auto_unseen_final message on renew.pl To test: 0 - Follow previous plan, set system preference UnseenRenewals to 'Allow' 1 - Adjust circ rule for: Renewals Allowed: 2 Unseen renewals allowed: 1 Renewal period: 5 No renewal before: 6 No automatic renewal before: 6 Auto renewal: Yes 2 - Issue an item that matches that rule 3 - Use the 'Renew' tab in the toolbar or browse to Circulation->Renew 4 - Enter the item barcode 5 - You see 2 messages: Cannot renew: auto_unseen_final "Continue without renewing" Item renewed.. 6 - Apply patch 7 - Check in item, and repeat 2-4 8 - Now you get a single success message and a note that this is the last unseen renewal 9 - Sign off! Signed-off-by: David Nind --- circ/renew.pl | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt | 3 +++ 2 files changed, 11 insertions(+) diff --git a/circ/renew.pl b/circ/renew.pl index bea1219d7e..7f8ae15e67 100755 --- a/circ/renew.pl +++ b/circ/renew.pl @@ -52,6 +52,7 @@ my $hard_due_date = $cgi->param('hard_due_date'); my ( $item, $checkout, $patron ); my $error = q{}; my $final_renewal = 0; +my $final_unseen = 0; my ( $soonest_renew_date, $latest_auto_renew_date ); if ( $op eq 'cud-renew' && $barcode ) { @@ -80,6 +81,12 @@ if ( $op eq 'cud-renew' && $barcode ) { $error = undef; $final_renewal = 1; } + if ( $error && ( $error eq 'auto_unseen_final' ) ) { + + # This error implies it can be renewed - but not again after this, so no error + $error = undef; + $final_unseen = 1; + } if ( $error && ( $error eq 'on_reserve' ) ) { if ($override_holds) { @@ -134,6 +141,7 @@ if ( $op eq 'cud-renew' && $barcode ) { borrower => $patron, error => $error, final_renewal => $final_renewal, + final_unseen => $final_unseen, soonestrenewdate => $soonest_renew_date, latestautorenewdate => $latest_auto_renew_date, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt index 5a8a43d70a..09441b8474 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -191,6 +191,9 @@ [% IF final_renewal %]

NOTE: This is the last allowed renewal on this item

[% END %] + [% IF final_unseen %] +

NOTE: This is the last allowed unseen renewal on this item, patron must be present in library for next renewal

+ [% END %] [% END %] -- 2.39.5