Bug 22675

Summary: SCO broken on invalid barcodes
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Self checkoutAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: major    
Priority: P5 - low CC: josef.moravec, katrin.fischer, kyle, martin.renvoize, nick, wizzyrea
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00
Bug Depends on: 21206    
Bug Blocks:    
Attachments: Bug 22675: Fix SCO behaviour on non-existent barcodes
Bug 22675: Fix SCO behaviour on non-existent barcodes
Bug 22675: Fix SCO behaviour on non-existent barcodes
Bug 22675: Fix SCO behaviour on non-existent barcodes

Description Tomás Cohen Arazi 2019-04-09 18:57:51 UTC
The SCO tool breaks when a non-existent barcode is introduced
To reproduce:
- Log into SCO
- Type any barcode that doesn't exist on the DB, hit enter
=> FAIL: Explodes
Comment 1 Tomás Cohen Arazi 2019-04-09 19:01:27 UTC
Created attachment 87672 [details] [review]
Bug 22675: Fix SCO behaviour on non-existent barcodes

Bug 21206 replaced GetItem for Koha::Items->find, and introduced this
problem. This patch verifies $item is defined before attempting to use
its methods.

To test:
- Log into SCO
- Type an invalid barcode
=> FAIL: Things explode :-/
- Apply this patch, reload
- Type an invalid barcode
=> SUCCESS: A nice error message is displayed :-D
- Sign off :-D
Comment 2 Liz Rea 2019-04-09 20:54:10 UTC
Created attachment 87684 [details] [review]
Bug 22675: Fix SCO behaviour on non-existent barcodes

Bug 21206 replaced GetItem for Koha::Items->find, and introduced this
problem. This patch verifies $item is defined before attempting to use
its methods.

To test:
- Log into SCO
- Type an invalid barcode
=> FAIL: Things explode :-/
- Apply this patch, reload
- Type an invalid barcode
=> SUCCESS: A nice error message is displayed :-D
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
100% that used to explode, and now does not. Excellent.
Comment 3 Liz Rea 2019-04-09 20:54:49 UTC
Created attachment 87685 [details] [review]
Bug 22675: Fix SCO behaviour on non-existent barcodes

Bug 21206 replaced GetItem for Koha::Items->find, and introduced this
problem. This patch verifies $item is defined before attempting to use
its methods.

To test:
- Log into SCO
- Type an invalid barcode
=> FAIL: Things explode :-/
- Apply this patch, reload
- Type an invalid barcode
=> SUCCESS: A nice error message is displayed :-D
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 4 Liz Rea 2019-04-09 20:55:19 UTC
I laughed so hard at myself I scared my dog.
Comment 5 Katrin Fischer 2019-04-10 07:20:45 UTC
Created attachment 87702 [details] [review]
Bug 22675: Fix SCO behaviour on non-existent barcodes

Bug 21206 replaced GetItem for Koha::Items->find, and introduced this
problem. This patch verifies $item is defined before attempting to use
its methods.

To test:
- Log into SCO
- Type an invalid barcode
=> FAIL: Things explode :-/
- Apply this patch, reload
- Type an invalid barcode
=> SUCCESS: A nice error message is displayed :-D
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Nick Clemens 2019-04-10 20:15:37 UTC
Awesome work all!

Pushed to master for 19.05
Comment 7 Martin Renvoize 2019-04-15 11:29:11 UTC
Bug in enhancement not in 18.11.x series