|
Lines 68-74
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
Link Here
|
| 68 |
my $showallitems = $input->param('showallitems'); |
68 |
my $showallitems = $input->param('showallitems'); |
| 69 |
my $pickup = $input->param('pickup'); |
69 |
my $pickup = $input->param('pickup'); |
| 70 |
|
70 |
|
| 71 |
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; |
71 |
my $itemtypes = { |
|
|
72 |
map { |
| 73 |
$_->itemtype => |
| 74 |
{ %{ $_->unblessed }, image_location => $_->image_location } |
| 75 |
} Koha::ItemTypes->search_with_localization->as_list |
| 76 |
}; |
| 72 |
|
77 |
|
| 73 |
# Select borrowers infos |
78 |
# Select borrowers infos |
| 74 |
my $findborrower = $input->param('findborrower'); |
79 |
my $findborrower = $input->param('findborrower'); |
|
Lines 326-332
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 326 |
last; |
331 |
last; |
| 327 |
} |
332 |
} |
| 328 |
|
333 |
|
| 329 |
my $force_hold_level; |
|
|
| 330 |
if ( $patron ) { |
334 |
if ( $patron ) { |
| 331 |
{ # CanBookBeReserved |
335 |
{ # CanBookBeReserved |
| 332 |
my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); |
336 |
my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); |
|
Lines 370-378
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 370 |
found => undef, |
374 |
found => undef, |
| 371 |
} |
375 |
} |
| 372 |
); |
376 |
); |
| 373 |
$force_hold_level = $holds->forced_hold_level(); |
377 |
$template->param( force_hold_level => $holds->forced_hold_level() ); |
| 374 |
$biblioloopiter{force_hold_level} = $force_hold_level; |
|
|
| 375 |
$template->param( force_hold_level => $force_hold_level ); |
| 376 |
|
378 |
|
| 377 |
# For a librarian to be able to place multiple record holds for a patron for a record, |
379 |
# For a librarian to be able to place multiple record holds for a patron for a record, |
| 378 |
# we must find out what the maximum number of holds they can place for the patron is |
380 |
# we must find out what the maximum number of holds they can place for the patron is |
|
Lines 383-590
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 383 |
$template->param( remaining_holds_for_record => $remaining_holds_for_record ); |
385 |
$template->param( remaining_holds_for_record => $remaining_holds_for_record ); |
| 384 |
} |
386 |
} |
| 385 |
|
387 |
|
| 386 |
|
|
|
| 387 |
my $count = Koha::Holds->search( { biblionumber => $biblionumber } )->count(); |
| 388 |
my $totalcount = $count; |
| 389 |
|
| 390 |
# adding a fixed value for priority options |
388 |
# adding a fixed value for priority options |
| 391 |
my $fixedRank = $count+1; |
389 |
my $fixedRank = $biblio->holds->count + 1; |
| 392 |
|
390 |
|
| 393 |
my %itemnumbers_of_biblioitem; |
391 |
my @items = $biblio->items->as_list; |
| 394 |
|
392 |
|
| 395 |
my @hostitems = get_hostitemnumbers_of($biblionumber); |
393 |
my @host_items = $biblio->host_items->as_list; |
| 396 |
my @itemnumbers; |
394 |
if (@host_items) { |
| 397 |
if (@hostitems){ |
395 |
push @items, @host_items; |
| 398 |
push(@itemnumbers, @hostitems); |
|
|
| 399 |
} |
396 |
} |
| 400 |
|
397 |
|
| 401 |
my $items = Koha::Items->search({ -or => { biblionumber => $biblionumber, itemnumber => { in => \@itemnumbers } } }); |
398 |
unless ( @items ) { |
| 402 |
|
|
|
| 403 |
unless ( $items->count ) { |
| 404 |
# FIXME Then why do we continue? |
399 |
# FIXME Then why do we continue? |
| 405 |
$template->param('noitems' => 1) unless ( $multi_hold ); |
400 |
$template->param('noitems' => 1) unless ( $multi_hold ); |
| 406 |
$biblioloopiter{noitems} = 1; |
401 |
$biblioloopiter{noitems} = 1; |
| 407 |
} |
402 |
} |
| 408 |
|
403 |
|
| 409 |
## Here we go backwards again to create hash of biblioitemnumber to itemnumbers |
|
|
| 410 |
## this is important when we have analytic items which may be on another record |
| 411 |
my ( $iteminfos_of ); |
| 412 |
while ( my $item = $items->next ) { |
| 413 |
$item = $item->unblessed; |
| 414 |
my $biblioitemnumber = $item->{biblioitemnumber}; |
| 415 |
my $itemnumber = $item->{itemnumber}; |
| 416 |
push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber ); |
| 417 |
$iteminfos_of->{$itemnumber} = $item; |
| 418 |
} |
| 419 |
|
| 420 |
my @biblioitemnumbers = keys %itemnumbers_of_biblioitem; |
| 421 |
|
| 422 |
my $biblioiteminfos_of = { |
| 423 |
map { |
| 424 |
my $biblioitem = $_; |
| 425 |
( $biblioitem->{biblioitemnumber} => $biblioitem ) |
| 426 |
} @{ Koha::Biblioitems->search( |
| 427 |
{ biblioitemnumber => { -in => \@biblioitemnumbers } }, |
| 428 |
{ select => ['biblionumber', 'biblioitemnumber', 'publicationyear', 'itemtype']} |
| 429 |
)->unblessed |
| 430 |
} |
| 431 |
}; |
| 432 |
|
| 433 |
my @bibitemloop; |
| 434 |
|
| 435 |
my @available_itemtypes; |
404 |
my @available_itemtypes; |
| 436 |
foreach my $biblioitemnumber (@biblioitemnumbers) { |
405 |
my $num_available = 0; |
| 437 |
my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber}; |
406 |
my $num_override = 0; |
| 438 |
my $num_available = 0; |
407 |
my $hiddencount = 0; |
| 439 |
my $num_override = 0; |
408 |
my $num_alreadyheld = 0; |
| 440 |
my $hiddencount = 0; |
409 |
|
| 441 |
my $num_alreadyheld = 0; |
410 |
# iterating through all items first to check if any of them available |
| 442 |
|
411 |
# to pass this value further inside down to IsAvailableForItemLevelRequest to |
| 443 |
$biblioitem->{force_hold_level} = $force_hold_level; |
412 |
# it's complicated logic to analyse. |
| 444 |
|
413 |
# (before this loop was inside that sub loop so it was O(n^2) ) |
| 445 |
$biblioloopiter{description} = $biblioitem->{description}; |
414 |
my $items_any_available; |
| 446 |
$biblioloopiter{itypename} = $biblioitem->{description}; |
415 |
$items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblio->biblionumber, patron => $patron }) |
| 447 |
if ( $biblioitem->{itemtype} ) { |
416 |
if $patron; |
| 448 |
|
417 |
|
| 449 |
$biblioitem->{description} = |
418 |
for my $item_object ( @items ) { |
| 450 |
$itemtypes->{ $biblioitem->{itemtype} }{description}; |
419 |
my $do_check; |
| 451 |
|
420 |
my $item = $item_object->unblessed; |
| 452 |
$biblioloopiter{imageurl} = |
421 |
if ( $patron ) { |
| 453 |
getitemtypeimagelocation( 'intranet', |
422 |
$do_check = $patron->do_check_for_previous_checkout($item) if $wants_check; |
| 454 |
$itemtypes->{ $biblioitem->{itemtype} }{imageurl} ); |
423 |
if ( $do_check && $wants_check ) { |
| 455 |
} |
424 |
$item->{checked_previously} = $do_check; |
| 456 |
|
425 |
if ( $multi_hold ) { |
| 457 |
# iterating through all items first to check if any of them available |
426 |
$biblioloopiter{checked_previously} = $do_check; |
| 458 |
# to pass this value further inside down to IsAvailableForItemLevelRequest to |
427 |
} else { |
| 459 |
# it's complicated logic to analyse. |
428 |
$template->param( checked_previously => $do_check ); |
| 460 |
# (before this loop was inside that sub loop so it was O(n^2) ) |
|
|
| 461 |
my $items_any_available; |
| 462 |
$items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitem->{biblionumber}, patron => $patron }) |
| 463 |
if $patron; |
| 464 |
|
| 465 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
| 466 |
my $item = $iteminfos_of->{$itemnumber}; |
| 467 |
my $do_check; |
| 468 |
if ( $patron ) { |
| 469 |
$do_check = $patron->do_check_for_previous_checkout($item) if $wants_check; |
| 470 |
if ( $do_check && $wants_check ) { |
| 471 |
$item->{checked_previously} = $do_check; |
| 472 |
if ( $multi_hold ) { |
| 473 |
$biblioloopiter{checked_previously} = $do_check; |
| 474 |
} else { |
| 475 |
$template->param( checked_previously => $do_check ); |
| 476 |
} |
| 477 |
} |
429 |
} |
| 478 |
} |
430 |
} |
| 479 |
$item->{force_hold_level} = $force_hold_level; |
431 |
} |
| 480 |
|
|
|
| 481 |
unless (C4::Context->preference('item-level_itypes')) { |
| 482 |
$item->{itype} = $biblioitem->{itemtype}; |
| 483 |
} |
| 484 |
|
432 |
|
| 485 |
$item->{itypename} = $itemtypes->{ $item->{itype} }{description}; |
433 |
$item->{itemtype} = $itemtypes->{ $item_object->effective_itemtype }; |
| 486 |
$item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} ); |
|
|
| 487 |
$item->{homebranch} = $item->{homebranch}; |
| 488 |
|
434 |
|
| 489 |
# if the holdingbranch is different than the homebranch, we show the |
435 |
if($item->{biblionumber} ne $biblio->biblionumber){ |
| 490 |
# holdingbranch of the document too |
436 |
$item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title; |
| 491 |
if ( $item->{homebranch} ne $item->{holdingbranch} ) { |
437 |
} |
| 492 |
$item->{holdingbranch} = $item->{holdingbranch}; |
|
|
| 493 |
} |
| 494 |
|
438 |
|
| 495 |
if($item->{biblionumber} ne $biblionumber){ |
439 |
# if the item is currently on loan, we display its return date and |
| 496 |
$item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title; |
440 |
# change the background color |
| 497 |
} |
441 |
my $issue = $item_object->checkout; |
|
|
442 |
if ( $issue ) { # FIXME must be moved to the template |
| 443 |
$item->{date_due} = $issue->date_due; |
| 444 |
$item->{backgroundcolor} = 'onloan'; |
| 445 |
} |
| 498 |
|
446 |
|
| 499 |
# if the item is currently on loan, we display its return date and |
447 |
# checking reserve |
| 500 |
# change the background color |
448 |
my $holds = $item_object->current_holds; |
| 501 |
my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ); |
449 |
if ( my $first_hold = $holds->next ) { |
| 502 |
if ( $issue ) { |
450 |
my $p = Koha::Patrons->find( $first_hold->borrowernumber ); |
| 503 |
$item->{date_due} = $issue->date_due; |
|
|
| 504 |
$item->{backgroundcolor} = 'onloan'; |
| 505 |
} |
| 506 |
|
451 |
|
| 507 |
# checking reserve |
452 |
$item->{backgroundcolor} = 'reserved'; |
| 508 |
my $item_object = Koha::Items->find( $itemnumber ); |
453 |
$item->{reservedate} = output_pref({ dt => dt_from_string( $first_hold->reservedate ), dateonly => 1 }); # FIXME Should be formatted in the template |
| 509 |
my $holds = $item_object->current_holds; |
454 |
$item->{ReservedFor} = $p; |
| 510 |
if ( my $first_hold = $holds->next ) { |
455 |
$item->{ExpectedAtLibrary} = $first_hold->branchcode; |
| 511 |
my $p = Koha::Patrons->find( $first_hold->borrowernumber ); |
456 |
$item->{waitingdate} = $first_hold->waitingdate; |
| 512 |
|
457 |
} |
| 513 |
$item->{backgroundcolor} = 'reserved'; |
|
|
| 514 |
$item->{reservedate} = output_pref({ dt => dt_from_string( $first_hold->reservedate ), dateonly => 1 }); # FIXME Should be formatted in the template |
| 515 |
$item->{ReservedFor} = $p; |
| 516 |
$item->{ExpectedAtLibrary} = $first_hold->branchcode; |
| 517 |
$item->{waitingdate} = $first_hold->waitingdate; |
| 518 |
} |
| 519 |
|
458 |
|
| 520 |
# Management of the notforloan document |
459 |
# Management of the notforloan document |
| 521 |
if ( $item->{notforloan} ) { |
460 |
if ( $item->{notforloan} ) { |
| 522 |
$item->{backgroundcolor} = 'other'; |
461 |
$item->{backgroundcolor} = 'other'; |
| 523 |
} |
462 |
} |
| 524 |
|
463 |
|
| 525 |
# Management of lost or long overdue items |
464 |
# Management of lost or long overdue items |
| 526 |
if ( $item->{itemlost} ) { |
465 |
if ( $item->{itemlost} ) { |
| 527 |
$item->{backgroundcolor} = 'other'; |
466 |
$item->{backgroundcolor} = 'other'; |
| 528 |
if ($logged_in_patron->category->hidelostitems && !$showallitems) { |
467 |
if ($logged_in_patron->category->hidelostitems && !$showallitems) { |
| 529 |
$item->{hide} = 1; |
468 |
$item->{hide} = 1; |
| 530 |
$hiddencount++; |
469 |
$hiddencount++; |
| 531 |
} |
|
|
| 532 |
} |
470 |
} |
|
|
471 |
} |
| 533 |
|
472 |
|
| 534 |
# Check the transit status |
473 |
# Check the transit status |
| 535 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = |
474 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = |
| 536 |
GetTransfers($itemnumber); |
475 |
GetTransfers($item_object->itemnumber); # FIXME replace with get_transfer |
| 537 |
|
476 |
|
| 538 |
if ( defined $transfertwhen && $transfertwhen ne '' ) { |
477 |
if ( defined $transfertwhen && $transfertwhen ne '' ) { |
| 539 |
$item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 }); |
478 |
$item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 }); |
| 540 |
$item->{transfertfrom} = $transfertfrom; |
479 |
$item->{transfertfrom} = $transfertfrom; |
| 541 |
$item->{transfertto} = $transfertto; |
480 |
$item->{transfertto} = $transfertto; |
| 542 |
$item->{nocancel} = 1; |
481 |
$item->{nocancel} = 1; |
| 543 |
} |
482 |
} |
| 544 |
|
483 |
|
| 545 |
# If there is no loan, return and transfer, we show a checkbox. |
484 |
# If there is no loan, return and transfer, we show a checkbox. |
| 546 |
$item->{notforloan} ||= 0; |
485 |
$item->{notforloan} ||= 0; |
| 547 |
|
486 |
|
| 548 |
# if independent branches is on we need to check if the person can reserve |
487 |
# if independent branches is on we need to check if the person can reserve |
| 549 |
# for branches they arent logged in to |
488 |
# for branches they arent logged in to |
| 550 |
if ( C4::Context->preference("IndependentBranches") ) { |
489 |
if ( C4::Context->preference("IndependentBranches") ) { |
| 551 |
if (! C4::Context->preference("canreservefromotherbranches")){ |
490 |
if (! C4::Context->preference("canreservefromotherbranches")){ |
| 552 |
# can't reserve items so need to check if item homebranch and userenv branch match if not we can't reserve |
491 |
# can't reserve items so need to check if item homebranch and userenv branch match if not we can't reserve |
| 553 |
my $userenv = C4::Context->userenv; |
492 |
my $userenv = C4::Context->userenv; |
| 554 |
unless ( C4::Context->IsSuperLibrarian ) { |
493 |
unless ( C4::Context->IsSuperLibrarian ) { |
| 555 |
$item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} ); |
494 |
$item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} ); |
| 556 |
} |
|
|
| 557 |
} |
495 |
} |
| 558 |
} |
496 |
} |
|
|
497 |
} |
| 559 |
|
498 |
|
| 560 |
if ( $patron ) { |
499 |
if ( $patron ) { |
| 561 |
my $patron_unblessed = $patron->unblessed; |
500 |
my $patron_unblessed = $patron->unblessed; |
| 562 |
my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed); |
501 |
my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed); |
| 563 |
|
502 |
|
| 564 |
my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); |
503 |
my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); |
| 565 |
|
504 |
|
| 566 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
505 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
| 567 |
|
506 |
|
| 568 |
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; |
507 |
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $item_object->itemnumber )->{status}; |
| 569 |
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); |
508 |
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); |
| 570 |
|
509 |
|
| 571 |
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); |
510 |
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); |
| 572 |
|
511 |
|
| 573 |
if ( |
512 |
if ( |
| 574 |
!$item->{cantreserve} |
513 |
!$item->{cantreserve} |
| 575 |
&& !$exceeded_maxreserves |
514 |
&& !$exceeded_maxreserves |
| 576 |
&& $can_item_be_reserved eq 'OK' |
515 |
&& $can_item_be_reserved eq 'OK' |
| 577 |
# items_any_available defined outside of the current loop, |
516 |
# items_any_available defined outside of the current loop, |
| 578 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
517 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
| 579 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available) |
518 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available) |
| 580 |
) |
519 |
) |
| 581 |
{ |
520 |
{ |
|
|
521 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
| 522 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
| 523 |
$item->{pickup_locations_count} = $pickup_locations->count; |
| 524 |
if ( $item->{pickup_locations_count} > 0 ) { |
| 525 |
$num_available++; |
| 526 |
$item->{available} = 1; |
| 527 |
# pass the holding branch for use as default |
| 528 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
| 529 |
$item->{default_pickup_location} = $default_pickup_location; |
| 530 |
} |
| 531 |
else { |
| 532 |
$item->{available} = 0; |
| 533 |
$item->{not_holdable} = "no_valid_pickup_location"; |
| 534 |
} |
| 535 |
|
| 536 |
push( @available_itemtypes, $item->{itype} ); |
| 537 |
} |
| 538 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
| 539 |
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules |
| 540 |
# with the exception of itemAlreadyOnHold because, you know, the item is already on hold |
| 541 |
if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { |
| 582 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
542 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
| 583 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
543 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
| 584 |
$item->{pickup_locations_count} = $pickup_locations->count; |
544 |
$item->{pickup_locations_count} = $pickup_locations->count; |
| 585 |
if ( $item->{pickup_locations_count} > 0 ) { |
545 |
if ( $item->{pickup_locations_count} > 0 ) { |
| 586 |
$num_available++; |
546 |
$item->{override} = 1; |
| 587 |
$item->{available} = 1; |
547 |
$num_override++; |
| 588 |
# pass the holding branch for use as default |
548 |
# pass the holding branch for use as default |
| 589 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
549 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
| 590 |
$item->{default_pickup_location} = $default_pickup_location; |
550 |
$item->{default_pickup_location} = $default_pickup_location; |
|
Lines 593-653
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 593 |
$item->{available} = 0; |
553 |
$item->{available} = 0; |
| 594 |
$item->{not_holdable} = "no_valid_pickup_location"; |
554 |
$item->{not_holdable} = "no_valid_pickup_location"; |
| 595 |
} |
555 |
} |
|
|
556 |
} else { $num_alreadyheld++ } |
| 596 |
|
557 |
|
| 597 |
push( @available_itemtypes, $item->{itype} ); |
558 |
push( @available_itemtypes, $item->{itype} ); |
| 598 |
} |
559 |
} |
| 599 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
|
|
| 600 |
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules |
| 601 |
# with the exception of itemAlreadyOnHold because, you know, the item is already on hold |
| 602 |
if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { |
| 603 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
| 604 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
| 605 |
$item->{pickup_locations_count} = $pickup_locations->count; |
| 606 |
if ( $item->{pickup_locations_count} > 0 ) { |
| 607 |
$item->{override} = 1; |
| 608 |
$num_override++; |
| 609 |
# pass the holding branch for use as default |
| 610 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
| 611 |
$item->{default_pickup_location} = $default_pickup_location; |
| 612 |
} |
| 613 |
else { |
| 614 |
$item->{available} = 0; |
| 615 |
$item->{not_holdable} = "no_valid_pickup_location"; |
| 616 |
} |
| 617 |
} else { $num_alreadyheld++ } |
| 618 |
|
| 619 |
push( @available_itemtypes, $item->{itype} ); |
| 620 |
} |
| 621 |
|
560 |
|
| 622 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
561 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
| 623 |
|
562 |
|
| 624 |
# Show serial enumeration when needed |
563 |
# Show serial enumeration when needed |
| 625 |
if ($item->{enumchron}) { |
564 |
if ($item->{enumchron}) { |
| 626 |
$itemdata_enumchron = 1; |
565 |
$itemdata_enumchron = 1; |
| 627 |
} |
566 |
} |
| 628 |
# Show collection when needed |
567 |
# Show collection when needed |
| 629 |
if ($item->{ccode}) { |
568 |
if ($item->{ccode}) { |
| 630 |
$itemdata_ccode = 1; |
569 |
$itemdata_ccode = 1; |
| 631 |
} |
|
|
| 632 |
} |
570 |
} |
| 633 |
|
|
|
| 634 |
push @{ $biblioitem->{itemloop} }, $item; |
| 635 |
} |
571 |
} |
| 636 |
|
572 |
|
| 637 |
# While we can't override an alreay held item, we should be able to override the others |
573 |
push @{ $biblioloopiter{itemloop} }, $item; |
| 638 |
# Unless all items are already held |
574 |
} |
| 639 |
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) { |
|
|
| 640 |
# That is, if all items require an override |
| 641 |
$template->param( override_required => 1 ); |
| 642 |
} elsif ( $num_available == 0 ) { |
| 643 |
$template->param( none_available => 1 ); |
| 644 |
$biblioloopiter{warn} = 1; |
| 645 |
$biblioloopiter{none_avail} = 1; |
| 646 |
} |
| 647 |
$template->param( hiddencount => $hiddencount); |
| 648 |
|
575 |
|
| 649 |
push @bibitemloop, $biblioitem; |
576 |
$biblioloopiter{biblioitem} = $biblio->biblioitem; |
|
|
577 |
|
| 578 |
# While we can't override an alreay held item, we should be able to override the others |
| 579 |
# Unless all items are already held |
| 580 |
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioloopiter{itemloop} } ) ) { |
| 581 |
# That is, if all items require an override |
| 582 |
$template->param( override_required => 1 ); |
| 583 |
} elsif ( $num_available == 0 ) { |
| 584 |
$template->param( none_available => 1 ); |
| 585 |
$biblioloopiter{warn} = 1; |
| 586 |
$biblioloopiter{none_avail} = 1; |
| 650 |
} |
587 |
} |
|
|
588 |
$template->param( hiddencount => $hiddencount); |
| 651 |
|
589 |
|
| 652 |
@available_itemtypes = uniq( @available_itemtypes ); |
590 |
@available_itemtypes = uniq( @available_itemtypes ); |
| 653 |
$template->param( available_itemtypes => \@available_itemtypes ); |
591 |
$template->param( available_itemtypes => \@available_itemtypes ); |
|
Lines 717-723
foreach my $biblionumber (@biblionumbers) {
Link Here
|
| 717 |
|
655 |
|
| 718 |
# display infos |
656 |
# display infos |
| 719 |
$template->param( |
657 |
$template->param( |
| 720 |
bibitemloop => \@bibitemloop, |
|
|
| 721 |
itemdata_enumchron => $itemdata_enumchron, |
658 |
itemdata_enumchron => $itemdata_enumchron, |
| 722 |
itemdata_ccode => $itemdata_ccode, |
659 |
itemdata_ccode => $itemdata_ccode, |
| 723 |
date => $date, |
660 |
date => $date, |
|
Lines 764-769
if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
Link Here
|
| 764 |
$template->param( |
701 |
$template->param( |
| 765 |
SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), |
702 |
SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), |
| 766 |
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), |
703 |
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), |
|
|
704 |
borrowernumber => $borrowernumber_hold, |
| 767 |
); |
705 |
); |
| 768 |
|
706 |
|
| 769 |
# printout the page |
707 |
# printout the page |
| 770 |
- |
|
|