fix for #1731
authorPaul Poulain <paul.poulain@biblibre.com>
Sat, 18 Apr 2009 23:04:23 +0000 (01:04 +0200)
committerGalen Charlton <galen.charlton@liblime.com>
Sat, 18 Apr 2009 23:38:45 +0000 (18:38 -0500)
The "place hold" button is hidden in detail.pl when there are no items or the
items are not for loan. MARC detail should do the same.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
catalogue/MARCdetail.pl

index db1c6f4..f569763 100755 (executable)
@@ -247,6 +247,7 @@ my @fields = $record->fields();
 my %witness
   ; #---- stores the list of subfields used at least once, with the "meaning" of the code
 my @big_array;
+my $norequests = 1;
 foreach my $field (@fields) {
     next if ( $field->tag() < 10 );
     my @subf = $field->subfields;
@@ -260,11 +261,13 @@ foreach my $field (@fields) {
         $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib};
         $this_row{ $subf[$i][0] } = GetAuthorisedValueDesc( $field->tag(),
                         $subf[$i][0], $subf[$i][1], '', $tagslib) || $subf[$i][1];
+        $norequests = 0 if $subf[$i][1] ==0 and $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.notforloan';
     }
     if (%this_row) {
         push( @big_array, \%this_row );
     }
 }
+
 my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode);
 @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
 
@@ -306,6 +309,7 @@ if ($subscriptionscount) {
 }
 
 $template->param (
+    norequests              => $norequests, 
     item_loop               => \@item_value_loop,
     item_header_loop        => \@header_value_loop,
     biblionumber            => $biblionumber,