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

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

Return to bug 21721