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