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

(-)a/t/db_dependent/Circulation.t (-3 / +23 lines)
Lines 721-728 subtest "CanBookBeRenewed tests" => sub { Link Here
721
        is( $error, 'auto_renew', 'Cannot renew, renew is automatic' );
721
        is( $error, 'auto_renew', 'Cannot renew, renew is automatic' );
722
    };
722
    };
723
723
724
    subtest "auto_too_much_oweing | OPACFineNoRenewalsBlockAutoRenew" => sub {
724
    subtest "auto_too_much_oweing | OPACFineNoRenewalsBlockAutoRenew & OPACFineNoRenewalsIncludeCredit" => sub {
725
        plan tests => 6;
725
        plan tests => 10;
726
        my $item_to_auto_renew = $builder->build({
726
        my $item_to_auto_renew = $builder->build({
727
            source => 'Item',
727
            source => 'Item',
728
            value => {
728
            value => {
Lines 739-744 subtest "CanBookBeRenewed tests" => sub { Link Here
739
        $dbh->do('UPDATE issuingrules SET norenewalbefore = 10, no_auto_renewal_after = 11');
739
        $dbh->do('UPDATE issuingrules SET norenewalbefore = 10, no_auto_renewal_after = 11');
740
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
740
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
741
        C4::Context->set_preference('OPACFineNoRenewals','10');
741
        C4::Context->set_preference('OPACFineNoRenewals','10');
742
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
742
        my $fines_amount = 5;
743
        my $fines_amount = 5;
743
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
744
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
744
        $account->add_debit(
745
        $account->add_debit(
Lines 783-789 subtest "CanBookBeRenewed tests" => sub { Link Here
783
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
784
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
784
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
785
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
785
786
787
        $account->add_credit(
788
            {
789
                amount      => $fines_amount,
790
                interface   => 'test',
791
                type        => 'overdue',
792
                description => "Some fines"
793
            }
794
        )->store;
795
        ( $renewokay, $error ) =
796
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
797
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
798
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
799
800
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
801
        ( $renewokay, $error ) =
802
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
803
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
804
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
805
786
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
806
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
807
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
787
    };
808
    };
788
809
789
    subtest "auto_account_expired | BlockExpiredPatronOpacActions" => sub {
810
    subtest "auto_account_expired | BlockExpiredPatronOpacActions" => sub {
790
- 

Return to bug 23293