|
Lines 215-280
subtest 'pickup_locations' => sub {
Link Here
|
| 215 |
my $patron4 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $library4->branchcode, firstname => '4' } } ); |
215 |
my $patron4 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $library4->branchcode, firstname => '4' } } ); |
| 216 |
|
216 |
|
| 217 |
my $results = { |
217 |
my $results = { |
| 218 |
"1-1-1-any" => 3, |
218 |
"1-1-from_home_library-any" => 3, |
| 219 |
"1-1-1-holdgroup" => 2, |
219 |
"1-1-from_home_library-holdgroup" => 2, |
| 220 |
"1-1-1-patrongroup" => 2, |
220 |
"1-1-from_home_library-patrongroup" => 2, |
| 221 |
"1-1-1-homebranch" => 1, |
221 |
"1-1-from_home_library-homebranch" => 1, |
| 222 |
"1-1-1-holdingbranch" => 1, |
222 |
"1-1-from_home_library-holdingbranch" => 1, |
| 223 |
"1-1-2-any" => 3, |
223 |
"1-1-from_any_library-any" => 3, |
| 224 |
"1-1-2-holdgroup" => 2, |
224 |
"1-1-from_any_library-holdgroup" => 2, |
| 225 |
"1-1-2-patrongroup" => 2, |
225 |
"1-1-from_any_library-patrongroup" => 2, |
| 226 |
"1-1-2-homebranch" => 1, |
226 |
"1-1-from_any_library-homebranch" => 1, |
| 227 |
"1-1-2-holdingbranch" => 1, |
227 |
"1-1-from_any_library-holdingbranch" => 1, |
| 228 |
"1-1-3-any" => 3, |
228 |
"1-1-from_local_hold_group-any" => 3, |
| 229 |
"1-1-3-holdgroup" => 2, |
229 |
"1-1-from_local_hold_group-holdgroup" => 2, |
| 230 |
"1-1-3-patrongroup" => 2, |
230 |
"1-1-from_local_hold_group-patrongroup" => 2, |
| 231 |
"1-1-3-homebranch" => 1, |
231 |
"1-1-from_local_hold_group-homebranch" => 1, |
| 232 |
"1-1-3-holdingbranch" => 1, |
232 |
"1-1-from_local_hold_group-holdingbranch" => 1, |
| 233 |
"1-4-1-any" => 0, |
233 |
"1-4-from_home_library-any" => 0, |
| 234 |
"1-4-1-holdgroup" => 0, |
234 |
"1-4-from_home_library-holdgroup" => 0, |
| 235 |
"1-4-1-patrongroup" => 0, |
235 |
"1-4-from_home_library-patrongroup" => 0, |
| 236 |
"1-4-1-homebranch" => 0, |
236 |
"1-4-from_home_library-homebranch" => 0, |
| 237 |
"1-4-1-holdingbranch" => 0, |
237 |
"1-4-from_home_library-holdingbranch" => 0, |
| 238 |
"1-4-2-any" => 3, |
238 |
"1-4-from_any_library-any" => 3, |
| 239 |
"1-4-2-holdgroup" => 2, |
239 |
"1-4-from_any_library-holdgroup" => 2, |
| 240 |
"1-4-2-patrongroup" => 1, |
240 |
"1-4-from_any_library-patrongroup" => 1, |
| 241 |
"1-4-2-homebranch" => 1, |
241 |
"1-4-from_any_library-homebranch" => 1, |
| 242 |
"1-4-2-holdingbranch" => 1, |
242 |
"1-4-from_any_library-holdingbranch" => 1, |
| 243 |
"1-4-3-any" => 0, |
243 |
"1-4-from_local_hold_group-any" => 0, |
| 244 |
"1-4-3-holdgroup" => 0, |
244 |
"1-4-from_local_hold_group-holdgroup" => 0, |
| 245 |
"1-4-3-patrongroup" => 0, |
245 |
"1-4-from_local_hold_group-patrongroup" => 0, |
| 246 |
"1-4-3-homebranch" => 0, |
246 |
"1-4-from_local_hold_group-homebranch" => 0, |
| 247 |
"1-4-3-holdingbranch" => 0, |
247 |
"1-4-from_local_hold_group-holdingbranch" => 0, |
| 248 |
"3-1-1-any" => 0, |
248 |
"3-1-from_home_library-any" => 0, |
| 249 |
"3-1-1-holdgroup" => 0, |
249 |
"3-1-from_home_library-holdgroup" => 0, |
| 250 |
"3-1-1-patrongroup" => 0, |
250 |
"3-1-from_home_library-patrongroup" => 0, |
| 251 |
"3-1-1-homebranch" => 0, |
251 |
"3-1-from_home_library-homebranch" => 0, |
| 252 |
"3-1-1-holdingbranch" => 0, |
252 |
"3-1-from_home_library-holdingbranch" => 0, |
| 253 |
"3-1-2-any" => 3, |
253 |
"3-1-from_any_library-any" => 3, |
| 254 |
"3-1-2-holdgroup" => 1, |
254 |
"3-1-from_any_library-holdgroup" => 1, |
| 255 |
"3-1-2-patrongroup" => 2, |
255 |
"3-1-from_any_library-patrongroup" => 2, |
| 256 |
"3-1-2-homebranch" => 0, |
256 |
"3-1-from_any_library-homebranch" => 0, |
| 257 |
"3-1-2-holdingbranch" => 1, |
257 |
"3-1-from_any_library-holdingbranch" => 1, |
| 258 |
"3-1-3-any" => 0, |
258 |
"3-1-from_local_hold_group-any" => 0, |
| 259 |
"3-1-3-holdgroup" => 0, |
259 |
"3-1-from_local_hold_group-holdgroup" => 0, |
| 260 |
"3-1-3-patrongroup" => 0, |
260 |
"3-1-from_local_hold_group-patrongroup" => 0, |
| 261 |
"3-1-3-homebranch" => 0, |
261 |
"3-1-from_local_hold_group-homebranch" => 0, |
| 262 |
"3-1-3-holdingbranch" => 0, |
262 |
"3-1-from_local_hold_group-holdingbranch" => 0, |
| 263 |
"3-4-1-any" => 0, |
263 |
"3-4-from_home_library-any" => 0, |
| 264 |
"3-4-1-holdgroup" => 0, |
264 |
"3-4-from_home_library-holdgroup" => 0, |
| 265 |
"3-4-1-patrongroup" => 0, |
265 |
"3-4-from_home_library-patrongroup" => 0, |
| 266 |
"3-4-1-homebranch" => 0, |
266 |
"3-4-from_home_library-homebranch" => 0, |
| 267 |
"3-4-1-holdingbranch" => 0, |
267 |
"3-4-from_home_library-holdingbranch" => 0, |
| 268 |
"3-4-2-any" => 3, |
268 |
"3-4-from_any_library-any" => 3, |
| 269 |
"3-4-2-holdgroup" => 1, |
269 |
"3-4-from_any_library-holdgroup" => 1, |
| 270 |
"3-4-2-patrongroup" => 1, |
270 |
"3-4-from_any_library-patrongroup" => 1, |
| 271 |
"3-4-2-homebranch" => 0, |
271 |
"3-4-from_any_library-homebranch" => 0, |
| 272 |
"3-4-2-holdingbranch" => 1, |
272 |
"3-4-from_any_library-holdingbranch" => 1, |
| 273 |
"3-4-3-any" => 3, |
273 |
"3-4-from_local_hold_group-any" => 3, |
| 274 |
"3-4-3-holdgroup" => 1, |
274 |
"3-4-from_local_hold_group-holdgroup" => 1, |
| 275 |
"3-4-3-patrongroup" => 1, |
275 |
"3-4-from_local_hold_group-patrongroup" => 1, |
| 276 |
"3-4-3-homebranch" => 0, |
276 |
"3-4-from_local_hold_group-homebranch" => 0, |
| 277 |
"3-4-3-holdingbranch" => 1 |
277 |
"3-4-from_local_hold_group-holdingbranch" => 1 |
| 278 |
}; |
278 |
}; |
| 279 |
|
279 |
|
| 280 |
sub _doTest { |
280 |
sub _doTest { |
|
Lines 291-297
subtest 'pickup_locations' => sub {
Link Here
|
| 291 |
} |
291 |
} |
| 292 |
} |
292 |
} |
| 293 |
); |
293 |
); |
| 294 |
my $ha_value=$ha==3?'holdgroup':($ha==2?'any':'homebranch'); |
294 |
my $ha_value = |
|
|
295 |
$ha eq 'from_local_hold_group' ? 'holdgroup' |
| 296 |
: ( |
| 297 |
$ha eq 'from_any_library' ? 'any' |
| 298 |
: 'homebranch' |
| 299 |
); |
| 295 |
|
300 |
|
| 296 |
my @pl = map { |
301 |
my @pl = map { |
| 297 |
my $pickup_location = $_; |
302 |
my $pickup_location = $_; |
|
Lines 299-305
subtest 'pickup_locations' => sub {
Link Here
|
| 299 |
} $item->pickup_locations( { patron => $patron } )->as_list; |
304 |
} $item->pickup_locations( { patron => $patron } )->as_list; |
| 300 |
|
305 |
|
| 301 |
ok( |
306 |
ok( |
| 302 |
scalar(@pl) == $results->{ |
307 |
scalar(@pl) eq $results->{ |
| 303 |
$item->copynumber . '-' |
308 |
$item->copynumber . '-' |
| 304 |
. $patron->firstname . '-' |
309 |
. $patron->firstname . '-' |
| 305 |
. $ha . '-' |
310 |
. $ha . '-' |
|
Lines 330-336
subtest 'pickup_locations' => sub {
Link Here
|
| 330 |
foreach my $item ($item1, $item3) { |
335 |
foreach my $item ($item1, $item3) { |
| 331 |
foreach my $patron ($patron1, $patron4) { |
336 |
foreach my $patron ($patron1, $patron4) { |
| 332 |
#holdallowed 1: homebranch, 2: any, 3: holdgroup |
337 |
#holdallowed 1: homebranch, 2: any, 3: holdgroup |
| 333 |
foreach my $ha (1, 2, 3) { |
338 |
foreach my $ha ('from_home_library', 'from_any_library', 'from_local_hold_group') { |
| 334 |
foreach my $hfp ('any', 'holdgroup', 'patrongroup', 'homebranch', 'holdingbranch') { |
339 |
foreach my $hfp ('any', 'holdgroup', 'patrongroup', 'homebranch', 'holdingbranch') { |
| 335 |
_doTest($item, $patron, $ha, $hfp, $results); |
340 |
_doTest($item, $patron, $ha, $hfp, $results); |
| 336 |
} |
341 |
} |
|
Lines 355-361
subtest 'pickup_locations' => sub {
Link Here
|
| 355 |
branchcode => undef, |
360 |
branchcode => undef, |
| 356 |
itemtype => $item1->itype, |
361 |
itemtype => $item1->itype, |
| 357 |
rules => { |
362 |
rules => { |
| 358 |
holdallowed => 1, |
363 |
holdallowed => 'from_home_library', |
| 359 |
hold_fulfillment_policy => 1, |
364 |
hold_fulfillment_policy => 1, |
| 360 |
returnbranch => 'any' |
365 |
returnbranch => 'any' |
| 361 |
} |
366 |
} |