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