[Koha-patches] [PATCH] If itemnumber is sent to catalogue/moredetail.pl use it

Michael Hafen mdhafen at tech.washk12.org
Fri Aug 29 21:36:51 CEST 2008


If itemnumber is part of the url for catalogue/moredetail.pl
put it to use.
This happens in members/boraccount.pl if a fine is attached to a
barcode.

This patch makes moredetail.pl show only the item specified by
itemnumber.

Implements some changes to the patch suggested on
patches at koha.org
give visual cue on UI and a link out.
More friendly pruning of the other items.

Thanks to Galen Charlton and Joe Atzberger
---
 catalogue/moredetail.pl                            |    7 ++++++-
 .../prog/en/modules/catalogue/moredetail.tmpl      |    3 +++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl
index 5d09087..6176815 100755
--- a/catalogue/moredetail.pl
+++ b/catalogue/moredetail.pl
@@ -51,7 +51,8 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({
 
 my $biblionumber=$query->param('biblionumber');
 my $title=$query->param('title');
-# my $bi=$query->param('bi');
+my $itemnumber=$query->param('itemnumber');
+my $bi=$query->param('bi');
 # $bi = $biblionumber unless $bi;
 my $data=GetBiblioData($biblionumber);
 my $dewey = $data->{'dewey'};
@@ -83,6 +84,7 @@ my $itemtypes = GetItemTypes;
 
 $data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'description'};
 $results[0]=$data;
+($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items);
 foreach my $item (@items){
     $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
     $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw);
@@ -124,6 +126,9 @@ $template->param(ITEM_DATA => \@items);
 $template->param(moredetailview => 1);
 $template->param(loggedinuser => $loggedinuser);
 $template->param(biblionumber => $biblionumber);
+$template->param(biblioitemnumber => $bi);
+$template->param(itemnumber => $itemnumber);
+$template->param(ONLY_ONE => 1) if ( $itemnumber && $count != @items );
 
 output_html_with_http_headers $query, $cookie, $template->output;
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
index 97fec1f..4935bd2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
@@ -36,6 +36,9 @@
     </ol>
     <!-- /TMPL_LOOP -->
     <br clear="all" />
+    <!-- TMPL_IF NAME="ONLY_ONE" -->
+        <div class="alert">You are only viewing one item.  <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber">">View All</a></div>
+    <!-- /TMPL_IF -->
     <!-- TMPL_LOOP NAME="ITEM_DATA" -->
     <div class="yui-g">
         <h3 id="item<!-- TMPL_VAR NAME="itemnumber" -->">Barcode <!-- TMPL_VAR NAME="barcode" -->  <!-- TMPL_IF name="notforloantext" --><!-- TMPL_VAR name="notforloantext" --> <!-- /TMPL_IF --></h3>
-- 
1.5.4.3




More information about the Koha-patches mailing list