Bug 22006

Summary: Koha::Account::Line->item should return undef if no item linked
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi (tcohen) <tomascohen>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, lucas, martin.renvoize, nick, pierre-marc.thibault, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 12001    
Bug Blocks: 19489    
Attachments: Bug 22006: Add tests
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item
Bug 22006: Add tests
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item
Bug 22006: Add tests
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item

Description Jonathan Druart 2018-12-14 19:11:38 UTC
If there is no item linked to an account line, the ->item method should return undef.
Now 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
Comment 1 Jonathan Druart 2018-12-14 19:17:16 UTC
Created attachment 83240 [details] [review]
Bug 22006: Add tests
Comment 2 Jonathan Druart 2018-12-14 19:17:20 UTC
Created attachment 83241 [details] [review]
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
Comment 3 Pierre-Marc Thibault 2018-12-14 20:08:10 UTC
Created attachment 83246 [details] [review]
Bug 22006: Add tests

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 4 Pierre-Marc Thibault 2018-12-14 20:08:13 UTC
Created attachment 83247 [details] [review]
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>
Comment 5 Tomás Cohen Arazi (tcohen) 2019-01-15 18:43:50 UTC
Created attachment 84000 [details] [review]
Bug 22006: Add tests

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi (tcohen) 2019-01-15 18:43:55 UTC
Created attachment 84001 [details] [review]
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>
Comment 7 Nick Clemens (kidclamp) 2019-01-18 20:59:09 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize (ashimema) 2019-01-23 12:48:15 UTC
Pushed to 18.11.x for 18.11.03
Comment 9 Lucas Gass (lukeg) 2019-01-23 23:18:21 UTC
backported to 18.05 for 18.05.09
Comment 10 Fridolin Somers 2019-01-30 08:51:45 UTC
Depends on Bug 12001 not in 17.11.x