From 9c2d58a470bc7791b0633c76b3f6d4cf2823dff4 Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Tue, 13 Nov 2007 11:59:09 -0600 Subject: [PATCH] update item-at-wrong-branch error message to show homebranch. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 28 +++++++++++-------- circ/circulation.pl | 3 +- .../prog/en/modules/circ/circulation.tmpl | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index bcc2409c60..91cb0cb72e 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -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, C, and C 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); diff --git a/circ/circulation.pl b/circ/circulation.pl index 6dfd771440..c68427c1e1 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl index be606f0bf5..e7b15b65cf 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -189,7 +189,7 @@ No patron matched -
  • This item does not belong here!
  • +
  • This item belongs to and cannot be issued from this location.
  • -- 2.39.5