Bugzilla – Attachment 164022 Details for
Bug 9762
Log circulation overrides
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9762: fix log for test 10 13 14 15 16 17
Bug-9762-fix-log-for-test-10-13-14-15-16-17.patch (text/plain), 5.07 KB, created by
Matthias Le Gac
on 2024-03-27 18:07:48 UTC
(
hide
)
Description:
Bug 9762: fix log for test 10 13 14 15 16 17
Filename:
MIME Type:
Creator:
Matthias Le Gac
Created:
2024-03-27 18:07:48 UTC
Size:
5.07 KB
patch
obsolete
>From 21b0c49e0dd076c65df0ee27269d59d25d1aad7f Mon Sep 17 00:00:00 2001 >From: Matthias Le Gac <matthias.le-gac@inlibro.com> >Date: Tue, 26 Mar 2024 16:17:52 -0400 >Subject: [PATCH] Bug 9762: fix log for test 10 13 14 15 16 17 > >--- > C4/Circulation.pm | 24 +++++++++++++++++++ > reserve/request.pl | 3 +-- > svc/renew | 58 ++++++++++++++++++++++++++++++++++++++++++++-- > 3 files changed, 81 insertions(+), 4 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ccbd2e3e51..50b5845b56 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -877,6 +877,14 @@ sub CanBookBeIssued { > } > if ( $patron->is_debarred ) { > $issuingimpossible{DEBARRED} = 1; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + borrower is restricted"; >+ } else { >+ $message = "borrower is restricted"; >+ } >+ push( @message, "borrower is restricted" ); >+ } > } > > if ( $patron->is_expired ) { >@@ -3195,6 +3203,22 @@ sub CanBookBeRenewed { > return ( 0, "on_reserve" ) > if ( $item->current_holds->search( { non_priority => 0 } )->count ); > >+ my $issuing_rule = Koha::CirculationRules->get_effective_rules( >+ { >+ categorycode => $patron->categorycode, >+ itemtype => $item->effective_itemtype, >+ branchcode => $branchcode, >+ rules => [ >+ 'renewalsallowed', >+ 'lengthunit', >+ 'unseen_renewals_allowed' >+ ] >+ } >+ ); >+ >+ return ( 0, "too_many" ) >+ if not $issuing_rule->{renewalsallowed} >+ or $issuing_rule->{renewalsallowed} <= $issue->renewals_count; > > my ( $status, $matched_reserve, $possible_holds ) = CheckReserves($item); > my @fillable_holds = (); >diff --git a/reserve/request.pl b/reserve/request.pl >index eefb8860a1..0d7be12c33 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -570,8 +570,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > my $branchcode = C4::Context->userenv->{branch}; > my $message = "Override limitation of hold"; > my @message = ("Override limitation of hold"); >- my $barcode = $input->param('barcode'); >- >+ my $barcode = $item->{barcode}; > > my $infos = ({ > message => \@message, >diff --git a/svc/renew b/svc/renew >index eca18e647f..5761f2e56f 100755 >--- a/svc/renew >+++ b/svc/renew >@@ -26,6 +26,7 @@ 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); > >@@ -52,6 +53,10 @@ 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; >@@ -65,9 +70,58 @@ my $item = Koha::Items->find($itemnumber); > CanBookBeRenewed( $patron, $item->checkout, $override_limit ); > > # If we're allowing reserved items to be renewed... >-if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride')) { >+if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride') ) { > $data->{renew_okay} = 1; >- $data->{error} = undef; >+ $data->{error} = undef; >+ >+ $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"); >+} >+ >+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"); > } > > if ( $data->{renew_okay} || ( $seen && $data->{error} eq 'too_unseen') ) { >-- >2.34.1
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 9762
:
149554
|
156222
|
163847
|
164022
|
164067
|
164068
|
164302
|
164387
|
164426
|
164479
|
164508
|
164509
|
164510
|
164519
|
170271
|
170272
|
170273
|
176742
|
177294
|
177295
|
177296