[Bug 21475] New: Error in the OPAC when viewing a record which has no biblio-level itemtype
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 Bug ID: 21475 Summary: Error in the OPAC when viewing a record which has no biblio-level itemtype Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: critical Priority: P5 - low Component: OPAC Assignee: koha-bugs@lists.koha-community.org Reporter: oleonard@myacpl.org QA Contact: testopia@bugs.koha-community.org When I view in the OPAC a record which has no biblio-level itemtype I get an error: Can't call method "may_article_request" on an undefined value at /home/vagrant/kohaclone/opac/opac-detail.pl line 761 My item-level_itypes system preference is set to "specific item." -- 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=21475 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Depends on| |17530 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Caused by: commit e85d6e12ea4dccd8fa08ec600864c2f985dcf886 Bug 17530: (QA follow-up) Move may_article_request to ItemType Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17530 [Bug 17530] Don't show 'article request' link when no article requests are permitted -- 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=21475 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Also, from C4::Circulation::transferbook: 324 my $code = C4::Context->preference("BranchTransferLimitsType") eq 'ccode' ? $item->ccode : $item->biblio->biblioitem->itemtype; # BranchTransferLimitsType is 'ccode' or 'itemtype' -- 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=21475 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Jonathan Druart from comment #2)
Also, from C4::Circulation::transferbook:
324 my $code = C4::Context->preference("BranchTransferLimitsType") eq 'ccode' ? $item->ccode : $item->biblio->biblioitem->itemtype; # BranchTransferLimitsType is 'ccode' or 'itemtype'
Scratch that, it should not explode. -- 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=21475 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl Status|NEW |ASSIGNED --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #1)
Caused by: commit e85d6e12ea4dccd8fa08ec600864c2f985dcf886 Bug 17530: (QA follow-up) Move may_article_request to ItemType
O no -- 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=21475 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |m.de.rooy@rijksmuseum.nl |ity.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=21475 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff 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=21475 --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 80591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80591&action=edit Bug 21475: Fix crash on missing default itemtype Test plan: Enable ArticleRequests. Find book without itemtype (942c). Maybe you need this: update biblioitems set itemtype=NULL where biblionumber=[...] Goto opac detail for that book. No crash anymore? 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=21475 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80591|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 80593 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80593&action=edit Bug 21475: Fix crash on missing default itemtype Test plan: Enable ArticleRequests. Find book without itemtype (942c). Maybe you need this: update biblioitems set itemtype=NULL where biblionumber=[...] Goto opac detail for that book. No crash anymore? 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=21475 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=21475 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80593|0 |1 is obsolete| | --- Comment #7 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 80595 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80595&action=edit Bug 21475: Fix crash on missing default itemtype Test plan: Enable ArticleRequests. Find book without itemtype (942c). Maybe you need this: update biblioitems set itemtype=NULL where biblionumber=[...] Goto opac detail for that book. No crash anymore? Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> 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=21475 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Bug 21150 added a check on the different item types configuration, but actually biblioitems.itemtype must be set to a valid itemtypes whatever is the value of the pref. This bug highlights the problem quite well, and we certainly have it for holds as well. I am in favor of workarounding it for now if incorrectly set, but what about adding a new check to the misc/maintenance/search_for_data_inconsistencies.pl script? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 --- Comment #9 from Julian Maurice <julian.maurice@biblibre.com> --- Comment on attachment 80595 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80595 Bug 21475: Fix crash on missing default itemtype Review of attachment 80595: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=21475&attachment=80595) ----------------------------------------------------------------- ::: opac/opac-detail.pl @@ +762,5 @@
my $artreqpossible = $patron ? $biblio->can_article_request( $patron ) + : $itemtype + ? $itemtype->may_article_request + : q{};
I think it's odd to return an empty string for what seems to be a boolean value. I can see that can_article_request and may_article_request do the same thing so it's consistent. But why not return simply 0 (as 1 is used for the true value) ? And why q{} instead of just '' ? Is there some kind of consensus about this that I'm not aware of ? (Note that this will not block QA, I'm just curious) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Julian Maurice from comment #9)
I think it's odd to return an empty string for what seems to be a boolean value. I can see that can_article_request and may_article_request do the same thing so it's consistent. But why not return simply 0 (as 1 is used for the true value) ? And why q{} instead of just '' ? Is there some kind of consensus about this that I'm not aware of ? (Note that this will not block QA, I'm just curious)
Empty string is in perl the default for false (not 0). q{} seems to be preferred above ''. The Koha codebase contains all variations. Nothing important. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 --- Comment #11 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Not important but I told the same few weeks ago, so we are at least 2 to think it's weird :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #12 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Marcel de Rooy from comment #10)
Empty string is in perl the default for false (not 0). q{} seems to be preferred above ''. The Koha codebase contains all variations. Nothing important.
Perl is weird. But it makes more sense now, thanks. (In reply to Jonathan Druart from comment #11)
Not important but I told the same few weeks ago, so we are at least 2 to think it's weird :)
I'm glad to know I'm not the only one :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80595|0 |1 is obsolete| | --- Comment #13 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 80843 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80843&action=edit Bug 21475: Fix crash on missing default itemtype Test plan: Enable ArticleRequests. Find book without itemtype (942c). Maybe you need this: update biblioitems set itemtype=NULL where biblionumber=[...] Goto opac detail for that book. No crash anymore? Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 Julian Maurice <julian.maurice@biblibre.com> 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=21475 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #14 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 18.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21475 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED CC| |martin.renvoize@ptfs-europe | |.com --- Comment #15 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Dependancy/Cause not in 18.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org