Bugzilla – Attachment 177294 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: Change how to pass the param
Bug-9762-Change-how-to-pass-the-param.patch (text/plain), 11.92 KB, created by
William Lavoie
on 2025-01-28 20:24:45 UTC
(
hide
)
Description:
Bug 9762: Change how to pass the param
Filename:
MIME Type:
Creator:
William Lavoie
Created:
2025-01-28 20:24:45 UTC
Size:
11.92 KB
patch
obsolete
>From 096881e2e2dc0092b336a2f9720e78e569e87fdd Mon Sep 17 00:00:00 2001 >From: Matthias Le Gac <matthias.le-gac@inlibro.com> >Date: Tue, 2 Apr 2024 16:26:17 -0400 >Subject: [PATCH] Bug 9762: Change how to pass the param > >--- > C4/Circulation.pm | 143 +++++++++++++++++++++++++++++++++++++++++++- > circ/circulation.pl | 1 + > 2 files changed, 143 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 80cead8a96..e99ed6f14d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -779,6 +779,7 @@ sub CanBookBeIssued { > > my $onsite_checkout = $params->{onsite_checkout} || 0; > my $override_high_holds = $params->{override_high_holds} || 0; >+ my $issueconfirmed = $params->{issueconfirmed} || 0; > > my $item_object = !$barcode ? undef : $params->{item} > // Koha::Items->find( { barcode => $barcode } ); >@@ -801,9 +802,21 @@ sub CanBookBeIssued { > my $circ_library = Koha::Libraries->find( _GetCircControlBranch($item_object, $patron) ); > > my $now = dt_from_string(); >+ my $message; >+ my @message_log; >+ > $duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); > if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now > $needsconfirmation{INVALID_DATE} = $duedate; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + sticky due date is invalid or due date in the past"; >+ } else { >+ $message = "sticky due date is invalid or due date in the past"; >+ } >+ push( @message_log, "sticky due date is invalid or due date in the past" ); >+ } >+ > } > > my $fees = Koha::Charges::Fees->new( >@@ -848,6 +861,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_log, "borrower is restricted" ); >+ } > } > > if ( $patron->is_expired ) { >@@ -920,10 +941,26 @@ sub CanBookBeIssued { > } else { > if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) { > $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + borrower had amend"; >+ } else { >+ $message = "borrower had amend"; >+ } >+ push( @message_log, "borrower had amend" ); >+ } > } elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { > $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; > } elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) { > $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + borrower had amend"; >+ } else { >+ $message = "borrower had amend"; >+ } >+ push( @message_log, "borrower had amend" ); >+ } > } > } > >@@ -1008,6 +1045,14 @@ sub CanBookBeIssued { > $needsconfirmation{issued_surname} = $patron->surname; > $needsconfirmation{issued_cardnumber} = $patron->cardnumber; > $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + item is checked out for someone else "; >+ } else { >+ $message = "item is checked out for someone else"; >+ } >+ push( @message_log, "item is checked out for someone else" ); >+ } > } > } > } >@@ -1031,6 +1076,14 @@ sub CanBookBeIssued { > $needsconfirmation{current_loan_count} = $toomany->{count}; > $needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; > $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + too many checkout"; >+ } else { >+ $message = "too many checkout"; >+ } >+ push( @message_log, "too many checkout" ); >+ } > } else { > $issuingimpossible{TOO_MANY} = $toomany->{reason}; > $issuingimpossible{current_loan_count} = $toomany->{count}; >@@ -1058,6 +1111,14 @@ sub CanBookBeIssued { > }else{ > $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; > $needsconfirmation{item_notforloan} = $item_object->notforloan; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + item not for loan"; >+ } else { >+ $message = "item not for loan"; >+ } >+ push( @message_log, "item not for loan" ); >+ } > } > } > else { >@@ -1104,6 +1165,14 @@ sub CanBookBeIssued { > my $code = $av->count ? $av->next->lib : ''; > $needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' ); > $alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' ); >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + item lost"; >+ } else { >+ $message = "item lost"; >+ } >+ push( @message_log, "item lost" ); >+ } > } > if ( C4::Context->preference("IndependentBranches") ) { > my $userenv = C4::Context->userenv; >@@ -1200,6 +1269,18 @@ sub CanBookBeIssued { > $needsconfirmation{'resbranchcode'} = $res->{branchcode}; > $needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; > $needsconfirmation{'reserve_id'} = $res->{reserve_id}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = >+ "$message + item is on reserve and waiting, but has been reserved by some other patron."; >+ } else { >+ $message = "item is on reserve and waiting, but has been reserved by some other patron."; >+ } >+ push( >+ @message_log, >+ "item is on reserve and waiting, but has been reserved by some other patron" >+ ); >+ } > } > elsif ( $restype eq "Reserved" ) { > # The item is on reserve for someone else. >@@ -1211,6 +1292,14 @@ sub CanBookBeIssued { > $needsconfirmation{'resbranchcode'} = $res->{branchcode}; > $needsconfirmation{'resreservedate'} = $res->{reservedate}; > $needsconfirmation{'reserve_id'} = $res->{reserve_id}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + item is on reserve for someone else"; >+ } else { >+ $message = "item is on reserve for someone else"; >+ } >+ push( @message_log, "item is on reserve for someone else" ); >+ } > } > elsif ( $restype eq "Transferred" ) { > # The item is determined hold being transferred for someone else. >@@ -1222,6 +1311,14 @@ sub CanBookBeIssued { > $needsconfirmation{'resbranchcode'} = $res->{branchcode}; > $needsconfirmation{'resreservedate'} = $res->{reservedate}; > $needsconfirmation{'reserve_id'} = $res->{reserve_id}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + item is determined hold being transferred for someone else"; >+ } else { >+ $message = "item is determined hold being transferred for someone else"; >+ } >+ push( @message_log, "item is determined hold being transferred for someone else" ); >+ } > } > elsif ( $restype eq "Processing" ) { > # The item is determined hold being processed for someone else. >@@ -1233,6 +1330,14 @@ sub CanBookBeIssued { > $needsconfirmation{'resbranchcode'} = $res->{branchcode}; > $needsconfirmation{'resreservedate'} = $res->{reservedate}; > $needsconfirmation{'reserve_id'} = $res->{reserve_id}; >+ if ($issueconfirmed) { >+ if ($message) { >+ $message = "$message + item is determined hold being processed for someone else"; >+ } else { >+ $message = "item is determined hold being processed for someone else"; >+ } >+ push( @message_log, "item is determined hold being processed for someone else" ); >+ } > } > } > } >@@ -1276,6 +1381,12 @@ sub CanBookBeIssued { > if ( $restriction_age && $patron->dateofbirth && $restriction_age > $patron->get_age() ) { > if ( C4::Context->preference('AgeRestrictionOverride') ) { > $needsconfirmation{AGE_RESTRICTION} = "$agerestriction"; >+ if ($message) { >+ $message = "$message + age restriction"; >+ } else { >+ $message = "age restriction"; >+ } >+ push( @message_log, "age restriction" ); > } > else { > $issuingimpossible{AGE_RESTRICTION} = "$agerestriction"; >@@ -1332,7 +1443,37 @@ sub CanBookBeIssued { > } > } > >- return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, ); >+ my $borrower = $patron; >+ my $user = C4::Context->userenv->{number}; >+ my $branchcode = C4::Context->userenv->{branch}; >+ my $item = Koha::Items->find( { barcode => $barcode } ); >+ my $itemnumber = $item->itemnumber; >+ >+ # action, cardnumber, barcode, date, heure, user, branche >+ if ($issueconfirmed) { >+ >+ my $infos = ( >+ { >+ message => \@message_log, >+ borrowernumber => $borrower->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"); >+ } >+ >+ >+ return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, \@message_log ); > } > > =head2 CanBookBeReturned >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 968470e6f1..e4f588f7dc 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -345,6 +345,7 @@ if ( @$barcodes && $op eq 'cud-checkout' ) { > { > onsite_checkout => $onsite_checkout, > override_high_holds => $override_high_holds || $override_high_holds_tmp || 0, >+ issueconfirmed => $issueconfirmed, > } > ); > } catch { >-- >2.43.0
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