|
Lines 1421-1427
sub AddIssue {
Link Here
|
| 1421 |
# If it costs to borrow this book, charge it to the patron's account. |
1421 |
# If it costs to borrow this book, charge it to the patron's account. |
| 1422 |
my ( $charge, $itemtype ) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} ); |
1422 |
my ( $charge, $itemtype ) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} ); |
| 1423 |
if ( $charge > 0 ) { |
1423 |
if ( $charge > 0 ) { |
| 1424 |
AddIssuingCharge( $issue, $charge ); |
1424 |
my $description = "Rental"; |
|
|
1425 |
AddIssuingCharge( $issue, $charge, $description ); |
| 1425 |
$item->{'charge'} = $charge; |
1426 |
$item->{'charge'} = $charge; |
| 1426 |
} |
1427 |
} |
| 1427 |
|
1428 |
|
|
Lines 2873-2898
sub AddRenewal {
Link Here
|
| 2873 |
# Charge a new rental fee, if applicable? |
2874 |
# Charge a new rental fee, if applicable? |
| 2874 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2875 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
| 2875 |
if ( $charge > 0 ) { |
2876 |
if ( $charge > 0 ) { |
| 2876 |
my $accountno = C4::Accounts::getnextacctno( $borrowernumber ); |
2877 |
my $description = "Renewal of Rental Item " . $biblio->title . " $item->{'barcode'}"; |
| 2877 |
my $manager_id = 0; |
2878 |
AddIssuingCharge($issue, $charge, $description); |
| 2878 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
|
|
| 2879 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
| 2880 |
Koha::Account::Line->new( |
| 2881 |
{ |
| 2882 |
date => dt_from_string(), |
| 2883 |
borrowernumber => $borrowernumber, |
| 2884 |
accountno => $accountno, |
| 2885 |
amount => $charge, |
| 2886 |
manager_id => $manager_id, |
| 2887 |
accounttype => 'Rent', |
| 2888 |
amountoutstanding => $charge, |
| 2889 |
itemnumber => $itemnumber, |
| 2890 |
branchcode => $branchcode, |
| 2891 |
description => 'Renewal of Rental Item ' |
| 2892 |
. $biblio->title |
| 2893 |
. " $item->{'barcode'}", |
| 2894 |
} |
| 2895 |
)->store(); |
| 2896 |
} |
2879 |
} |
| 2897 |
|
2880 |
|
| 2898 |
# Send a renewal slip according to checkout alert preferencei |
2881 |
# Send a renewal slip according to checkout alert preferencei |
|
Lines 3217-3223
sub _get_discount_from_rule {
Link Here
|
| 3217 |
=cut |
3200 |
=cut |
| 3218 |
|
3201 |
|
| 3219 |
sub AddIssuingCharge { |
3202 |
sub AddIssuingCharge { |
| 3220 |
my ( $checkout, $charge ) = @_; |
3203 |
my ( $checkout, $charge, $description ) = @_; |
| 3221 |
|
3204 |
|
| 3222 |
# FIXME What if checkout does not exist? |
3205 |
# FIXME What if checkout does not exist? |
| 3223 |
|
3206 |
|
|
Lines 3225-3231
sub AddIssuingCharge {
Link Here
|
| 3225 |
my $accountline = $account->add_debit( |
3208 |
my $accountline = $account->add_debit( |
| 3226 |
{ |
3209 |
{ |
| 3227 |
amount => $charge, |
3210 |
amount => $charge, |
| 3228 |
description => 'Rental', |
3211 |
description => $description, |
| 3229 |
note => undef, |
3212 |
note => undef, |
| 3230 |
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, |
3213 |
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, |
| 3231 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
3214 |
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, |
| 3232 |
- |
|
|