Bug 12242

Summary: Allow hiding branches from the OPAC search pulldowns
Product: Koha Reporter: paxed <pasi.kallinen>
Component: OPACAssignee: paxed <pasi.kallinen>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: dcook, magnus, marjorie.barry-vila, martin.renvoize, mtompset, veron
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27360
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31654
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Allow hiding branches from the OPAC search pulldowns

Description paxed 2014-05-13 11:07:19 UTC
We have a branch where items go during db conversion, if the item has any errors. This branch should not be shown to the patrons.

Patch to follow...
Comment 1 paxed 2014-05-13 11:15:03 UTC
Created attachment 28202 [details] [review]
Allow hiding branches from the OPAC search pulldowns

Libraries may have branches which are not in actual use, for
example our system has a branch where items with errors go
during database conversion from our old ILS.

These branches should not be shown to the patron.

This patch adds a new syspref OpacHideBranches, where you can
list branch codes, separated by pipe, to hide from the OPAC.

To test:
1) Apply patch
2) Check OPAC where library pulldowns are shown, eg. Advanced Search
   so that all libraries are listed.
3) Edit syspref OpacHideBranch, set it to some branch codes,
   separated by pipe.
4) Check OPAC that those libraries do not show up in the pulldowns.
Comment 2 Mark Tompsett 2014-05-13 12:12:00 UTC
Comment on attachment 28202 [details] [review]
Allow hiding branches from the OPAC search pulldowns

Review of attachment 28202 [details] [review]:
-----------------------------------------------------------------

::: C4/Auth.pm
@@ +417,5 @@
> +                    \@include_branches;
> +                } else {
> +                    $tmpbranches;
> +                }
> +            },

Inline functions like this are difficult to maintain. They are also difficult to write tests for.

If you modify C4 or Koha libraries, you need to write a test. This is only possible if you write this as a function.

I'm assuming GetBranchesLoop is in C4/Branches, and I think this function would better fit there.

This also seems like a convoluted way of doing it, but I could be wrong.

::: installer/data/mysql/sysprefs.sql
@@ +235,4 @@
>  ('OPACFRBRizeEditions','0','','If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
>  ('opacheader','','70|10','Add HTML to be included as a custom header in the OPAC','Textarea'),
>  ('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','Textarea'),
> +('OpacHideBranches','',NULL,'Hide these branches from OPAC search branches pull-down. (Use short branch names, separated by pipe-characters.)','Free'),

I'm not sure a system preference is the best way to do it, because you also have search groups which could show up in the drop downs.

Perhaps modifications to the library and group entry screens?
Comment 3 Mark Tompsett 2014-05-13 12:12:42 UTC
I am failing this because of the lack of tests when modifying a C4 or Koha library.
Comment 4 Magnus Enger 2014-06-16 09:39:51 UTC
paxed: Will you be using some other functionality to hide the items from searches? What happens if an item connected to your hidden branch turns up in a search?
Comment 5 Marc VĂ©ron 2016-10-04 16:33:00 UTC
Still valid?
Comment 6 Katrin Fischer 2022-09-12 05:59:02 UTC
ON bug 27360 David Cook suggested to use the OPAC public flag for this. I think this is not a bad idea to extend it's scope. What do others think?
Comment 7 Katrin Fischer 2022-09-12 05:59:32 UTC
*** Bug 31549 has been marked as a duplicate of this bug. ***
Comment 8 David Cook 2022-09-12 23:38:22 UTC
(In reply to Magnus Enger from comment #4)
> paxed: Will you be using some other functionality to hide the items from
> searches? What happens if an item connected to your hidden branch turns up
> in a search?

Yeah, you'd use OpacSuppression or OpacHideItems for that.
Comment 9 David Cook 2022-09-12 23:39:27 UTC
(In reply to Katrin Fischer from comment #6)
> ON bug 27360 David Cook suggested to use the OPAC public flag for this. I
> think this is not a bad idea to extend it's scope. What do others think?

I think that David Cook is on to something there... ;)
Comment 10 Martin Renvoize (ashimema) 2022-11-03 14:11:06 UTC

*** This bug has been marked as a duplicate of bug 31654 ***