Lines 307-312
if ($patron) {
Link Here
|
307 |
my $itemdata_enumchron = 0; |
307 |
my $itemdata_enumchron = 0; |
308 |
my $itemdata_ccode = 0; |
308 |
my $itemdata_ccode = 0; |
309 |
my @biblioloop = (); |
309 |
my @biblioloop = (); |
|
|
310 |
my $reserveloop = 0; |
310 |
my $no_reserves_allowed = 0; |
311 |
my $no_reserves_allowed = 0; |
311 |
foreach my $biblionumber (@biblionumbers) { |
312 |
foreach my $biblionumber (@biblionumbers) { |
312 |
next unless $biblionumber =~ m|^\d+$|; |
313 |
next unless $biblionumber =~ m|^\d+$|; |
Lines 320-383
foreach my $biblionumber (@biblionumbers) {
Link Here
|
320 |
last; |
321 |
last; |
321 |
} |
322 |
} |
322 |
|
323 |
|
323 |
my $force_hold_level; |
|
|
324 |
if ( $patron ) { |
325 |
{ # CanBookBeReserved |
326 |
my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); |
327 |
if ( $canReserve->{status} eq 'OK' ) { |
328 |
|
329 |
#All is OK and we can continue |
330 |
} |
331 |
elsif ( $canReserve->{status} eq 'noReservesAllowed' || $canReserve->{status} eq 'notReservable' ) { |
332 |
$no_reserves_allowed = 1; |
333 |
} |
334 |
elsif ( $canReserve->{status} eq 'tooManyReserves' ) { |
335 |
$exceeded_maxreserves = 1; |
336 |
$template->param( maxreserves => $canReserve->{limit} ); |
337 |
} |
338 |
elsif ( $canReserve->{status} eq 'tooManyHoldsForThisRecord' ) { |
339 |
$exceeded_holds_per_record = 1; |
340 |
$biblioloopiter{ $canReserve->{status} } = 1; |
341 |
} |
342 |
elsif ( $canReserve->{status} eq 'ageRestricted' ) { |
343 |
$template->param( $canReserve->{status} => 1 ); |
344 |
$biblioloopiter{ $canReserve->{status} } = 1; |
345 |
} |
346 |
elsif ( $canReserve->{status} eq 'alreadypossession' ) { |
347 |
$template->param( $canReserve->{status} => 1); |
348 |
$biblioloopiter{ $canReserve->{status} } = 1; |
349 |
} |
350 |
else { |
351 |
$biblioloopiter{ $canReserve->{status} } = 1; |
352 |
} |
353 |
} |
354 |
|
355 |
# For multiple holds per record, if a patron has previously placed a hold, |
356 |
# the patron can only place more holds of the same type. That is, if the |
357 |
# patron placed a record level hold, all the holds the patron places must |
358 |
# be record level. If the patron placed an item level hold, all holds |
359 |
# the patron places must be item level |
360 |
my $holds = Koha::Holds->search( |
361 |
{ |
362 |
borrowernumber => $patron->borrowernumber, |
363 |
biblionumber => $biblionumber, |
364 |
found => undef, |
365 |
} |
366 |
); |
367 |
$force_hold_level = $holds->forced_hold_level(); |
368 |
$biblioloopiter{force_hold_level} = $force_hold_level; |
369 |
$template->param( force_hold_level => $force_hold_level ); |
370 |
|
371 |
# For a librarian to be able to place multiple record holds for a patron for a record, |
372 |
# we must find out what the maximum number of holds they can place for the patron is |
373 |
my $max_holds_for_record = GetMaxPatronHoldsForRecord( $patron->borrowernumber, $biblionumber ); |
374 |
my $remaining_holds_for_record = $max_holds_for_record - $holds->count(); |
375 |
$biblioloopiter{remaining_holds_for_record} = $max_holds_for_record; |
376 |
$template->param( max_holds_for_record => $max_holds_for_record ); |
377 |
$template->param( remaining_holds_for_record => $remaining_holds_for_record ); |
378 |
} |
379 |
|
380 |
|
381 |
my $count = Koha::Holds->search( { biblionumber => $biblionumber } )->count(); |
324 |
my $count = Koha::Holds->search( { biblionumber => $biblionumber } )->count(); |
382 |
my $totalcount = $count; |
325 |
my $totalcount = $count; |
383 |
|
326 |
|
Lines 401-406
foreach my $biblionumber (@biblionumbers) {
Link Here
|
401 |
$biblioloopiter{noitems} = 1; |
344 |
$biblioloopiter{noitems} = 1; |
402 |
} |
345 |
} |
403 |
|
346 |
|
|
|
347 |
$biblioloopiter{biblionumber} = $biblionumber; |
348 |
$biblioloopiter{title} = $biblio->title; |
349 |
$biblioloopiter{rank} = $fixedRank; |
350 |
|
351 |
# get the time for the form name... |
352 |
my $time = time(); |
353 |
|
354 |
$template->param( |
355 |
time => $time, |
356 |
fixedRank => $fixedRank, |
357 |
); |
358 |
|
359 |
unless( $patron ){ |
360 |
|
361 |
# existingreserves building |
362 |
my @reserveloop; |
363 |
my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); |
364 |
foreach my $res ( |
365 |
sort { |
366 |
my $a_found = $a->found() || ''; |
367 |
my $b_found = $a->found() || ''; |
368 |
$a_found cmp $b_found; |
369 |
} @reserves |
370 |
) |
371 |
{ |
372 |
my %reserve; |
373 |
if ( $res->is_found() ) { |
374 |
$reserve{'holdingbranch'} = $res->item()->holdingbranch(); |
375 |
$reserve{'biblionumber'} = $res->item()->biblionumber(); |
376 |
$reserve{'barcodenumber'} = $res->item()->barcode(); |
377 |
$reserve{'wbrcode'} = $res->branchcode(); |
378 |
$reserve{'itemnumber'} = $res->itemnumber(); |
379 |
$reserve{'wbrname'} = $res->branch()->branchname(); |
380 |
$reserve{'atdestination'} = $res->is_at_destination(); |
381 |
$reserve{'desk_name'} = ( $res->desk() ) ? $res->desk()->desk_name() : '' ; |
382 |
$reserve{'found'} = $res->is_found(); |
383 |
$reserve{'inprocessing'} = $res->is_in_processing(); |
384 |
$reserve{'intransit'} = $res->is_in_transit(); |
385 |
} |
386 |
elsif ( $res->priority() > 0 ) { |
387 |
if ( my $item = $res->item() ) { |
388 |
$reserve{'itemnumber'} = $item->id(); |
389 |
$reserve{'barcodenumber'} = $item->barcode(); |
390 |
$reserve{'item_level_hold'} = 1; |
391 |
} |
392 |
} |
393 |
|
394 |
$reserve{'expirationdate'} = $res->expirationdate; |
395 |
$reserve{'date'} = $res->reservedate; |
396 |
$reserve{'borrowernumber'} = $res->borrowernumber(); |
397 |
$reserve{'biblionumber'} = $res->biblionumber(); |
398 |
$reserve{'patron'} = $res->borrower; |
399 |
$reserve{'notes'} = $res->reservenotes(); |
400 |
$reserve{'waiting_date'} = $res->waitingdate(); |
401 |
$reserve{'ccode'} = $res->item() ? $res->item()->ccode() : undef; |
402 |
$reserve{'barcode'} = $res->item() ? $res->item()->barcode() : undef; |
403 |
$reserve{'priority'} = $res->priority(); |
404 |
$reserve{'lowestPriority'} = $res->lowestPriority(); |
405 |
$reserve{'suspend'} = $res->suspend(); |
406 |
$reserve{'suspend_until'} = $res->suspend_until(); |
407 |
$reserve{'reserve_id'} = $res->reserve_id(); |
408 |
$reserve{itemtype} = $res->itemtype(); |
409 |
$reserve{branchcode} = $res->branchcode(); |
410 |
$reserve{non_priority} = $res->non_priority(); |
411 |
$reserve{object} = $res; |
412 |
|
413 |
push( @reserveloop, \%reserve ); |
414 |
} |
415 |
|
416 |
$biblioloopiter{reserveloop} = \@reserveloop; |
417 |
$reserveloop = 1 if (@reserveloop); |
418 |
|
419 |
push @biblioloop, \%biblioloopiter; |
420 |
next; |
421 |
} |
422 |
|
423 |
my $force_hold_level; |
424 |
my $items_any_available; |
425 |
|
426 |
{ # CanBookBeReserved |
427 |
my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); |
428 |
if ( $canReserve->{status} eq 'OK' ) { |
429 |
|
430 |
#All is OK and we can continue |
431 |
} |
432 |
elsif ( $canReserve->{status} eq 'noReservesAllowed' || $canReserve->{status} eq 'notReservable' ) { |
433 |
$no_reserves_allowed = 1; |
434 |
} |
435 |
elsif ( $canReserve->{status} eq 'tooManyReserves' ) { |
436 |
$exceeded_maxreserves = 1; |
437 |
$template->param( maxreserves => $canReserve->{limit} ); |
438 |
} |
439 |
elsif ( $canReserve->{status} eq 'tooManyHoldsForThisRecord' ) { |
440 |
$exceeded_holds_per_record = 1; |
441 |
$biblioloopiter{ $canReserve->{status} } = 1; |
442 |
} |
443 |
elsif ( $canReserve->{status} eq 'ageRestricted' ) { |
444 |
$template->param( $canReserve->{status} => 1 ); |
445 |
$biblioloopiter{ $canReserve->{status} } = 1; |
446 |
} |
447 |
elsif ( $canReserve->{status} eq 'alreadypossession' ) { |
448 |
$template->param( $canReserve->{status} => 1); |
449 |
$biblioloopiter{ $canReserve->{status} } = 1; |
450 |
} |
451 |
else { |
452 |
$biblioloopiter{ $canReserve->{status} } = 1; |
453 |
} |
454 |
} |
455 |
|
456 |
# Add the valid pickup locations |
457 |
my @pickup_locations = $biblio->pickup_locations({ patron => $patron }); |
458 |
$biblioloopiter{pickup_locations} = \@pickup_locations; |
459 |
$biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ]; |
460 |
|
461 |
# For multiple holds per record, if a patron has previously placed a hold, |
462 |
# the patron can only place more holds of the same type. That is, if the |
463 |
# patron placed a record level hold, all the holds the patron places must |
464 |
# be record level. If the patron placed an item level hold, all holds |
465 |
# the patron places must be item level |
466 |
my $holds = Koha::Holds->search( |
467 |
{ |
468 |
borrowernumber => $patron->borrowernumber, |
469 |
biblionumber => $biblionumber, |
470 |
found => undef, |
471 |
} |
472 |
); |
473 |
$force_hold_level = $holds->forced_hold_level(); |
474 |
$biblioloopiter{force_hold_level} = $force_hold_level; |
475 |
$template->param( force_hold_level => $force_hold_level ); |
476 |
|
477 |
# For a librarian to be able to place multiple record holds for a patron for a record, |
478 |
# we must find out what the maximum number of holds they can place for the patron is |
479 |
my $max_holds_for_record = GetMaxPatronHoldsForRecord( $patron->borrowernumber, $biblionumber ); |
480 |
my $remaining_holds_for_record = $max_holds_for_record - $holds->count(); |
481 |
$biblioloopiter{remaining_holds_for_record} = $max_holds_for_record; |
482 |
$template->param( max_holds_for_record => $max_holds_for_record ); |
483 |
$template->param( remaining_holds_for_record => $remaining_holds_for_record ); |
484 |
|
485 |
my @bibitemloop; |
486 |
|
404 |
## Here we go backwards again to create hash of biblioitemnumber to itemnumbers |
487 |
## Here we go backwards again to create hash of biblioitemnumber to itemnumbers |
405 |
## this is important when we have analytic items which may be on another record |
488 |
## this is important when we have analytic items which may be on another record |
406 |
my ( $iteminfos_of ); |
489 |
my ( $iteminfos_of ); |
Lines 425-431
foreach my $biblionumber (@biblionumbers) {
Link Here
|
425 |
} |
508 |
} |
426 |
}; |
509 |
}; |
427 |
|
510 |
|
428 |
my @bibitemloop; |
511 |
|
429 |
|
512 |
|
430 |
my @available_itemtypes; |
513 |
my @available_itemtypes; |
431 |
foreach my $biblioitemnumber (@biblioitemnumbers) { |
514 |
foreach my $biblioitemnumber (@biblioitemnumbers) { |
Lines 457-465
foreach my $biblionumber (@biblionumbers) {
Link Here
|
457 |
# to pass this value further inside down to IsAvailableForItemLevelRequest to |
540 |
# to pass this value further inside down to IsAvailableForItemLevelRequest to |
458 |
# it's complicated logic to analyse. |
541 |
# it's complicated logic to analyse. |
459 |
# (before this loop was inside that sub loop so it was O(n^2) ) |
542 |
# (before this loop was inside that sub loop so it was O(n^2) ) |
460 |
my $items_any_available; |
543 |
$items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitem->{biblionumber}, patron => $patron }); |
461 |
$items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitem->{biblionumber}, patron => $patron }) |
|
|
462 |
if $patron; |
463 |
|
544 |
|
464 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
545 |
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { |
465 |
my $item = $iteminfos_of->{$itemnumber}; |
546 |
my $item = $iteminfos_of->{$itemnumber}; |
Lines 557-584
foreach my $biblionumber (@biblionumbers) {
Link Here
|
557 |
} |
638 |
} |
558 |
} |
639 |
} |
559 |
|
640 |
|
560 |
if ( $patron ) { |
641 |
my $patron_unblessed = $patron->unblessed; |
561 |
my $patron_unblessed = $patron->unblessed; |
642 |
my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed); |
562 |
my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed); |
|
|
563 |
|
643 |
|
564 |
my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); |
644 |
my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); |
565 |
|
645 |
|
566 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
646 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
567 |
|
647 |
|
568 |
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; |
648 |
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; |
569 |
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); |
649 |
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); |
570 |
|
650 |
|
571 |
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); |
651 |
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); |
572 |
|
652 |
|
573 |
if ( |
653 |
if ( |
574 |
!$item->{cantreserve} |
654 |
!$item->{cantreserve} |
575 |
&& !$exceeded_maxreserves |
655 |
&& !$exceeded_maxreserves |
576 |
&& $can_item_be_reserved eq 'OK' |
656 |
&& $can_item_be_reserved eq 'OK' |
577 |
# items_any_available defined outside of the current loop, |
657 |
# items_any_available defined outside of the current loop, |
578 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
658 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
579 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available) |
659 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available) |
580 |
) |
660 |
) |
581 |
{ |
661 |
{ |
|
|
662 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
663 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
664 |
$item->{pickup_locations_count} = $pickup_locations->count; |
665 |
if ( $item->{pickup_locations_count} > 0 ) { |
666 |
$num_available++; |
667 |
$item->{available} = 1; |
668 |
# pass the holding branch for use as default |
669 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
670 |
$item->{default_pickup_location} = $default_pickup_location; |
671 |
} |
672 |
else { |
673 |
$item->{available} = 0; |
674 |
$item->{not_holdable} = "no_valid_pickup_location"; |
675 |
} |
676 |
|
677 |
push( @available_itemtypes, $item->{itype} ); |
678 |
} |
679 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
680 |
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules |
681 |
# with the exception of itemAlreadyOnHold because, you know, the item is already on hold |
682 |
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 |
683 |
# 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 })->as_list; |
684 |
my @pickup_locations = $item_object->pickup_locations({ patron => $patron })->as_list; |
584 |
$item->{pickup_locations_count} = scalar @pickup_locations; |
685 |
$item->{pickup_locations_count} = scalar @pickup_locations; |
Lines 600-647
foreach my $biblionumber (@biblionumbers) {
Link Here
|
600 |
$item->{available} = 0; |
701 |
$item->{available} = 0; |
601 |
$item->{not_holdable} = "no_valid_pickup_location"; |
702 |
$item->{not_holdable} = "no_valid_pickup_location"; |
602 |
} |
703 |
} |
|
|
704 |
} else { $num_alreadyheld++ } |
603 |
|
705 |
|
604 |
push( @available_itemtypes, $item->{itype} ); |
706 |
push( @available_itemtypes, $item->{itype} ); |
605 |
} |
707 |
} |
606 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
|
|
607 |
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules |
608 |
# with the exception of itemAlreadyOnHold because, you know, the item is already on hold |
609 |
if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { |
610 |
# Send the pickup locations count to the UI, the pickup locations will be pulled using the API |
611 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
612 |
$item->{pickup_locations_count} = $pickup_locations->count; |
613 |
if ( $item->{pickup_locations_count} > 0 ) { |
614 |
$item->{override} = 1; |
615 |
$num_override++; |
616 |
# pass the holding branch for use as default |
617 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
618 |
$item->{default_pickup_location} = $default_pickup_location; |
619 |
} |
620 |
else { |
621 |
$item->{available} = 0; |
622 |
$item->{not_holdable} = "no_valid_pickup_location"; |
623 |
} |
624 |
} else { $num_alreadyheld++ } |
625 |
|
626 |
push( @available_itemtypes, $item->{itype} ); |
627 |
} |
628 |
|
708 |
|
629 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
709 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
630 |
|
710 |
|
631 |
# Show serial enumeration when needed |
711 |
# Show serial enumeration when needed |
632 |
if ($item->{enumchron}) { |
712 |
if ($item->{enumchron}) { |
633 |
$itemdata_enumchron = 1; |
713 |
$itemdata_enumchron = 1; |
634 |
} |
714 |
} |
635 |
# Show collection when needed |
715 |
# Show collection when needed |
636 |
if ($item->{ccode}) { |
716 |
if ($item->{ccode}) { |
637 |
$itemdata_ccode = 1; |
717 |
$itemdata_ccode = 1; |
638 |
} |
|
|
639 |
} |
718 |
} |
640 |
|
719 |
|
641 |
push @{ $biblioitem->{itemloop} }, $item; |
720 |
push @{ $biblioitem->{itemloop} }, $item; |
642 |
} |
721 |
} |
643 |
|
722 |
|
644 |
# While we can't override an alreay held item, we should be able to override the others |
723 |
# While we can't override an already held item, we should be able to override the others |
645 |
# Unless all items are already held |
724 |
# Unless all items are already held |
646 |
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) { |
725 |
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) { |
647 |
# That is, if all items require an override |
726 |
# That is, if all items require an override |
Lines 658-759
foreach my $biblionumber (@biblionumbers) {
Link Here
|
658 |
|
737 |
|
659 |
@available_itemtypes = uniq( @available_itemtypes ); |
738 |
@available_itemtypes = uniq( @available_itemtypes ); |
660 |
$template->param( available_itemtypes => \@available_itemtypes ); |
739 |
$template->param( available_itemtypes => \@available_itemtypes ); |
|
|
740 |
$template->param(bibitemloop => \@bibitemloop); |
661 |
|
741 |
|
662 |
# existingreserves building |
|
|
663 |
my @reserveloop; |
664 |
my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); |
665 |
foreach my $res ( |
666 |
sort { |
667 |
my $a_found = $a->found() || ''; |
668 |
my $b_found = $a->found() || ''; |
669 |
$a_found cmp $b_found; |
670 |
} @reserves |
671 |
) |
672 |
{ |
673 |
my %reserve; |
674 |
if ( $res->is_found() ) { |
675 |
$reserve{'holdingbranch'} = $res->item()->holdingbranch(); |
676 |
$reserve{'biblionumber'} = $res->item()->biblionumber(); |
677 |
$reserve{'barcodenumber'} = $res->item()->barcode(); |
678 |
$reserve{'wbrcode'} = $res->branchcode(); |
679 |
$reserve{'itemnumber'} = $res->itemnumber(); |
680 |
$reserve{'wbrname'} = $res->branch()->branchname(); |
681 |
$reserve{'atdestination'} = $res->is_at_destination(); |
682 |
$reserve{'desk_name'} = ( $res->desk() ) ? $res->desk()->desk_name() : '' ; |
683 |
$reserve{'found'} = $res->is_found(); |
684 |
$reserve{'inprocessing'} = $res->is_in_processing(); |
685 |
$reserve{'intransit'} = $res->is_in_transit(); |
686 |
} |
687 |
elsif ( $res->priority() > 0 ) { |
688 |
if ( my $item = $res->item() ) { |
689 |
$reserve{'itemnumber'} = $item->id(); |
690 |
$reserve{'barcodenumber'} = $item->barcode(); |
691 |
$reserve{'item_level_hold'} = 1; |
692 |
} |
693 |
} |
694 |
|
695 |
$reserve{'expirationdate'} = $res->expirationdate; |
696 |
$reserve{'date'} = $res->reservedate; |
697 |
$reserve{'borrowernumber'} = $res->borrowernumber(); |
698 |
$reserve{'biblionumber'} = $res->biblionumber(); |
699 |
$reserve{'patron'} = $res->borrower; |
700 |
$reserve{'notes'} = $res->reservenotes(); |
701 |
$reserve{'waiting_date'} = $res->waitingdate(); |
702 |
$reserve{'ccode'} = $res->item() ? $res->item()->ccode() : undef; |
703 |
$reserve{'barcode'} = $res->item() ? $res->item()->barcode() : undef; |
704 |
$reserve{'priority'} = $res->priority(); |
705 |
$reserve{'lowestPriority'} = $res->lowestPriority(); |
706 |
$reserve{'suspend'} = $res->suspend(); |
707 |
$reserve{'suspend_until'} = $res->suspend_until(); |
708 |
$reserve{'reserve_id'} = $res->reserve_id(); |
709 |
$reserve{itemtype} = $res->itemtype(); |
710 |
$reserve{branchcode} = $res->branchcode(); |
711 |
$reserve{non_priority} = $res->non_priority(); |
712 |
$reserve{object} = $res; |
713 |
|
714 |
push( @reserveloop, \%reserve ); |
715 |
} |
716 |
|
717 |
# get the time for the form name... |
718 |
my $time = time(); |
719 |
|
720 |
$template->param( |
721 |
time => $time, |
722 |
fixedRank => $fixedRank, |
723 |
); |
724 |
|
725 |
# display infos |
726 |
$template->param( |
727 |
bibitemloop => \@bibitemloop, |
728 |
itemdata_enumchron => $itemdata_enumchron, |
729 |
itemdata_ccode => $itemdata_ccode, |
730 |
date => $date, |
731 |
biblionumber => $biblionumber, |
732 |
findborrower => $findborrower, |
733 |
biblio => $biblio, |
734 |
holdsview => 1, |
735 |
C4::Search::enabled_staff_search_views, |
736 |
); |
737 |
|
738 |
$biblioloopiter{biblionumber} = $biblionumber; |
739 |
$biblioloopiter{title} = $biblio->title; |
740 |
$biblioloopiter{rank} = $fixedRank; |
741 |
$biblioloopiter{reserveloop} = \@reserveloop; |
742 |
|
743 |
if (@reserveloop) { |
744 |
$template->param( reserveloop => \@reserveloop ); |
745 |
} |
746 |
|
747 |
if ( $patron ) { |
748 |
# Add the valid pickup locations |
749 |
my @pickup_locations = $biblio->pickup_locations({ patron => $patron }); |
750 |
$biblioloopiter{pickup_locations} = \@pickup_locations; |
751 |
$biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ]; |
752 |
} |
753 |
|
742 |
|
754 |
push @biblioloop, \%biblioloopiter; |
743 |
push @biblioloop, \%biblioloopiter; |
755 |
} |
744 |
} |
756 |
|
745 |
|
|
|
746 |
# display infos |
747 |
$template->param( |
748 |
reserveloop => 1, |
749 |
itemdata_enumchron => $itemdata_enumchron, |
750 |
itemdata_ccode => $itemdata_ccode, |
751 |
date => $date, |
752 |
biblionumber => $biblionumber, |
753 |
findborrower => $findborrower, |
754 |
holdsview => 1, |
755 |
C4::Search::enabled_staff_search_views, |
756 |
); |
757 |
|
757 |
$template->param( biblioloop => \@biblioloop ); |
758 |
$template->param( biblioloop => \@biblioloop ); |
758 |
$template->param( no_reserves_allowed => $no_reserves_allowed ); |
759 |
$template->param( no_reserves_allowed => $no_reserves_allowed ); |
759 |
$template->param( biblionumbers => join('/', @biblionumbers) ); |
760 |
$template->param( biblionumbers => join('/', @biblionumbers) ); |
760 |
- |
|
|