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

(-)a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t (-2 / +5 lines)
Lines 40-46 my $patron_category = $builder->build( Link Here
40
        source => 'Category',
40
        source => 'Category',
41
        value  => {
41
        value  => {
42
            categorycode   => 'NOT_X', category_type => 'P', enrolmentfee => 0, noissueschargeguarantees => 0,
42
            categorycode   => 'NOT_X', category_type => 'P', enrolmentfee => 0, noissueschargeguarantees => 0,
43
            noissuescharge => 0,  noissueschargeguarantorswithguarantees => 0
43
            noissuescharge => 0,       noissueschargeguarantorswithguarantees => 0
44
        }
44
        }
45
    }
45
    }
46
);
46
);
Lines 86-92 is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check Link Here
86
86
87
$patron->category->noissueschargeguarantees(11);
87
$patron->category->noissueschargeguarantees(11);
88
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode );
88
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode );
89
is( $issuingimpossible->{DEBT_GUARANTEES}, undef, "Patron can check out item as the patron category limit is now higher than 10" );
89
is(
90
    $issuingimpossible->{DEBT_GUARANTEES}, undef,
91
    "Patron can check out item as the patron category limit is now higher than 10"
92
);
90
93
91
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->id })->next();
94
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->id })->next();
92
is( $accountline->amountoutstanding+0, 10, "Found 10.00 amount outstanding" );
95
is( $accountline->amountoutstanding+0, 10, "Found 10.00 amount outstanding" );
(-)a/t/db_dependent/Koha/Patron.t (-10 / +9 lines)
Lines 2412-2425 subtest 'is_patron_inside_charge_limits() tests' => sub { Link Here
2412
    )->store;
2412
    )->store;
2413
2413
2414
    my $patron_borrowing_status;
2414
    my $patron_borrowing_status;
2415
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits( { patron => $patron } );
2415
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits();
2416
2416
2417
    is( $patron_borrowing_status->{noissuescharge}->{charge},    11, "Only patron's fines are reported in total" );
2417
    is( $patron_borrowing_status->{noissuescharge}->{charge},    11, "Only patron's fines are reported in total" );
2418
    is( $patron_borrowing_status->{noissuescharge}->{limit},     10, "Limit correctly identified at category level" );
2418
    is( $patron_borrowing_status->{noissuescharge}->{limit},     10, "Limit correctly identified at category level" );
2419
    is( $patron_borrowing_status->{noissuescharge}->{overlimit}, 1,  "Patron is over the charge limit" );
2419
    is( $patron_borrowing_status->{noissuescharge}->{overlimit}, 1,  "Patron is over the charge limit" );
2420
2420
2421
    $patron->category->noissuescharge(undef);
2421
    $patron->category->noissuescharge(undef);
2422
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits( { patron => $patron } );
2422
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits();
2423
    is( $patron_borrowing_status->{noissuescharge}->{limit}, 50, "Limit correctly identified at global syspref level" );
2423
    is( $patron_borrowing_status->{noissuescharge}->{limit}, 50, "Limit correctly identified at global syspref level" );
2424
    is( $patron_borrowing_status->{noissuescharge}->{charge},    11, "Charges correctly identified" );
2424
    is( $patron_borrowing_status->{noissuescharge}->{charge},    11, "Charges correctly identified" );
2425
    is( $patron_borrowing_status->{noissuescharge}->{overlimit}, 0,  "Patron is within the charge limit" );
2425
    is( $patron_borrowing_status->{noissuescharge}->{overlimit}, 0,  "Patron is within the charge limit" );
Lines 2432-2438 subtest 'is_patron_inside_charge_limits() tests' => sub { Link Here
2432
    is( $patron_borrowing_status->{NoIssuesChargeGuarantees}->{overlimit}, 1,     "Patron is over the charge limit" );
2432
    is( $patron_borrowing_status->{NoIssuesChargeGuarantees}->{overlimit}, 1,     "Patron is over the charge limit" );
2433
2433
2434
    $patron->category->noissueschargeguarantees(12);
2434
    $patron->category->noissueschargeguarantees(12);
2435
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits( { patron => $patron } );
2435
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits();
2436
    is(
2436
    is(
2437
        $patron_borrowing_status->{NoIssuesChargeGuarantees}->{limit}, 12,
2437
        $patron_borrowing_status->{NoIssuesChargeGuarantees}->{limit}, 12,
2438
        "Limit correctly identified at patron category level"
2438
        "Limit correctly identified at patron category level"
Lines 2441-2452 subtest 'is_patron_inside_charge_limits() tests' => sub { Link Here
2441
    is( $patron_borrowing_status->{NoIssuesChargeGuarantees}->{overlimit}, 0,     "Patron is inside the charge limit" );
2441
    is( $patron_borrowing_status->{NoIssuesChargeGuarantees}->{overlimit}, 0,     "Patron is inside the charge limit" );
2442
2442
2443
    is(
2443
    is(
2444
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}, 0,
2444
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}, undef,
2445
        "Limit correctly identified as not set at either patron category or global syspref level"
2445
        "Limit correctly identified as not set at either patron category or global syspref level"
2446
    );
2446
    );
2447
    is(
2447
    is(
2448
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{charge}, 22.22,
2448
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{charge}, 0,
2449
        "Charges correctly identified"
2449
        "Charges ignored as there is no limit set at either patron category or global syspref level"
2450
    );
2450
    );
2451
    is(
2451
    is(
2452
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit}, 0,
2452
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit}, 0,
Lines 2455-2461 subtest 'is_patron_inside_charge_limits() tests' => sub { Link Here
2455
2455
2456
    $patron->category->noissueschargeguarantorswithguarantees(23);
2456
    $patron->category->noissueschargeguarantorswithguarantees(23);
2457
    t::lib::Mocks::mock_preference( 'NoIssuesChargeGuarantorsWithGuarantees', 20 );
2457
    t::lib::Mocks::mock_preference( 'NoIssuesChargeGuarantorsWithGuarantees', 20 );
2458
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits( { patron => $patron } );
2458
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits();
2459
    is(
2459
    is(
2460
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}, 23,
2460
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}, 23,
2461
        "Limit correctly identified at patron category level"
2461
        "Limit correctly identified at patron category level"
Lines 2470-2477 subtest 'is_patron_inside_charge_limits() tests' => sub { Link Here
2470
    );
2470
    );
2471
2471
2472
    $patron->category->noissueschargeguarantorswithguarantees(undef);
2472
    $patron->category->noissueschargeguarantorswithguarantees(undef);
2473
    t::lib::Mocks::mock_preference( 'NoIssuesChargeGuarantorsWithGuarantees', 20 );
2473
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits();
2474
    $patron_borrowing_status = $patron->is_patron_inside_charge_limits( { patron => $patron } );
2475
    is(
2474
    is(
2476
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}, 20,
2475
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}, 20,
2477
        "Limit correctly defaults to global syspref"
2476
        "Limit correctly defaults to global syspref"
Lines 2482-2488 subtest 'is_patron_inside_charge_limits() tests' => sub { Link Here
2482
    );
2481
    );
2483
    is(
2482
    is(
2484
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit}, 1,
2483
        $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit}, 1,
2485
        "Patron is inside the charge limit"
2484
        "Patron is over the charge limit"
2486
    );
2485
    );
2487
2486
2488
    $schema->storage->txn_rollback;
2487
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/SIP/Transaction.t (-6 / +5 lines)
Lines 659-665 subtest do_checkout_with_sysprefs_override => sub { Link Here
659
        {
659
        {
660
            class => 'Koha::Patrons',
660
            class => 'Koha::Patrons',
661
            value => {
661
            value => {
662
                branchcode => $library->branchcode,
662
                branchcode   => $library->branchcode,
663
                categorycode => $patron_category->{categorycode},
663
                categorycode => $patron_category->{categorycode},
664
            }
664
            }
665
        }
665
        }
Lines 681-687 subtest do_checkout_with_sysprefs_override => sub { Link Here
681
        {
681
        {
682
            class => 'Koha::Patrons',
682
            class => 'Koha::Patrons',
683
            value => {
683
            value => {
684
                branchcode => $library->branchcode,
684
                branchcode   => $library->branchcode,
685
                categorycode => $patron_category->{categorycode},
685
                categorycode => $patron_category->{categorycode},
686
            }
686
            }
687
        }
687
        }
Lines 791-803 subtest do_checkout_with_patron_blocked => sub { Link Here
791
            library => $library->branchcode,
791
            library => $library->branchcode,
792
        }
792
        }
793
    );
793
    );
794
    
794
795
    my $patron_category = $builder->build(
795
    my $patron_category = $builder->build(
796
        {
796
        {
797
            source => 'Category',
797
            source => 'Category',
798
            value  => {
798
            value  => {
799
                categorycode   => 'NOT_X2', category_type => 'P', enrolmentfee => 0, noissueschargeguarantees => 0,
799
                categorycode   => 'NOT_X2', category_type => 'P', enrolmentfee => 0, noissueschargeguarantees => 0,
800
                noissuescharge => 0,       noissueschargeguarantorswithguarantees => 0
800
                noissuescharge => 0,        noissueschargeguarantorswithguarantees => 0
801
            }
801
            }
802
        }
802
        }
803
    );
803
    );
Lines 818-824 subtest do_checkout_with_patron_blocked => sub { Link Here
818
        {
818
        {
819
            class => 'Koha::Patrons',
819
            class => 'Koha::Patrons',
820
            value => {
820
            value => {
821
                branchcode => $library->branchcode,
821
                branchcode   => $library->branchcode,
822
                categorycode => $patron_category->{categorycode},
822
                categorycode => $patron_category->{categorycode},
823
            }
823
            }
824
        }
824
        }
825
- 

Return to bug 28924