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

(-)a/C4/Circulation.pm (-4 / +4 lines)
Lines 1468-1481 sub AddIssue { Link Here
1468
            # If it costs to borrow this book, charge it to the patron's account.
1468
            # If it costs to borrow this book, charge it to the patron's account.
1469
            my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} );
1469
            my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} );
1470
            if ( $charge > 0 ) {
1470
            if ( $charge > 0 ) {
1471
                AddIssuingCharge( $issue, $charge, 'rent' );
1471
                AddIssuingCharge( $issue, $charge, 'RENT' );
1472
            }
1472
            }
1473
1473
1474
            my $itemtype_object = Koha::ItemTypes->find( $item_object->effective_itemtype );
1474
            my $itemtype_object = Koha::ItemTypes->find( $item_object->effective_itemtype );
1475
            if ( $itemtype_object ) {
1475
            if ( $itemtype_object ) {
1476
                my $accumulate_charge = $fees->accumulate_rentalcharge();
1476
                my $accumulate_charge = $fees->accumulate_rentalcharge();
1477
                if ( $accumulate_charge > 0 ) {
1477
                if ( $accumulate_charge > 0 ) {
1478
                    AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily' ) if $accumulate_charge > 0;
1478
                    AddIssuingCharge( $issue, $accumulate_charge, 'RENT_DAILY' ) if $accumulate_charge > 0;
1479
                    $charge += $accumulate_charge;
1479
                    $charge += $accumulate_charge;
1480
                    $item_unblessed->{charge} = $charge;
1480
                    $item_unblessed->{charge} = $charge;
1481
                }
1481
                }
Lines 2908-2914 sub AddRenewal { Link Here
2908
    # Charge a new rental fee, if applicable
2908
    # Charge a new rental fee, if applicable
2909
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
2909
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
2910
    if ( $charge > 0 ) {
2910
    if ( $charge > 0 ) {
2911
        AddIssuingCharge($issue, $charge, 'rent_renew');
2911
        AddIssuingCharge($issue, $charge, 'RENT_RENEW');
2912
    }
2912
    }
2913
2913
2914
    # Charge a new accumulate rental fee, if applicable
2914
    # Charge a new accumulate rental fee, if applicable
Lines 2916-2922 sub AddRenewal { Link Here
2916
    if ( $itemtype_object ) {
2916
    if ( $itemtype_object ) {
2917
        my $accumulate_charge = $fees->accumulate_rentalcharge();
2917
        my $accumulate_charge = $fees->accumulate_rentalcharge();
2918
        if ( $accumulate_charge > 0 ) {
2918
        if ( $accumulate_charge > 0 ) {
2919
            AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily_renew' )
2919
            AddIssuingCharge( $issue, $accumulate_charge, 'RENT_DAILY_RENEW' )
2920
        }
2920
        }
2921
        $charge += $accumulate_charge;
2921
        $charge += $accumulate_charge;
2922
    }
2922
    }
(-)a/Koha/Account.pm (-12 / +12 lines)
Lines 452-461 $debit_type can be any of: Link Here
452
  - new_card
452
  - new_card
453
  - overdue
453
  - overdue
454
  - processing
454
  - processing
455
  - rent
455
  - RENT
456
  - rent_daily
456
  - RENT_DAILY
457
  - rent_renew
457
  - RENT_RENEW
458
  - rent_daily_renew
458
  - RENT_DAILY_RENEW
459
  - RESERVE
459
  - RESERVE
460
  - manual_debit
460
  - manual_debit
461
461
Lines 714-723 our $offset_type = { Link Here
714
    'RESERVE'          => 'Reserve Fee',
714
    'RESERVE'          => 'Reserve Fee',
715
    'processing'       => 'Processing Fee',
715
    'processing'       => 'Processing Fee',
716
    'lost_item'        => 'Lost Item',
716
    'lost_item'        => 'Lost Item',
717
    'rent'             => 'Rental Fee',
717
    'RENT'             => 'Rental Fee',
718
    'rent_daily'       => 'Rental Fee',
718
    'RENT_DAILY'       => 'Rental Fee',
719
    'rent_renew'       => 'Rental Fee',
719
    'RENT_RENEW'       => 'Rental Fee',
720
    'rent_daily_renew' => 'Rental Fee',
720
    'RENT_DAILY_RENEW' => 'Rental Fee',
721
    'overdue'          => 'OVERDUE',
721
    'overdue'          => 'OVERDUE',
722
    'manual_debit'     => 'Manual Debit',
722
    'manual_debit'     => 'Manual Debit',
723
    'hold_expired'     => 'Hold Expired'
723
    'hold_expired'     => 'Hold Expired'
Lines 748-757 our $account_type_debit = { Link Here
748
    'new_card'         => 'N',
748
    'new_card'         => 'N',
749
    'overdue'          => 'OVERDUE',
749
    'overdue'          => 'OVERDUE',
750
    'processing'       => 'PF',
750
    'processing'       => 'PF',
751
    'rent'             => 'RENT',
751
    'RENT'             => 'RENT',
752
    'rent_daily'       => 'RENT_DAILY',
752
    'RENT_DAILY'       => 'RENT_DAILY',
753
    'rent_renew'       => 'RENT_RENEW',
753
    'RENT_RENEW'       => 'RENT_RENEW',
754
    'rent_daily_renew' => 'RENT_DAILY_RENEW',
754
    'RENT_DAILY_RENEW' => 'RENT_DAILY_RENEW',
755
    'RESERVE'          => 'RESERVE',
755
    'RESERVE'          => 'RESERVE',
756
    'manual_debit'     => 'M'
756
    'manual_debit'     => 'M'
757
};
757
};
(-)a/t/db_dependent/Accounts.t (-1 / +1 lines)
Lines 782-788 subtest "Koha::Account::non_issues_charges tests" => sub { Link Here
782
    $account->add_debit(
782
    $account->add_debit(
783
        {
783
        {
784
            description => 'a Rental fee',
784
            description => 'a Rental fee',
785
            type        => 'rent',
785
            type        => 'RENT',
786
            amount      => $rent,
786
            amount      => $rent,
787
            interface   => 'commandline'
787
            interface   => 'commandline'
788
        }
788
        }
(-)a/t/db_dependent/Circulation/issue.t (-1 / +1 lines)
Lines 211-217 $sth->execute; Link Here
211
my $countaccount = $sth->fetchrow_array;
211
my $countaccount = $sth->fetchrow_array;
212
is ($countaccount,0,"0 accountline exists");
212
is ($countaccount,0,"0 accountline exists");
213
my $checkout = Koha::Checkouts->find( $issue_id1 );
213
my $checkout = Koha::Checkouts->find( $issue_id1 );
214
my $charge = C4::Circulation::AddIssuingCharge( $checkout, 10, 'rent' );
214
my $charge = C4::Circulation::AddIssuingCharge( $checkout, 10, 'RENT' );
215
is( ref( $charge ), 'Koha::Account::Line', "An issuing charge has been added" );
215
is( ref( $charge ), 'Koha::Account::Line', "An issuing charge has been added" );
216
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' );
216
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' );
217
my $offset = Koha::Account::Offsets->find( { debit_id => $charge->id } );
217
my $offset = Koha::Account::Offsets->find( { debit_id => $charge->id } );
(-)a/t/db_dependent/Koha/Account.t (-7 / +6 lines)
Lines 290-296 subtest 'add_debit() tests' => sub { Link Here
290
            description => 'amount validation failure',
290
            description => 'amount validation failure',
291
            library_id  => $patron->branchcode,
291
            library_id  => $patron->branchcode,
292
            note        => 'this should fail anyway',
292
            note        => 'this should fail anyway',
293
            type        => 'rent',
293
            type        => 'RENT',
294
            user_id     => $patron->id,
294
            user_id     => $patron->id,
295
            interface   => 'commandline'
295
            interface   => 'commandline'
296
        }
296
        }
Lines 316-322 subtest 'add_debit() tests' => sub { Link Here
316
            description => 'Rental charge of 25',
316
            description => 'Rental charge of 25',
317
            library_id  => $patron->branchcode,
317
            library_id  => $patron->branchcode,
318
            note        => 'not really important',
318
            note        => 'not really important',
319
            type        => 'rent',
319
            type        => 'RENT',
320
            user_id     => $patron->id
320
            user_id     => $patron->id
321
        }
321
        }
322
    ); } 'Koha::Exceptions::MissingParameter', 'Exception thrown if interface parameter missing';
322
    ); } 'Koha::Exceptions::MissingParameter', 'Exception thrown if interface parameter missing';
Lines 330-336 subtest 'add_debit() tests' => sub { Link Here
330
            description => 'Rental charge of 25',
330
            description => 'Rental charge of 25',
331
            library_id  => $patron->branchcode,
331
            library_id  => $patron->branchcode,
332
            note        => 'not really important',
332
            note        => 'not really important',
333
            type        => 'rent',
333
            type        => 'RENT',
334
            user_id     => $patron->id,
334
            user_id     => $patron->id,
335
            interface   => 'commandline'
335
            interface   => 'commandline'
336
        }
336
        }
Lines 344-350 subtest 'add_debit() tests' => sub { Link Here
344
    );
344
    );
345
    is(
345
    is(
346
        $line_1->debit_type_code,
346
        $line_1->debit_type_code,
347
        $Koha::Account::account_type_debit->{'rent'},
347
        $Koha::Account::account_type_debit->{'RENT'},
348
        'Account type is correctly set'
348
        'Account type is correctly set'
349
    );
349
    );
350
350
Lines 357-363 subtest 'add_debit() tests' => sub { Link Here
357
            description => 'Rental charge of 37',
357
            description => 'Rental charge of 37',
358
            library_id  => $patron->branchcode,
358
            library_id  => $patron->branchcode,
359
            note        => 'not really important',
359
            note        => 'not really important',
360
            type        => 'rent',
360
            type        => 'RENT',
361
            user_id     => $patron->id,
361
            user_id     => $patron->id,
362
            interface   => 'commandline'
362
            interface   => 'commandline'
363
        }
363
        }
Lines 371-377 subtest 'add_debit() tests' => sub { Link Here
371
    );
371
    );
372
    is(
372
    is(
373
        $line_2->debit_type_code,
373
        $line_2->debit_type_code,
374
        $Koha::Account::account_type_debit->{'rent'},
374
        $Koha::Account::account_type_debit->{'RENT'},
375
        'Account type is correctly set'
375
        'Account type is correctly set'
376
    );
376
    );
377
377
378
- 

Return to bug 23049