Lines 585-622
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
585 |
|
585 |
|
586 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
586 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
587 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
587 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
588 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' }); |
588 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' }); |
589 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref off"); |
589 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref off"); |
590 |
ok( !$procfee, "No processing fee if no processing fee"); |
590 |
ok( !$procfee, "No processing fee if no processing fee"); |
591 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
591 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
592 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
592 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
593 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' }); |
593 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' }); |
594 |
ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set"); |
594 |
ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set"); |
595 |
ok( !$procfee, "No processing fee if no processing fee"); |
595 |
ok( !$procfee, "No processing fee if no processing fee"); |
596 |
$lostfine->delete(); |
596 |
$lostfine->delete(); |
597 |
|
597 |
|
598 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
598 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
599 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
599 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
600 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' }); |
600 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' }); |
601 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
601 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
602 |
ok( !$procfee, "No processing fee if no processing fee"); |
602 |
ok( !$procfee, "No processing fee if no processing fee"); |
603 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
603 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
604 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
604 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
605 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' }); |
605 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' }); |
606 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
606 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
607 |
ok( !$procfee, "No processing fee if no processing fee"); |
607 |
ok( !$procfee, "No processing fee if no processing fee"); |
608 |
$lostfine->delete(); |
608 |
$lostfine->delete(); |
609 |
|
609 |
|
610 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
610 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
611 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
611 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
612 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' }); |
612 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' }); |
613 |
ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off"); |
613 |
ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off"); |
614 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
614 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
615 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
615 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
616 |
$procfee->delete(); |
616 |
$procfee->delete(); |
617 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
617 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
618 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
618 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
619 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' }); |
619 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' }); |
620 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set"); |
620 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set"); |
621 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
621 |
ok( $procfee->amount == 8.16, "Processing fee if processing fee"); |
622 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
622 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
Lines 625-638
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
625 |
|
625 |
|
626 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
626 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
627 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
627 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
628 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
628 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
629 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
629 |
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off"); |
630 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
630 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
631 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
631 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
632 |
$procfee->delete(); |
632 |
$procfee->delete(); |
633 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
633 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
634 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
634 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
635 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
635 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
636 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
636 |
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set"); |
637 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
637 |
ok( $procfee->amount == 2.04, "Processing fee if processing fee"); |
638 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
638 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
Lines 643-686
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
643 |
|
643 |
|
644 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
644 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor"); |
645 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
645 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
646 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' }); |
646 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' }); |
647 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref on"); |
647 |
ok( !$lostfine, "No lost fine if no replacementcost or default when pref on"); |
648 |
ok( !$procfee, "No processing fee if no processing fee"); |
648 |
ok( !$procfee, "No processing fee if no processing fee"); |
649 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
649 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor"); |
650 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
650 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' }); |
651 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' }); |
651 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' }); |
652 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
652 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
653 |
ok( !$procfee, "No processing fee if no processing fee"); |
653 |
ok( !$procfee, "No processing fee if no processing fee"); |
654 |
|
654 |
|
655 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
655 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor"); |
656 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
656 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
657 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' }); |
657 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' }); |
658 |
is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on"); |
658 |
is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on"); |
659 |
ok( !$procfee, "No processing fee if no processing fee"); |
659 |
ok( !$procfee, "No processing fee if no processing fee"); |
660 |
$lostfine->delete(); |
660 |
$lostfine->delete(); |
661 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
661 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor"); |
662 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
662 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' }); |
663 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' }); |
663 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' }); |
664 |
is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set"); |
664 |
is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set"); |
665 |
ok( !$procfee, "No processing fee if no processing fee"); |
665 |
ok( !$procfee, "No processing fee if no processing fee"); |
666 |
|
666 |
|
667 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
667 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor"); |
668 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
668 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
669 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' }); |
669 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' }); |
670 |
ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on"); |
670 |
ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on"); |
671 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
671 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
672 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
672 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
673 |
$procfee->delete(); |
673 |
$procfee->delete(); |
674 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
674 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor"); |
675 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
675 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' }); |
676 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' }); |
676 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' }); |
677 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
677 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set"); |
678 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
678 |
is( $procfee->amount, "8.160000", "Processing fee if processing fee"); |
679 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
679 |
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" ); |
680 |
|
680 |
|
681 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
681 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
682 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
682 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
683 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
683 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
684 |
is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on"); |
684 |
is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on"); |
685 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
685 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
686 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
686 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
Lines 688-707
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
688 |
$procfee->delete(); |
688 |
$procfee->delete(); |
689 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
689 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
690 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
690 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
691 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
691 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
692 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set"); |
692 |
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set"); |
693 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
693 |
is( $procfee->amount, "2.040000", "Processing fee if processing fee"); |
694 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
694 |
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" ); |
695 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
695 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
696 |
my $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
696 |
my $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
697 |
my $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
697 |
my $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
698 |
ok( $lostfines->count == 1 , "Lost fine cannot be double charged for the same issue_id"); |
698 |
ok( $lostfines->count == 1 , "Lost fine cannot be double charged for the same issue_id"); |
699 |
ok( $procfees->count == 1, "Processing fee cannot be double charged for the same issue_id"); |
699 |
ok( $procfees->count == 1, "Processing fee cannot be double charged for the same issue_id"); |
700 |
MarkIssueReturned($cli_borrowernumber, $cli_itemnumber4); |
700 |
MarkIssueReturned($cli_borrowernumber, $cli_itemnumber4); |
701 |
$cli_issue_id_4X = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4 } })->{issue_id}; |
701 |
$cli_issue_id_4X = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4 } })->{issue_id}; |
702 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
702 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor"); |
703 |
$lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
703 |
$lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
704 |
$procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
704 |
$procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
705 |
ok( $lostfines->count == 2 , "Lost fine can be charged twice for the same item if they are distinct issue_id's"); |
705 |
ok( $lostfines->count == 2 , "Lost fine can be charged twice for the same item if they are distinct issue_id's"); |
706 |
ok( $procfees->count == 2, "Processing fee can be charged twice for the same item if they are distinct issue_id's"); |
706 |
ok( $procfees->count == 2, "Processing fee can be charged twice for the same item if they are distinct issue_id's"); |
707 |
$lostfines->delete(); |
707 |
$lostfines->delete(); |
Lines 724-730
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
724 |
is($lostfine->branchcode, $branchcode, "Lost fine branchcode set correctly"); |
724 |
is($lostfine->branchcode, $branchcode, "Lost fine branchcode set correctly"); |
725 |
|
725 |
|
726 |
# Processing Fee |
726 |
# Processing Fee |
727 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
727 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
728 |
ok($procfee, "Processing fee created"); |
728 |
ok($procfee, "Processing fee created"); |
729 |
is($procfee->manager_id, $staff_id, "Processing fee manager_id set correctly"); |
729 |
is($procfee->manager_id, $staff_id, "Processing fee manager_id set correctly"); |
730 |
is($procfee->issue_id, $cli_issue_id_4X, "Processing fee issue_id set correctly"); |
730 |
is($procfee->issue_id, $cli_issue_id_4X, "Processing fee issue_id set correctly"); |
Lines 743-749
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
743 |
t::lib::Mocks::mock_preference( 'FinesLog', 0 ); |
743 |
t::lib::Mocks::mock_preference( 'FinesLog', 0 ); |
744 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
744 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
745 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
745 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
746 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
746 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
747 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' ); |
747 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' ); |
748 |
$lostfine->delete(); |
748 |
$lostfine->delete(); |
749 |
$procfee->delete(); |
749 |
$procfee->delete(); |
Lines 751-757
subtest "C4::Accounts::chargelostitem tests" => sub {
Link Here
|
751 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
751 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
752 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
752 |
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor"); |
753 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
753 |
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' }); |
754 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' }); |
754 |
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' }); |
755 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' ); |
755 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' ); |
756 |
$lostfine->delete(); |
756 |
$lostfine->delete(); |
757 |
$procfee->delete(); |
757 |
$procfee->delete(); |