Summary: | OPACs most popular feature includes titles hidden by OpacHiddenItems | ||
---|---|---|---|
Product: | Koha | Reporter: | Alex Buckley <alexbuckley> |
Component: | OPAC | Assignee: | David Cook <dcook> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P3 | CC: | david, dcook, katrin.fischer, nengard |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: |
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20662 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18989 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31161 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11690 |
||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This fixes the "Most popular" list in the OPAC (enabled using the OpacTopissue system preference) so that items are correctly excluded when the OpacSuppression and OpacHiddenItems system preferences are configured. Before this, settings for these two system preferences had no effect on the "Most popular" page.
|
Version(s) released in: | |
Bug Depends on: | |||
Bug Blocks: | 24403 | ||
Attachments: |
Bug 17904: Make OPAC "Most popular" respect hidden record sysprefs
Bug 19704: Make OPAC "Most popular" respect hidden record sysprefs Bug 19704: Make OPAC "Most popular" respect hidden record sysprefs |
Description
Alex Buckley
2017-11-27 21:39:28 UTC
*** Bug 20662 has been marked as a duplicate of this bug. *** Still an issue in master It should also take into account OpacSuppression "OpacHiddenItems" is such a pain... I was thinking that it's too bad that we don't just save a "hidden" status when items are saved, but then I remembered that you can update "OpacHiddenItems" at any time, and that can dramatically change which records are hidden, and it would be expensive to re-calculate a stored state for every record as a result... But with C4::Circulation::GetTopIssues, we need to process every record fetched to see if it's hidden... I suppose we could fetch $count and if X records are hidden then we need to fetch at least X new records (based off the $count offset) to try to fill in the gaps. It wouldn't be very efficient but it might be the only way of working with the current "hidden" model... Technically, using multiple queries could also mean we could run into a race condition but I can't think of any other way of doing it. (In reply to David Cook from comment #5) > Technically, using multiple queries could also mean we could run into a race > condition but I can't think of any other way of doing it. Actually, one safeguard against that would be to initially pre-fetch X records more than we need I suppose... Actually... I have another idea... https://wiki.koha-community.org/wiki/OpacHiddenItems We could read that YAML into a Perl hash and then create a DBIC query or use SQL::Abstract... Of course, that wouldn't take into account "OpacSuppression" which isn't stored anywhere except the MARCXML. Maybe a database column would make sense for "OpacSuppression"... (In reply to David Cook from comment #7) > Actually... I have another idea... > > https://wiki.koha-community.org/wiki/OpacHiddenItems > > We could read that YAML into a Perl hash and then create a DBIC query or use > SQL::Abstract... Ah the syspref "OpacHiddenItemsExceptions" exists... that makes it even more fun. Created attachment 136433 [details] [review] Bug 17904: Make OPAC "Most popular" respect hidden record sysprefs At the moment, OpacSuppression and OpacHiddenItems don't affect the output of the OPAC's "Most popular" page. This patch adds support for the OpacSuppression and OpacHiddenItems system preferences, so that items are excluded from the "Most popular" calculation based on the hidden rules. Test plan: 0a. Apply patches 0b. koha-plack --restart kohadev 0c. Log into Koha as "koha" user 1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacTopissue 2. Enable "OpacTopissue" 3. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51 4. Checkout 39999000001310 5. Checkout 39999000005578 6. Checkout 39999000004571 7. Checkout 39999000005592 8. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 9. See 3 titles 10. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems 11. Change "OpacHiddenItems" to the following (within the single quotes): barcode: [39999000001310,39999000005578] location: ['RANDOM','THAT','THIS'] 12. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 13. See 2 titles ("Gairm" is hidden, as is one of the items for "Continuous delivery /") 14. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItemsExceptions 15. Update the syspref to 'S' 16. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 17. See 3 titles again 18. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacSuppression 19. Change syspref to "Hide" 20. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=114 21. Change 942$n to "Yes" and save record 22. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 23. See 2 titles ("Clean code : a handbook of agile software craftsmanship / Robert C. Martin ... [et al.]" is suppressed Created attachment 136434 [details] [review] Bug 19704: Make OPAC "Most popular" respect hidden record sysprefs At the moment, OpacSuppression and OpacHiddenItems don't affect the output of the OPAC's "Most popular" page. This patch adds support for the OpacSuppression and OpacHiddenItems system preferences, so that items are excluded from the "Most popular" calculation based on the hidden rules. Test plan: 0a. Apply patches 0b. koha-plack --restart kohadev 0c. Log into Koha as "koha" user 1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacTopissue 2. Enable "OpacTopissue" 3. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51 4. Checkout 39999000001310 5. Checkout 39999000005578 6. Checkout 39999000004571 7. Checkout 39999000005592 8. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 9. See 3 titles 10. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems 11. Change "OpacHiddenItems" to the following (within the single quotes): barcode: [39999000001310,39999000005578] location: ['RANDOM','THAT','THIS'] 12. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 13. See 2 titles ("Gairm" is hidden, as is one of the items for "Continuous delivery /") 14. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItemsExceptions 15. Update the syspref to 'S' 16. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 17. See 3 titles again 18. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacSuppression 19. Change syspref to "Hide" 20. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=114 21. Change 942$n to "Yes" and save record 22. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 23. See 2 titles ("Clean code : a handbook of agile software craftsmanship / Robert C. Martin ... [et al.]" is suppressed) Created attachment 137273 [details] [review] Bug 19704: Make OPAC "Most popular" respect hidden record sysprefs At the moment, OpacSuppression and OpacHiddenItems don't affect the output of the OPAC's "Most popular" page. This patch adds support for the OpacSuppression and OpacHiddenItems system preferences, so that items are excluded from the "Most popular" calculation based on the hidden rules. Test plan: 0a. Apply patches 0b. koha-plack --restart kohadev 0c. Log into Koha as "koha" user 1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacTopissue 2. Enable "OpacTopissue" 3. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51 4. Checkout 39999000001310 5. Checkout 39999000005578 6. Checkout 39999000004571 7. Checkout 39999000005592 8. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 9. See 3 titles 10. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems 11. Change "OpacHiddenItems" to the following (within the single quotes): barcode: [39999000001310,39999000005578] location: ['RANDOM','THAT','THIS'] 12. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 13. See 2 titles ("Gairm" is hidden, as is one of the items for "Continuous delivery /") 14. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItemsExceptions 15. Update the syspref to 'S' 16. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 17. See 3 titles again 18. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacSuppression 19. Change syspref to "Hide" 20. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=114 21. Change 942$n to "Yes" and save record 22. Go to http://localhost:8080/cgi-bin/koha/opac-topissues.pl?limit=10&branch=&itemtype=&timeLimit=999&do_it=1 23. See 2 titles ("Clean code : a handbook of agile software craftsmanship / Robert C. Martin ... [et al.]" is suppressed) Signed-off-by: David Nind <david@davidnind.com> Quite keen to see this one fixed, but we have 2 complaints in the QA test tools. Can you please fix? FAIL C4/Circulation.pm FAIL critic # Variables::ProhibitConditionalDeclarations: Got 2 violation(s). (In reply to Katrin Fischer from comment #13) > Quite keen to see this one fixed, but we have 2 complaints in the QA test > tools. Can you please fix? > > FAIL C4/Circulation.pm > FAIL critic > # Variables::ProhibitConditionalDeclarations: Got 2 violation(s). I saw your message, and it's on my TODO list. I'll be coming back to this! (In reply to David Cook from comment #14) > (In reply to Katrin Fischer from comment #13) > > Quite keen to see this one fixed, but we have 2 complaints in the QA test > > tools. Can you please fix? > > > > FAIL C4/Circulation.pm > > FAIL critic > > # Variables::ProhibitConditionalDeclarations: Got 2 violation(s). > > I saw your message, and it's on my TODO list. I'll be coming back to this! My ever growing TODO list, unfortunately... Ping? :) I think I need to refactor this one. Need to move the code into a separate module and add unit tests for it. The Hidden and Suppression fields need more methods built up around them... (In reply to David Cook from comment #17) > I think I need to refactor this one. > > Need to move the code into a separate module and add unit tests for it. Although that's hard to do because it needs to produce SQL specific to the GetTopIssues function in C4::Circulation... *** Bug 11690 has been marked as a duplicate of this bug. *** Would be great to see this one revived. (In reply to Katrin Fischer from comment #20) > Would be great to see this one revived. It's pretty low on my list at the moment, so I probably won't be looking at it until early to mid 2024 I think. |