|
Lines 37-42
use t::lib::Mocks;
Link Here
|
| 37 |
my $schema = Koha::Database->new->schema; |
37 |
my $schema = Koha::Database->new->schema; |
| 38 |
$schema->storage->txn_begin; |
38 |
$schema->storage->txn_begin; |
| 39 |
|
39 |
|
|
|
40 |
my $dbh = C4::Context->dbh; |
| 41 |
|
| 40 |
my $builder = t::lib::TestBuilder->new; |
42 |
my $builder = t::lib::TestBuilder->new; |
| 41 |
my $patron = $builder->build( { source => 'Borrower' } ); |
43 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 42 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
44 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
|
Lines 215-217
subtest 'custom_cover_image_url' => sub {
Link Here
|
| 215 |
}; |
217 |
}; |
| 216 |
|
218 |
|
| 217 |
$schema->storage->txn_rollback; |
219 |
$schema->storage->txn_rollback; |
|
|
220 |
|
| 221 |
|
| 222 |
subtest 'pickup_locations' => sub { |
| 223 |
plan tests => 25; |
| 224 |
|
| 225 |
$schema->storage->txn_begin; |
| 226 |
|
| 227 |
# Cleanup database |
| 228 |
Koha::Holds->search->delete; |
| 229 |
Koha::Patrons->search->delete; |
| 230 |
Koha::Items->search->delete; |
| 231 |
Koha::Libraries->search->delete; |
| 232 |
$dbh->do('DELETE FROM issues'); |
| 233 |
$dbh->do('DELETE FROM issuingrules'); |
| 234 |
$dbh->do( |
| 235 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) |
| 236 |
VALUES (?, ?, ?, ?)}, |
| 237 |
{}, |
| 238 |
'*', '*', '*', 25 |
| 239 |
); |
| 240 |
$dbh->do('DELETE FROM branch_item_rules'); |
| 241 |
$dbh->do('DELETE FROM default_branch_circ_rules'); |
| 242 |
$dbh->do('DELETE FROM default_branch_item_rules'); |
| 243 |
$dbh->do('DELETE FROM default_circ_rules'); |
| 244 |
|
| 245 |
my $root1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); |
| 246 |
my $root2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); |
| 247 |
my $root3 = $builder->build_object( { class => 'Koha::Library::Groups', value => { ft_local_hold_group => 1 } } ); |
| 248 |
|
| 249 |
my $library1 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
| 250 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
| 251 |
my $library3 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 0 } } ); |
| 252 |
my $library4 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
| 253 |
my $library5 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
| 254 |
my $library6 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
| 255 |
|
| 256 |
my $group1_1 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root1->id, branchcode => $library1->branchcode } } ); |
| 257 |
my $group1_2 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root1->id, branchcode => $library2->branchcode } } ); |
| 258 |
|
| 259 |
my $group2_3 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root2->id, branchcode => $library3->branchcode } } ); |
| 260 |
my $group2_4 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root2->id, branchcode => $library4->branchcode } } ); |
| 261 |
|
| 262 |
my $group3_5 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root3->id, branchcode => $library5->branchcode } } ); |
| 263 |
my $group3_6 = $builder->build_object( { class => 'Koha::Library::Groups', value => { parent_id => $root3->id, branchcode => $library6->branchcode } } ); |
| 264 |
|
| 265 |
my $biblio1 = $builder->build_object( { class => 'Koha::Biblios' } ); |
| 266 |
my $biblioitem1 = $builder->build_object( { class => 'Koha::Biblioitems', value => { biblionumber => $biblio1->biblionumber } } ); |
| 267 |
my $biblio2 = $builder->build_object( { class => 'Koha::Biblios' } ); |
| 268 |
my $biblioitem2 = $builder->build_object( { class => 'Koha::Biblioitems', value => { biblionumber => $biblio2->biblionumber } } ); |
| 269 |
|
| 270 |
my $item1_1 = Koha::Item->new({ |
| 271 |
biblionumber => $biblio1->biblionumber, |
| 272 |
biblioitemnumber => $biblioitem1->biblioitemnumber, |
| 273 |
homebranch => $library1->branchcode, |
| 274 |
holdingbranch => $library2->branchcode, |
| 275 |
itype => 'test', |
| 276 |
barcode => "item11barcode", |
| 277 |
})->store; |
| 278 |
|
| 279 |
my $item1_3 = Koha::Item->new({ |
| 280 |
biblionumber => $biblio1->biblionumber, |
| 281 |
biblioitemnumber => $biblioitem1->biblioitemnumber, |
| 282 |
homebranch => $library3->branchcode, |
| 283 |
holdingbranch => $library4->branchcode, |
| 284 |
itype => 'test', |
| 285 |
barcode => "item13barcode", |
| 286 |
})->store; |
| 287 |
|
| 288 |
my $item2_2 = Koha::Item->new({ |
| 289 |
biblionumber => $biblio2->biblionumber, |
| 290 |
biblioitemnumber => $biblioitem2->biblioitemnumber, |
| 291 |
homebranch => $library2->branchcode, |
| 292 |
holdingbranch => $library1->branchcode, |
| 293 |
itype => 'test', |
| 294 |
barcode => "item22barcode", |
| 295 |
})->store; |
| 296 |
|
| 297 |
my $item2_3 = Koha::Item->new({ |
| 298 |
biblionumber => $biblio2->biblionumber, |
| 299 |
biblioitemnumber => $biblioitem2->biblioitemnumber, |
| 300 |
homebranch => $library3->branchcode, |
| 301 |
holdingbranch => $library3->branchcode, |
| 302 |
itype => 'test', |
| 303 |
barcode => "item23barcode", |
| 304 |
})->store; |
| 305 |
|
| 306 |
my $item2_4 = Koha::Item->new({ |
| 307 |
biblionumber => $biblio2->biblionumber, |
| 308 |
biblioitemnumber => $biblioitem2->biblioitemnumber, |
| 309 |
homebranch => $library4->branchcode, |
| 310 |
holdingbranch => $library4->branchcode, |
| 311 |
itype => 'test', |
| 312 |
barcode => "item24barcode", |
| 313 |
})->store; |
| 314 |
|
| 315 |
my $patron1 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $library1->branchcode } } ); |
| 316 |
my $patron4 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $library4->branchcode } } ); |
| 317 |
|
| 318 |
t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch'); |
| 319 |
|
| 320 |
#Case 1: holdallowed any, hold_fulfillment_policy any |
| 321 |
$dbh->do( |
| 322 |
q{INSERT INTO default_circ_rules (holdallowed, hold_fulfillment_policy, returnbranch) |
| 323 |
VALUES (?,?,?)}, |
| 324 |
{}, |
| 325 |
2, 'any', 'any' |
| 326 |
); |
| 327 |
|
| 328 |
my @pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 329 |
my @pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 330 |
my @pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 331 |
my @pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 332 |
|
| 333 |
|
| 334 |
ok(scalar(@pl_1_1) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5 && scalar(@pl_2_4) == 5, 'Returns all libraries that are pickup locations'); |
| 335 |
|
| 336 |
#Case 2: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'homebranch' |
| 337 |
$dbh->do( |
| 338 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 339 |
{}, |
| 340 |
1, 'any' |
| 341 |
); |
| 342 |
|
| 343 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 344 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 345 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 346 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 347 |
|
| 348 |
ok(scalar(@pl_1_1) == 5 && scalar(@pl_2_4) == 5, 'Returns all libraries that are pickup locations, when item\'s hombebranch equals patron\' homebranch'); |
| 349 |
ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations'); |
| 350 |
|
| 351 |
#Case 3: holdallowed holdgroup, hold_fulfillment_policy any |
| 352 |
$dbh->do( |
| 353 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 354 |
{}, |
| 355 |
3, 'any' |
| 356 |
); |
| 357 |
|
| 358 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 359 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 360 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 361 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 362 |
|
| 363 |
ok(scalar(@pl_1_1) == 5 && scalar(@pl_2_4) == 5 && scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5, 'Returns all libraries that are pickup_locations, when item\'s hombebranch is in patron\' holdgroup'); |
| 364 |
|
| 365 |
#Case 4: holdallowed any, hold_fulfillment_policy holdgroup |
| 366 |
$dbh->do( |
| 367 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 368 |
{}, |
| 369 |
2, 'holdgroup' |
| 370 |
); |
| 371 |
|
| 372 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 373 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 374 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 375 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 376 |
|
| 377 |
ok(scalar(@pl_1_1) == 3 && scalar(@pl_2_4) == 3 && scalar(@pl_1_4) == 3 && scalar(@pl_2_1) == 3, 'Returns libraries in item\'s holdgroup, and that are pickup_locations'); |
| 378 |
|
| 379 |
#Case 5: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'homebranch' |
| 380 |
$dbh->do( |
| 381 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 382 |
{}, |
| 383 |
1, 'holdgroup' |
| 384 |
); |
| 385 |
|
| 386 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 387 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 388 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 389 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 390 |
|
| 391 |
ok(scalar(@pl_1_1) == 2 && scalar(@pl_2_4) == 1, 'Returns libraries in item\'s holdgroup whose homebranch equals patron\'s homebranch, and that are pickup_locations'); |
| 392 |
ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'Returns no pickup locations'); |
| 393 |
|
| 394 |
#Case 6: holdallowed holdgroup, hold_fulfillment_policy holdgroup |
| 395 |
$dbh->do( |
| 396 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 397 |
{}, |
| 398 |
3, 'holdgroup' |
| 399 |
); |
| 400 |
|
| 401 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 402 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 403 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 404 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 405 |
|
| 406 |
ok(scalar(@pl_1_1) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 1 && scalar(@pl_1_4) == 1, 'Returns libraries in item\'s holdgroup whose homebranch is included patron\'s holdgroup, and that are pickup_locations'); |
| 407 |
|
| 408 |
#Case 7: holdallowed any, hold_fulfillment_policy homebranch |
| 409 |
$dbh->do( |
| 410 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 411 |
{}, |
| 412 |
2, 'homebranch' |
| 413 |
); |
| 414 |
|
| 415 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 416 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 417 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 418 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 419 |
|
| 420 |
ok(scalar(@pl_1_1) == 1 && scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns homebranch of items in biblio, that are pickup_locations'); |
| 421 |
|
| 422 |
#Case 8: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'homebranch' |
| 423 |
$dbh->do( |
| 424 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 425 |
{}, |
| 426 |
1, 'homebranch' |
| 427 |
); |
| 428 |
|
| 429 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 430 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 431 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 432 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 433 |
|
| 434 |
ok(scalar(@pl_1_1) == 1 && scalar(@pl_2_4) == 1 && $pl_1_1[0]->{branchcode} eq $library1->branchcode && $pl_2_4[0]->{branchcode} eq $library4->branchcode, 'Returns homebranch of items in biblio that equals patron\'s homebranch, and that are pickup_locations'); |
| 435 |
ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned'); |
| 436 |
|
| 437 |
#Case 9: holdallowed holdgroup, hold_fulfillment_policy homebranch |
| 438 |
$dbh->do( |
| 439 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 440 |
{}, |
| 441 |
3, 'homebranch' |
| 442 |
); |
| 443 |
|
| 444 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 445 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 446 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 447 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 448 |
|
| 449 |
ok(scalar(@pl_1_1) == 1 && scalar(@pl_2_1) == 1 && scalar(@pl_2_4) == 1, 'Returns homebranch of items in biblio that are within patron\'s holdgroup, and that are pickup_locations'); |
| 450 |
ok(scalar(@pl_1_4) == 0, 'No pickup locations returned'); |
| 451 |
|
| 452 |
#Case 10: holdallowed any, hold_fulfillment_policy holdingbranch |
| 453 |
$dbh->do( |
| 454 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 455 |
{}, |
| 456 |
2, 'holdingbranch' |
| 457 |
); |
| 458 |
|
| 459 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 460 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 461 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 462 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 463 |
|
| 464 |
ok(scalar(@pl_1_1) == 2 && scalar(@pl_1_4) == 2 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 2, 'Returns holdingbranch of items in biblio, that are pickup_locations'); |
| 465 |
|
| 466 |
#Case 11: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'homebranch' |
| 467 |
$dbh->do( |
| 468 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 469 |
{}, |
| 470 |
1, 'holdingbranch' |
| 471 |
); |
| 472 |
|
| 473 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 474 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 475 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 476 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 477 |
|
| 478 |
ok(scalar(@pl_1_1) == 1 && scalar(@pl_2_4) == 1, 'Returns holdingbranch of items in biblio, whose homebranch equals patron\'s, and that are pickup_locations'); |
| 479 |
ok(scalar(@pl_1_4) == 0 && scalar(@pl_2_1) == 0, 'No pickup locations returned'); |
| 480 |
|
| 481 |
#Case 12: holdallowed holdgroup, hold_fulfillment_policy holdingbranch |
| 482 |
$dbh->do( |
| 483 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 484 |
{}, |
| 485 |
3, 'holdingbranch' |
| 486 |
); |
| 487 |
|
| 488 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 489 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 490 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 491 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 492 |
|
| 493 |
ok(scalar(@pl_1_1) == 1 && scalar(@pl_2_4) == 1 && scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 1, 'Returns holdingbranch of items in biblio, whose homebranch are within patron\'s holdgroup, and that are pickup_locations'); |
| 494 |
|
| 495 |
t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch'); |
| 496 |
|
| 497 |
#Case 13: holdallowed homebranch, hold_fulfillment_policy any, HomeOrHoldingBranch 'holdingbranch' |
| 498 |
$dbh->do( |
| 499 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 500 |
{}, |
| 501 |
1, 'any' |
| 502 |
); |
| 503 |
|
| 504 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 505 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 506 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 507 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 508 |
|
| 509 |
ok(scalar(@pl_1_4) == 5 && scalar(@pl_2_1) == 5 && scalar(@pl_2_4) == 5, 'Returns all libraries when item\'s holdingbranch equals patron\'s homebranch, and that are pickup_locations'); |
| 510 |
ok(scalar(@pl_1_1) == 0, 'No pickup locations returned'); |
| 511 |
|
| 512 |
#Case 14: holdallowed homebranch, hold_fulfillment_policy holdgroup, HomeOrHoldingBranch 'holdingbranch' |
| 513 |
$dbh->do( |
| 514 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 515 |
{}, |
| 516 |
1, 'holdgroup' |
| 517 |
); |
| 518 |
|
| 519 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 520 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 521 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 522 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 523 |
|
| 524 |
ok(scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 2 && scalar(@pl_2_4) == 1, 'Returns libraries in item\'s holdgroup whose holdingbranch equals patron\'s homebranch, and that are pickup_locations'); |
| 525 |
ok(scalar(@pl_1_1) == 0, 'No pickup locations returned'); |
| 526 |
|
| 527 |
#Case 15: holdallowed homebranch, hold_fulfillment_policy homebranch, HomeOrHoldingBranch 'holdingbranch' |
| 528 |
$dbh->do( |
| 529 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 530 |
{}, |
| 531 |
1, 'homebranch' |
| 532 |
); |
| 533 |
|
| 534 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 535 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 536 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 537 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 538 |
|
| 539 |
#ok(scalar(@pl_2_4) == 1 && $pl_2_4[0]->{branchcode} eq $library4->branchcode, 'Pickup location for patron 4 and item 3 renders item\'s holding branch'); |
| 540 |
ok(scalar(@pl_2_1) == 1 && scalar(@pl_2_4) == 1, 'Returns homebranch of items in biblio whose holdingbranch equals patron\'s homebranch, and that are pickup_locations'); |
| 541 |
ok(scalar(@pl_1_1) == 0 && scalar(@pl_1_4) == 0, 'No pickup locations returned'); |
| 542 |
|
| 543 |
#Case 16: holdallowed homebranch, hold_fulfillment_policy holdingbranch, HomeOrHoldingBranch 'holdingbranch' |
| 544 |
$dbh->do( |
| 545 |
q{UPDATE default_circ_rules set holdallowed = ?, hold_fulfillment_policy = ?}, |
| 546 |
{}, |
| 547 |
1, 'holdingbranch' |
| 548 |
); |
| 549 |
|
| 550 |
@pl_1_1 = $biblio1->pickup_locations( { patron => $patron1 } ); |
| 551 |
@pl_1_4 = $biblio1->pickup_locations( { patron => $patron4 } ); |
| 552 |
@pl_2_1 = $biblio2->pickup_locations( { patron => $patron1 } ); |
| 553 |
@pl_2_4 = $biblio2->pickup_locations( { patron => $patron4 } ); |
| 554 |
|
| 555 |
ok(scalar(@pl_1_4) == 1 && scalar(@pl_2_1) == 1 && scalar(@pl_2_4) == 1, 'Returns holdingbranch of items in biblio that equals patron\'s homebranch, and that are pickup_locations'); |
| 556 |
ok(scalar(@pl_1_1) == 0, 'No pickup locations returned'); |
| 557 |
|
| 558 |
$schema->storage->txn_rollback; |
| 559 |
}; |