[followup](bug #3348) fix spent values and spent resume
[koha.git] / opac / opac-basket.pl
index b01d449..a50bdd5 100755 (executable)
 
 
 use strict;
-require Exporter;
+use warnings;
 use CGI;
+use C4::Koha;
 use C4::Biblio;
+use C4::Items;
 use C4::Auth;
 use C4::Output;
 
@@ -47,6 +49,8 @@ my @results;
 
 my $num = 1;
 my $marcflavour = C4::Context->preference('marcflavour');
+
+
 foreach my $biblionumber ( @bibs ) {
     $template->param( biblionumber => $biblionumber );
 
@@ -55,8 +59,30 @@ foreach my $biblionumber ( @bibs ) {
     my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
     my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
     my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
+    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
+    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
     my @items            = &GetItemsInfo( $biblionumber, 'opac' );
 
+    my $hasauthors = 0;
+    if($dat->{'author'} || @$marcauthorsarray) {
+      $hasauthors = 1;
+    }
+       
+    my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'});
+    my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'} );
+
+       for my $itm (@items) {
+           if ($itm->{'location'}){
+           $itm->{'location_description'} = $shelflocations->{$itm->{'location'} };
+               }
+       }
+       # COinS format FIXME: for books Only
+        my $coins_format;
+        my $fmt = substr $record->leader(), 6,2;
+        my $fmts;
+        $fmts->{'am'} = 'book';
+        $dat->{ocoins_format} = $fmts->{$fmt};
+
     if ( $num % 2 == 1 ) {
         $dat->{'even'} = 1;
     }
@@ -67,6 +93,9 @@ foreach my $biblionumber ( @bibs ) {
     $dat->{MARCNOTES}      = $marcnotesarray;
     $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
     $dat->{MARCAUTHORS}    = $marcauthorsarray;
+    $dat->{MARCSERIES}  = $marcseriesarray;
+    $dat->{MARCURLS}    = $marcurlsarray;
+    $dat->{HASAUTHORS}  = $hasauthors;
 
     if ( C4::Context->preference("BiblioDefaultView") eq "normal" ) {
         $dat->{dest} = "opac-detail.pl";