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.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3c41dfbe3f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Hammat Wele 2025-09-30 16:37:45 +00:00 committed by Paul Derscheid
parent 43c06a34ce
commit 4d2e3faf4e
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 4 additions and 31 deletions

View File

@ -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;
}

View File

@ -247,6 +247,8 @@
<span>Override Renew hold for another</span>
[% CASE 'TOO_MUCH' %]
<span>Override auto-renew too much owing restriction</span>
[% CASE 'OVERRIDDEN' %]
<span>Restriction overridden temporarily</span>
[% CASE %]
<span>[% override | html %]</span>
[% END %]