Bug 8015: Add unit tests for SimpleMARC and MarcModificationTemplates routines
[koha.git] / opac / opac-basket.pl
index e71c8f1..7b3a90a 100755 (executable)
@@ -21,7 +21,9 @@ use warnings;
 use CGI;
 use C4::Koha;
 use C4::Biblio;
+use C4::Branch;
 use C4::Items;
+use C4::Circulation;
 use C4::Auth;
 use C4::Output;
 
@@ -68,7 +70,7 @@ foreach my $biblionumber ( @bibs ) {
     my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
     my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
     my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
-    my @items            = &GetItemsLocationInfo( $biblionumber );
+    my @items            = &GetItemsInfo( $biblionumber );
     my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
 
     my $hasauthors = 0;
@@ -76,6 +78,7 @@ foreach my $biblionumber ( @bibs ) {
       $hasauthors = 1;
     }
     my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
+    my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
 
        # COinS format FIXME: for books Only
         my $coins_format;
@@ -88,6 +91,18 @@ foreach my $biblionumber ( @bibs ) {
         $dat->{'even'} = 1;
     }
 
+my $branches = GetBranches();
+    for my $itm (@items) {
+        if ($itm->{'location'}){
+            $itm->{'location_opac'} = $shelflocations->{$itm->{'location'} };
+        }
+        my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
+        if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
+             $itm->{transfertwhen} = $transfertwhen;
+             $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
+             $itm->{transfertto}   = $branches->{$transfertto}{branchname};
+        }
+    }
     $num++;
     $dat->{biblionumber} = $biblionumber;
     $dat->{ITEM_RESULTS}   = \@items;