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

(-)a/t/db_dependent/Circulation.t (-3 / +25 lines)
Lines 669-687 my ( $reused_itemnumber_1, $reused_itemnumber_2 ); Link Here
669
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
669
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
670
        C4::Context->set_preference('OPACFineNoRenewals','10');
670
        C4::Context->set_preference('OPACFineNoRenewals','10');
671
        my $fines_amount = 5;
671
        my $fines_amount = 5;
672
        C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount );
672
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
673
        $account->add_debit(
674
            {
675
                amount      => $fines_amount,
676
                type        => 'fine',
677
                item_id     => $item_to_auto_renew->{itemnumber},
678
                description => "Some fines"
679
            }
680
        )->accounttype->('F')->store;
673
        ( $renewokay, $error ) =
681
        ( $renewokay, $error ) =
674
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
682
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
675
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
683
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
676
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
684
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
677
685
678
        C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount );
686
        $account->add_debit(
687
            {
688
                amount      => $fines_amount,
689
                type        => 'fine',
690
                item_id     => $item_to_auto_renew->{itemnumber},
691
                description => "Some fines"
692
            }
693
        )->accounttype->('F')->store;
679
        ( $renewokay, $error ) =
694
        ( $renewokay, $error ) =
680
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
695
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
681
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
696
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
682
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
697
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
683
698
684
        C4::Accounts::manualinvoice( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber}, "Some fines", 'F', $fines_amount );
699
        $account->add_debit(
700
            {
701
                amount      => $fines_amount,
702
                type        => 'fine',
703
                item_id     => $item_to_auto_renew->{itemnumber},
704
                description => "Some fines"
705
            }
706
        )->accounttype->('F')->store;
685
        ( $renewokay, $error ) =
707
        ( $renewokay, $error ) =
686
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
708
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->{itemnumber} );
687
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
709
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
(-)a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t (-2 / +3 lines)
Lines 22-29 use Test::More tests => 6; Link Here
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
use t::lib::Mocks;
23
use t::lib::Mocks;
24
24
25
use C4::Accounts qw( manualinvoice );
26
use C4::Circulation qw( CanBookBeIssued );
25
use C4::Circulation qw( CanBookBeIssued );
26
use Koha::Account;
27
use Koha::Account::Lines;
27
use Koha::Account::Lines;
28
use Koha::Account::Offsets;
28
use Koha::Account::Offsets;
29
29
Lines 68-74 t::lib::Mocks::mock_preference( 'AllowFineOverride', '' ); Link Here
68
my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
68
my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
69
is( $issuingimpossible->{DEBT_GUARANTEES}, undef, "Patron can check out item" );
69
is( $issuingimpossible->{DEBT_GUARANTEES}, undef, "Patron can check out item" );
70
70
71
manualinvoice( $guarantee->{borrowernumber}, undef, undef, 'L', 10.00 );
71
my $account = Koha::Account->new( { patron_id => $guarantee->{borrowernumber} } );
72
$account->add_debit({ amount => 10.00, type => 'lost_item' });
72
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
73
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
73
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
74
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
74
75
(-)a/t/db_dependent/api/v1/patrons_accounts.t (-2 lines)
Lines 25-31 use Test::Warn; Link Here
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
26
use t::lib::Mocks;
26
use t::lib::Mocks;
27
27
28
use C4::Accounts qw(manualinvoice);
29
use C4::Auth;
28
use C4::Auth;
30
use Koha::Account::Line;
29
use Koha::Account::Line;
31
30
32
- 

Return to bug 21756