Fix for Bug 5265, error message on lists is misleading
authorOwen Leonard <oleonard@myacpl.org>
Mon, 4 Oct 2010 15:11:11 +0000 (11:11 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Wed, 6 Oct 2010 10:18:56 +0000 (06:18 -0400)
The check to see if an item exists always evaluates as true.
Correcting this lets the script handle the error as it
was designed to.

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
C4/VirtualShelves/Page.pm

index 73ca42d..9d15847 100644 (file)
@@ -89,7 +89,8 @@ sub shelfpage ($$$$$) {
         if ( $shelfnumber = $query->param('viewshelf') ) {
             if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ) ) {
                 if ( $barcode = $query->param('addbarcode') ) {
-                    if ( $item = GetItem( 0, $barcode ) ) {
+                    $item = GetItem( 0, $barcode );
+                    if (defined $item && $item->{'itemnumber'}){
                         $biblio = GetBiblioFromItemNumber( $item->{'itemnumber'} );
                         AddToShelf( $biblio->{'biblionumber'}, $shelfnumber )
                           or push @paramsloop, { duplicatebiblio => $barcode };