Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 14 Dec 2018 19:15:24 +0000 (16:15 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 18 Jan 2019 20:32:54 +0000 (20:32 +0000)
commit6c8089b40fef1b59ab056bae8817933afdb2fcc3
tree52cd2f06ccf999799823007b118ee5da2c7c89d3
parent58f04600f084e2bb5306f18bba1b9a0b22e1664b
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item

If there is no item linked to an account line, the ->item method should return undef.
Without this patch it explodes with:
Carp::croak('DBIC result _type  isn\'t of the _type Item') called at /home/vagrant/kohaclone/Koha/Object.pm line 102

Exists since the introduction of this method by bug 12001

Reported on bug 19489 comment 18.

Test plan:
  prove t/db_dependent/Koha/Account/Lines.t
must return green

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Koha/Account/Line.pm