use Modern::Perl;
use CGI qw ( -utf8 );
-use List::MoreUtils qw/uniq/;
-use Date::Calc qw/Date_to_Days/;
-use C4::Output;
-use C4::Auth;
-use C4::Reserves;
-use C4::Biblio;
-use C4::Items;
-use C4::Koha;
-use C4::Serials;
-use C4::Circulation;
-use Koha::DateUtils;
+use List::MoreUtils qw( uniq );
+use Date::Calc qw( Date_to_Days );
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
+use C4::Reserves qw( RevertWaitingStatus AlterPriority ToggleLowestPriority ToggleSuspend CanBookBeReserved GetMaxPatronHoldsForRecord ItemsAnyAvailableAndNotRestricted CanItemBeReserved IsAvailableForItemLevelRequest );
+use C4::Items qw( get_hostitemnumbers_of );
+use C4::Koha qw( getitemtypeimagelocation );
+use C4::Serials qw( CountSubscriptionFromBiblionumber );
+use C4::Circulation qw( GetTransfers _GetCircControlBranch GetBranchItemRule );
+use Koha::DateUtils qw( dt_from_string output_pref );
use C4::Utils::DataTables::Members;
-use C4::Members;
-use C4::Search; # enabled_staff_search_views
+use C4::Search qw( enabled_staff_search_views );
use Koha::Biblios;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Checkouts;
use Koha::Holds;
use Koha::CirculationRules;
my %biblioloopiter = ();
my $biblio = Koha::Biblios->find( $biblionumber );
+ unless ($biblio) {
+ $biblioloopiter{noitems} = 1;
+ $template->param('nobiblio' => 1);
+ last;
+ }
my $force_hold_level;
if ( $patron ) {
unless ( $items->count ) {
# FIXME Then why do we continue?
- $template->param('noitems' => 1);
+ $template->param('noitems' => 1) unless ( $multi_hold );
$biblioloopiter{noitems} = 1;
}
- ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers,
- ## when by definition all of the itemnumber have the same biblioitemnumber
+ ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers
+ ## this is important when we have analytic items which may be on another record
my ( $iteminfos_of );
while ( my $item = $items->next ) {
$item = $item->unblessed;
$iteminfos_of->{$itemnumber} = $item;
}
- ## Should be same as biblionumber
my @biblioitemnumbers = keys %itemnumbers_of_biblioitem;
my $biblioiteminfos_of = {
( $biblioitem->{biblioitemnumber} => $biblioitem )
} @{ Koha::Biblioitems->search(
{ biblioitemnumber => { -in => \@biblioitemnumbers } },
- { select => ['biblioitemnumber', 'publicationyear', 'itemtype']}
+ { select => ['biblionumber', 'biblioitemnumber', 'publicationyear', 'itemtype']}
)->unblessed
}
};
# it's complicated logic to analyse.
# (before this loop was inside that sub loop so it was O(n^2) )
my $items_any_available;
-
- $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitemnumber, patron => $patron })
+ $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitem->{biblionumber}, patron => $patron })
if $patron;
foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) {
}
$template->param( biblioloop => \@biblioloop );
-$template->param( biblionumbers => $biblionumbers );
$template->param( no_reserves_allowed => $no_reserves_allowed );
+$template->param( biblionumbers => join('/', @biblionumbers) );
$template->param( exceeded_maxreserves => $exceeded_maxreserves );
$template->param( exceeded_holds_per_record => $exceeded_holds_per_record );
$template->param( subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber));