| 
      
            Lines 1470-1484
          sub AddIssue {
      
      
        Link Here
      
     | 
  
        
          | 1470 | 
                      # If it costs to borrow this book, charge it to the patron's account.  | 
          1470 | 
                      # If it costs to borrow this book, charge it to the patron's account.  | 
        
        
          | 1471 | 
                      my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} ); | 
          1471 | 
                      my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} ); | 
        
        
          | 1472 | 
                      if ( $charge > 0 ) { | 
          1472 | 
                      if ( $charge > 0 ) { | 
        
          
            
              | 1473 | 
                              my $description = "Rental";  | 
              1473 | 
                              AddIssuingCharge( $issue, $charge, 'rent' );  | 
            
            
              | 1474 | 
                              AddIssuingCharge( $issue, $charge, $description );  | 
               | 
               | 
            
        
          | 1475 | 
                      }  | 
          1474 | 
                      }  | 
        
        
          | 1476 | 
           | 
          1475 | 
           | 
        
        
          | 1477 | 
                      my $itemtype_object = Koha::ItemTypes->find( $item_object->effective_itemtype );  | 
          1476 | 
                      my $itemtype_object = Koha::ItemTypes->find( $item_object->effective_itemtype );  | 
        
        
          | 1478 | 
                      if ( $itemtype_object ) { | 
          1477 | 
                      if ( $itemtype_object ) { | 
        
        
          | 1479 | 
                          my $accumulate_charge = $fees->accumulate_rentalcharge();  | 
          1478 | 
                          my $accumulate_charge = $fees->accumulate_rentalcharge();  | 
        
        
          | 1480 | 
                          if ( $accumulate_charge > 0 ) { | 
          1479 | 
                          if ( $accumulate_charge > 0 ) { | 
        
          
            
              | 1481 | 
                                  AddIssuingCharge( $issue, $accumulate_charge, 'Daily rental' ) if $accumulate_charge > 0;  | 
              1480 | 
                                  AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily' ) if $accumulate_charge > 0;  | 
            
        
          | 1482 | 
                              $charge += $accumulate_charge;  | 
          1481 | 
                              $charge += $accumulate_charge;  | 
        
        
          | 1483 | 
                              $item_unblessed->{charge} = $charge; | 
          1482 | 
                              $item_unblessed->{charge} = $charge; | 
        
        
          | 1484 | 
                          }  | 
          1483 | 
                          }  | 
        
  
    | 
      
            Lines 2912-2919
          sub AddRenewal {
      
      
        Link Here
      
     | 
  
        
          | 2912 | 
              # Charge a new rental fee, if applicable  | 
          2911 | 
              # Charge a new rental fee, if applicable  | 
        
        
          | 2913 | 
              my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );  | 
          2912 | 
              my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );  | 
        
        
          | 2914 | 
              if ( $charge > 0 ) { | 
          2913 | 
              if ( $charge > 0 ) { | 
        
          
            
              | 2915 | 
                      my $description = "Renewal of Rental Item " . $biblio->title . " " .$item_object->barcode;  | 
              2914 | 
                      AddIssuingCharge($issue, $charge, 'rent_renew');  | 
            
            
              | 2916 | 
                      AddIssuingCharge($issue, $charge, $description);  | 
               | 
               | 
            
        
          | 2917 | 
              }  | 
          2915 | 
              }  | 
        
        
          | 2918 | 
           | 
          2916 | 
           | 
        
        
          | 2919 | 
              # Charge a new accumulate rental fee, if applicable  | 
          2917 | 
              # Charge a new accumulate rental fee, if applicable  | 
        
  
    | 
      
            Lines 2921-2928
          sub AddRenewal {
      
      
        Link Here
      
     | 
  
        
          | 2921 | 
              if ( $itemtype_object ) { | 
          2919 | 
              if ( $itemtype_object ) { | 
        
        
          | 2922 | 
                  my $accumulate_charge = $fees->accumulate_rentalcharge();  | 
          2920 | 
                  my $accumulate_charge = $fees->accumulate_rentalcharge();  | 
        
        
          | 2923 | 
                  if ( $accumulate_charge > 0 ) { | 
          2921 | 
                  if ( $accumulate_charge > 0 ) { | 
        
          
            
              | 2924 | 
                          my $type_desc = "Renewal of Daily Rental Item " . $biblio->title . " $item_unblessed->{'barcode'}"; | 
              2922 | 
                          AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily_renew' )  | 
            
            
              | 2925 | 
                          AddIssuingCharge( $issue, $accumulate_charge, $type_desc )  | 
               | 
               | 
            
        
          | 2926 | 
                  }  | 
          2923 | 
                  }  | 
        
        
          | 2927 | 
                  $charge += $accumulate_charge;  | 
          2924 | 
                  $charge += $accumulate_charge;  | 
        
        
          | 2928 | 
              }  | 
          2925 | 
              }  | 
        
  
    | 
      
            Lines 3244-3255
          sub _get_discount_from_rule {
      
      
        Link Here
      
     | 
  
        
          | 3244 | 
           | 
          3241 | 
           | 
        
        
          | 3245 | 
          =head2 AddIssuingCharge  | 
          3242 | 
          =head2 AddIssuingCharge  | 
        
        
          | 3246 | 
           | 
          3243 | 
           | 
        
          
            
              | 3247 | 
                &AddIssuingCharge( $checkout, $charge, [$description] )  | 
              3244 | 
                &AddIssuingCharge( $checkout, $charge, $type )  | 
            
        
          | 3248 | 
           | 
          3245 | 
           | 
        
        
          | 3249 | 
          =cut  | 
          3246 | 
          =cut  | 
        
        
          | 3250 | 
           | 
          3247 | 
           | 
        
        
          | 3251 | 
          sub AddIssuingCharge { | 
          3248 | 
          sub AddIssuingCharge { | 
        
          
            
              | 3252 | 
                  my ( $checkout, $charge, $description ) = @_;  | 
              3249 | 
                  my ( $checkout, $charge, $type ) = @_;  | 
            
        
          | 3253 | 
           | 
          3250 | 
           | 
        
        
          | 3254 | 
              # FIXME What if checkout does not exist?  | 
          3251 | 
              # FIXME What if checkout does not exist?  | 
        
        
          | 3255 | 
           | 
          3252 | 
           | 
        
  
    | 
      
            Lines 3257-3268
          sub AddIssuingCharge {
      
      
        Link Here
      
     | 
  
        
          | 3257 | 
              my $accountline = $account->add_debit(  | 
          3254 | 
              my $accountline = $account->add_debit(  | 
        
        
          | 3258 | 
                  { | 
          3255 | 
                  { | 
        
        
          | 3259 | 
                      amount      => $charge,  | 
          3256 | 
                      amount      => $charge,  | 
        
            
              | 3260 | 
                          description => $description,  | 
               | 
               | 
            
        
          | 3261 | 
                      note        => undef,  | 
          3257 | 
                      note        => undef,  | 
        
        
          | 3262 | 
                      user_id     => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, | 
          3258 | 
                      user_id     => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, | 
        
        
          | 3263 | 
                      library_id  => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, | 
          3259 | 
                      library_id  => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, | 
        
        
          | 3264 | 
                      interface   => C4::Context->interface,  | 
          3260 | 
                      interface   => C4::Context->interface,  | 
        
          
            
              | 3265 | 
                          type        => 'rent',  | 
              3261 | 
                          type        => $type,  | 
            
        
          | 3266 | 
                      item_id     => $checkout->itemnumber,  | 
          3262 | 
                      item_id     => $checkout->itemnumber,  | 
        
        
          | 3267 | 
                      issue_id    => $checkout->issue_id,  | 
          3263 | 
                      issue_id    => $checkout->issue_id,  | 
        
        
          | 3268 | 
                  }  | 
          3264 | 
                  }  |