Bugzilla – Attachment 98923 Details for
Bug 24474
Lost items that are checked out are always returned, even when attempting to renew them
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24474: (follow-up) Add LOST_FOUND logic to Koha::Account::pay
Bug-24474-follow-up-Add-LOSTFOUND-logic-to-KohaAcc.patch (text/plain), 4.02 KB, created by
Martin Renvoize (ashimema)
on 2020-02-14 10:50:22 UTC
(
hide
)
Description:
Bug 24474: (follow-up) Add LOST_FOUND logic to Koha::Account::pay
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-14 10:50:22 UTC
Size:
4.02 KB
patch
obsolete
>From 7ca01ac520f8be6ea7b1811f5dd92bbab42725e3 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 14 Feb 2020 10:39:21 +0000 >Subject: [PATCH] Bug 24474: (follow-up) Add LOST_FOUND logic to > Koha::Account::pay > >This patch adds the same updated logic as found in >Koha::Account::Line->apply to handle LOST_FOUND credits being applied >against their associated LOST debit. > >Currently a 'LOST_FOUND' credit is never created via the pay method and >so the additional test will always pass, but the addition here accounts >for possible future uses. >--- > Koha/Account.pm | 37 ++++++++++++++++++++++++------------- > 1 file changed, 24 insertions(+), 13 deletions(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 6fc464178f..6df02cf2ff 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -64,6 +64,7 @@ Koha::Account->new( { patron_id => $borrowernumber } )->pay( > lines => $lines, # Arrayref of Koha::Account::Line objects to pay > credit_type => $type, # credit_type_code code > offset_type => $offset_type, # offset type code >+ item_id => $itemnumber, # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND) > } > ); > >@@ -82,9 +83,15 @@ sub pay { > my $credit_type = $params->{credit_type}; > my $offset_type = $params->{offset_type} || $type eq 'WRITEOFF' ? 'Writeoff' : 'Payment'; > my $cash_register = $params->{cash_register}; >+ my $item_id = $params->{item_id}; > > my $userenv = C4::Context->userenv; > >+ $credit_type ||= >+ $type eq 'WRITEOFF' >+ ? 'WRITEOFF' >+ : 'PAYMENT'; >+ > my $patron = Koha::Patrons->find( $self->{patron_id} ); > > my $manager_id = $userenv ? $userenv->{number} : 0; >@@ -115,12 +122,16 @@ sub pay { > $balance_remaining = $balance_remaining - $amount_to_pay; > > # Same logic exists in Koha::Account::Line::apply >- if ( $new_amountoutstanding == 0 >- && $fine->itemnumber >+ if ( C4::Context->preference('MarkLostItemsAsReturned') =~ m|onpayment| > && $fine->debit_type_code >- && ( $fine->debit_type_code eq 'LOST' ) ) >+ && $fine->debit_type_code eq 'LOST' >+ && $new_amountoutstanding == 0 >+ && $fine->itemnumber >+ && !( $credit_type eq 'LOST_FOUND' >+ && $item_id == $fine->itemnumber ) ) > { >- C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); >+ C4::Circulation::ReturnLostItem( $self->{patron_id}, >+ $fine->itemnumber ); > } > > my $account_offset = Koha::Account::Offset->new( >@@ -174,12 +185,16 @@ sub pay { > $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); > $fine->store(); > >- if ( $fine->amountoutstanding == 0 >- && $fine->itemnumber >+ if ( C4::Context->preference('MarkLostItemsAsReturned') =~ m|onpayment| > && $fine->debit_type_code >- && ( $fine->debit_type_code eq 'LOST' ) ) >+ && $fine->debit_type_code eq 'LOST' >+ && $fine->amountoutstanding == 0 >+ && $fine->itemnumber >+ && !( $credit_type eq 'LOST_FOUND' >+ && $item_id == $fine->itemnumber ) ) > { >- C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); >+ C4::Circulation::ReturnLostItem( $self->{patron_id}, >+ $fine->itemnumber ); > } > > my $account_offset = Koha::Account::Offset->new( >@@ -216,11 +231,6 @@ sub pay { > last unless $balance_remaining > 0; > } > >- $credit_type ||= >- $type eq 'WRITEOFF' >- ? 'WRITEOFF' >- : 'PAYMENT'; >- > $description ||= $type eq 'WRITEOFF' ? 'Writeoff' : q{}; > > my $payment = Koha::Account::Line->new( >@@ -237,6 +247,7 @@ sub pay { > branchcode => $library_id, > register_id => $cash_register, > note => $note, >+ itemnumber => $item_id, > } > )->store(); > >-- >2.20.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 24474
:
98392
|
98393
|
98436
|
98437
|
98438
|
98439
|
98460
|
98485
|
98486
|
98487
|
98645
|
98646
|
98647
|
98648
|
98673
|
98674
|
98675
|
98676
|
98923
|
100229
|
100230
|
100231
|
100232
|
100233
|
102104
|
102105
|
102106
|
102107
|
102108
|
102109
|
102110
|
102132
|
102133
|
102134
|
102135
|
102136
|
102137
|
102138