Bug 20499

Summary: Checkout of bad barcode: Internal Server Error
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: CirculationAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: gmcharlt, jonathan.druart, kyle.m.hall, m.de.rooy, nick
Version: Main   
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:
Bug Depends on: 19943    
Bug Blocks:    
Attachments: Bug 20499: Unit Test to prove the problem
Bug 20499: Fix the Internal Server Error
Bug 20499: Fix the Internal Server Error
Bug 20499: Unit Test to prove the problem
Bug 20499: Fix the Internal Server Error
Bug 20499: just check if GetItem returns something is enough
Bug 20499: Unit Test to prove the problem
Bug 20499: Fix the Internal Server Error
Bug 20499: just check if GetItem returns something is enough

Description Mark Tompsett 2018-03-29 18:30:58 UTC
There is no error checking on whether the barcode was found. Add some to prevent this internal server error.

Can't call method "biblioitem" on an undefined value at /home/vagrant/kohaclone/C4/Circulation.pm line 673.
Comment 1 Mark Tompsett 2018-03-29 18:46:50 UTC
Created attachment 73439 [details] [review]
Bug 20499: Unit Test to prove the problem

TEST PLAN
---------
1) apply this patch
2) prove t/db_dependent/Circulation.t
   -- horrible death.
3) apply next path
4) prove t/db_dependent/Circulation.t
   -- passes.
5) run koha qa test tools
Comment 2 Mark Tompsett 2018-03-29 18:49:42 UTC
Created attachment 73440 [details] [review]
Bug 20499: Fix the Internal Server Error

TEST PLAN
---------
See comment #1

Applying the test without the patch: messy.
Applyin both patches: smooth.
Run koha qa test tools
Comment 3 Mark Tompsett 2018-03-29 18:51:40 UTC
The location of the test was chosen, because it is where the first occurrence of CanBookBeIssued is. Feel free to move it elsewhere if needed. But the fix is the fix. :)
Comment 4 Mark Tompsett 2018-03-29 19:03:24 UTC
Created attachment 73442 [details] [review]
Bug 20499: Fix the Internal Server Error

TEST PLAN
---------
See comment #1

Applying the test without the patch: messy.
Applyin both patches: smooth.
Run koha qa test tools
Comment 5 Jonathan Druart 2018-04-12 15:28:42 UTC
Caused by 
  commit 6183c0e6a910663fec02bdba66d05f173310f562
  Bug 19943: Koha::Biblio - Replace GetBiblioItemData with Koha::Biblio->biblioitem
Comment 6 Jonathan Druart 2018-04-12 15:32:00 UTC
Created attachment 74107 [details] [review]
Bug 20499: Unit Test to prove the problem

TEST PLAN
---------
1) apply this patch
2) prove t/db_dependent/Circulation.t
   -- horrible death.
3) apply next path
4) prove t/db_dependent/Circulation.t
   -- passes.
5) run koha qa test tools

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2018-04-12 15:32:03 UTC
Created attachment 74108 [details] [review]
Bug 20499: Fix the Internal Server Error

TEST PLAN
---------
See comment #1

Applying the test without the patch: messy.
Applyin both patches: smooth.
Run koha qa test tools

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2018-04-12 15:32:06 UTC
Created attachment 74109 [details] [review]
Bug 20499: just check if GetItem returns something is enough

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Marcel de Rooy 2018-04-13 08:06:53 UTC
QA: Looking here
Comment 10 Marcel de Rooy 2018-04-13 08:09:10 UTC
'"KohaIsAwesome" is not a valid barcode.
Mark: Formally, this is an assumption :)
Comment 11 Marcel de Rooy 2018-04-13 08:16:00 UTC
Created attachment 74144 [details] [review]
Bug 20499: Unit Test to prove the problem

TEST PLAN
---------
1) apply this patch
2) prove t/db_dependent/Circulation.t
   -- horrible death.
3) apply next path
4) prove t/db_dependent/Circulation.t
   -- passes.
5) run koha qa test tools

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Marcel de Rooy 2018-04-13 08:16:05 UTC
Created attachment 74145 [details] [review]
Bug 20499: Fix the Internal Server Error

TEST PLAN
---------
See comment #1

Applying the test without the patch: messy.
Applyin both patches: smooth.
Run koha qa test tools

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Marcel de Rooy 2018-04-13 08:16:09 UTC
Created attachment 74146 [details] [review]
Bug 20499: just check if GetItem returns something is enough

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Jonathan Druart 2018-04-13 16:41:54 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 15 Nick Clemens 2018-05-21 17:36:07 UTC
Dependency not in stable