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-590
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); |
643 |
|
|
|
644 |
my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); |
563 |
|
645 |
|
564 |
my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); |
646 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
565 |
|
647 |
|
566 |
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; |
648 |
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; |
|
|
649 |
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); |
567 |
|
650 |
|
568 |
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; |
651 |
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); |
569 |
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); |
|
|
570 |
|
652 |
|
571 |
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); |
653 |
if ( |
|
|
654 |
!$item->{cantreserve} |
655 |
&& !$exceeded_maxreserves |
656 |
&& $can_item_be_reserved eq 'OK' |
657 |
# items_any_available defined outside of the current loop, |
658 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
659 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available) |
660 |
) |
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 |
} |
572 |
|
676 |
|
573 |
if ( |
677 |
push( @available_itemtypes, $item->{itype} ); |
574 |
!$item->{cantreserve} |
678 |
} |
575 |
&& !$exceeded_maxreserves |
679 |
elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
576 |
&& $can_item_be_reserved eq 'OK' |
680 |
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules |
577 |
# items_any_available defined outside of the current loop, |
681 |
# with the exception of itemAlreadyOnHold because, you know, the item is already on hold |
578 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
682 |
if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { |
579 |
&& IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available) |
|
|
580 |
) |
581 |
{ |
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 }); |
684 |
my $pickup_locations = $item_object->pickup_locations({ patron => $patron }); |
584 |
$item->{pickup_locations_count} = $pickup_locations->count; |
685 |
$item->{pickup_locations_count} = $pickup_locations->count; |
585 |
if ( $item->{pickup_locations_count} > 0 ) { |
686 |
if ( $item->{pickup_locations_count} > 0 ) { |
586 |
$num_available++; |
687 |
$item->{override} = 1; |
587 |
$item->{available} = 1; |
688 |
$num_override++; |
588 |
# pass the holding branch for use as default |
689 |
# pass the holding branch for use as default |
589 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
690 |
my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; |
590 |
$item->{default_pickup_location} = $default_pickup_location; |
691 |
$item->{default_pickup_location} = $default_pickup_location; |
Lines 593-640
foreach my $biblionumber (@biblionumbers) {
Link Here
|
593 |
$item->{available} = 0; |
694 |
$item->{available} = 0; |
594 |
$item->{not_holdable} = "no_valid_pickup_location"; |
695 |
$item->{not_holdable} = "no_valid_pickup_location"; |
595 |
} |
696 |
} |
|
|
697 |
} else { $num_alreadyheld++ } |
596 |
|
698 |
|
597 |
push( @available_itemtypes, $item->{itype} ); |
699 |
push( @available_itemtypes, $item->{itype} ); |
598 |
} |
700 |
} |
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 |
|
701 |
|
622 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
702 |
# If none of the conditions hold true, then neither override nor available is set and the item cannot be checked |
623 |
|
703 |
|
624 |
# Show serial enumeration when needed |
704 |
# Show serial enumeration when needed |
625 |
if ($item->{enumchron}) { |
705 |
if ($item->{enumchron}) { |
626 |
$itemdata_enumchron = 1; |
706 |
$itemdata_enumchron = 1; |
627 |
} |
707 |
} |
628 |
# Show collection when needed |
708 |
# Show collection when needed |
629 |
if ($item->{ccode}) { |
709 |
if ($item->{ccode}) { |
630 |
$itemdata_ccode = 1; |
710 |
$itemdata_ccode = 1; |
631 |
} |
|
|
632 |
} |
711 |
} |
633 |
|
712 |
|
634 |
push @{ $biblioitem->{itemloop} }, $item; |
713 |
push @{ $biblioitem->{itemloop} }, $item; |
635 |
} |
714 |
} |
636 |
|
715 |
|
637 |
# While we can't override an alreay held item, we should be able to override the others |
716 |
# While we can't override an already held item, we should be able to override the others |
638 |
# Unless all items are already held |
717 |
# Unless all items are already held |
639 |
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) { |
718 |
if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) { |
640 |
# That is, if all items require an override |
719 |
# That is, if all items require an override |
Lines 651-752
foreach my $biblionumber (@biblionumbers) {
Link Here
|
651 |
|
730 |
|
652 |
@available_itemtypes = uniq( @available_itemtypes ); |
731 |
@available_itemtypes = uniq( @available_itemtypes ); |
653 |
$template->param( available_itemtypes => \@available_itemtypes ); |
732 |
$template->param( available_itemtypes => \@available_itemtypes ); |
|
|
733 |
$template->param(bibitemloop => \@bibitemloop); |
654 |
|
734 |
|
655 |
# existingreserves building |
|
|
656 |
my @reserveloop; |
657 |
my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); |
658 |
foreach my $res ( |
659 |
sort { |
660 |
my $a_found = $a->found() || ''; |
661 |
my $b_found = $a->found() || ''; |
662 |
$a_found cmp $b_found; |
663 |
} @reserves |
664 |
) |
665 |
{ |
666 |
my %reserve; |
667 |
if ( $res->is_found() ) { |
668 |
$reserve{'holdingbranch'} = $res->item()->holdingbranch(); |
669 |
$reserve{'biblionumber'} = $res->item()->biblionumber(); |
670 |
$reserve{'barcodenumber'} = $res->item()->barcode(); |
671 |
$reserve{'wbrcode'} = $res->branchcode(); |
672 |
$reserve{'itemnumber'} = $res->itemnumber(); |
673 |
$reserve{'wbrname'} = $res->branch()->branchname(); |
674 |
$reserve{'atdestination'} = $res->is_at_destination(); |
675 |
$reserve{'desk_name'} = ( $res->desk() ) ? $res->desk()->desk_name() : '' ; |
676 |
$reserve{'found'} = $res->is_found(); |
677 |
$reserve{'inprocessing'} = $res->is_in_processing(); |
678 |
$reserve{'intransit'} = $res->is_in_transit(); |
679 |
} |
680 |
elsif ( $res->priority() > 0 ) { |
681 |
if ( my $item = $res->item() ) { |
682 |
$reserve{'itemnumber'} = $item->id(); |
683 |
$reserve{'barcodenumber'} = $item->barcode(); |
684 |
$reserve{'item_level_hold'} = 1; |
685 |
} |
686 |
} |
687 |
|
688 |
$reserve{'expirationdate'} = $res->expirationdate; |
689 |
$reserve{'date'} = $res->reservedate; |
690 |
$reserve{'borrowernumber'} = $res->borrowernumber(); |
691 |
$reserve{'biblionumber'} = $res->biblionumber(); |
692 |
$reserve{'patron'} = $res->borrower; |
693 |
$reserve{'notes'} = $res->reservenotes(); |
694 |
$reserve{'waiting_date'} = $res->waitingdate(); |
695 |
$reserve{'ccode'} = $res->item() ? $res->item()->ccode() : undef; |
696 |
$reserve{'barcode'} = $res->item() ? $res->item()->barcode() : undef; |
697 |
$reserve{'priority'} = $res->priority(); |
698 |
$reserve{'lowestPriority'} = $res->lowestPriority(); |
699 |
$reserve{'suspend'} = $res->suspend(); |
700 |
$reserve{'suspend_until'} = $res->suspend_until(); |
701 |
$reserve{'reserve_id'} = $res->reserve_id(); |
702 |
$reserve{itemtype} = $res->itemtype(); |
703 |
$reserve{branchcode} = $res->branchcode(); |
704 |
$reserve{non_priority} = $res->non_priority(); |
705 |
$reserve{object} = $res; |
706 |
|
707 |
push( @reserveloop, \%reserve ); |
708 |
} |
709 |
|
710 |
# get the time for the form name... |
711 |
my $time = time(); |
712 |
|
713 |
$template->param( |
714 |
time => $time, |
715 |
fixedRank => $fixedRank, |
716 |
); |
717 |
|
718 |
# display infos |
719 |
$template->param( |
720 |
bibitemloop => \@bibitemloop, |
721 |
itemdata_enumchron => $itemdata_enumchron, |
722 |
itemdata_ccode => $itemdata_ccode, |
723 |
date => $date, |
724 |
biblionumber => $biblionumber, |
725 |
findborrower => $findborrower, |
726 |
biblio => $biblio, |
727 |
holdsview => 1, |
728 |
C4::Search::enabled_staff_search_views, |
729 |
); |
730 |
|
731 |
$biblioloopiter{biblionumber} = $biblionumber; |
732 |
$biblioloopiter{title} = $biblio->title; |
733 |
$biblioloopiter{rank} = $fixedRank; |
734 |
$biblioloopiter{reserveloop} = \@reserveloop; |
735 |
|
736 |
if (@reserveloop) { |
737 |
$template->param( reserveloop => \@reserveloop ); |
738 |
} |
739 |
|
740 |
if ( $patron ) { |
741 |
# Add the valid pickup locations |
742 |
my @pickup_locations = $biblio->pickup_locations({ patron => $patron }); |
743 |
$biblioloopiter{pickup_locations} = \@pickup_locations; |
744 |
$biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ]; |
745 |
} |
746 |
|
735 |
|
747 |
push @biblioloop, \%biblioloopiter; |
736 |
push @biblioloop, \%biblioloopiter; |
748 |
} |
737 |
} |
749 |
|
738 |
|
|
|
739 |
# display infos |
740 |
$template->param( |
741 |
reserveloop => 1, |
742 |
itemdata_enumchron => $itemdata_enumchron, |
743 |
itemdata_ccode => $itemdata_ccode, |
744 |
date => $date, |
745 |
biblionumber => $biblionumber, |
746 |
findborrower => $findborrower, |
747 |
holdsview => 1, |
748 |
C4::Search::enabled_staff_search_views, |
749 |
); |
750 |
|
750 |
$template->param( biblioloop => \@biblioloop ); |
751 |
$template->param( biblioloop => \@biblioloop ); |
751 |
$template->param( no_reserves_allowed => $no_reserves_allowed ); |
752 |
$template->param( no_reserves_allowed => $no_reserves_allowed ); |
752 |
$template->param( biblionumbers => join('/', @biblionumbers) ); |
753 |
$template->param( biblionumbers => join('/', @biblionumbers) ); |
753 |
- |
|
|