Bug 18501: Remove the borrowernumber parameter
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 12 Aug 2020 13:45:24 +0000 (15:45 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 20 Aug 2020 10:31:59 +0000 (12:31 +0200)
It was not used

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/Circulation.pm
Koha/Item.pm
t/db_dependent/Circulation.t

index 31f9e91..d9b3790 100644 (file)
@@ -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;
index fbc0983..a752ca8 100644 (file)
@@ -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;
     }
 
index bf72949..4bdae84 100755 (executable)
@@ -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" );