[Koha-bugs] [Bug 13934] Check in fails on master "Can't bless non-reference at .../ItemType.pm Line 64"

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Apr 1 10:23:24 CEST 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934

--- Comment #1 from Jonathan Druart <jonathan.druart at biblibre.com> ---
Created attachment 37412
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37412&action=edit
Bug 13934: C4::ItemType->get should return undef if no parameter given

The issue: If you try to check in an item with a non existent barcode,
the application will exploded with a software error:
"Can't bless non-reference at .../ItemType.pm Line 64".
It's caused by:
commit 7431f8cfe29e330e2232b0df591afc4d923b0a52
    Bug 11944: Fix encoding issue in C4::ItemType

and the following change:
@@ -105,9 +104,6 @@ sub get {
     my $data = $dbh->selectrow_hashref(
         "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype
     );
-    if ( $data->{description} ) {
-        $data->{description} = Encode::encode('UTF-8', $data->{description});
-    }

because of the following:
  my $s;
  $s->{foo} = "bar" if $s->{foo};
  use Data::Dumper;warn Dumper $s;
=> {} # not undef

So later,
  bless $opts => $class;
will fail because $opts is undef and was not (i.e. {}) before.

Test plan:
Try to check in an item with a non existent barcode and confirm you have the
friendly warning message instead of the ugly software error.

Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even
if the behavior is changed, it should not introduce any regression
somewhere else.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list