From 007cd1a54881a864903ff7e7b13f721eddc15e9c Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Tue, 30 Sep 2025 16:37:45 +0000 Subject: [PATCH] Bug 40866: Fix incorrect display of override message on normal checkouts - The message 'No patron matched Restriction overridden temporarily' was appearing on every checkout, even when no restriction override occurred. - This was caused by the message being set unconditionally after AddIssue in circ/circulation.pl. - The message should not appear in circulation.pl, but in the Log Viewer. To test: 1. Check out an item to a patron normally. 2. 'Restriction overridden temporarily' message appears. 3. Apply patches 4. Repeat 1. ---> Verify that no 'Restriction overridden temporarily' message appears. 5. Check out an item that requires an override (e.g., not for loan item with AllowNotForLoanOverride enabled). ---> Verify that no 'Restriction overridden temporarily' message appears. 6. Go to Tool -> Log viewer. 7. Enter the borrowernumber in Object field and submit. ---> Verify that the 'Restriction overridden temporarily' message is logged correctly. --- circ/circulation.pl | 33 ++----------------- .../prog/en/includes/action-logs.inc | 2 ++ 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index caa743afa22..7c1bbc95d60 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -39,7 +39,6 @@ use C4::Members; use C4::Biblio qw( TransformMarcToKoha ); use C4::Search qw( new_record_from_zebra ); use C4::Reserves qw( ModReserveAffect ); -use C4::Log qw( logaction ); use Koha::Holds; use C4::Context; use CGI::Session; @@ -327,7 +326,6 @@ if ($patron) { # # my $message; -my @message; if ( @$barcodes && $op eq 'cud-checkout' ) { my $checkout_infos; @@ -548,7 +546,8 @@ if ( @$barcodes && $op eq 'cud-checkout' ) { if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { $datedue = $booked->end_date; } - $needsconfirmation->{'DEBT'} = $needsconfirmationDEBT if ($debt_confirmed); + $needsconfirmation->{'DEBT'} = $needsconfirmationDEBT if ($debt_confirmed); + $needsconfirmation->{'OVERRIDDEN'} = $issueconfirmed if ($issueconfirmed); my $issue = AddIssue( $patron, $barcode, $datedue, $cancelreserve, @@ -564,34 +563,6 @@ if ( @$barcodes && $op eq 'cud-checkout' ) { } ); $template_params->{issue} = $issue; - - my $borrower = $patron; - my $borrowernumber = $patron->borrowernumber; - my $user = C4::Context->userenv->{number}; - my $branchcode = C4::Context->userenv->{branch}; - $message = "Restriction overridden temporarily"; - @message = ("Restriction overridden temporarily"); - - if ($issueconfirmed) { - my $infos = ( - { - message => \@message, - borrowernumber => $borrowernumber, - barcode => $barcode, - manager_id => $user, - branchcode => $branchcode, - } - ); - - my $json_infos = JSON->new->utf8->pretty->encode($infos); - $json_infos =~ s/"/'/g; - - logaction( - "CIRCULATION", "ISSUE", - $borrower->{'borrowernumber'}, - $json_infos, - ) if C4::Context->preference("IssueLog"); - } $session->clear('auto_renew'); $inprocess = 1; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc index 6b0deca6366..774e05477f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc @@ -247,6 +247,8 @@ Override Renew hold for another [% CASE 'TOO_MUCH' %] Override auto-renew too much owing restriction + [% CASE 'OVERRIDDEN' %] + Restriction overridden temporarily [% CASE %] [% override | html %] [% END %] -- 2.34.1