=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
#'
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);
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(
$noquestion = 0;
}
$template->param(
+ itemhomebranch => $getmessageiteminfo->{'homebranch'} ,
day => $day,
month => $month,
year => $year