Summary: | biblionumber in OPACHiddenItems breaks opac lists | ||
---|---|---|---|
Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
Component: | OPAC | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | normal | ||
Priority: | P5 - low | CC: | fridolin.somers, jonathan.druart, kyle, m.de.rooy |
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: |
22.05.00,21.11.05
|
|
Circulation function: | |||
Bug Depends on: | 24254 | ||
Bug Blocks: | |||
Attachments: |
Bug 29802: add 'me' to filter_by_visible_in_opac query
Bug 29802: add 'me' to filter_by_visible_in_opac query Bug 29802: Unit tests Bug 29802: add 'me' to filter_by_visible_in_opac query Bug 29802: Unit tests Bug 29802: add 'me' to filter_by_visible_in_opac query |
Description
Nick Clemens (kidclamp)
2022-01-05 19:26:43 UTC
Created attachment 129101 [details] [review] 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 Indeed, this comes from C4::XSLT::buildKohaItemsNamespace : $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } ); Created attachment 131099 [details] [review] 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> 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. Created attachment 131911 [details] [review] Bug 29802: Unit tests prove -v t/db_dependent/Koha/Items.t prove -v t/db_dependent/XSLT.t Created attachment 131912 [details] [review] 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> (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 Created attachment 131970 [details] [review] 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> Created attachment 131971 [details] [review] 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> 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. (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 :) Whaoo what a complex programing paradox ;) great job and great unit tests Pushed to master for 22.05, thanks to everybody involved [U+1F984] Pushed to 21.11.x for 21.11.05 |