From 817cd2680e2114c7a169cde492aaca44af2717ad Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 1 Dec 2008 15:38:07 -0600 Subject: [PATCH] Minor logical cleanup. The conditional assignment previously was: $norequests = 0 && $norequests if .... The execution of "0" served no purpose. Also consolidated RequestOnOpac logic to the one line that cared about it. Signed-off-by: Galen Charlton --- opac/opac-detail.pl | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 4198ce3983..de61ce3369 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -110,20 +110,13 @@ foreach my $subscription (@subscriptions) { $dat->{'count'} = scalar(@items); -#adding RequestOnOpac filter to allow or not the display of plce reserve button -# FIXME - use me or delete me. -my $RequestOnOpac; -if (C4::Context->preference("RequestOnOpac")) { - $RequestOnOpac = 1; -} - my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber ) ); my $norequests = 1; my $branches = GetBranches(); my %itemfields; for my $itm (@items) { - $norequests = 0 && $norequests + $norequests = 0 if ( (not $itm->{'wthdrawn'} ) && (not $itm->{'itemlost'} ) && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} ) @@ -131,7 +124,7 @@ for my $itm (@items) { && ($itm->{'itemnumber'} ) ); $itm->{ $itm->{'publictype'} } = 1; - $itm->{datedue} = format_date($itm->{datedue}); + $itm->{datedue} = format_date($itm->{datedue}); $itm->{datelastseen} = format_date($itm->{datelastseen}); #get collection code description, too @@ -140,10 +133,9 @@ for my $itm (@items) { $itm->{'location_description'} = $shelflocations->{$itm->{'location'} }; $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); $itm->{'description'} = $itemtypes->{$itemtype}->{'description'}; - $itemfields{ccode} = 1 if($itm->{ccode}); - $itemfields{enumchron} = 1 if($itm->{enumchron}); - $itemfields{copynumber} = 1 if($itm->{copynumber}); - $itemfields{itemnotes} = 1 if($itm->{itemnotes}); + foreach (qw(ccode enumchron copynumber itemnotes)) { + $itemfields{$_} = 1 if ($itm->{$_}); + } # walk through the item-level authorised values and populate some images my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) ); @@ -182,7 +174,7 @@ my $subtitle = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 's MARCSERIES => $marcseriesarray, MARCURLS => $marcurlsarray, norequests => $norequests, - RequestOnOpac => $RequestOnOpac, + RequestOnOpac => C4::Context->preference("RequestOnOpac"), itemdata_ccode => $itemfields{ccode}, itemdata_enumchron => $itemfields{enumchron}, itemdata_copynumber => $itemfields{copynumber}, -- 2.39.5