Bug 22006 - Koha::Account::Line->item should return undef if no item linked
Summary: Koha::Account::Line->item should return undef if no item linked
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Tomás Cohen Arazi
URL:
Keywords:
Depends on: 12001
Blocks: 19489
  Show dependency treegraph
 
Reported: 2018-12-14 19:11 UTC by Jonathan Druart
Modified: 2019-01-30 08:51 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 22006: Add tests (1.14 KB, patch)
2018-12-14 19:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item (1.09 KB, patch)
2018-12-14 19:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22006: Add tests (1.20 KB, patch)
2018-12-14 20:08 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item (1.15 KB, patch)
2018-12-14 20:08 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 22006: Add tests (1.26 KB, patch)
2019-01-15 18:43 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22006: Handle undefined itemnumber for Koha::Account::Line->item (1.21 KB, patch)
2019-01-15 18:43 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 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 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 2019-01-18 20:59:09 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-01-23 12:48:15 UTC
Pushed to 18.11.x for 18.11.03
Comment 9 Lucas Gass 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