Bug 12330

Summary: hide item types, collections, locations on advanced search if hidden by opachiddenitems
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: OPACAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, m.de.rooy, marjorie.barry-vila, mtompset, sandboxes, tmisilo, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10937
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 12330: OpacHiddenItems not affecting Advanced Search
Bug 12330: OpacHiddenItems not affecting Advanced Search
[SIGNED-OFF] Bug 12330: OpacHiddenItems not affecting Advanced Search
Bug 12330: OpacHiddenItems not affecting Advanced Search
Bug 12330: [QA Follow-up] Consistency between opac-search and staff client

Description Nicole C. Engard 2014-05-29 16:41:30 UTC
If an item type, collection code or shelving location is hidden from opac view with the opachiddenitems preference then they should be hidden as options on the advanced search page as well.
Comment 1 Mark Tompsett 2014-05-30 01:11:08 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2014-05-30 01:34:33 UTC Comment hidden (obsolete)
Comment 3 Biblibre Sandboxes 2014-05-30 13:31:51 UTC
Patch tested with a sandbox, by Nicole Engard <nengard@bywatersolutions.com>
Comment 4 Nicole C. Engard 2014-05-30 13:33:13 UTC
That was my first time using the sandbox ... Did I do it right? I don't see the signed off patch attached here.

Nicole
Comment 5 Mark Tompsett 2014-05-30 13:36:09 UTC
Hmmm... I don't see the signed off patched either.
Comment 6 Nicole C. Engard 2014-05-30 13:40:38 UTC Comment hidden (obsolete)
Comment 7 Nicole C. Engard 2014-05-30 13:41:11 UTC
Did the sign off the traditional way as well to get the attachment - there might be a problem with the sandboxes attaching patches.
Comment 8 Jonathan Druart 2014-05-30 14:04:26 UTC
(In reply to Nicole C. Engard from comment #7)
> Did the sign off the traditional way as well to get the attachment - there
> might be a problem with the sandboxes attaching patches.

I think I did not update git-bz on sandboxes.
It is on my todo list...
Comment 9 Marjorie Barry-Vila 2014-06-03 17:30:34 UTC
Hi,

I tested it on a sandbox and i have a question:
location and items types should be hidden on facets too if there are exclued in syspref?
Will i create a new bug on bz?

Regards,

Marjorie
Comment 10 Mark Tompsett 2014-06-03 20:09:05 UTC
(In reply to Marjorie Barry-Vila from comment #9)
> [should] location and items types be hidden on facets too if [they]
> are exclu[d]ed in [the OpacHiddenItems] syspref?

This bug handles just the Advanced Search page's criteria. Facets are on the OPAC results page, and thus beyond the scope of this bug.

> Will i create a new bug on bz?

I'm not sure, because Bug 10891 was all about customizing which facets are viewable. That would certainly cover the scope of what you are asking about.
Comment 11 Marjorie Barry-Vila 2014-06-04 12:32:48 UTC
(In reply to M. Tompsett from comment #10)
> (In reply to Marjorie Barry-Vila from comment #9)
> > [should] location and items types be hidden on facets too if [they]
> > are exclu[d]ed in [the OpacHiddenItems] syspref?
> 
> This bug handles just the Advanced Search page's criteria. Facets are on the
> OPAC results page, and thus beyond the scope of this bug.
> 
> > Will i create a new bug on bz?
> 
> I'm not sure, because Bug 10891 was all about customizing which facets are
> viewable. That would certainly cover the scope of what you are asking about.

Thank you for your reply and corrected faults. You are right for bug 10891.

Regards,
Marjorie
Comment 12 Marcel de Rooy 2014-07-09 14:11:34 UTC
Created attachment 29585 [details] [review]
Bug 12330: OpacHiddenItems not affecting Advanced Search

This patch affects only the area displayed on Advanced Search
by setting the AdvancedSearchTypes OPAC system preference
accordingly. Prior to this patch, no filtering based on
OpacHiddenItems was done. This patch determines if itemtypes,
collections, or shelving locations are hidden and prevents
them from being shown.

TEST PLAN
---------
 1) Back up your DB (always handy)
 2) Set the Searching system preference AdvancedSearchTypes to:
    'itemtypes|ccode|loc' (without the single quotes).
 3) Set the OPAC system preference OpacHiddenItems to include the
    lines:
     itype: [{list of itemtype codes separated by commas}]
     location: [{list of comma delimited shelving location codes}]
     ccode: [{list of comma delimited collection codes}]
    Make sure to exclude one value for each, so there will be at
    least one known thing on each tab.
 4) Open the OPAC.
 5) Click on 'Advanced Search'
    -- three tabs appear: Itemtypes, Collection, Shelving location
    -- Everything is visible
 6) Set the Searching system preference AdvancedSearchTypes to:
    'itemtypes | ccode |     loc' (without the single quotes).
 7) Refresh the OPAC.
    -- There will be three tabs, but ugliness ensues.
 8) Apply the patch
 9) Refresh the OPAC.
    -- You will see: Itemtypes, Collection, Shelving location
    -- Only excluded values from OpacHiddenItems will be seen.
10) Run koha qa test tools

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
All tests pass

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Small rewording in comment only.
Comment 13 Marcel de Rooy 2014-07-09 14:12:34 UTC
Created attachment 29586 [details] [review]
Bug 12330: [QA Follow-up] Consistency between opac-search and staff client

In opac-search two regexes are added for the results of splitting the
pref AdvancedSearchTypes, allowing spaces before and after the names.
The same regexes should be added to catalogue/search.pl to have the
same behavior there.

Test plan:
Set AdvancedSearchTypes to "itemtypes  |  ccode |  loc " (no quotes).
Check OPAC and staff with and without this patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Tomás Cohen Arazi (tcohen) 2014-09-05 15:33:04 UTC
Patches pushed to master.

Thanks Mark!