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 2888-2895
sub AddRenewal {
Link Here
|
2888 |
# Charge a new rental fee, if applicable |
2887 |
# Charge a new rental fee, if applicable |
2889 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2888 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2890 |
if ( $charge > 0 ) { |
2889 |
if ( $charge > 0 ) { |
2891 |
my $description = "Renewal of Rental Item " . $biblio->title . " " .$item_object->barcode; |
2890 |
AddIssuingCharge($issue, $charge, 'rent_renewal'); |
2892 |
AddIssuingCharge($issue, $charge, $description); |
|
|
2893 |
} |
2891 |
} |
2894 |
|
2892 |
|
2895 |
# Charge a new accumulate rental fee, if applicable |
2893 |
# Charge a new accumulate rental fee, if applicable |
Lines 2897-2904
sub AddRenewal {
Link Here
|
2897 |
if ( $itemtype_object ) { |
2895 |
if ( $itemtype_object ) { |
2898 |
my $accumulate_charge = $fees->accumulate_rentalcharge(); |
2896 |
my $accumulate_charge = $fees->accumulate_rentalcharge(); |
2899 |
if ( $accumulate_charge > 0 ) { |
2897 |
if ( $accumulate_charge > 0 ) { |
2900 |
my $type_desc = "Renewal of Daily Rental Item " . $biblio->title . " $item_unblessed->{'barcode'}"; |
2898 |
AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily_renewal' ) |
2901 |
AddIssuingCharge( $issue, $accumulate_charge, $type_desc ) |
|
|
2902 |
} |
2899 |
} |
2903 |
$charge += $accumulate_charge; |
2900 |
$charge += $accumulate_charge; |
2904 |
} |
2901 |
} |
Lines 3220-3231
sub _get_discount_from_rule {
Link Here
|
3220 |
|
3217 |
|
3221 |
=head2 AddIssuingCharge |
3218 |
=head2 AddIssuingCharge |
3222 |
|
3219 |
|
3223 |
&AddIssuingCharge( $checkout, $charge, [$description] ) |
3220 |
&AddIssuingCharge( $checkout, $charge, $type ) |
3224 |
|
3221 |
|
3225 |
=cut |
3222 |
=cut |
3226 |
|
3223 |
|
3227 |
sub AddIssuingCharge { |
3224 |
sub AddIssuingCharge { |
3228 |
my ( $checkout, $charge, $description ) = @_; |
3225 |
my ( $checkout, $charge, $type ) = @_; |
3229 |
|
3226 |
|
3230 |
# FIXME What if checkout does not exist? |
3227 |
# FIXME What if checkout does not exist? |
3231 |
|
3228 |
|
Lines 3233-3244
sub AddIssuingCharge {
Link Here
|
3233 |
my $accountline = $account->add_debit( |
3230 |
my $accountline = $account->add_debit( |
3234 |
{ |
3231 |
{ |
3235 |
amount => $charge, |
3232 |
amount => $charge, |
3236 |
description => $description, |
|
|
3237 |
note => undef, |
3233 |
note => undef, |
3238 |
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, |
3234 |
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, |
3239 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
3235 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
3240 |
interface => C4::Context->interface, |
3236 |
interface => C4::Context->interface, |
3241 |
type => 'rent', |
3237 |
type => $type, |
3242 |
item_id => $checkout->itemnumber, |
3238 |
item_id => $checkout->itemnumber, |
3243 |
issue_id => $checkout->issue_id, |
3239 |
issue_id => $checkout->issue_id, |
3244 |
} |
3240 |
} |