Bug 1248 - Add a "quick spine label" print to the bib item page in cataloging
[koha.git] / catalogue / detail.pl
index a24031e..0c3a764 100755 (executable)
@@ -35,6 +35,8 @@ use C4::Serials;
 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn);
 use C4::External::Amazon;
 use C4::Search;                # enabled_staff_search_views
+use C4::VirtualShelves;
+use C4::XSLT;
 
 # use Smart::Comments;
 
@@ -56,6 +58,14 @@ my $fw = GetFrameworkCode($biblionumber);
 my $marcflavour      = C4::Context->preference("marcflavour");
 my $record           = GetMarcBiblio($biblionumber);
 
+# XSLT processing of some stuff
+if (C4::Context->preference("XSLTDetailsDisplay") ) {
+    $template->param('XSLTDetailsDisplay' =>'1',
+        'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail','intranet') );
+}
+
+$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
+
 # some useful variables for enhanced content;
 # in each case, we're grabbing the first value we find in
 # the record and normalizing it
@@ -81,7 +91,7 @@ my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
 my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
-my $subtitle         = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $record, '');
+my $subtitle         = GetRecordValue('subtitle', $record, $fw);
 
 # Get Branches, Itemtypes and Locations
 my $branches = GetBranches();
@@ -102,8 +112,9 @@ foreach my $subscription (@subscriptions) {
        my $serials_to_display;
     $cell{subscriptionid}    = $subscription->{subscriptionid};
     $cell{subscriptionnotes} = $subscription->{notes};
-       $cell{branchcode}        = $subscription->{branchcode};
-       $cell{hasalert}          = $subscription->{hasalert};
+    $cell{branchcode}        = $subscription->{branchcode};
+    $cell{branchname}        = GetBranchName($subscription->{branchcode});
+    $cell{hasalert}          = $subscription->{hasalert};
     #get the three latest serials.
        $serials_to_display = $subscription->{staffdisplaycount};
        $serials_to_display = C4::Context->preference('StaffSerialIssueDisplayCount') unless $serials_to_display;
@@ -155,6 +166,10 @@ foreach my $item (@items) {
     # checking for holds
     my ($reservedate,$reservedfor,$expectedAt) = GetReservesFromItemnumber($item->{itemnumber});
     my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
+    
+    if (C4::Context->preference('HidePatronName')){
+       $item->{'hidepatronname'} = 1;
+    }
 
     if ( defined $reservedate ) {
         $item->{backgroundcolor} = 'reserved';
@@ -162,7 +177,8 @@ foreach my $item (@items) {
         $item->{ReservedForBorrowernumber}     = $reservedfor;
         $item->{ReservedForSurname}     = $ItemBorrowerReserveInfo->{'surname'};
         $item->{ReservedForFirstname}   = $ItemBorrowerReserveInfo->{'firstname'};
-        $item->{ExpectedAtLibrary}     = $branches->{$expectedAt}{branchname};
+        $item->{ExpectedAtLibrary}      = $branches->{$expectedAt}{branchname};
+       $item->{cardnumber}             = $ItemBorrowerReserveInfo->{'cardnumber'};
     }
 
        # Check the transit status
@@ -220,6 +236,12 @@ $template->param(
 
 # $debug and $template->param(debug_display => 1);
 
+# Lists
+
+if (C4::Context->preference("virtualshelves") ) {
+   $template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) );
+}
+
 # XISBN Stuff
 if (C4::Context->preference("FRBRizeEditions")==1) {
     eval {