Bug 16272: (follow-up) Specific case when switching an on-site checkout to a regular checkout
Same as previous patch but if another circ rule exists Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
fe563f5911
commit
666f79ed74
|
|
@ -532,7 +532,8 @@ sub TooMany {
|
|||
}
|
||||
}
|
||||
if ( C4::Context->preference('ConsiderOnSiteCheckoutsAsNormalCheckouts') ) {
|
||||
if ( $checkout_count >= $max_checkouts_allowed ) {
|
||||
my $delta = $switch_onsite_checkout ? 1 : 0;
|
||||
if ( $checkout_count >= $max_checkouts_allowed + $delta ) {
|
||||
return {
|
||||
reason => 'TOO_MANY_CHECKOUTS',
|
||||
count => $checkout_count,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
# with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 8;
|
||||
use C4::Context;
|
||||
|
||||
use C4::Biblio;
|
||||
|
|
@ -117,8 +117,23 @@ my $another_item = $builder->build({
|
|||
});
|
||||
|
||||
C4::Circulation::AddIssue( $patron, $another_item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
|
||||
( undef, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
|
||||
( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
|
||||
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' );
|
||||
is( exists $impossible->{TOO_MANY}, '', '' );
|
||||
|
||||
$dbh->do(q|DELETE FROM issuingrules|);
|
||||
my $borrower_circ_rule = $builder->build({
|
||||
source => 'DefaultCircRule',
|
||||
value => {
|
||||
branchcode => $branch->{branchcode},
|
||||
categorycode => '*',
|
||||
maxissueqty => 2,
|
||||
maxonsiteissueqty => 1,
|
||||
},
|
||||
});
|
||||
( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
|
||||
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' );
|
||||
is( exists $impossible->{TOO_MANY}, '', '' );
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue