From 3e027874b2b8e481f0dcfbe40bebc00ade90b3ed Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 6 May 2013 09:44:01 -0400 Subject: [PATCH] Bug 10278 - Add ability to hide items and records from search results for Independent Branches For the staff intranet, enabling IndependentBranchesRecordsAndItems 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. In add addition, all items whose homebranch is not that libraries will be filtered and hidden from the search results and record details. This system preference will not affect the OPAC, unless the environment variable BRANCHCODE is defined in the koha-httpd.conf file. If it is defined, the same filters are applied to the OPAC, but based on the branchcode value of the environment variable BRANCHCODE, rather than the logged in branch. 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 IndependentBranchesRecordesAndItems 5) Perform the same search again, any records without items owned by the currently logged in library should not appear. --- C4/Auth.pm | 2 +- C4/Branch.pm | 83 ++++++++++++++++---- C4/Context.pm | 36 +++++---- C4/Items.pm | 10 ++- C4/Search.pm | 71 +++++++++++++++++ C4/Serials.pm | 4 + catalogue/search.pl | 29 +++---- cataloguing/addbooks.pl | 3 +- cataloguing/additem.pl | 43 ++++++----- installer/data/mysql/updatedatabase.pl | 45 ++++++++--- .../intranet-tmpl/prog/en/includes/cat-search.inc | 64 +++++++++------- .../prog/en/modules/admin/preferences/admin.pref | 7 ++ .../prog/en/modules/catalogue/advsearch.tt | 59 ++++++++------ .../prog/en/modules/cataloguing/addbooks.tt | 2 + opac/opac-search.pl | 6 ++ 15 files changed, 327 insertions(+), 137 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 1e17e59..63751e8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -648,7 +648,7 @@ sub checkauth { $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), $session->param('emailaddress'), $session->param('branchprinter'), - $session->param('persona') + $session->param('persona'), $type ); C4::Context::set_shelves_userenv('bar',$session->param('barshelves')); C4::Context::set_shelves_userenv('pub',$session->param('pubshelves')); diff --git a/C4/Branch.pm b/C4/Branch.pm index 81d9dc3..2fe506a 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -42,6 +42,7 @@ BEGIN { &GetCategoryTypes &GetBranchCategories &GetBranchesInCategory + &GetCategoriesForBranch &ModBranchCategoryInfo &GetIndependentGroupModificationRights &DelBranch @@ -109,6 +110,7 @@ Create a branch selector with the following code. sub GetBranches { my ($onlymine)=@_; + $onlymine ||= onlymine(); # returns a reference to a hash of references to ALL branches... my %branches; my $dbh = C4::Context->dbh; @@ -431,6 +433,39 @@ sub GetBranchesInCategory { return( \@branches ); } +=head2 GetCategoriesForBranch + + my @categories = GetCategoriesForBranch({ + branchcode => $branchcode, + categorytype => 'independent_group' + }); + + Called in a list context, returns an array of branch category codes + that branch is part of. + + Called in a scalar context, returns an array ref. + +=cut + +sub GetCategoriesForBranch { + my ( $params ) = @_; + my $branchcode = $params->{branchcode}; + my $categorytype = $params->{categorytype} || '%'; + + carp("Missing branchcode parameter!") unless ( $branchcode ); + + my $sql = q{ + SELECT categorycode FROM branchrelations + JOIN branchcategories USING ( categorycode ) + WHERE branchcode = ? + AND categorytype = ? + }; + + my $categories = C4::Context->dbh->selectcol_arrayref( $sql, {}, ( $branchcode, $categorytype ) ); + + return wantarray() ? $categories : @$categories; +} + =head2 GetIndependentGroupModificationRights GetIndependentGroupModificationRights( @@ -460,7 +495,7 @@ sub GetBranchesInCategory { is useful for "branchcode IN $branchcodes" clauses in SQL queries. - $this_branch and $other_branch are equal for efficiency. + Returns 1 if $this_branch and $other_branch are equal for efficiency. So you can write: my @branches = GetIndependentGroupModificationRights(); @@ -472,30 +507,44 @@ sub GetBranchesInCategory { sub GetIndependentGroupModificationRights { my ($params) = @_; - my $this_branch = $params->{branch}; - my $other_branch = $params->{for}; - my $stringify = $params->{stringify}; + my $this_branch = $params->{branch} ||= q{}; + my $other_branch = $params->{for} ||= q{}; + my $stringify = $params->{stringify} ||= q{}; + $this_branch ||= $ENV{BRANCHCODE}; $this_branch ||= C4::Context->userenv->{branch}; - carp("No branch found!") unless ($this_branch); + unless ($this_branch) { + carp("No branch found!"); + return; + } return 1 if ( $this_branch eq $other_branch ); - my $sql = q{ - SELECT DISTINCT(branchcode) - FROM branchrelations - JOIN branchcategories USING ( categorycode ) - WHERE categorycode IN ( - SELECT categorycode - FROM branchrelations - WHERE branchcode = ? - ) - AND branchcategories.categorytype = 'independent_group' - }; + my $allow_all = 0; + $allow_all = 1 if C4::Context->IsSuperLibrarian(); + $allow_all = 1 if C4::Context->userenv->{type} eq 'opac' && !$ENV{BRANCHCODE}; + my $sql; my @params; - push( @params, $this_branch ); + if ( $allow_all ) { + $sql = q{ + SELECT branchcode FROM branches WHERE 1 + } + } else { + $sql = q{ + SELECT DISTINCT(branchcode) + FROM branchrelations + JOIN branchcategories USING ( categorycode ) + WHERE categorycode IN ( + SELECT categorycode + FROM branchrelations + WHERE branchcode = ? + ) + AND branchcategories.categorytype = 'independent_group' + }; + push( @params, $this_branch ); + } if ($other_branch) { $sql .= q{ AND branchcode = ? }; diff --git a/C4/Context.pm b/C4/Context.pm index 6bebfaf..aa6aa3b 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1112,23 +1112,31 @@ set_userenv is called in Auth.pm #' sub set_userenv { - my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= @_; - my $var=$context->{"activeuser"} || ''; + my ( + $usernum, $userid, $usercnum, $userfirstname, + $usersurname, $userbranch, $branchname, $userflags, + $emailaddress, $branchprinter, $persona, $type + ) = @_; + + my $var = $context->{"activeuser"} || ''; + my $cell = { - "number" => $usernum, - "id" => $userid, - "cardnumber" => $usercnum, - "firstname" => $userfirstname, - "surname" => $usersurname, - #possibly a law problem - "branch" => $userbranch, - "branchname" => $branchname, - "flags" => $userflags, - "emailaddress" => $emailaddress, - "branchprinter" => $branchprinter, - "persona" => $persona, + "number" => $usernum, + "id" => $userid, + "cardnumber" => $usercnum, + "firstname" => $userfirstname, + "surname" => $usersurname, + "branch" => $userbranch, + "branchname" => $branchname, + "flags" => $userflags, + "emailaddress" => $emailaddress, + "branchprinter" => $branchprinter, + "persona" => $persona, + "type" => $type, }; + $context->{userenv}->{$var} = $cell; + return $cell; } diff --git a/C4/Items.pm b/C4/Items.pm index 37951d8..d552c90 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1206,6 +1206,11 @@ If this is set, it is set to C. sub GetItemsInfo { my ( $biblionumber ) = @_; + + my $IndependentBranchesRecordsAndItems = + C4::Context->preference('IndependentBranchesRecordsAndItems') + && !C4::Context->IsSuperLibrarian(); + my $dbh = C4::Context->dbh; # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance. my $query = " @@ -1235,7 +1240,10 @@ sub GetItemsInfo { LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber LEFT JOIN itemtypes ON itemtypes.itemtype = " . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); - $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; + $query .= " WHERE items.biblionumber = ? "; + $query .= " AND items.homebranch IN ( " . GetIndependentGroupModificationRights({ stringify => 1}) . " ) " if ( $IndependentBranchesRecordsAndItems ); + $query .= " ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; + my $sth = $dbh->prepare($query); $sth->execute($biblionumber); my $i = 0; diff --git a/C4/Search.pm b/C4/Search.pm index 0453b91..b4fe6d1 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -36,6 +36,7 @@ use URI::Escape; use Business::ISBN; use MARC::Record; use MARC::Field; +use List::MoreUtils qw(none); use utf8; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); @@ -301,6 +302,20 @@ sub SimpleSearch { $zoom_query->destroy(); } + if ( C4::Context->preference('IndependentBranchesRecordsAndItems') ) { + my @new_results; + my $dbh = C4::Context->dbh(); + foreach my $result ( @{$results} ) { + my $marc_record = MARC::Record->new_from_usmarc($result); + my $koha_record = TransformMarcToKoha( $dbh, $marc_record ); + my $is_allowed = $koha_record->{branchcode} ? GetIndependentGroupModificationRights( { for => $koha_record->{branchcode} } ) : 1; + + push( @new_results, $result ) if ( $is_allowed ); + } + $results = \@new_results; + $total_hits = scalar( @new_results ); + } + return ( undef, $results, $total_hits ); } @@ -1574,6 +1589,29 @@ sub buildQuery { $limit .= "($availability_limit)"; } + if ( C4::Context->preference('IndependentBranchesRecordsAndItems') ) { + my $search_context = C4::Context->userenv->{type}; + my $IndependentBranchesRecordsAndItems; + if ( $search_context eq 'opac' ) { + # For the OPAC, if IndependentBranchesRecordsAndItems is enabled, + # and BRANCHCODE has been set in the httpd conf, + # we need to filter the items + $IndependentBranchesRecordsAndItems = $ENV{BRANCHCODE}; + } + else { + # For the intranet, if IndependentBranchesRecordsAndItems is enabled, + # and the user is not a superlibrarian, + # we need to filter the items + $IndependentBranchesRecordsAndItems = !C4::Context->IsSuperLibrarian(); + } + my @allowed_branches = $IndependentBranchesRecordsAndItems ? GetIndependentGroupModificationRights() : (); + + if ( @allowed_branches ) { + $limit .= " and " if ( $query || $limit ); + $limit .= "(" . join( " or ", map { "branch:$_" } @allowed_branches ) . ")"; + } + } + # Normalize the query and limit strings # This is flawed , means we can't search anything with : in it # if user wants to do ccl or cql, start the query with that @@ -1828,14 +1866,47 @@ sub searchResults { my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref + my $IndependentBranchesRecordsAndItems; + if ( $search_context eq 'opac' ) { + # For the OPAC, if IndependentBranchesRecordsAndItems is enabled, + # and BRANCHCODE has been set in the httpd conf, + # we need to filter the items + $IndependentBranchesRecordsAndItems = + C4::Context->preference('IndependentBranchesRecordsAndItems') + && $ENV{BRANCHCODE}; + } + else { + # For the intranet, if IndependentBranchesRecordsAndItems is enabled, + # and the user is not a superlibrarian, + # we need to filter the items + $IndependentBranchesRecordsAndItems = + C4::Context->preference('IndependentBranchesRecordsAndItems') + && !C4::Context->IsSuperLibrarian(); + } + my @allowed_branches = $IndependentBranchesRecordsAndItems ? GetIndependentGroupModificationRights() : undef; + # loop through every item + my $index = -1; foreach my $field (@fields) { + $index++; my $item; # populate the items hash foreach my $code ( keys %subfieldstosearch ) { $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); } + + # if IndependentBranchesRecordsAndItems is enabled, and this record + # isn't allowed to be viewed, remove it from the items list and go + # right to the next item. + if ( $IndependentBranchesRecordsAndItems ) { + if ( none { $_ eq $item->{homebranch} } @allowed_branches ) { + splice(@fields, $index, 1); + $items_count--; + next; + } + } + $item->{description} = $itemtypes{ $item->{itype} }{description}; # OPAC hidden items diff --git a/C4/Serials.pm b/C4/Serials.pm index b82d63f..77039b7 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -738,6 +738,10 @@ sub SearchSubscriptions { push @where_strs, "subscription.closed = ?"; push @where_args, "$args->{closed}"; } + if( C4::Context->preference('IndependentBranchesRecordsAndItems') && !C4::Context->IsSuperlibrarian() ) { + my $branches = GetIndependentGroupModificationRights( { stringify => 1 } ); + push @where_strs, "subscription.branchcode IN ( $branches )"; + } if(@where_strs){ $query .= " WHERE " . join(" AND ", @where_strs); } diff --git a/catalogue/search.pl b/catalogue/search.pl index 9e81a81..8c1c86b 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -135,6 +135,8 @@ Not yet completed... use strict; # always use #use warnings; FIXME - Bug 2505 +use List::MoreUtils qw(any); + ## STEP 1. Load things that are used in both search page and # results page and decide which template to load, operations # to perform, etc. @@ -152,6 +154,7 @@ use URI::Escape; use POSIX qw(ceil floor); use String::Random; use C4::Branch; # GetBranches +use URI::Escape; my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold"); # create a new CGI object @@ -181,9 +184,11 @@ else { flagsrequired => { catalogue => 1 }, } ); + if (C4::Context->preference("marcflavour") eq "UNIMARC" ) { $template->param('UNIMARC' => 1); } + if (C4::Context->preference("IntranetNumbersPreferPhrase")) { $template->param('numbersphr' => 1); } @@ -228,20 +233,10 @@ my $branches = GetBranches(); # Populate branch_loop with all branches sorted by their name. If # IndependentBranches is activated, set the default branch to the borrower # branch, except for superlibrarian who need to search all libraries. -my $user = C4::Context->userenv; -my @branch_loop = map { - { - value => $_, - branchname => $branches->{$_}->{branchname}, - selected => $user->{branch} eq $_ && C4::Branch::onlymine(), - } -} sort { - $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} -} keys %$branches; - -my $categories = GetBranchCategories('searchdomain'); - -$template->param(branchloop => \@branch_loop, searchdomainloop => $categories); +$template->param( + branchloop => GetBranchesLoop(), + searchdomainloop => GetBranchCategories( undef, 'searchdomain' ), +); # load the Type stuff my $itemtypes = GetItemTypes; @@ -407,12 +402,12 @@ if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) { } # an operand can be a single term, a phrase, or a complete ccl query -my @operands = map uri_unescape($_), $cgi->param('q'); +my @operands = map { uri_unescape( $_ ) } $cgi->param('q'); # limits are use to limit to results to a pre-defined category such as branch or language -my @limits = map uri_unescape($_), $cgi->param('limit'); +my @limits = map { uri_unescape($_) } $cgi->param('limit'); -if($params->{'multibranchlimit'}) { +if( $params->{'multibranchlimit'} ) { my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')'; push @limits, $multibranch if ($multibranch ne '()'); } diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl index b22a646..1fd86b1 100755 --- a/cataloguing/addbooks.pl +++ b/cataloguing/addbooks.pl @@ -98,11 +98,12 @@ if ($query) { foreach my $line (@newresults) { if ( not exists $line->{'size'} ) { $line->{'size'} = "" } } + my $q = $input->param('q'); $template->param( total => $total_hits, query => $query, resultsloop => \@newresults, - pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ), + pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$q&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ), ); } diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index dbb44bd..d0b7792 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -677,6 +677,10 @@ if ( C4::Context->preference('EasyAnalyticalRecords') ) { } } +my $IndependentBranches = !C4::Context->IsSuperLibrarian() + && C4::Context->preference('IndependentBranches'); +my $IndependentBranchesRecordsAndItems = $IndependentBranches + && C4::Context->preference('IndependentBranchesRecordsAndItems'); foreach my $field (@fields) { next if ( $field->tag() < 10 ); @@ -700,15 +704,14 @@ foreach my $field (@fields) { || $subfieldvalue; } - if ( $field->tag eq $branchtagfield - && $subfieldcode eq $branchtagsubfield - && C4::Context->preference("IndependentBranches") ) + if ( $IndependentBranches + && $field->tag eq $branchtagfield + && $subfieldcode eq $branchtagsubfield ) { + #verifying rights - my $userenv = C4::Context->userenv(); unless ( - $userenv->{'flags'} % 2 == 1 - || GetIndependentGroupModificationRights( + GetIndependentGroupModificationRights( { for => $subfieldvalue } ) ) @@ -716,24 +719,24 @@ foreach my $field (@fields) { $this_row{'nomod'} = 1; } } - $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield); - if ( C4::Context->preference('EasyAnalyticalRecords') ) { - foreach my $hostitemnumber (@hostitemnumbers){ - if ($this_row{itemnumber} eq $hostitemnumber){ - $this_row{hostitemflag} = 1; - $this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber); - last; - } - } + $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield); -# my $countanalytics=GetAnalyticsCount($this_row{itemnumber}); -# if ($countanalytics > 0){ -# $this_row{countanalytics} = $countanalytics; -# } - } + if ( C4::Context->preference('EasyAnalyticalRecords') ) { + foreach my $hostitemnumber (@hostitemnumbers) { + if ( $this_row{itemnumber} eq $hostitemnumber ) { + $this_row{hostitemflag} = 1; + $this_row{hostbiblionumber} = + GetBiblionumberFromItemnumber($hostitemnumber); + last; + } + } + } } + + next if ( $this_row{'nomod'} && $IndependentBranchesRecordsAndItems ); + if (%this_row) { push(@big_array, \%this_row); } diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0ff92f7..5b10f90 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6941,18 +6941,6 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } -$DBversion = "3.11.00.XXX"; -if ( CheckVersion($DBversion) ) { - $dbh->do(q{ - ALTER TABLE branchcategories - CHANGE categorytype categorytype - ENUM( 'searchdomain', 'independent_group' ) - NULL DEFAULT NULL - }); - print "Upgrade to $DBversion done (Remove branch property groups, add independent groups)\n"; - SetVersion ($DBversion); -} - $DBversion = '3.13.00.003'; if ( CheckVersion($DBversion) ) { $dbh->do("ALTER TABLE serial DROP itemnumber"); @@ -7148,6 +7136,39 @@ if ( CheckVersion($DBversion) ) { $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('WhenLostForgiveFine','0',NULL,'If ON, Forgives the fines on an item when it is lost.','YesNo')"); $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('WhenLostChargeReplacementFee','1',NULL,'If ON, Charge the replacement price when a patron loses an item.','YesNo')"); print "Upgrade to $DBversion done (Bug 7639: system preferences to forgive fines on lost items)\n"; + SetVersion($DBversion); +} + +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + ALTER TABLE branchcategories + CHANGE categorytype categorytype + ENUM( 'searchdomain', 'independent_group' ) + NULL DEFAULT NULL + }); + print "Upgrade to $DBversion done (Remove branch property groups, add independent groups)\n"; + SetVersion ($DBversion); +} + +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(" + INSERT INTO systempreferences ( + variable, + value, + options, + explanation, + type + ) VALUES ( + 'IndependentBranchesRecordsAndItems', + '0', + '', + 'If on, the staff interface search will hide all records that do not contain an item owned by the logged in branch, and hide the items themselves.', + 'YesNo' + ) + "); + print "Upgrade to $DBversion done (Bug 10278 - Add ability to hide items and records from search results for Independent Branches)\n"; SetVersion ($DBversion); } 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 @@
-

[% LibraryName %]

-
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 1215ac1..7433a53 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: IndependentBranchesRecordsAndItems + default: 0 + choices: + yes: Prevent + no: "Don't prevent" + - staff from seeing items owned by other libraries, and records without any items the library. 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..1dac415 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Catalog › Advanced search [% INCLUDE 'doc-head-close.inc' %] @@ -229,34 +230,40 @@ [% END %] -
Location and availability -
-

-
+
Location and availability +
+

+
-
-

- - [% IF ( searchdomainloop ) %] -

OR

-

- [% END %] -
+
+

+ + +

+ + [% IF searchdomainloop && !Koha.Preference('IndependentBranchesRecordsAndItems') %] +

OR

+

+ + +

+ [% END %]
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index d2ab6a8..081de3d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -28,7 +28,9 @@ function GetZ3950Terms(fw){ var strQuery="&frameworkcode=" + fw; [% FOREACH z3950_search_param IN z3950_search_params %] +/* strQuery += "&" + "[% z3950_search_param.name %]" + "=" + "[% z3950_search_param.encvalue %]"; +*/ [% END %] return strQuery; } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 2854da6..e4fce3e 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -407,6 +407,12 @@ if($params->{'multibranchlimit'}) { push @limits, $multibranch if ($multibranch ne '()'); } +if ( C4::Context->preference('IndependentBranchesRecordsAndItems') ) { + my @branches = GetIndependentGroupModificationRights(); + my $allowed = '(' . join( " or ", map { "branch: $_ " } @branches ) . ')'; + push( @limits, $allowed ) if ( $allowed ne '()' ); +} + my $available; foreach my $limit(@limits) { if ($limit =~/available/) { -- 1.7.2.5