Bugzilla – Attachment 108577 Details for
Bug 18501
Automatic refunds need protection from failure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18501: Remove the borrowernumber parameter
Bug-18501-Remove-the-borrowernumber-parameter.patch (text/plain), 5.63 KB, created by
Martin Renvoize
on 2020-08-19 10:41:36 UTC
(
hide
)
Description:
Bug 18501: Remove the borrowernumber parameter
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2020-08-19 10:41:36 UTC
Size:
5.63 KB
patch
obsolete
>From a63c4292bf4d1a0c357601772c26a91d46a92d9a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 12 Aug 2020 15:45:24 +0200 >Subject: [PATCH] Bug 18501: Remove the borrowernumber parameter > >It was not used > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Circulation.pm | 4 +--- > Koha/Item.pm | 3 +-- > t/db_dependent/Circulation.t | 12 ++++++------ > 3 files changed, 8 insertions(+), 11 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 31f9e91ba4..d9b3790dc2 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2048,7 +2048,6 @@ sub AddReturn { > my $refunded = $item->set_found( > { > holdingbranch => $item_holding_branch, >- borrowernumber => $borrowernumber > } > ); > >@@ -2490,7 +2489,7 @@ sub _FixOverduesOnReturn { > > =head2 _FixAccountForLostAndFound > >- &_FixAccountForLostAndFound($itemnumber, [$borrowernumber, $barcode]); >+ &_FixAccountForLostAndFound($itemnumber, [$barcode]); > > Finds the most recent lost item charge for this item and refunds the borrower > appropriatly, taking into account any payments or writeoffs already applied >@@ -2502,7 +2501,6 @@ Internal function, not exported, called only by AddReturn. > > sub _FixAccountForLostAndFound { > my $itemnumber = shift or return; >- my $borrowernumber = @_ ? shift : undef; > my $item_id = @_ ? shift : $itemnumber; # Send the barcode if you want that logged in the description > > my $credit; >diff --git a/Koha/Item.pm b/Koha/Item.pm >index fbc0983fee..a752ca8676 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -767,7 +767,6 @@ sub set_found { > my ($self, $params) = @_; > > my $holdingbranch = $params->{holdingbranch} || $self->holdingbranch; >- my $borrowernumber = $params->{borrowernumber} || undef; > > ## If item was lost, it has now been found, reverse any list item charges if necessary. > my $refund = 1; >@@ -793,7 +792,7 @@ sub set_found { > ) > ) > { >- _FixAccountForLostAndFound( $self->itemnumber, borrowernumber, $self->barcode ); >+ C4::Circulation::_FixAccountForLostAndFound( $self->itemnumber, $self->barcode ); > $refunded = 1; > } > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index bf729494d4..4bdae841c7 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -2747,7 +2747,7 @@ subtest '_FixAccountForLostAndFound' => sub { > ); > $credit->apply( { debits => [ $debts->as_list ], offset_type => 'Writeoff' } ); > >- my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); >+ my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); > is( $credit_return_id, undef, 'No LOST_FOUND account line added' ); > > $lost_fee_line->discard_changes; # reload from DB >@@ -2809,7 +2809,7 @@ subtest '_FixAccountForLostAndFound' => sub { > ); > $credit->apply( { debits => [ $debts->as_list ], offset_type => 'Payment' } ); > >- my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); >+ my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); > my $credit_return = Koha::Account::Lines->find($credit_return_id); > > is( $credit_return->credit_type_code, 'LOST_FOUND', 'An account line of type LOST_FOUND is added' ); >@@ -2867,7 +2867,7 @@ subtest '_FixAccountForLostAndFound' => sub { > is( $lost_fee_line->amountoutstanding + 0, > $replacement_amount, 'The right LOST amountountstanding is generated' ); > >- my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); >+ my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); > my $credit_return = Koha::Account::Lines->find($credit_return_id); > > is( $credit_return->credit_type_code, 'LOST_FOUND', 'An account line of type LOST_FOUND is added' ); >@@ -2953,7 +2953,7 @@ subtest '_FixAccountForLostAndFound' => sub { > $lost_fee_line->discard_changes; > my $outstanding = $lost_fee_line->amountoutstanding; > >- my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); >+ my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); > my $credit_return = Koha::Account::Lines->find($credit_return_id); > > is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PROCESSING - PAYMENT (LOST_FOUND)' ); >@@ -3050,7 +3050,7 @@ subtest '_FixAccountForLostAndFound' => sub { > > t::lib::Mocks::mock_preference( 'AccountAutoReconcile', 1 ); > >- my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); >+ my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); > my $credit_return = Koha::Account::Lines->find($credit_return_id); > > is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PROCESSING - payment (LOST_FOUND)' ); >@@ -3181,7 +3181,7 @@ subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub { > > $patron->delete(); > >- my $return_value = C4::Circulation::_FixAccountForLostAndFound( $patron->id, $item->itemnumber ); >+ my $return_value = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); > > is( $return_value, undef, "_FixAccountForLostAndFound returns undef if patron is deleted" ); > >-- >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 18501
:
108004
|
108005
|
108006
|
108121
|
108122
|
108123
|
108167
|
108168
|
108169
|
108170
|
108193
|
108194
|
108195
|
108243
|
108248
|
108249
|
108291
|
108292
|
108293
|
108294
|
108295
|
108296
|
108297
|
108298
|
108299
|
108300
|
108301
|
108482
|
108483
|
108484
|
108485
|
108486
|
108487
|
108488
|
108489
|
108490
|
108491
|
108492
|
108493
|
108494
|
108575
|
108576
|
108577
|
108578
|
108579
|
108580
|
108581
|
108582
|
108583
|
108584
|
108585
|
108586
|
108596
|
108597
|
108598
|
108599
|
108600
|
108601
|
108602
|
108603
|
108604
|
108605
|
108606
|
108607
|
108608
|
108610
|
108611
|
108612
|
108613
|
108614
|
108615
|
108616
|
108617
|
108618
|
108619
|
108620
|
108621
|
108717
|
108732
|
108738
|
108739
|
108740
|
108741
|
108784
|
108785
|
108786
|
108787
|
108788
|
108795
|
111295