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 2910-2917
sub AddRenewal {
Link Here
|
2910 |
# Charge a new rental fee, if applicable |
2909 |
# Charge a new rental fee, if applicable |
2911 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2910 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2912 |
if ( $charge > 0 ) { |
2911 |
if ( $charge > 0 ) { |
2913 |
my $description = "Renewal of Rental Item " . $biblio->title . " " .$item_object->barcode; |
2912 |
AddIssuingCharge($issue, $charge, 'rent_renew'); |
2914 |
AddIssuingCharge($issue, $charge, $description); |
|
|
2915 |
} |
2913 |
} |
2916 |
|
2914 |
|
2917 |
# Charge a new accumulate rental fee, if applicable |
2915 |
# Charge a new accumulate rental fee, if applicable |
Lines 2919-2926
sub AddRenewal {
Link Here
|
2919 |
if ( $itemtype_object ) { |
2917 |
if ( $itemtype_object ) { |
2920 |
my $accumulate_charge = $fees->accumulate_rentalcharge(); |
2918 |
my $accumulate_charge = $fees->accumulate_rentalcharge(); |
2921 |
if ( $accumulate_charge > 0 ) { |
2919 |
if ( $accumulate_charge > 0 ) { |
2922 |
my $type_desc = "Renewal of Daily Rental Item " . $biblio->title . " $item_unblessed->{'barcode'}"; |
2920 |
AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily_renew' ) |
2923 |
AddIssuingCharge( $issue, $accumulate_charge, $type_desc ) |
|
|
2924 |
} |
2921 |
} |
2925 |
$charge += $accumulate_charge; |
2922 |
$charge += $accumulate_charge; |
2926 |
} |
2923 |
} |
Lines 3242-3253
sub _get_discount_from_rule {
Link Here
|
3242 |
|
3239 |
|
3243 |
=head2 AddIssuingCharge |
3240 |
=head2 AddIssuingCharge |
3244 |
|
3241 |
|
3245 |
&AddIssuingCharge( $checkout, $charge, [$description] ) |
3242 |
&AddIssuingCharge( $checkout, $charge, $type ) |
3246 |
|
3243 |
|
3247 |
=cut |
3244 |
=cut |
3248 |
|
3245 |
|
3249 |
sub AddIssuingCharge { |
3246 |
sub AddIssuingCharge { |
3250 |
my ( $checkout, $charge, $description ) = @_; |
3247 |
my ( $checkout, $charge, $type ) = @_; |
3251 |
|
3248 |
|
3252 |
# FIXME What if checkout does not exist? |
3249 |
# FIXME What if checkout does not exist? |
3253 |
|
3250 |
|
Lines 3255-3266
sub AddIssuingCharge {
Link Here
|
3255 |
my $accountline = $account->add_debit( |
3252 |
my $accountline = $account->add_debit( |
3256 |
{ |
3253 |
{ |
3257 |
amount => $charge, |
3254 |
amount => $charge, |
3258 |
description => $description, |
|
|
3259 |
note => undef, |
3255 |
note => undef, |
3260 |
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, |
3256 |
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, |
3261 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
3257 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
3262 |
interface => C4::Context->interface, |
3258 |
interface => C4::Context->interface, |
3263 |
type => 'rent', |
3259 |
type => $type, |
3264 |
item_id => $checkout->itemnumber, |
3260 |
item_id => $checkout->itemnumber, |
3265 |
issue_id => $checkout->issue_id, |
3261 |
issue_id => $checkout->issue_id, |
3266 |
} |
3262 |
} |