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

(-)a/C4/Circulation.pm (-1 / +2 lines)
Lines 531-537 sub TooMany { Link Here
531
            }
531
            }
532
        }
532
        }
533
        if ( C4::Context->preference('ConsiderOnSiteCheckoutsAsNormalCheckouts') ) {
533
        if ( C4::Context->preference('ConsiderOnSiteCheckoutsAsNormalCheckouts') ) {
534
            if ( $checkout_count >= $max_checkouts_allowed ) {
534
            my $delta = $switch_onsite_checkout ? 1 : 0;
535
            if ( $checkout_count >= $max_checkouts_allowed + $delta ) {
535
                return {
536
                return {
536
                    reason => 'TOO_MANY_CHECKOUTS',
537
                    reason => 'TOO_MANY_CHECKOUTS',
537
                    count => $checkout_count,
538
                    count => $checkout_count,
(-)a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t (-3 / +17 lines)
Lines 15-21 Link Here
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
16
16
17
use Modern::Perl;
17
use Modern::Perl;
18
use Test::More tests => 5;
18
use Test::More tests => 8;
19
use C4::Context;
19
use C4::Context;
20
20
21
use C4::Biblio;
21
use C4::Biblio;
Lines 117-124 my $another_item = $builder->build({ Link Here
117
});
117
});
118
118
119
C4::Circulation::AddIssue( $patron, $another_item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
119
C4::Circulation::AddIssue( $patron, $another_item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
120
( undef, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
120
( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
121
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' );
121
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' );
122
is( exists $impossible->{TOO_MANY}, '', '' );
123
124
$dbh->do(q|DELETE FROM issuingrules|);
125
my $borrower_circ_rule = $builder->build({
126
    source => 'DefaultCircRule',
127
    value => {
128
        branchcode         => $branch->{branchcode},
129
        categorycode       => '*',
130
        maxissueqty        => 2,
131
        maxonsiteissueqty  => 1,
132
    },
133
});
134
( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
135
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' );
136
is( exists $impossible->{TOO_MANY}, '', '' );
122
137
123
$schema->storage->txn_rollback;
138
$schema->storage->txn_rollback;
124
139
125
- 

Return to bug 16272