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