Lines 101-125
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub {
Link Here
|
101 |
}); |
101 |
}); |
102 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
102 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
103 |
is_deeply( |
103 |
is_deeply( |
104 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
104 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
105 |
[ 0, 0 ], |
105 |
{ |
|
|
106 |
reason => 'TOO_MANY_CHECKOUTS', |
107 |
count => 0, |
108 |
max_allowed => 0, |
109 |
}, |
106 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
110 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
107 |
); |
111 |
); |
108 |
is_deeply( |
112 |
is_deeply( |
109 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
113 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
110 |
[ 0, 0 ], |
114 |
{ |
|
|
115 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
116 |
count => 0, |
117 |
max_allowed => 0, |
118 |
}, |
111 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
119 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
112 |
); |
120 |
); |
113 |
|
121 |
|
114 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
122 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
115 |
is_deeply( |
123 |
is_deeply( |
116 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
124 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
117 |
[ 0, 0 ], |
125 |
{ |
|
|
126 |
reason => 'TOO_MANY_CHECKOUTS', |
127 |
count => 0, |
128 |
max_allowed => 0, |
129 |
}, |
118 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
130 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
119 |
); |
131 |
); |
120 |
is_deeply( |
132 |
is_deeply( |
121 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
133 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
122 |
[ 0, 0 ], |
134 |
{ |
|
|
135 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
136 |
count => 0, |
137 |
max_allowed => 0, |
138 |
}, |
123 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
139 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
124 |
); |
140 |
); |
125 |
|
141 |
|
Lines 183-190
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
183 |
|
199 |
|
184 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
200 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
185 |
is_deeply( |
201 |
is_deeply( |
186 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
202 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
187 |
[ 1, 1 ], |
203 |
{ |
|
|
204 |
reason => 'TOO_MANY_CHECKOUTS', |
205 |
count => 1, |
206 |
max_allowed => 1, |
207 |
}, |
188 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
208 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
189 |
); |
209 |
); |
190 |
is( |
210 |
is( |
Lines 195-207
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
195 |
|
215 |
|
196 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
216 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
197 |
is_deeply( |
217 |
is_deeply( |
198 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
218 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
199 |
[ 1, 1 ], |
219 |
{ |
|
|
220 |
reason => 'TOO_MANY_CHECKOUTS', |
221 |
count => 1, |
222 |
max_allowed => 1, |
223 |
}, |
200 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
224 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
201 |
); |
225 |
); |
202 |
is_deeply( |
226 |
is_deeply( |
203 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
227 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
204 |
[ 1, 1 ], |
228 |
{ |
|
|
229 |
reason => 'TOO_MANY_CHECKOUTS', |
230 |
count => 1, |
231 |
max_allowed => 1, |
232 |
}, |
205 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
233 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
206 |
); |
234 |
); |
207 |
|
235 |
|
Lines 231-250
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub {
Link Here
|
231 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
259 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
232 |
); |
260 |
); |
233 |
is_deeply( |
261 |
is_deeply( |
234 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
262 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
235 |
[ 1, 1 ], |
263 |
{ |
|
|
264 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
265 |
count => 1, |
266 |
max_allowed => 1, |
267 |
}, |
236 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
268 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
237 |
); |
269 |
); |
238 |
|
270 |
|
239 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
271 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
240 |
is_deeply( |
272 |
is_deeply( |
241 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
273 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
242 |
[ 1, 1 ], |
274 |
{ |
|
|
275 |
reason => 'TOO_MANY_CHECKOUTS', |
276 |
count => 1, |
277 |
max_allowed => 1, |
278 |
}, |
243 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
279 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
244 |
); |
280 |
); |
245 |
is_deeply( |
281 |
is_deeply( |
246 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
282 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
247 |
[ 1, 1 ], |
283 |
{ |
|
|
284 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
285 |
count => 1, |
286 |
max_allowed => 1, |
287 |
}, |
248 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
288 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
249 |
); |
289 |
); |
250 |
|
290 |
|
Lines 271-278
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
271 |
|
311 |
|
272 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
312 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
273 |
is_deeply( |
313 |
is_deeply( |
274 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
314 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
275 |
[ 1, 1 ], |
315 |
{ |
|
|
316 |
reason => 'TOO_MANY_CHECKOUTS', |
317 |
count => 1, |
318 |
max_allowed => 1, |
319 |
}, |
276 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
320 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
277 |
); |
321 |
); |
278 |
is( |
322 |
is( |
Lines 283-295
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
283 |
|
327 |
|
284 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
328 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
285 |
is_deeply( |
329 |
is_deeply( |
286 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
330 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
287 |
[ 1, 1 ], |
331 |
{ |
|
|
332 |
reason => 'TOO_MANY_CHECKOUTS', |
333 |
count => 1, |
334 |
max_allowed => 1, |
335 |
}, |
288 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
336 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
289 |
); |
337 |
); |
290 |
is_deeply( |
338 |
is_deeply( |
291 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
339 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
292 |
[ 1, 1 ], |
340 |
{ |
|
|
341 |
reason => 'TOO_MANY_CHECKOUTS', |
342 |
count => 1, |
343 |
max_allowed => 1, |
344 |
}, |
293 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
345 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
294 |
); |
346 |
); |
295 |
|
347 |
|
Lines 305-324
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
305 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
357 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
306 |
); |
358 |
); |
307 |
is_deeply( |
359 |
is_deeply( |
308 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
360 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
309 |
[ 1, 1 ], |
361 |
{ |
|
|
362 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
363 |
count => 1, |
364 |
max_allowed => 1, |
365 |
}, |
310 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
366 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
311 |
); |
367 |
); |
312 |
|
368 |
|
313 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
369 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
314 |
is_deeply( |
370 |
is_deeply( |
315 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ) ], |
371 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
316 |
[ 1, 1 ], |
372 |
{ |
|
|
373 |
reason => 'TOO_MANY_CHECKOUTS', |
374 |
count => 1, |
375 |
max_allowed => 1, |
376 |
}, |
317 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
377 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
318 |
); |
378 |
); |
319 |
is_deeply( |
379 |
is_deeply( |
320 |
[ C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ) ], |
380 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
321 |
[ 1, 1 ], |
381 |
{ |
|
|
382 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
383 |
count => 1, |
384 |
max_allowed => 1, |
385 |
}, |
322 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
386 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
323 |
); |
387 |
); |
324 |
|
388 |
|
325 |
- |
|
|