Bug 5549 : Add Extra Perl Dependencies
[koha_fer] / catalogue / moredetail.pl
index 68af91c..1a3a2d0 100755 (executable)
@@ -35,6 +35,7 @@ use C4::Circulation;  # to use itemissues
 use C4::Members; # to use GetMember
 use C4::Search;                # enabled_staff_search_views
 use C4::Members qw/GetHideLostItemsPreference/;
+use Koha::DateUtils;
 
 my $query=new CGI;
 
@@ -68,7 +69,7 @@ my $title=$query->param('title');
 my $bi=$query->param('bi');
 $bi = $biblionumber unless $bi;
 my $itemnumber = $query->param('itemnumber');
-my $data=GetBiblioData($biblionumber);
+my $data = &GetBiblioData($biblionumber);
 my $dewey = $data->{'dewey'};
 my $showallitems = $query->param('showallitems');
 
@@ -86,7 +87,6 @@ my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
 # $dewey=~ s/\.$//;
 # $data->{'dewey'}=$dewey;
 
-my @results;
 my $fw = GetFrameworkCode($biblionumber);
 my @all_items= GetItemsInfo($biblionumber);
 my @items;
@@ -107,7 +107,7 @@ if (@hostitems){
         push (@items,@hostitems);
 }
 
-
+my $subtitle = GetRecordValue('subtitle', $record, $fw);
 
 my $totalcount=@all_items;
 my $showncount=@items;
@@ -120,7 +120,11 @@ my $ccodes= GetKohaAuthorisedValues('items.ccode',$fw);
 my $itemtypes = GetItemTypes;
 
 $data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'description'};
-$results[0]=$data;
+
+foreach ( keys %{$data} ) {
+    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
+}
+
 ($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items);
 foreach my $item (@items){
     $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
@@ -159,8 +163,8 @@ foreach my $item (@items){
     }
     $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
     $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
-    if ($item->{'datedue'}) {
-        $item->{'datedue'} = format_date($item->{'datedue'});
+    if ($item->{datedue}) {
+        $item->{datedue} = format_sqldatetime($item->{datedue});
         $item->{'issue'}= 1;
     } else {
         $item->{'issue'}= 0;
@@ -171,15 +175,18 @@ $template->param(count => $data->{'count'},
     subscriptiontitle   => $data->{title},
        C4::Search::enabled_staff_search_views,
 );
-$template->param(BIBITEM_DATA => \@results);
-$template->param(ITEM_DATA => \@items);
-$template->param(moredetailview => 1);
-$template->param(loggedinuser => $loggedinuser);
-$template->param(biblionumber => $biblionumber);
-$template->param(biblioitemnumber => $bi);
-$template->param(itemnumber => $itemnumber);
+
+$template->param(
+    ITEM_DATA           => \@items,
+    moredetailview      => 1,
+    loggedinuser        => $loggedinuser,
+    biblionumber        => $biblionumber,
+    biblioitemnumber    => $bi,
+    itemnumber          => $itemnumber,
+    z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
+    subtitle            => $subtitle,
+);
 $template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items );
-$template->param(z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)));
 
 output_html_with_http_headers $query, $cookie, $template->output;