Lines 91-108
C4::Context->set_userenv($patron->{borrowernumber}, $patron->{userid}, 'usercnum
Link Here
|
91 |
# OSCO: On-site checkout |
91 |
# OSCO: On-site checkout |
92 |
|
92 |
|
93 |
subtest 'no rules exist' => sub { |
93 |
subtest 'no rules exist' => sub { |
94 |
plan tests => 4; |
94 |
plan tests => 6; |
95 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
95 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
96 |
is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); |
96 |
is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); |
97 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); |
97 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); |
|
|
98 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
98 |
|
99 |
|
99 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
100 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
100 |
is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); |
101 |
is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); |
101 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); |
102 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); |
|
|
103 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
102 |
}; |
104 |
}; |
103 |
|
105 |
|
104 |
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { |
106 |
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { |
105 |
plan tests => 12; |
107 |
plan tests => 16; |
106 |
my $issuingrule = $builder->build({ |
108 |
my $issuingrule = $builder->build({ |
107 |
source => 'Issuingrule', |
109 |
source => 'Issuingrule', |
108 |
value => { |
110 |
value => { |
Lines 118-128
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub {
Link Here
|
118 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
120 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
119 |
is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
121 |
is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
120 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
122 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
123 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
121 |
|
124 |
|
122 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
125 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
123 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
126 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
124 |
is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
127 |
is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
125 |
is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
128 |
is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
129 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
126 |
|
130 |
|
127 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
131 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
128 |
|
132 |
|
Lines 130-140
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub {
Link Here
|
130 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
134 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
131 |
is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
135 |
is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
132 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
136 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
137 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
133 |
|
138 |
|
134 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
139 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
135 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
140 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
136 |
is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
141 |
is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
137 |
is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
142 |
is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
143 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
138 |
|
144 |
|
139 |
teardown(); |
145 |
teardown(); |
140 |
}; |
146 |
}; |
Lines 179-185
subtest '1 Issuingrule exist 1 1: issue is allowed' => sub {
Link Here
|
179 |
}; |
185 |
}; |
180 |
|
186 |
|
181 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { |
187 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { |
182 |
plan tests => 11; |
188 |
plan tests => 14; |
183 |
my $issuingrule = $builder->build({ |
189 |
my $issuingrule = $builder->build({ |
184 |
source => 'Issuingrule', |
190 |
source => 'Issuingrule', |
185 |
value => { |
191 |
value => { |
Lines 199-204
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
199 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
205 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
200 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
206 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
201 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
207 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
208 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
202 |
|
209 |
|
203 |
is( |
210 |
is( |
204 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
211 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
Lines 212-228
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
212 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
219 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
213 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
220 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
214 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
221 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
222 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
215 |
|
223 |
|
216 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
224 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
217 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
225 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
218 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
226 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
219 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
227 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
228 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
220 |
|
229 |
|
221 |
teardown(); |
230 |
teardown(); |
222 |
}; |
231 |
}; |
223 |
|
232 |
|
224 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { |
233 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { |
225 |
plan tests => 11; |
234 |
plan tests => 14; |
226 |
my $issuingrule = $builder->build({ |
235 |
my $issuingrule = $builder->build({ |
227 |
source => 'Issuingrule', |
236 |
source => 'Issuingrule', |
228 |
value => { |
237 |
value => { |
Lines 248-264
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub {
Link Here
|
248 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
257 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
249 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
258 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
250 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
259 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
260 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
251 |
|
261 |
|
252 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
262 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
253 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
263 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
254 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
264 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
255 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
265 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
256 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
266 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
267 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
257 |
|
268 |
|
258 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
269 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
259 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
270 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
260 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
271 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
261 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
272 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
273 |
is( ref $too_many->{issuing_rule}, 'Koha::IssuingRule', 'TooMany should return an issuing rule' ); |
262 |
|
274 |
|
263 |
teardown(); |
275 |
teardown(); |
264 |
}; |
276 |
}; |
Lines 267-273
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
267 |
# Note: the same test coul be done for |
279 |
# Note: the same test coul be done for |
268 |
# DefaultBorrowerCircRule, DefaultBranchCircRule, DefaultBranchItemRule ans DefaultCircRule.pm |
280 |
# DefaultBorrowerCircRule, DefaultBranchCircRule, DefaultBranchItemRule ans DefaultCircRule.pm |
269 |
|
281 |
|
270 |
plan tests => 22; |
282 |
plan tests => 28; |
271 |
my $issuingrule = $builder->build({ |
283 |
my $issuingrule = $builder->build({ |
272 |
source => 'BranchBorrowerCircRule', |
284 |
source => 'BranchBorrowerCircRule', |
273 |
value => { |
285 |
value => { |
Lines 286-291
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
286 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
298 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
287 |
is( $too_many->{count}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
299 |
is( $too_many->{count}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
288 |
is( $too_many->{max_allowed}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
300 |
is( $too_many->{max_allowed}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
301 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
289 |
|
302 |
|
290 |
is( |
303 |
is( |
291 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
304 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
Lines 298-308
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
298 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
311 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
299 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
312 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
300 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
313 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
314 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
301 |
|
315 |
|
302 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
316 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
303 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
317 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
304 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
318 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
305 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
319 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
320 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
306 |
|
321 |
|
307 |
teardown(); |
322 |
teardown(); |
308 |
|
323 |
|
Lines 320-336
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
320 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
335 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
321 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
336 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
322 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
337 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
|
|
338 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
323 |
|
339 |
|
324 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
340 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
325 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
341 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
326 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
342 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
327 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
343 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
328 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
344 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
345 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
329 |
|
346 |
|
330 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
347 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
331 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
348 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
332 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
349 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
333 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
350 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
|
|
351 |
is( $too_many->{issuing_rule}, undef, 'TooMany should return no issuing rule' ); |
334 |
|
352 |
|
335 |
teardown(); |
353 |
teardown(); |
336 |
}; |
354 |
}; |
337 |
- |
|
|