Bugzilla – Attachment 187680 Details for
Bug 40866
Corrections to override logging
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40866: Remove original Bug 9762 implementation remnants (Part 2 - Renewals)
Bug-40866-Remove-original-Bug-9762-implementation-.patch (text/plain), 7.70 KB, created by
Andrew Fuerste-Henry
on 2025-10-09 15:21:20 UTC
(
hide
)
Description:
Bug 40866: Remove original Bug 9762 implementation remnants (Part 2 - Renewals)
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2025-10-09 15:21:20 UTC
Size:
7.70 KB
patch
obsolete
>From 06f4955fd1690ee20644e776f977dd8299a834c4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 9 Oct 2025 07:29:17 +0100 >Subject: [PATCH] Bug 40866: Remove original Bug 9762 implementation remnants > (Part 2 - Renewals) > >This patch removes the duplicate logging code from renewal scripts >(circ/renew.pl and svc/renew) that was part of the original Bug 9762 >implementation. > >The original implementation created separate logaction() calls with >custom JSON messages whenever renewal overrides occurred. This caused >double logging alongside the Alternative implementation which properly >logs overrides via the confirmations parameter in AddRenewal. > >Changes: > >circ/renew.pl: >- Removed unused variables: $user, $branchcode, @message >- Removed separate logaction() calls for override logging >- Changed to use confirmations array with proper codes: > * 'RENEWAL_LIMIT' for override_limit > * 'ON_RESERVE' for override_holds >- Removed C4::Log qw(logaction) import > >svc/renew: >- Removed unused variables: $borrower, $user, $message, @message >- Removed separate logaction() calls for override logging >- Changed to use confirmations array with proper codes: > * 'ON_RESERVE' for on_reserve override > * 'RENEWAL_LIMIT' for too_many override >- Removed C4::Log qw(logaction) import > >The Alternative implementation in AddRenewal will now handle all >override logging consistently through the confirmations parameter. > >Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> >--- > circ/renew.pl | 49 ++---------------------------------------------- > svc/renew | 52 ++------------------------------------------------- > 2 files changed, 4 insertions(+), 97 deletions(-) > >diff --git a/circ/renew.pl b/circ/renew.pl >index b6a55e0fb23..523070ad528 100755 >--- a/circ/renew.pl >+++ b/circ/renew.pl >@@ -24,7 +24,6 @@ use C4::Context; > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate AddRenewal ); >-use C4::Log qw( logaction ); > use Koha::DateUtils qw( dt_from_string ); > use Koha::Database; > use Koha::BiblioFrameworks; >@@ -66,42 +65,19 @@ if ( $op eq 'cud-renew' && $barcode ) { > > $patron = $checkout->patron; > my $borrowernumber = $patron->borrowernumber; >- my $user = C4::Context->userenv->{number}; >- my $branchcode = C4::Context->userenv->{branch}; >- my @message; > > if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { > my $confirmations; > my $can_renew; > my $info; > ( $can_renew, $error, $info ) = CanBookBeRenewed( $patron, $checkout, $override_limit ); >- push @{$confirmations}, $override_limit if $override_limit; >+ push @{$confirmations}, 'RENEWAL_LIMIT' if $override_limit; > > if ( $error && ( $error eq 'on_reserve' ) ) { > if ($override_holds) { > $can_renew = 1; > $error = undef; >- >- @message = ("Override Renew hold for another"); >- >- 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", "RENEWAL", >- $patron->borrowernumber, >- $json_infos, >- ) if C4::Context->preference("RenewalLog"); >+ push @{$confirmations}, 'ON_RESERVE'; > } else { > $can_renew = 0; > } >@@ -133,27 +109,6 @@ if ( $op eq 'cud-renew' && $barcode ) { > } > ); > $template->param( date_due => $date_due ); >- >- @message = ("Override limit Renew"); >- >- 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", "RENEWAL", >- $patron->borrowernumber, >- $json_infos, >- ) if C4::Context->preference("RenewalLog"); > } > } else { > $error = "patron_restricted"; >diff --git a/svc/renew b/svc/renew >index 4f117a8d3d8..86c8b1548ae 100755 >--- a/svc/renew >+++ b/svc/renew >@@ -26,7 +26,6 @@ use Try::Tiny; > use C4::Circulation qw( AddRenewal CanBookBeRenewed ); > use C4::Context; > use C4::Auth qw(check_cookie_auth); >-use C4::Log qw( logaction ); > > use Koha::DateUtils qw(output_pref dt_from_string); > >@@ -54,10 +53,6 @@ my $date_due; > if ( $input->param('date_due') ) { > $date_due = dt_from_string( scalar $input->param('date_due') ); > } >-my $borrower = Koha::Patrons->find($borrowernumber); >-my $user = C4::Context->userenv->{'number'}; >-my $message; >-my @message; > > my $data; > $data->{itemnumber} = $itemnumber; >@@ -75,56 +70,13 @@ my $confirmations; > if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride') ) { > $data->{renew_okay} = 1; > $data->{error} = undef; >- >- push @{$confirmations}, 'ON_RESERVE' if $override_limit; >- $message = "Override Renew hold for another"; >- @message = ("Override Renew hold for another"); >- >- my $infos = ( >- { >- message => \@message, >- borrowernumber => $borrowernumber, >- barcode => $item->barcode, >- manager_id => $user, >- branchcode => $branchcode, >- } >- ); >- >- my $json_infos = JSON->new->utf8->pretty->encode($infos); >- $json_infos =~ s/"/'/g; >- >- logaction( >- "CIRCULATION", "RENEWAL", >- $borrower->{'borrowernumber'}, >- $json_infos, >- ) if C4::Context->preference("IssueLog"); >+ push @{$confirmations}, 'ON_RESERVE'; > } > > if ( $data->{error} && $data->{error} eq 'too_many' && C4::Context->preference('AllowRenewalLimitOverride') ) { > $data->{renew_okay} = 1; > $data->{error} = undef; >- >- $message = "Override limit Renew"; >- @message = ("Override limit Renew"); >- >- my $infos = ( >- { >- message => \@message, >- borrowernumber => $borrowernumber, >- barcode => $item->barcode, >- manager_id => $user, >- branchcode => $branchcode, >- } >- ); >- >- my $json_infos = JSON->new->utf8->pretty->encode($infos); >- $json_infos =~ s/"/'/g; >- >- logaction( >- "CIRCULATION", "RENEWAL", >- $borrower->{'borrowernumber'}, >- $json_infos, >- ) if C4::Context->preference("IssueLog"); >+ push @{$confirmations}, 'RENEWAL_LIMIT' if $override_limit; > } > > if ( $data->{renew_okay} || ( $seen && $data->{error} eq 'too_unseen' ) ) { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40866
:
186985
|
186986
|
187063
|
187116
|
187627
|
187628
|
187629
|
187630
|
187631
|
187632
|
187633
|
187675
|
187676
|
187677
|
187678
|
187679
|
187680
|
187681
|
187682
|
187683
|
187684
|
187685
|
187686
|
187687
|
187688
|
187689
|
187690
|
187691
|
187692
|
187693
|
187694
|
187707
|
187725