Bugzilla – Attachment 17963 Details for
Bug 10200
Add more Independent Branches options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10200 - Add more Independent Branches options - Part 2 - IndependentBranchesOpacSearch
Bug-10200---Add-more-Independent-Branches-options-.patch (text/plain), 8.38 KB, created by
Kyle M Hall
on 2013-05-06 14:32:00 UTC
(
hide
)
Description:
Bug 10200 - Add more Independent Branches options - Part 2 - IndependentBranchesOpacSearch
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-05-06 14:32:00 UTC
Size:
8.38 KB
patch
obsolete
>From 7db124d5595f37933c716e76fec3146573a1b511 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 6 May 2013 10:16:56 -0400 >Subject: [PATCH] Bug 10200 - Add more Independent Branches options - Part 2 - IndependentBranchesOpacSearch > >Enabling IndependentBranchesIntranetSearch will automatically add a >branch limit filter to the search results thus hiding all records >without one of more items owned by the library as defined by the >webserver environment variable BRANCHCODE for the given OPAC, including >records with no items attach. > >Test Plan: >1) Apply the patch >2) Run updatedatabase.pl >3) Add this line to the http-conf for your OPAC: > SetEnv BRANCHCODE "MPL" > Replace MPL with the branchcode you want to use for this test >4) Perform a search that will give results for both records which > have items owned by the set library, and records which have > no items owned by the set library. >5) Enable the new system preference IndependentBranchesOpacSearch >6) Perform the same search again, any records without items owned > by the library set in the BRANCHCODE environment variable should > not appear. >--- > installer/data/mysql/updatedatabase.pl | 20 ++++++- > .../prog/en/modules/admin/preferences/admin.pref | 7 +++ > .../opac-tmpl/prog/en/modules/opac-advsearch.tt | 58 ++++++++++++-------- > opac/opac-search.pl | 8 +++- > 4 files changed, 68 insertions(+), 25 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index a8cec45..7d61069 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6787,7 +6787,7 @@ if ( CheckVersion($DBversion) ) { > $DBversion = "3.11.00.XXX"; > if ( CheckVersion($DBversion) ) { > print "Upgrade to $DBversion done (IndependentBranches)\n"; >- $dbh->do(" >+ $dbh->do(q{ > INSERT INTO systempreferences ( > variable, > value, >@@ -6801,7 +6801,23 @@ if ( CheckVersion($DBversion) ) { > 'If on, the staff interface search will hide all records that do not contain an item owned by the logged in branch.', > 'YesNo' > ) >- "); >+ }); >+ >+ $dbh->do(q{ >+ INSERT INTO systempreferences ( >+ variable, >+ value, >+ options, >+ explanation, >+ type >+ ) VALUES ( >+ 'IndependentBranchesOpacSearch', >+ '0', >+ '', >+ "If on, the opac catalog search will hide all records that do not contain an item owned by the branchcode defined by the OPAC's branch via the URL.", >+ 'YesNo' >+ ) >+ }); > SetVersion ($DBversion); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index 41b04a9..5435daf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -77,6 +77,13 @@ Administration: > yes: Prevent > no: "Don't prevent" > - staff from seeing records without items owned by the logged in branch. >+ - >+ - pref: IndependentBranchesOpacSearch >+ default: 0 >+ choices: >+ yes: Prevent >+ no: "Don't prevent" >+ - OPAC search results from containing records that do not have item's owned by the library defined by the OPAC's branch via the URL. > CAS Authentication: > - > - pref: casAuthentication >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >index 825e8be..04b3455 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >@@ -282,30 +282,44 @@ > <div class="yui-u first"> > <!-- AVAILABILITY LIMITS --> > [% UNLESS ( singleBranchMode ) %] >- <div id="location" class="container"><fieldset><legend>Location and availability: </legend> >+ <div id="location" class="container"> >+ <fieldset> >+ <legend>Location and availability: </legend> > >- <label for="branchloop">Library:</label> >- <select name="limit" id="branchloop"> >- <option value="">All libraries</option> >- [% FOREACH BranchesLoo IN BranchesLoop %] >- [% IF ( BranchesLoo.selected ) %] >- <option value="branch:[% BranchesLoo.value %]" selected="selected">[% BranchesLoo.branchname %]</option> >- [% ELSE %] >- <option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option> >- [% END %] >- [% END %] >- </select> >- [% IF ( searchdomainloop ) %] >- <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. --> >- <label for="categoryloop">Groups of libraries</label><select name="multibranchlimit" id="categoryloop"> >- <option value=""> -- none -- </option> >- [% FOREACH searchdomainloo IN searchdomainloop %] >- <option value="[% searchdomainloo.categorycode %]">[% searchdomainloo.categoryname %]</option> >+ [% UNLESS IndependentBranchesOpacSearch %] >+ <label for="branchloop">Library:</label> >+ <select name="limit" id="branchloop"> >+ <option value="">All libraries</option> >+ [% FOREACH BranchesLoo IN BranchesLoop %] >+ [% IF ( BranchesLoo.selected ) %] >+ <option value="branch:[% BranchesLoo.value %]" selected="selected">[% BranchesLoo.branchname %]</option> >+ [% ELSE %] >+ <option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ >+ [% IF ( searchdomainloop ) %] >+ <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. --> >+ >+ <label for="categoryloop">Groups of libraries</label> >+ <select name="multibranchlimit" id="categoryloop"> >+ <option value=""> -- none -- </option> >+ [% FOREACH searchdomainloo IN searchdomainloop %] >+ <option value="[% searchdomainloo.categorycode %]">[% searchdomainloo.categoryname %]</option> >+ [% END %] >+ </select> >+ [% END %] > [% END %] >- </select> >- [% END %] >- <div style="margin-top:.4em"><label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label></div> >- </fieldset></div> >+ >+ <div style="margin-top:.4em"> >+ <label for="available-items"> >+ <input type="checkbox" id="available-items" name="limit" value="available" /> >+ Only items currently available for loan or reference >+ </label> >+ </div> >+ </fieldset> >+ </div> > [% END %] > <!-- /AVAILABILITY LIMITS --> > </div> >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 363a11e..228a0de 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -120,6 +120,8 @@ if ($template_name eq 'opac-results.tmpl') { > $template->param('COinSinOPACResults' => C4::Context->preference('COinSinOPACResults')); > } > >+$template->param( IndependentBranchesOpacSearch => C4::Context->preference('IndependentBranchesOpacSearch') ); >+ > # get biblionumbers stored in the cart > my @cart_list; > >@@ -402,7 +404,11 @@ if ($operands[0] && !$operands[1]) { > my @limits = $cgi->param('limit'); > @limits = map { uri_unescape($_) } @limits; > >-if($params->{'multibranchlimit'}) { >+if ( C4::Context->preference('IndependentBranchesOpacSearch') ) { >+ @limits = map { ( $_ =~ /^branch:/ ) ? undef : $_ } @limits; >+ push( @limits, "branch: " . $ENV{'BRANCHCODE'} ); >+} >+elsif($params->{'multibranchlimit'}) { > push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')'; > } > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10200
:
17960
|
17961
|
17963
|
17981
|
17982
|
17983
|
17984
|
17985
|
17986
|
17987