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

(-)a/C4/SIP/ILS/Transaction/Checkout.pm (-3 / +20 lines)
Lines 18-23 use C4::Context; Link Here
18
use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ProcessOfflineIssue );
18
use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ProcessOfflineIssue );
19
use C4::Members;
19
use C4::Members;
20
use Koha::DateUtils qw( dt_from_string );
20
use Koha::DateUtils qw( dt_from_string );
21
use Koha::Number::Price;
22
use Koha::Account;
23
21
24
22
use parent qw(C4::SIP::ILS::Transaction);
25
use parent qw(C4::SIP::ILS::Transaction);
23
26
Lines 89-97 sub do_checkout { Link Here
89
                $noerror = 0;
92
                $noerror = 0;
90
                last;
93
                last;
91
            } elsif ($confirmation eq 'DEBT') {
94
            } elsif ($confirmation eq 'DEBT') {
92
                $self->screen_msg('Outstanding Fines block issue');
95
                my $message = "";
93
                $noerror = 0;
96
                if ($account->{under_noissuescharge_block_checkout}) {
94
                last;
97
                    $message = 'Outstanding Fines block issue';
98
                    $noerror = 0;
99
                } else {
100
                    $message = "You have outstanding fines";
101
                }
102
103
                if ($account->{show_outstanding_amount}) {
104
                    my $patron_account = Koha::Account->new( { patron_id => $patron->borrowernumber });
105
                    my $balance = $patron_account->balance;
106
                    if ($balance) {
107
                        $message .= (" - You owe " . Koha::Number::Price->new( $balance )->format({ with_symbol => 1}) . ".");
108
                    }
109
                }
110
                $self->screen_msg($message);
111
                last if ($account->{under_noissuescharge_block_checkout});
95
            } elsif ($confirmation eq 'HIGHHOLDS') {
112
            } elsif ($confirmation eq 'HIGHHOLDS') {
96
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
113
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
97
                $self->screen_msg('Loan period reduced for high-demand item');
114
                $self->screen_msg('Loan period reduced for high-demand item');
(-)a/etc/SIPconfig.xml (+2 lines)
Lines 74-79 Link Here
74
             holds_get_captured="1"
74
             holds_get_captured="1"
75
             prevcheckout_block_checkout="0"
75
             prevcheckout_block_checkout="0"
76
             overdues_block_checkout="1"
76
             overdues_block_checkout="1"
77
             under_noissuescharge_block_checkout="1"
78
             show_outstanding_amount="1"
77
             format_due_date="0"
79
             format_due_date="0"
78
             inhouse_item_types=""
80
             inhouse_item_types=""
79
             inhouse_patron_categories="">
81
             inhouse_patron_categories="">
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +88 lines)
Lines 4-10 Link Here
4
# Current state is very rudimentary. Please help to extend it!
4
# Current state is very rudimentary. Please help to extend it!
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
use Test::More tests => 16;
7
use Test::More tests => 17;
8
8
9
use Koha::Database;
9
use Koha::Database;
10
use t::lib::TestBuilder;
10
use t::lib::TestBuilder;
Lines 439-444 subtest do_checkin => sub { Link Here
439
    };
439
    };
440
};
440
};
441
441
442
subtest do_checkout_under_noissuecharge => sub {
443
    plan tests => 5;
444
445
    my $mockILS = Test::MockObject->new;
446
    my $server = { ils => $mockILS };
447
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
448
    my $institution = {
449
        id             => $library->id,
450
        implementation => "ILS",
451
        policy         => {
452
            checkin  => "true",
453
            renewal  => "true",
454
            checkout => "true",
455
            timeout  => 100,
456
            retries  => 5,
457
        }
458
    };
459
    my $ils = C4::SIP::ILS->new($institution);
460
    my $item = $builder->build_sample_item(
461
        {
462
            library => $library->branchcode,
463
        }
464
    );
465
466
    my $fines_patron = $builder->build_object(
467
        {
468
            class => 'Koha::Patrons',
469
            value => {
470
                branchcode => $library->branchcode,
471
            }
472
        }
473
    );
474
    my $fee1 = $builder->build(
475
        {
476
            source => 'Accountline',
477
            value  => {
478
                borrowernumber => $fines_patron->borrowernumber,
479
                amountoutstanding => 4,
480
            }
481
        }
482
    );
483
484
    $server->{account}->{under_noissuescharge_block_checkout} = 1;
485
    $server->{account}->{show_outstanding_amount} = 0;
486
    my $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account});
487
    is( $circ->{screen_msg}, 'Outstanding Fines block issue',
488
        "Checkout is blocked when the amount is under noissuecharge and under_noissuescharge_block_checkout is enabled" );
489
490
    $server->{account}->{under_noissuescharge_block_checkout} = 1;
491
    $server->{account}->{show_outstanding_amount} = 1;
492
    $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account});
493
    is( $circ->{screen_msg}, 'Outstanding Fines block issue - You owe $4.00.',
494
        "Checkout is blocked and the amount is displayed when it is under noissuecharge and under_noissuescharge_block_checkout is enabled" );
495
496
    $server->{account}->{under_noissuescharge_block_checkout} = 0;
497
    $server->{account}->{show_outstanding_amount} = 0;
498
    $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account});
499
    is( $circ->{screen_msg}, 'You have outstanding fines',
500
        "Checkout is allowed when the amount is under noissuecharge and under_noissuescharge_block_checkout is disabled" );
501
502
    $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode );
503
504
    $server->{account}->{under_noissuescharge_block_checkout} = 0;
505
    $server->{account}->{show_outstanding_amount} = 1;
506
    $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account});
507
    is( $circ->{screen_msg}, 'You have outstanding fines - You owe $4.00.',
508
        "Checkout is allowed and the amount is displayed when it is under noissuecharge and under_noissuescharge_block_checkout is disabled" );
509
510
    $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode );
511
512
    $fee1 = $builder->build(
513
        {
514
            source => 'Accountline',
515
            value  => {
516
                borrowernumber => $fines_patron->borrowernumber,
517
                amountoutstanding => 4,
518
            }
519
        }
520
    );
521
522
    $server->{account}->{under_noissuescharge_block_checkout} = 0;
523
    $server->{account}->{show_outstanding_amount} = 0;
524
    $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account});
525
    is( $circ->{screen_msg}, 'Patron has fines',
526
        "Checkout is blocked when amount is over noissuecharge and under_noissuescharge_block_checkout is disabled" );
527
};
528
442
subtest do_checkout_with_patron_blocked => sub {
529
subtest do_checkout_with_patron_blocked => sub {
443
    plan tests => 4;
530
    plan tests => 4;
444
531
445
- 

Return to bug 32408