From 32c26620725ddcb05d0a9f0b742def7bd33d34ff Mon Sep 17 00:00:00 2001 From: Jonathan Druart 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 Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- 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.39.5