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

(-)a/t/db_dependent/Accounts.t (-2 / +15 lines)
Lines 555-572 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
555
    my $cli_itemnumber2 = $builder->build_sample_item({ itype => $itype_replace_no_fee->{itemtype} })->itemnumber;
555
    my $cli_itemnumber2 = $builder->build_sample_item({ itype => $itype_replace_no_fee->{itemtype} })->itemnumber;
556
    my $cli_itemnumber3 = $builder->build_sample_item({ itype => $itype_no_replace_fee->{itemtype} })->itemnumber;
556
    my $cli_itemnumber3 = $builder->build_sample_item({ itype => $itype_no_replace_fee->{itemtype} })->itemnumber;
557
    my $cli_itemnumber4 = $builder->build_sample_item({ itype => $itype_replace_fee->{itemtype} })->itemnumber;
557
    my $cli_itemnumber4 = $builder->build_sample_item({ itype => $itype_replace_fee->{itemtype} })->itemnumber;
558
    my $cli_itemnumber5 = $builder->build_sample_item({ itype => $itype_replace_fee->{itemtype} })->itemnumber;
559
    my $cli_bundle1     = $builder->build_sample_item({ itype => $itype_no_replace_no_fee->{itemtype} })->itemnumber;
560
    $schema->resultset('ItemBundle')->create( { host => $cli_bundle1, item => $cli_itemnumber5 } );
558
561
559
    my $cli_issue_id_1 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1 } })->{issue_id};
562
    my $cli_issue_id_1 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1 } })->{issue_id};
560
    my $cli_issue_id_2 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2 } })->{issue_id};
563
    my $cli_issue_id_2 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2 } })->{issue_id};
561
    my $cli_issue_id_3 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3 } })->{issue_id};
564
    my $cli_issue_id_3 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3 } })->{issue_id};
562
    my $cli_issue_id_4 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4 } })->{issue_id};
565
    my $cli_issue_id_4 = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4 } })->{issue_id};
563
    my $cli_issue_id_4X = undef;
566
    my $cli_issue_id_4X = undef;
567
    my $cli_bundle_issue = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_bundle1 } })->{issue_id};
564
568
565
    my $lostfine;
569
    my $lostfine;
566
    my $procfee;
570
    my $procfee;
567
571
568
    subtest "fee application tests" => sub {
572
    subtest "fee application tests" => sub {
569
        plan tests => 44;
573
        plan tests => 48;
570
574
571
        t::lib::Mocks::mock_preference('item-level_itypes', '1');
575
        t::lib::Mocks::mock_preference('item-level_itypes', '1');
572
        t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0');
576
        t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0');
Lines 694-699 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
694
        ok( $procfees->count == 2,  "Processing fee can be charged twice for the same item if they are distinct issue_id's");
698
        ok( $procfees->count == 2,  "Processing fee can be charged twice for the same item if they are distinct issue_id's");
695
        $lostfines->delete();
699
        $lostfines->delete();
696
        $procfees->delete();
700
        $procfees->delete();
701
702
        C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber5, 6.12, "Bundle");
703
        $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber5, debit_type_code => 'LOST' });
704
        $procfee  = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber5, debit_type_code => 'PROCESSING' });
705
        is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set (Bundle)");
706
        is( $procfee->amount, "2.040000",  "Processing fee if processing fee (Bundle)");
707
        is( $lostfine->issue_id, $cli_bundle_issue, "Lost fine issue id matched to bundle issue");
708
        is( $procfee->issue_id, $cli_bundle_issue, "Processing fee issue id matched to bundle issue");
709
        $lostfine->delete();
710
        $procfee->delete();
697
    };
711
    };
698
712
699
    subtest "basic fields tests" => sub {
713
    subtest "basic fields tests" => sub {
700
- 

Return to bug 28854