|
Lines 91-111
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 => 2; |
94 |
plan tests => 4; |
| 95 |
is_deeply( |
95 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 96 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
96 |
is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); |
| 97 |
{ reason => 'NO_RULE_DEFINED', max_allowed => 0 }, |
97 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); |
| 98 |
'CO should not be allowed, in any cases' |
98 |
|
| 99 |
); |
99 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 100 |
is_deeply( |
100 |
is( $too_many->{reason}, 'NO_RULE_DEFINED', 'CO should not be allowed, in any cases' ); |
| 101 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
101 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed, in any cases' ); |
| 102 |
{ reason => 'NO_RULE_DEFINED', max_allowed => 0 }, |
|
|
| 103 |
'OSCO should not be allowed, in any cases' |
| 104 |
); |
| 105 |
}; |
102 |
}; |
| 106 |
|
103 |
|
| 107 |
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { |
104 |
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { |
| 108 |
plan tests => 4; |
105 |
plan tests => 12; |
| 109 |
my $issuingrule = $builder->build({ |
106 |
my $issuingrule = $builder->build({ |
| 110 |
source => 'Issuingrule', |
107 |
source => 'Issuingrule', |
| 111 |
value => { |
108 |
value => { |
|
Lines 117-160
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub {
Link Here
|
| 117 |
}, |
114 |
}, |
| 118 |
}); |
115 |
}); |
| 119 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
116 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
| 120 |
is_deeply( |
117 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 121 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
118 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 122 |
{ |
119 |
is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 123 |
reason => 'TOO_MANY_CHECKOUTS', |
120 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 124 |
count => 0, |
121 |
|
| 125 |
max_allowed => 0, |
122 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 126 |
}, |
123 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 127 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
124 |
is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 128 |
); |
125 |
is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 129 |
is_deeply( |
|
|
| 130 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 131 |
{ |
| 132 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
| 133 |
count => 0, |
| 134 |
max_allowed => 0, |
| 135 |
}, |
| 136 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 137 |
); |
| 138 |
|
126 |
|
| 139 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
127 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
| 140 |
is_deeply( |
128 |
|
| 141 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
129 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 142 |
{ |
130 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 143 |
reason => 'TOO_MANY_CHECKOUTS', |
131 |
is( $too_many->{count}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 144 |
count => 0, |
132 |
is( $too_many->{max_allowed}, 0, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 145 |
max_allowed => 0, |
133 |
|
| 146 |
}, |
134 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 147 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
135 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 148 |
); |
136 |
is( $too_many->{count}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 149 |
is_deeply( |
137 |
is( $too_many->{max_allowed}, 0, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 150 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
|
|
| 151 |
{ |
| 152 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
| 153 |
count => 0, |
| 154 |
max_allowed => 0, |
| 155 |
}, |
| 156 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 157 |
); |
| 158 |
|
138 |
|
| 159 |
teardown(); |
139 |
teardown(); |
| 160 |
}; |
140 |
}; |
|
Lines 199-205
subtest '1 Issuingrule exist 1 1: issue is allowed' => sub {
Link Here
|
| 199 |
}; |
179 |
}; |
| 200 |
|
180 |
|
| 201 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { |
181 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { |
| 202 |
plan tests => 5; |
182 |
plan tests => 11; |
| 203 |
my $issuingrule = $builder->build({ |
183 |
my $issuingrule = $builder->build({ |
| 204 |
source => 'Issuingrule', |
184 |
source => 'Issuingrule', |
| 205 |
value => { |
185 |
value => { |
|
Lines 215-229
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
| 215 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
195 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
| 216 |
|
196 |
|
| 217 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
197 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
| 218 |
is_deeply( |
198 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 219 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
199 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 220 |
{ |
200 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 221 |
reason => 'TOO_MANY_CHECKOUTS', |
201 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 222 |
count => 1, |
202 |
|
| 223 |
max_allowed => 1, |
|
|
| 224 |
}, |
| 225 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 226 |
); |
| 227 |
is( |
203 |
is( |
| 228 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
204 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 229 |
undef, |
205 |
undef, |
|
Lines 231-260
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
| 231 |
); |
207 |
); |
| 232 |
|
208 |
|
| 233 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
209 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
| 234 |
is_deeply( |
210 |
|
| 235 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
211 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 236 |
{ |
212 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 237 |
reason => 'TOO_MANY_CHECKOUTS', |
213 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 238 |
count => 1, |
214 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 239 |
max_allowed => 1, |
215 |
|
| 240 |
}, |
216 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 241 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
217 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 242 |
); |
218 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 243 |
is_deeply( |
219 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 244 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
|
|
| 245 |
{ |
| 246 |
reason => 'TOO_MANY_CHECKOUTS', |
| 247 |
count => 1, |
| 248 |
max_allowed => 1, |
| 249 |
}, |
| 250 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 251 |
); |
| 252 |
|
220 |
|
| 253 |
teardown(); |
221 |
teardown(); |
| 254 |
}; |
222 |
}; |
| 255 |
|
223 |
|
| 256 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { |
224 |
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { |
| 257 |
plan tests => 5; |
225 |
plan tests => 11; |
| 258 |
my $issuingrule = $builder->build({ |
226 |
my $issuingrule = $builder->build({ |
| 259 |
source => 'Issuingrule', |
227 |
source => 'Issuingrule', |
| 260 |
value => { |
228 |
value => { |
|
Lines 275-309
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub {
Link Here
|
| 275 |
undef, |
243 |
undef, |
| 276 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
244 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 277 |
); |
245 |
); |
| 278 |
is_deeply( |
246 |
|
| 279 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
247 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 280 |
{ |
248 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 281 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
249 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 282 |
count => 1, |
250 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 283 |
max_allowed => 1, |
|
|
| 284 |
}, |
| 285 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 286 |
); |
| 287 |
|
251 |
|
| 288 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
252 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
| 289 |
is_deeply( |
253 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 290 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
254 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 291 |
{ |
255 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 292 |
reason => 'TOO_MANY_CHECKOUTS', |
256 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 293 |
count => 1, |
257 |
|
| 294 |
max_allowed => 1, |
258 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 295 |
}, |
259 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 296 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
260 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 297 |
); |
261 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 298 |
is_deeply( |
|
|
| 299 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 300 |
{ |
| 301 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
| 302 |
count => 1, |
| 303 |
max_allowed => 1, |
| 304 |
}, |
| 305 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 306 |
); |
| 307 |
|
262 |
|
| 308 |
teardown(); |
263 |
teardown(); |
| 309 |
}; |
264 |
}; |
|
Lines 312-318
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
| 312 |
# Note: the same test coul be done for |
267 |
# Note: the same test coul be done for |
| 313 |
# DefaultBorrowerCircRule, DefaultBranchCircRule, DefaultBranchItemRule ans DefaultCircRule.pm |
268 |
# DefaultBorrowerCircRule, DefaultBranchCircRule, DefaultBranchItemRule ans DefaultCircRule.pm |
| 314 |
|
269 |
|
| 315 |
plan tests => 10; |
270 |
plan tests => 22; |
| 316 |
my $issuingrule = $builder->build({ |
271 |
my $issuingrule = $builder->build({ |
| 317 |
source => 'BranchBorrowerCircRule', |
272 |
source => 'BranchBorrowerCircRule', |
| 318 |
value => { |
273 |
value => { |
|
Lines 327-341
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
| 327 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
282 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
| 328 |
|
283 |
|
| 329 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
284 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
| 330 |
is_deeply( |
285 |
my $too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 331 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
286 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 332 |
{ |
287 |
is( $too_many->{count}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 333 |
reason => 'TOO_MANY_CHECKOUTS', |
288 |
is( $too_many->{max_allowed}, 1, 'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 334 |
count => 1, |
289 |
|
| 335 |
max_allowed => 1, |
|
|
| 336 |
}, |
| 337 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 338 |
); |
| 339 |
is( |
290 |
is( |
| 340 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
291 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 341 |
undef, |
292 |
undef, |
|
Lines 343-366
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
| 343 |
); |
294 |
); |
| 344 |
|
295 |
|
| 345 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
296 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
| 346 |
is_deeply( |
297 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 347 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
298 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 348 |
{ |
299 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 349 |
reason => 'TOO_MANY_CHECKOUTS', |
300 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 350 |
count => 1, |
301 |
|
| 351 |
max_allowed => 1, |
302 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 352 |
}, |
303 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 353 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
304 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 354 |
); |
305 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 355 |
is_deeply( |
|
|
| 356 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 357 |
{ |
| 358 |
reason => 'TOO_MANY_CHECKOUTS', |
| 359 |
count => 1, |
| 360 |
max_allowed => 1, |
| 361 |
}, |
| 362 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 363 |
); |
| 364 |
|
306 |
|
| 365 |
teardown(); |
307 |
teardown(); |
| 366 |
|
308 |
|
|
Lines 373-407
subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub {
Link Here
|
| 373 |
undef, |
315 |
undef, |
| 374 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
316 |
'CO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 375 |
); |
317 |
); |
| 376 |
is_deeply( |
318 |
|
| 377 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
319 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 378 |
{ |
320 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 379 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
321 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 380 |
count => 1, |
322 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' ); |
| 381 |
max_allowed => 1, |
|
|
| 382 |
}, |
| 383 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 384 |
); |
| 385 |
|
323 |
|
| 386 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
324 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
| 387 |
is_deeply( |
325 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ); |
| 388 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
326 |
is( $too_many->{reason}, 'TOO_MANY_CHECKOUTS', 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 389 |
{ |
327 |
is( $too_many->{count}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 390 |
reason => 'TOO_MANY_CHECKOUTS', |
328 |
is( $too_many->{max_allowed}, 1, 'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 391 |
count => 1, |
329 |
|
| 392 |
max_allowed => 1, |
330 |
$too_many = C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ); |
| 393 |
}, |
331 |
is( $too_many->{reason}, 'TOO_MANY_ONSITE_CHECKOUTS', 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 394 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
332 |
is( $too_many->{count}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 395 |
); |
333 |
is( $too_many->{max_allowed}, 1, 'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' ); |
| 396 |
is_deeply( |
|
|
| 397 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 398 |
{ |
| 399 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
| 400 |
count => 1, |
| 401 |
max_allowed => 1, |
| 402 |
}, |
| 403 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 404 |
); |
| 405 |
|
334 |
|
| 406 |
teardown(); |
335 |
teardown(); |
| 407 |
}; |
336 |
}; |
| 408 |
- |
|
|