Bugzilla – Attachment 17961 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 1 - IndependentBranchesIntranetSearch
Bug-10200---Add-more-Independent-Branches-options-.patch (text/plain), 11.68 KB, created by
Kyle M Hall
on 2013-05-06 13:50:57 UTC
(
hide
)
Description:
Bug 10200 - Add more Independent Branches options - Part 1 - IndependentBranchesIntranetSearch
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-05-06 13:50:57 UTC
Size:
11.68 KB
patch
obsolete
>From b0da4938e9af442f05bb38218ff366e9cd44b309 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 6 May 2013 09:44:01 -0400 >Subject: [PATCH] Bug 10200 - Add more Independent Branches options - Part 1 - IndependentBranchesIntranetSearch > >Enabling IndependentBranchesIntranetSearch will automatically add a >branch limit filter to the search results thus hiding all records >without one or more items owned by the logged in library, including >records with no items attached. > >Test Plan: >1) Apply patch >2) Run updatedatabase.pl >3) Perform a search that will give results for both records which > have items owned by the logged in library, and records which have > no items owned by the logged in library. >4) Enable the new system preference IndependentBranchesIntranetSearch >5) Perform the same search again, any records without items owned > by the currently logged in library should not appear. >--- > catalogue/search.pl | 10 +++- > installer/data/mysql/updatedatabase.pl | 20 ++++++ > .../intranet-tmpl/prog/en/includes/cat-search.inc | 64 +++++++++++--------- > .../prog/en/modules/admin/preferences/admin.pref | 7 ++ > .../prog/en/modules/catalogue/advsearch.tt | 58 ++++++++++-------- > 5 files changed, 105 insertions(+), 54 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 8624b3b..6d4ebd1 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -179,9 +179,13 @@ else { > flagsrequired => { catalogue => 1 }, > } > ); >+ >+$template->param( IndependentBranchesIntranetSearch => C4::Context->preference('IndependentBranchesIntranetSearch') ); >+ > if (C4::Context->preference("marcflavour") eq "UNIMARC" ) { > $template->param('UNIMARC' => 1); > } >+ > if (C4::Context->preference("IntranetNumbersPreferPhrase")) { > $template->param('numbersphr' => 1); > } >@@ -411,7 +415,11 @@ my @operands = $cgi->param('q'); > # limits are use to limit to results to a pre-defined category such as branch or language > my @limits = $cgi->param('limit'); > >-if($params->{'multibranchlimit'}) { >+if ( C4::Context->preference('IndependentBranchesIntranetSearch') ) { >+ @limits = map { ( $_ =~ /^branch:/ ) ? undef : $_ } @limits; >+ push( @limits, "branch: " . C4::Context->userenv->{branch} ); >+} >+elsif( $params->{'multibranchlimit'} ) { > push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')'; > } > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index be4dfa2..a8cec45 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6784,6 +6784,26 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.11.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ print "Upgrade to $DBversion done (IndependentBranches)\n"; >+ $dbh->do(" >+ INSERT INTO systempreferences ( >+ variable, >+ value, >+ options, >+ explanation, >+ type >+ ) VALUES ( >+ 'IndependentBranchesIntranetSearch', >+ '0', >+ '', >+ 'If on, the staff interface search will hide all records that do not contain an item owned by the logged in branch.', >+ 'YesNo' >+ ) >+ "); >+ SetVersion ($DBversion); >+} > > =head1 FUNCTIONS > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc >index 186f1d1..4cf3e71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc >@@ -1,33 +1,41 @@ > <div class="gradient"> >-<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Catalogue Resident Search Box --> >-<div id="header_search"> >+ <h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Catalogue Resident Search Box --> >+ <div id="header_search"> > >-[% INCLUDE 'patron-search-box.inc' %] >+ [% INCLUDE 'patron-search-box.inc' %] > >-[% IF ( CAN_user_circulate ) %] >-<div id="checkin_search" class="residentsearch"> >- <p class="tip">Scan a barcode to check in:</p> >- <form method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off"> >- <input name="barcode" id="ret_barcode" size="40" /> >- <input value="Submit" class="submit" type="submit" /> >- </form> >-</div> >- [% END %] >- [% IF ( CAN_user_catalogue ) %] >- <div id="catalog_search" class="residentsearch"> >- <p class="tip">Enter search keywords:</p> >- <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="cat-search-block"> >- <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" /> >- <input type="submit" class="submit" value="Submit" /> >- </form> >- </div> >- [% END %] >- >- <ul> >- [% IF ( CAN_user_circulate ) %]<li><a href="#circ_search">Check out</a></li>[% END %] >- [% IF ( CAN_user_circulate ) %]<li><a href="#checkin_search">Check in</a></li>[% END %] >- [% IF ( CAN_user_catalogue ) %]<li class="ui-tabs-selected"><a href="#catalog_search">Search the catalog</a></li>[% END %] >- </ul> >-</div><!-- /header_search --> >+ [% IF ( CAN_user_circulate ) %] >+ <div id="checkin_search" class="residentsearch"> >+ <p class="tip">Scan a barcode to check in:</p> >+ <form method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off"> >+ <input name="barcode" id="ret_barcode" size="40" /> >+ <input value="Submit" class="submit" type="submit" /> >+ </form> >+ </div> >+ [% END %] >+ >+ [% IF ( CAN_user_catalogue ) %] >+ <div id="catalog_search" class="residentsearch"> >+ <p class="tip">Enter search keywords:</p> >+ <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="cat-search-block"> >+ <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" /> >+ <input type="submit" class="submit" value="Submit" /> >+ </form> >+ </div> >+ [% END %] >+ >+ >+ <ul> >+ [% IF ( CAN_user_circulate ) %] >+ <li><a href="#circ_search">Check out</a></li> >+ [% END %] >+ [% IF ( CAN_user_circulate ) %] >+ <li><a href="#checkin_search">Check in</a></li> >+ [% END %] >+ [% IF ( CAN_user_catalogue ) %] >+ <li class="ui-tabs-selected"><a href="#catalog_search">Search the catalog</a></li> >+ [% END %] >+ </ul> >+ </div><!-- /header_search --> > </div><!-- /gradient --> > <!-- End Catalogue Resident Search Box --> >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 bb5c546..41b04a9 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 >@@ -70,6 +70,13 @@ Administration: > yes: Prevent > no: "Don't prevent" > - staff (but not superlibrarians) from modifying objects (holds, items, patrons, etc.) belonging to other libraries. >+ - >+ - pref: IndependentBranchesIntranetSearch >+ default: 0 >+ choices: >+ yes: Prevent >+ no: "Don't prevent" >+ - staff from seeing records without items owned by the logged in branch. > CAS Authentication: > - > - pref: casAuthentication >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >index c982eb4..a3f6048 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -229,34 +229,42 @@ > [% END %] > > <!-- AVAILABILITY LIMITS --> >- <fieldset id="availability"><legend>Location and availability</legend> >-<fieldset id="currently-avail"> >- <p><label for="available-items">Only items currently available</label> <input type="checkbox" id="available-items" name="limit" value="available" /></p> >-</fieldset> >+<fieldset id="availability"><legend>Location and availability</legend> >+ <fieldset id="currently-avail"> >+ <p><label for="available-items">Only items currently available</label> <input type="checkbox" id="available-items" name="limit" value="available" /></p> >+ </fieldset> >+ >+ [% UNLESS IndependentBranchesIntranetSearch %] >+ <fieldset id="select-libs"> >+ <p> >+ <label for="branchloop">Individual libraries:</label> >+ <select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'> >+ <option value="">All libraries</option> >+ [% FOREACH branchloo IN branchloop %] >+ [% IF ( branchloo.selected ) %] >+ <option value="branch:[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> >+ [% ELSE %] >+ <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </p> > >-<fieldset id="select-libs"> >- <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'> >- <option value="">All libraries</option> >- [% FOREACH branchloo IN branchloop %] >- [% IF ( branchloo.selected ) %] >- <option value="branch:[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> >- [% ELSE %] >- <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option> >- [% END %] >- [% END %] >- </select></p> >- <!-- <input type="hidden" name="limit" value="branch: MAIN" /> --> >- [% IF ( searchdomainloop ) %] >- <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. --> >- <p><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></p> >+ [% IF ( searchdomainloop ) %] >+ <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. --> >+ <p> >+ <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> >+ </p> >+ [% END %] >+ </fieldset> > [% END %] > </fieldset> >- </fieldset> > <!-- /AVAILABILITY LIMITS --> > > <!-- RANK LIMITS --> >-- >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