From ac7aedd11813c5d770681288ee5cc7f9916550b4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 10 Aug 2020 16:45:26 +0200 Subject: [PATCH] Bug 18501: Remove the borrowernumber parameter It was not used --- 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 1b298bcb7f..9a705b0f12 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2037,7 +2037,6 @@ sub AddReturn { my $refunded = $item->set_found( { holdingbranch => $item_holding_branch, - borrowernumber => $borrowernumber } ); @@ -2479,7 +2478,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 @@ -2491,7 +2490,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 9f32beefd9..0bb04684ed 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; @@ -794,7 +793,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 bb2ff5f978..d0ab836b26 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2746,7 +2746,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 @@ -2808,7 +2808,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' ); @@ -2866,7 +2866,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' ); @@ -2952,7 +2952,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)' ); @@ -3049,7 +3049,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)' ); @@ -3180,7 +3180,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