[Bug 19431] New: Error when trying to checkout an unknown barcode
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Bug ID: 19431 Summary: Error when trying to checkout an unknown barcode Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com When trying to checkout an unknown barcode, I receive an internal server error: Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. It should ask me to do a fast add instead. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com --- Comment #1 from Josef Moravec <josef.moravec@gmail.com> --- (In reply to Katrin Fischer from comment #0)
When trying to checkout an unknown barcode, I receive an internal server error:
Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387.
It should ask me to do a fast add instead.
For me, it asks for fast cataloguing the item - I can't reproduce it on my devbox... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 67857 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67857&action=edit Bug 19431: Fix error when checking out an unknown barcode It seems this has been caused by commit 1544f9a5d4a8acd47c97d7c6ac55dee8e759d3ff Bug 18276: Remove GetBiblioFromItemNumber - circulation pages To reproduce the problem you need switch on the two prefs - OnSiteCheckouts - OnSiteCheckoutsForce Test plan: Try to check an item out using an unknown barcode With the 2 prefs set to on and without this patch, you will get the following error in the log Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. With this patch applied you should not get this error and a correct behaviour for the different pref combinations. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |18276 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18276 [Bug 18276] Koha::Biblio - Remove GetBiblioFromItemNumber -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #67857|0 |1 is obsolete| | --- Comment #3 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 67863 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67863&action=edit Bug 19431: Fix error when checking out an unknown barcode It seems this has been caused by commit 1544f9a5d4a8acd47c97d7c6ac55dee8e759d3ff Bug 18276: Remove GetBiblioFromItemNumber - circulation pages To reproduce the problem you need switch on the two prefs - OnSiteCheckouts - OnSiteCheckoutsForce Test plan: Try to check an item out using an unknown barcode With the 2 prefs set to on and without this patch, you will get the following error in the log Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. With this patch applied you should not get this error and a correct behaviour for the different pref combinations. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #67863|0 |1 is obsolete| | --- Comment #4 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 67917 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67917&action=edit Bug 19431: Fix error when checking out an unknown barcode It seems this has been caused by commit 1544f9a5d4a8acd47c97d7c6ac55dee8e759d3ff Bug 18276: Remove GetBiblioFromItemNumber - circulation pages To reproduce the problem you need switch on the two prefs - OnSiteCheckouts - OnSiteCheckoutsForce Test plan: Try to check an item out using an unknown barcode With the 2 prefs set to on and without this patch, you will get the following error in the log Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. With this patch applied you should not get this error and a correct behaviour for the different pref combinations. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Works in my testing. I would suggest adding parens to the second conditional: if ( (a and b) or (c) ) just for clarity, but not necessary if you don't want to -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I will take a look again later but I think the condition is wrong, I guess it should be if( $item and ( !$blocker or $force_allow_issue ) ){ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #67917|0 |1 is obsolete| | --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 67966 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67966&action=edit Bug 19431: Fix error when checking out an unknown barcode It seems this has been caused by commit 1544f9a5d4a8acd47c97d7c6ac55dee8e759d3ff Bug 18276: Remove GetBiblioFromItemNumber - circulation pages To reproduce the problem you need switch on the two prefs - OnSiteCheckouts - OnSiteCheckoutsForce Test plan: Try to check an item out using an unknown barcode With the 2 prefs set to on and without this patch, you will get the following error in the log Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. With this patch applied you should not get this error and a correct behaviour for the different pref combinations. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Sorry about that, the condition was wrong! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #67966|0 |1 is obsolete| | --- Comment #9 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 68069 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68069&action=edit Bug 19431: Fix error when checking out an unknown barcode It seems this has been caused by commit 1544f9a5d4a8acd47c97d7c6ac55dee8e759d3ff Bug 18276: Remove GetBiblioFromItemNumber - circulation pages To reproduce the problem you need switch on the two prefs - OnSiteCheckouts - OnSiteCheckoutsForce Test plan: Try to check an item out using an unknown barcode With the 2 prefs set to on and without this patch, you will get the following error in the log Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. With this patch applied you should not get this error and a correct behaviour for the different pref combinations. Signed-off-by: Owen Leonard <oleonard@myacpl.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QA: Looking here now -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|Trivial patch |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- - unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) { + if ( $error->{UNKNOWN_BARCODE} or not $onsite_checkout or not C4::Context->preference("OnSiteCheckoutsForce") ) { If CanBookBeIssued sets the UNKNOWN_BARCODE flag, it returns no DEBT question and no other impossible errors. But since there is one error, it will set $blocker to 1. Just wondering if there are other errors that should trigger the blocker flag when doing onsite checkouts here. If CanBookBeIssued said No, when is an onsite checkout still possible? - if( !$blocker || $force_allow_issue ){ + + if( $item and ( !$blocker or $force_allow_issue ) ){ Since you raised the blocker flag in the unknown barcode case, you do not need to test for $item here. Note that item is found by barcode and CanBookBeIssued calls GetItem with barcode parameter. Please clarify/adjust. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #12 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Marcel de Rooy from comment #11)
- unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) { + if ( $error->{UNKNOWN_BARCODE} or not $onsite_checkout or not C4::Context->preference("OnSiteCheckoutsForce") ) {
If CanBookBeIssued sets the UNKNOWN_BARCODE flag, it returns no DEBT question and no other impossible errors. But since there is one error, it will set $blocker to 1. Just wondering if there are other errors that should trigger the blocker flag when doing onsite checkouts here. If CanBookBeIssued said No, when is an onsite checkout still possible?
I put the test there to avoid to copy paste the blocker=1 and the IMPOSSIBLE flag. Do you have something better to suggest?
- if( !$blocker || $force_allow_issue ){ + + if( $item and ( !$blocker or $force_allow_issue ) ){
Since you raised the blocker flag in the unknown barcode case, you do not need to test for $item here. Note that item is found by barcode and CanBookBeIssued calls GetItem with barcode parameter.
Yes definitely, but this code is very confusing and I think explicitly tell we need $item here makes sense (even if useless in a algorithm pov, in my opinion it helps the read). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #12)
(In reply to Marcel de Rooy from comment #11)
- unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) { + if ( $error->{UNKNOWN_BARCODE} or not $onsite_checkout or not C4::Context->preference("OnSiteCheckoutsForce") ) {
If CanBookBeIssued sets the UNKNOWN_BARCODE flag, it returns no DEBT question and no other impossible errors. But since there is one error, it will set $blocker to 1. Just wondering if there are other errors that should trigger the blocker flag when doing onsite checkouts here. If CanBookBeIssued said No, when is an onsite checkout still possible?
I put the test there to avoid to copy paste the blocker=1 and the IMPOSSIBLE flag. Do you have something better to suggest?
My question was: Is UNKNOWN_BARCODE the only one needed here? Should the blocker flag be set (among other things) for other types of errors ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #14 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- UNKNOWN_BARCODE is the one we need to add to fix this bug. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #14)
UNKNOWN_BARCODE is the one we need to add to fix this bug.
Hmm I never thought of that ;) I am not blocking this patch but I raised a valid question and got no answer. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #68069|0 |1 is obsolete| | --- Comment #16 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 68462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68462&action=edit Bug 19431: Fix error when checking out an unknown barcode It seems this has been caused by commit 1544f9a5d4a8acd47c97d7c6ac55dee8e759d3ff Bug 18276: Remove GetBiblioFromItemNumber - circulation pages To reproduce the problem you need switch on the two prefs - OnSiteCheckouts - OnSiteCheckoutsForce Test plan: Try to check an item out using an unknown barcode With the 2 prefs set to on and without this patch, you will get the following error in the log Can't call method "materials" on an undefined value at /home/vagrant/kohaclone/circ/circulation.pl line 387. With this patch applied you should not get this error and a correct behaviour for the different pref combinations. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 --- Comment #17 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Marcel de Rooy from comment #15)
(In reply to Jonathan Druart from comment #14)
UNKNOWN_BARCODE is the one we need to add to fix this bug.
Hmm I never thought of that ;) I am not blocking this patch but I raised a valid question and got no answer.
To be honest I have no idea what we need to do more. The subroutine and the script are very ugly and need a full refurnish to be readable and less error-prone. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #18 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 17.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19431 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |fridolin.somers@biblibre.co | |m Status|Pushed to Master |RESOLVED --- Comment #19 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Does not appear in 17.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org