[Bug 29802] New: biblionumber in OPACHiddenItems breaks opac lists
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Bug ID: 29802 Summary: biblionumber in OPACHiddenItems breaks opac lists Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org When biblionumber is in the opachiddenitems preference the query to find hidden items dies: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblionumber' in where clause is ambiguous [for Statement "SELECT `me`.`itemnumber`, `me`.`biblionumber`, `me`.`biblioitemnumber`, `me`.`barcode`, `me`.`dateaccessioned`, `me`.`booksellerid`, `me`.`homebranch`, `me`.`price`, `me`.`replacementprice`, `me`.`replacementpricedate`, `me`.`datelastborrowed`, `me`.`datelastseen`, `me`.`stack`, `me`.`notforloan`, `me`.`damaged`, `me`.`damaged_on`, `me`.`itemlost`, `me`.`itemlost_on`, `me`.`withdrawn`, `me`.`withdrawn_on`, `me`.`itemcallnumber`, `me`.`coded_location_qualifier`, `me`.`issues`, `me`.`renewals`, `me`.`reserves`, `me`.`restricted`, `me`.`itemnotes`, `me`.`itemnotes_nonpublic`, `me`.`holdingbranch`, `me`.`timestamp`, `me`.`location`, `me`.`permanent_location`, `me`.`onloan`, `me`.`cn_source`, `me`.`cn_sort`, `me`.`ccode`, `me`.`materials`, `me`.`uri`, `me`.`itype`, `me`.`more_subfields_xml`, `me`.`enumchron`, `me`.`copynumber`, `me`.`stocknumber`, `me`.`new_status`, `me`.`exclude_from_local_holds_priority`, `branchtransfers`.`branchtransfer_id`, `branchtransfers`.`itemnumber`, `branchtransfers`.`daterequested`, `branchtransfers`.`datesent`, `branchtransfers`.`frombranch`, `branchtransfers`.`datearrived`, `branchtransfers`.`datecancelled`, `branchtransfers`.`tobranch`, `branchtransfers`.`comments`, `branchtransfers`.`reason`, `branchtransfers`.`cancellation_reason`, `reserves`.`reserve_id`, `reserves`.`borrowernumber`, `reserves`.`reservedate`, `reserves`.`biblionumber`, `reserves`.`branchcode`, `reserves`.`desk_id`, `reserves`.`notificationdate`, `reserves`.`reminderdate`, `reserves`.`cancellationdate`, `reserves`.`cancellation_reason`, `reserves`.`reservenotes`, `reserves`.`priority`, `reserves`.`found`, `reserves`.`timestamp`, `reserves`.`itemnumber`, `reserves`.`waitingdate`, `reserves`.`expirationdate`, `reserves`.`lowestPriority`, `reserves`.`suspend`, `reserves`.`suspend_until`, `reserves`.`itemtype`, `reserves`.`item_level_hold`, `reserves`.`non_priority` FROM `items` `me` LEFT JOIN `branchtransfers` `branchtransfers` ON `branchtransfers`.`itemnumber` = `me`.`itemnumber` LEFT JOIN `reserves` `reserves` ON `reserves`.`itemnumber` = `me`.`itemnumber` WHERE ( ( ( `biblionumber` NOT IN ( ?, ?, ?, ?, ?, ? ) OR `biblionumber` IS NULL ) AND `itemlost` = ? AND ( `itype` NOT IN ( ?, ? ) OR `itype` IS NULL ) AND ( `location` NOT IN ( ?, ? ) OR `location` IS NULL ) AND `me`.`biblionumber` = ? AND 1=1 ) ) ORDER BY `me`.`itemnumber`" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |koha-bugs@lists.koha-commun | |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=29802 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=29802 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 129101 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=129101&action=edit Bug 29802: add 'me' to filter_by_visible_in_opac query This patch prefixes all of the fields in OpacHiddenItems with "me." before searching. Unit tests added to cover this case1 To test: 1 - Create a public list 2 - Set OpacHiddenItems to: biblionumber: [1] 3 - Attempt to view list in OPAC 4 - Booom 5 - Aply patch 6 - Reload list 7 - Success -- 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=29802 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #2 from Fridolin Somers <fridolin.somers@biblibre.com> --- Indeed, this comes from C4::XSLT::buildKohaItemsNamespace : $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } ); -- 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=29802 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch -- 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=29802 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #129101|0 |1 is obsolete| | --- Comment #3 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 131099 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131099&action=edit Bug 29802: add 'me' to filter_by_visible_in_opac query This patch prefixes all of the fields in OpacHiddenItems with "me." before searching. Unit tests added to cover this case1 To test: 1 - Create a public list 2 - Set OpacHiddenItems to: biblionumber: [1] 3 - Attempt to view list in OPAC 4 - Booom 5 - Aply patch 6 - Reload list 7 - Success Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> -- 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=29802 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=29802 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | Patch complexity|Trivial patch |Small patch Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | -- 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=29802 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Please show that it breaks in your test. And that your change resolves that. And tell me what this does: + my $mocked_context = Test::MockModule->new('C4::Context'); + $mocked_context->mock( 'yaml_preference', sub { + return { biblionumber => [ $biblio2->biblionumber ] }; + }); I think it is useless code. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 131911 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131911&action=edit Bug 29802: Unit tests prove -v t/db_dependent/Koha/Items.t prove -v t/db_dependent/XSLT.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131099|0 |1 is obsolete| | --- Comment #6 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 131912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131912&action=edit Bug 29802: add 'me' to filter_by_visible_in_opac query This patch prefixes all of the fields in OpacHiddenItems with "me." before searching. Unit tests added to cover this case1 To test: 1 - Create a public list 2 - Set OpacHiddenItems to: biblionumber: [1] 3 - Attempt to view list in OPAC 4 - Booom 5 - Aply patch 6 - Reload list 7 - Success Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- (In reply to Marcel de Rooy from comment #4)
Please show that it breaks in your test. And that your change resolves that.
Tests updated and moved to own patch
And tell me what this does: + my $mocked_context = Test::MockModule->new('C4::Context'); + $mocked_context->mock( 'yaml_preference', sub { + return { biblionumber => [ $biblio2->biblionumber ] }; + });
I think it is useless code.
Looks like you are correct - copied from Items.t - seems to have been done for convenience there, mocking pref directly works -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Jonathan Druart <jonathan.druart+koha@gmail.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=29802 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131911|0 |1 is obsolete| | Attachment #131912|0 |1 is obsolete| | --- Comment #8 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 131970 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131970&action=edit Bug 29802: Unit tests prove -v t/db_dependent/Koha/Items.t prove -v t/db_dependent/XSLT.t Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #9 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 131971 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131971&action=edit Bug 29802: add 'me' to filter_by_visible_in_opac query This patch prefixes all of the fields in OpacHiddenItems with "me." before searching. Unit tests added to cover this case1 To test: 1 - Create a public list 2 - Set OpacHiddenItems to: biblionumber: [1] 3 - Attempt to view list in OPAC 4 - Booom 5 - Aply patch 6 - Reload list 7 - Success Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24254 CC| |jonathan.druart+koha@gmail. | |com Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24254 [Bug 24254] Add Koha::Items->filter_by_visible_in_opac -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #10 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Sorry Marcel, I didn't you were assigned as QA contact here. Feel free to switch it back to NQA if you want to have another look. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #10)
Sorry Marcel, I didn't you were assigned as QA contact here. Feel free to switch it back to NQA if you want to have another look.
No reason to :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #12 from Fridolin Somers <fridolin.somers@biblibre.com> --- Whaoo what a complex programing paradox ;) great job and great unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29802 --- Comment #13 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, 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=29802 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Status|Pushed to master |Pushed to stable Version(s)|22.05.00 |22.05.00,21.11.05 released in| | --- Comment #14 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.11.x for 21.11.05 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org