| Lines 24-30
          use Data::Dumper;
      
      
        Link Here | 
        
          | 24 | use List::MoreUtils qw( uniq ); | 24 | use List::MoreUtils qw( uniq ); | 
        
          | 25 | use Try::Tiny; | 25 | use Try::Tiny; | 
        
          | 26 |  | 26 |  | 
            
              | 27 | use C4::Circulation qw( ReturnLostItem ); |  |  | 
        
          | 28 | use C4::Letters; | 27 | use C4::Letters; | 
        
          | 29 | use C4::Log qw( logaction ); | 28 | use C4::Log qw( logaction ); | 
        
          | 30 | use C4::Stats qw( UpdateStats ); | 29 | use C4::Stats qw( UpdateStats ); | 
  
    | Lines 114-128
          sub pay {
      
      
        Link Here | 
        
          | 114 |         $fine->amountoutstanding($new_amountoutstanding)->store(); | 113 |         $fine->amountoutstanding($new_amountoutstanding)->store(); | 
        
          | 115 |         $balance_remaining = $balance_remaining - $amount_to_pay; | 114 |         $balance_remaining = $balance_remaining - $amount_to_pay; | 
        
          | 116 |  | 115 |  | 
            
              | 117 |         # Same logic exists in Koha::Account::Line::apply |  |  | 
            
              | 118 |         if (   $new_amountoutstanding == 0 | 
            
              | 119 |             && $fine->itemnumber | 
            
              | 120 |             && $fine->debit_type_code | 
            
              | 121 |             && ( $fine->debit_type_code eq 'LOST' ) ) | 
            
              | 122 |         { | 
            
              | 123 |             C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); | 
            
              | 124 |         } | 
            
              | 125 |  | 
        
          | 126 |         my $account_offset = Koha::Account::Offset->new( | 116 |         my $account_offset = Koha::Account::Offset->new( | 
        
          | 127 |             { | 117 |             { | 
        
          | 128 |                 debit_id => $fine->id, | 118 |                 debit_id => $fine->id, | 
  
    | Lines 174-187
          sub pay {
      
      
        Link Here | 
        
          | 174 |         $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); | 164 |         $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); | 
        
          | 175 |         $fine->store(); | 165 |         $fine->store(); | 
        
          | 176 |  | 166 |  | 
            
              | 177 |         if (   $fine->amountoutstanding == 0 |  |  | 
            
              | 178 |             && $fine->itemnumber | 
            
              | 179 |             && $fine->debit_type_code | 
            
              | 180 |             && ( $fine->debit_type_code eq 'LOST' ) ) | 
            
              | 181 |         { | 
            
              | 182 |             C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); | 
            
              | 183 |         } | 
            
              | 184 |  | 
        
          | 185 |         my $account_offset = Koha::Account::Offset->new( | 167 |         my $account_offset = Koha::Account::Offset->new( | 
        
          | 186 |             { | 168 |             { | 
        
          | 187 |                 debit_id => $fine->id, | 169 |                 debit_id => $fine->id, |