If itemnumber is sent to catalogue/moredetail.pl use it
authorMichael Hafen <mdhafen@tech.washk12.org>
Fri, 29 Aug 2008 19:36:51 +0000 (13:36 -0600)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 28 Oct 2008 21:09:27 +0000 (22:09 +0100)
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@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

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
catalogue/moredetail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl

index 5d09087..6176815 100755 (executable)
@@ -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;
 
index 97fec1f..4935bd2 100644 (file)
@@ -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>