| Lines 3213-3245
          sub AddIssuingCharge {
      
      
        Link Here | 
        
          | 3213 |  | 3213 |  | 
        
          | 3214 |     # FIXME What if checkout does not exist? | 3214 |     # FIXME What if checkout does not exist? | 
        
          | 3215 |  | 3215 |  | 
          
            
              | 3216 |     my $nextaccntno = C4::Accounts::getnextacctno( $checkout->borrowernumber ); | 3216 |     my $account = Koha::Account->new({ patron_id => $checkout->borrowernumber }); | 
            
              | 3217 |  | 3217 |     my $accountline = $account->add_debit( | 
            
              | 3218 |     my $manager_id  = 0; |  |  | 
            
              | 3219 |     $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; | 
            
              | 3220 |  | 
            
              | 3221 |     my $accountline = Koha::Account::Line->new( | 
            
              | 3222 |         { | 
            
              | 3223 |             borrowernumber    => $checkout->borrowernumber, | 
            
              | 3224 |             itemnumber        => $checkout->itemnumber, | 
            
              | 3225 |             issue_id          => $checkout->issue_id, | 
            
              | 3226 |             accountno         => $nextaccntno, | 
            
              | 3227 |             amount            => $charge, | 
            
              | 3228 |             amountoutstanding => $charge, | 
            
              | 3229 |             manager_id        => $manager_id, | 
            
              | 3230 |             description       => 'Rental', | 
            
              | 3231 |             accounttype       => 'Rent', | 
            
              | 3232 |             date              => \'NOW()', | 
            
              | 3233 |         } | 
            
              | 3234 |     )->store(); | 
            
              | 3235 |  | 
            
              | 3236 |     Koha::Account::Offset->new( | 
        
          | 3237 |         { | 3218 |         { | 
          
            
              | 3238 |             debit_id => $accountline->id, | 3219 |             amount      => $charge, | 
            
              | 3239 |             type     => 'Rental Fee', | 3220 |             description => 'Rental', | 
            
              | 3240 |             amount   => $charge, | 3221 |             note        => undef, | 
            
              |  |  | 3222 |             user_id     => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, | 
            
              | 3223 |             library_id  => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, | 
            
              | 3224 |             type        => 'rent', | 
            
              | 3225 |             item_id     => $checkout->itemnumber, | 
            
              | 3226 |             issue_id    => $checkout->issue_id, | 
        
          | 3241 |         } | 3227 |         } | 
          
            
              | 3242 |     )->store(); | 3228 |     ); | 
        
          | 3243 | } | 3229 | } | 
        
          | 3244 |  | 3230 |  | 
        
          | 3245 | =head2 GetTransfers | 3231 | =head2 GetTransfers | 
            
              | 3246 | -  |  |  |