| 
      
            Lines 256-261
          sub adjust {
      
      
        Link Here
      
     | 
  
        
          | 256 | 
                      my $difference                = $amount - $amount_before;  | 
          256 | 
                      my $difference                = $amount - $amount_before;  | 
        
        
          | 257 | 
                      my $new_outstanding           = $amount_outstanding_before + $difference;  | 
          257 | 
                      my $new_outstanding           = $amount_outstanding_before + $difference;  | 
        
        
          | 258 | 
           | 
          258 | 
           | 
        
            
               | 
               | 
              259 | 
                          # Catch cases that require patron refunds  | 
            
            
              | 260 | 
                          if ( $new_outstanding < 0 ) { | 
            
            
              | 261 | 
                              my $account =  | 
            
            
              | 262 | 
                                Koha::Patrons->find( $self->borrowernumber )->account;  | 
            
            
              | 263 | 
                              my $credit = $account->add_credit(  | 
            
            
              | 264 | 
                                  { | 
            
            
              | 265 | 
                                      amount      => $new_outstanding * -1,  | 
            
            
              | 266 | 
                                      description => 'Overpayment refund',  | 
            
            
              | 267 | 
                                      type        => 'credit',  | 
            
            
              | 268 | 
                                      ( $update_type eq 'fine_increment' ? ( item_id => $self->itemnumber ) : ()),  | 
            
            
              | 269 | 
                                  }  | 
            
            
              | 270 | 
                              );  | 
            
            
              | 271 | 
                              $new_outstanding = 0;  | 
            
            
              | 272 | 
                          }  | 
            
            
              | 273 | 
               | 
            
        
          | 259 | 
                      # Update the account line  | 
          274 | 
                      # Update the account line  | 
        
        
          | 260 | 
                      $self->set(  | 
          275 | 
                      $self->set(  | 
        
        
          | 261 | 
                          { | 
          276 | 
                          { | 
        
            
              | 262 | 
              -   | 
               | 
               |