update item-at-wrong-branch error message to show homebranch.
authorRyan Higgins <rch@balrog.liblime.com>
Tue, 13 Nov 2007 17:59:09 +0000 (11:59 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 13 Nov 2007 18:46:45 +0000 (12:46 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Biblio.pm
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl

index bcc2409..91cb0cb 100644 (file)
@@ -1209,9 +1209,9 @@ sub GetBiblioItemByBiblioNumber {
 
 =over 4
 
-$item = &GetBiblioFromItemNumber($itemnumber);
+$item = &GetBiblioFromItemNumber($itemnumber,$barcode);
 
-Looks up the item with the given itemnumber.
+Looks up the item with the given itemnumber. if undef, try the barcode.
 
 C<&itemnodata> returns a reference-to-hash whose keys are the fields
 from the C<biblio>, C<biblioitems>, and C<items> tables in the Koha
@@ -1223,16 +1223,22 @@ database.
 
 #'
 sub GetBiblioFromItemNumber {
-    my ( $itemnumber ) = @_;
+    my ( $itemnumber, $barcode ) = @_;
     my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare(
-        "SELECT * FROM items 
-        LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
-        LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
-         WHERE items.itemnumber = ?"
-    );
-
-    $sth->execute($itemnumber);
+    my $sth;
+    if($itemnumber) {
+               $sth=$dbh->prepare(  "SELECT * FROM items 
+           LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+           LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
+                WHERE items.itemnumber = ?") ; 
+       $sth->execute($itemnumber);
+       } else {
+               $sth=$dbh->prepare(  "SELECT * FROM items 
+           LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+           LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
+                WHERE items.barcode = ?") ; 
+       $sth->execute($barcode);
+       }
     my $data = $sth->fetchrow_hashref;
     $sth->finish;
     return ($data);
index 6dfd771..c68427c 100755 (executable)
@@ -247,7 +247,7 @@ if ($barcode) {
         my $noerror    = 1;
         my $noquestion = 1;
 #         Get the item title for more information
-       my $getmessageiteminfo  = GetBiblioFromItemNumber($barcode);
+       my $getmessageiteminfo  = GetBiblioFromItemNumber(undef,$barcode);
     
         foreach my $impossible ( keys %$error ) {
             $template->param(
@@ -265,6 +265,7 @@ if ($barcode) {
             $noquestion = 0;
         }
         $template->param(
+                        itemhomebranch => $getmessageiteminfo->{'homebranch'} ,        
             day   => $day,
             month => $month,
             year  => $year
index be606f0..e7b15b6 100755 (executable)
@@ -189,7 +189,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <!-- /TMPL_IF -->
        
        <!-- TMPL_IF NAME="NOTSAMEBRANCH" -->
-            <li><span class="problem">This item does not belong here!</span></li>
+            <li><span class="problem">This item belongs to <!-- TMPL_VAR NAME="itemhomebranch" --> and cannot be issued from this location.</span></li>
        <!-- /TMPL_IF -->        
         </ul>