View | Details | Raw Unified | Return to bug 21721
Collapse All | Expand All

(-)a/C4/Circulation.pm (-16 / +6 lines)
Lines 1409-1415 sub AddIssue { Link Here
1409
           # If it costs to borrow this book, charge it to the patron's account.
1409
           # If it costs to borrow this book, charge it to the patron's account.
1410
            my ( $charge, $itemtype ) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} );
1410
            my ( $charge, $itemtype ) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} );
1411
            if ( $charge > 0 ) {
1411
            if ( $charge > 0 ) {
1412
                AddIssuingCharge( $issue, $charge );
1412
                my $description = "Rental";
1413
                AddIssuingCharge( $issue, $charge, $description );
1413
                $item->{'charge'} = $charge;
1414
                $item->{'charge'} = $charge;
1414
            }
1415
            }
1415
1416
Lines 2873-2890 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
        $sth = $dbh->prepare(
2880
                "INSERT INTO accountlines
2881
                    (date, borrowernumber, accountno, amount, manager_id,
2882
                    description,accounttype, amountoutstanding, itemnumber)
2883
                    VALUES (now(),?,?,?,?,?,?,?,?)"
2884
        );
2885
        $sth->execute( $borrowernumber, $accountno, $charge, $manager_id,
2886
            "Renewal of Rental Item " . $biblio->title . " $item->{'barcode'}",
2887
            'Rent', $charge, $itemnumber );
2888
    }
2879
    }
2889
2880
2890
    # Send a renewal slip according to checkout alert preferencei
2881
    # Send a renewal slip according to checkout alert preferencei
Lines 3209-3215 sub _get_discount_from_rule { Link Here
3209
=cut
3200
=cut
3210
3201
3211
sub AddIssuingCharge {
3202
sub AddIssuingCharge {
3212
    my ( $checkout, $charge ) = @_;
3203
    my ( $checkout, $charge, $description ) = @_;
3213
3204
3214
    # FIXME What if checkout does not exist?
3205
    # FIXME What if checkout does not exist?
3215
3206
Lines 3217-3223 sub AddIssuingCharge { Link Here
3217
    my $accountline = $account->add_debit(
3208
    my $accountline = $account->add_debit(
3218
        {
3209
        {
3219
            amount      => $charge,
3210
            amount      => $charge,
3220
            description => 'Rental',
3211
            description => $description,
3221
            note        => undef,
3212
            note        => undef,
3222
            user_id     => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0,
3213
            user_id     => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0,
3223
            library_id  => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
3214
            library_id  => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
3224
- 

Return to bug 21721