Lines 77-83
my $item = $builder->build( { source => 'Item', value => { itype => $itemtype-
Link Here
|
77 |
my $patron = $builder->build( { source => 'Borrower' } ); |
77 |
my $patron = $builder->build( { source => 'Borrower' } ); |
78 |
my $amount = '5.000000'; |
78 |
my $amount = '5.000000'; |
79 |
my $description = "Test fee!"; |
79 |
my $description = "Test fee!"; |
80 |
my $type = 'L'; |
80 |
my $type = 'LOST'; |
81 |
my $note = 'Test note!'; |
81 |
my $note = 'Test note!'; |
82 |
warning_like { |
82 |
warning_like { |
83 |
C4::Accounts::manualinvoice( $patron->{borrowernumber}, |
83 |
C4::Accounts::manualinvoice( $patron->{borrowernumber}, |
Lines 580-617
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
580 |
t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0'); |
580 |
t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0'); |
581 |
|
581 |
|
582 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
582 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
583 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' }); |
583 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' }); |
584 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
584 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
585 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref off"); |
585 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref off"); |
586 |
ok( !$procfee, "No processing fee if no processing fee"); |
586 |
ok( !$procfee, "No processing fee if no processing fee"); |
587 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
587 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
588 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' }); |
588 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' }); |
589 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
589 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
590 |
ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set"); |
590 |
ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set"); |
591 |
ok( !$procfee, "No processing fee if no processing fee"); |
591 |
ok( !$procfee, "No processing fee if no processing fee"); |
592 |
$lostfine->delete(); |
592 |
$lostfine->delete(); |
593 |
|
593 |
|
594 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
594 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
595 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' }); |
595 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' }); |
596 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
596 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
597 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
597 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
598 |
ok( !$procfee, "No processing fee if no processing fee"); |
598 |
ok( !$procfee, "No processing fee if no processing fee"); |
599 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
599 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
600 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' }); |
600 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' }); |
601 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
601 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
602 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
602 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
603 |
ok( !$procfee, "No processing fee if no processing fee"); |
603 |
ok( !$procfee, "No processing fee if no processing fee"); |
604 |
$lostfine->delete(); |
604 |
$lostfine->delete(); |
605 |
|
605 |
|
606 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
606 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
607 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' }); |
607 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' }); |
608 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
608 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
609 |
ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off"); |
609 |
ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off"); |
610 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
610 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
611 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
611 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
612 |
$procfee->delete(); |
612 |
$procfee->delete(); |
613 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
613 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
614 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' }); |
614 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' }); |
615 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
615 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
616 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set"); |
616 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set"); |
617 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
617 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
Lines 620-633
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
620 |
$procfee->delete(); |
620 |
$procfee->delete(); |
621 |
|
621 |
|
622 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
622 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
623 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
623 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
624 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
624 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
625 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
625 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
626 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
626 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
627 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
627 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
628 |
$procfee->delete(); |
628 |
$procfee->delete(); |
629 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
629 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
630 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
630 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
631 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
631 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
632 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
632 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
633 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
633 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
Lines 638-681
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
638 |
t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1'); |
638 |
t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1'); |
639 |
|
639 |
|
640 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
640 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
641 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' }); |
641 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' }); |
642 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
642 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
643 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref on"); |
643 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref on"); |
644 |
ok( !$procfee, "No processing fee if no processing fee"); |
644 |
ok( !$procfee, "No processing fee if no processing fee"); |
645 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
645 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
646 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'L' }); |
646 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' }); |
647 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
647 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' }); |
648 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
648 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
649 |
ok( !$procfee, "No processing fee if no processing fee"); |
649 |
ok( !$procfee, "No processing fee if no processing fee"); |
650 |
|
650 |
|
651 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
651 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
652 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' }); |
652 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' }); |
653 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
653 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
654 |
is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on"); |
654 |
is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on"); |
655 |
ok( !$procfee, "No processing fee if no processing fee"); |
655 |
ok( !$procfee, "No processing fee if no processing fee"); |
656 |
$lostfine->delete(); |
656 |
$lostfine->delete(); |
657 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
657 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
658 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'L' }); |
658 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' }); |
659 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
659 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' }); |
660 |
is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set"); |
660 |
is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set"); |
661 |
ok( !$procfee, "No processing fee if no processing fee"); |
661 |
ok( !$procfee, "No processing fee if no processing fee"); |
662 |
|
662 |
|
663 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
663 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
664 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' }); |
664 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' }); |
665 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
665 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
666 |
ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on"); |
666 |
ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on"); |
667 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
667 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
668 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
668 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
669 |
$procfee->delete(); |
669 |
$procfee->delete(); |
670 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
670 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
671 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'L' }); |
671 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' }); |
672 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
672 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' }); |
673 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
673 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
674 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
674 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
675 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
675 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
676 |
|
676 |
|
677 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
677 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
678 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
678 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
679 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
679 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
680 |
is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on"); |
680 |
is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on"); |
681 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
681 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
Lines 683-689
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
683 |
$lostfine->delete(); |
683 |
$lostfine->delete(); |
684 |
$procfee->delete(); |
684 |
$procfee->delete(); |
685 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
685 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
686 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
686 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
687 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
687 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
688 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set"); |
688 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set"); |
689 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
689 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
Lines 699-705
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
699 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, '1.99', "Perdedor"); |
699 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, '1.99', "Perdedor"); |
700 |
|
700 |
|
701 |
# Lost Item Fee |
701 |
# Lost Item Fee |
702 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
702 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
703 |
ok($lostfine, "Lost fine created"); |
703 |
ok($lostfine, "Lost fine created"); |
704 |
is($lostfine->manager_id, $staff_id, "Lost fine manager_id set correctly"); |
704 |
is($lostfine->manager_id, $staff_id, "Lost fine manager_id set correctly"); |
705 |
is($lostfine->issue_id, $cli_issue_id_4, "Lost fine issue_id set correctly"); |
705 |
is($lostfine->issue_id, $cli_issue_id_4, "Lost fine issue_id set correctly"); |
Lines 726-732
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
726 |
|
726 |
|
727 |
t::lib::Mocks::mock_preference( 'FinesLog', 0 ); |
727 |
t::lib::Mocks::mock_preference( 'FinesLog', 0 ); |
728 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
728 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
729 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
729 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
730 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
730 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
731 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' ); |
731 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' ); |
732 |
$lostfine->delete(); |
732 |
$lostfine->delete(); |
Lines 734-740
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
734 |
|
734 |
|
735 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
735 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
736 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
736 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
737 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'L' }); |
737 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' }); |
738 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
738 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' }); |
739 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' ); |
739 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' ); |
740 |
$lostfine->delete(); |
740 |
$lostfine->delete(); |