Lines 25-31
use CGI qw ( -utf8 );
Link Here
|
25 |
use C4::Auth qw( get_template_and_user ); |
25 |
use C4::Auth qw( get_template_and_user ); |
26 |
use C4::Koha qw( getitemtypeimagelocation getitemtypeimagesrc ); |
26 |
use C4::Koha qw( getitemtypeimagelocation getitemtypeimagesrc ); |
27 |
use C4::Circulation qw( GetBranchItemRule ); |
27 |
use C4::Circulation qw( GetBranchItemRule ); |
28 |
use C4::Reserves qw( CanItemBeReserved CanBookBeReserved AddReserve GetReservesControlBranch ItemsAnyAvailableAndNotRestricted IsAvailableForItemLevelRequest GetReserveFee ); |
28 |
use C4::Reserves qw( CanItemBeReserved CanBookBeReserved AddReserve GetReservesControlBranch IsAvailableForItemLevelRequest GetReserveFee ); |
29 |
use C4::Biblio qw( GetBiblioData GetFrameworkCode ); |
29 |
use C4::Biblio qw( GetBiblioData GetFrameworkCode ); |
30 |
use C4::Output qw( output_html_with_http_headers ); |
30 |
use C4::Output qw( output_html_with_http_headers ); |
31 |
use C4::Context; |
31 |
use C4::Context; |
Lines 441-448
foreach my $biblioNum (@biblionumbers) {
Link Here
|
441 |
# to pass this value further inside down to IsAvailableForItemLevelRequest to |
441 |
# to pass this value further inside down to IsAvailableForItemLevelRequest to |
442 |
# it's complicated logic to analyse. |
442 |
# it's complicated logic to analyse. |
443 |
# (before this loop was inside that sub loop so it was O(n^2) ) |
443 |
# (before this loop was inside that sub loop so it was O(n^2) ) |
444 |
my $items_any_available; |
|
|
445 |
$items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron; |
446 |
foreach my $item (@{$biblioData->{items}}) { |
444 |
foreach my $item (@{$biblioData->{items}}) { |
447 |
|
445 |
|
448 |
my $item_info = $item->unblessed; |
446 |
my $item_info = $item->unblessed; |
Lines 481-491
foreach my $biblioNum (@biblionumbers) {
Link Here
|
481 |
|
479 |
|
482 |
my $branch = GetReservesControlBranch( $item_info, $patron_unblessed ); |
480 |
my $branch = GetReservesControlBranch( $item_info, $patron_unblessed ); |
483 |
|
481 |
|
484 |
# items_any_available defined outside of the current loop, |
|
|
485 |
# so we avoiding loop inside IsAvailableForItemLevelRequest: |
486 |
my $policy_holdallowed = |
482 |
my $policy_holdallowed = |
487 |
CanItemBeReserved( $patron, $item, undef, { get_from_cache => 1 } )->{status} eq 'OK' && |
483 |
CanItemBeReserved( $patron, $item, undef, { get_from_cache => 1 } )->{status} eq 'OK' && |
488 |
IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available); |
484 |
IsAvailableForItemLevelRequest($item, $patron, undef); |
489 |
|
485 |
|
490 |
if ($policy_holdallowed) { |
486 |
if ($policy_holdallowed) { |
491 |
my $opac_hold_policy = Koha::CirculationRules->get_opacitemholds_policy( { item => $item, patron => $patron } ); |
487 |
my $opac_hold_policy = Koha::CirculationRules->get_opacitemholds_policy( { item => $item, patron => $patron } ); |