Bug 8361: Do not allow checkouts if no rules are defined
We should require a circulation rule to allow checkouts and reject them
if no rules are defined.
Test plan:
- Delete all issuing rules
- Check an item out
=> Without this patch the checkout is allowed
=> With this patch applied it is rejected
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 11dfb2e0b2)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
parent
36685a439a
commit
32c8bf4a3d
|
|
@ -555,6 +555,10 @@ sub TooMany {
|
|||
}
|
||||
}
|
||||
|
||||
if ( not defined( $issuing_rule ) and not defined($branch_borrower_circ_rule->{maxissueqty}) ) {
|
||||
return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
|
||||
}
|
||||
|
||||
# OK, the patron can issue !!!
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,15 +92,15 @@ C4::Context->set_userenv($patron->{borrowernumber}, $patron->{userid}, 'usercnum
|
|||
|
||||
subtest 'no rules exist' => sub {
|
||||
plan tests => 2;
|
||||
is(
|
||||
is_deeply(
|
||||
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ),
|
||||
undef,
|
||||
'CO should be allowed, in any cases'
|
||||
{ reason => 'NO_RULE_DEFINED', max_allowed => 0 },
|
||||
'CO should not be allowed, in any cases'
|
||||
);
|
||||
is(
|
||||
is_deeply(
|
||||
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ),
|
||||
undef,
|
||||
'OSCO should be allowed, in any cases'
|
||||
{ reason => 'NO_RULE_DEFINED', max_allowed => 0 },
|
||||
'OSCO should not be allowed, in any cases'
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue