Bugzilla – Attachment 134174 Details for
Bug 28642
Add IndependentBranches syspref to hide other items and libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28642: Expand IndependentBranches to hide others items and libraries
0001-Bug-28642-Expand-IndependentBranches-to-hide-others-.patch (text/plain), 68.89 KB, created by
Michael Hafen
on 2022-04-27 17:32:20 UTC
(
hide
)
Description:
Bug 28642: Expand IndependentBranches to hide others items and libraries
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2022-04-27 17:32:20 UTC
Size:
68.89 KB
patch
obsolete
>From 3175425f9eabc9f2739e70f629b12cbe58ab66cd Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Tue, 29 Jun 2021 16:49:48 -0600 >Subject: [PATCH] Bug 28642: Expand IndependentBranches to hide others items > and libraries >Content-Type: text/plain; charset="utf-8" > >Adds a system preference: IndependentBranchesHideOtherBranchesItems. >When on: > All library select's will be limited to just the users library. > Item lists in search results, title details, item details, holds, and exports > will only show items at the users library. > >Test Plan: > >Apply patch and run koha-upgrade-schema or manually create IndependentBranchesHideOtherBranchesItems system preference. >Login with an account that is not Super Librarian. >Set the IndependentBranchesHideOtherBranchesItems system preference to yes. >On the Item Search page observe that only your library shows in the home and current library fields. >On the Advanced Search page observe that only your library shows in the location -> individual libraries field. >Search the catalog for a title with an item at your library and also at another library. >Observe that you only see your library listed in the facets panel (Refine your search -> Home Libraries section) >Observe that you only see the item at your library in the search results, title details, MARC details, Items, Checkout history, and Edit Items pages. >On the title details page Save the title as a text format, for example MARCXML, and observe that only item(s) at your library are in the export. >On the Place hold page, search for a patron and observe that only patrons at your library are found. >After selecting a patron observe that only items at your library are displaed. >In the Circulation -> Overdues page observe that you only see items at your library. >In the Check out quick search search for patrons. Observe that only patrons at your school are found unless you search by cardnumber. >On the Patrons page observe that only your library shows in the library field of the search form. >In the Search Patrons tab of the quick search click the '+' to open the other fields. Observe that only your library shows in the Library field. >On the Modify Patron page (edit patron) observe that only your library shows in the library field in the library management section. >In Serials start a new subscription and observe that only your library shows in the library field. >In Serials -> Check expiration observe that only your library show in the library field. >In Reports observe that only your library shows in the following reports: Acquisitions statistics, Patrons statistics, Catalog statistics, Circulation statistics, Serials statistics, Cash register statistics, Holds statistics, Patrons with the most checkouts, Most-circulated items, Items with no checkouts, Items lost, Catalog by item type, Average loan time. >In Suggestions observe that only your library shows in the library field on the Suggestion management and New purchase suggestion pages. >In Tools -> Patron Lists when adding patrons to a list observe that only patrons at your library are found by name. >In Patron Clubs observe that the library field only shows your library in the Club Template and Club edit pages. >In Comments observe that only comments at your library are shown. >In Import Patrons observe that the library field in the defaults section only shows your library. >In Batch patron modification observe that your library is the only library in the library field. >In Batch item modification observe that your library is the only library in the Home and Current library fields. >In Export data observe that only your library shows in the 'With items owned by the following libraries' field and it is selected. >In Inventory observe that only your library shows in the library field. >In News observe that only your library shows in the library field in the Filter on the home page and the Edit entry page. >Open the Opac and log in. >On the Advanced search page observe that your library is the only library in the Location field. >Search for a title with items at multiple libraries. Observe that only your library shows in the libraries facets (refine your search). >--- > C4/Context.pm | 4 +++- > C4/Items.pm | 9 ++++++++- > C4/Search.pm | 6 ++++++ > C4/XSLT.pm | 4 ++++ > Koha/Template/Plugin/Branches.pm | 5 +++-- > Koha/UI/Form/Builder/Item.pm | 6 +++++- > catalogue/MARCdetail.pl | 2 ++ > catalogue/export.pl | 13 +++++++++++++ > catalogue/issuehistory.pl | 8 ++++++-- > catalogue/itemsearch.pl | 13 ++++++++++++- > catalogue/search.pl | 3 +++ > cataloguing/additem.pl | 1 + > circ/overdue.pl | 7 +++++++ > installer/data/mysql/atomicupdate/bug_28642.perl | 5 +++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc | 2 ++ > .../prog/en/includes/patron-search.inc | 1 - > .../intranet-tmpl/prog/en/modules/acqui/invoices.tt | 4 ++++ > .../prog/en/modules/admin/preferences/admin.pref | 7 +++++++ > .../prog/en/modules/catalogue/advsearch.tt | 3 +++ > .../prog/en/modules/catalogue/itemsearch.tt | 3 +++ > .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 12 ++++++++++++ > .../prog/en/modules/circ/view_holdsqueue.tt | 4 ++++ > .../prog/en/modules/clubs/clubs-add-modify.tt | 4 ++++ > .../prog/en/modules/clubs/templates-add-modify.tt | 4 ++++ > .../intranet-tmpl/prog/en/modules/members/member.tt | 6 +++++- > .../prog/en/modules/members/memberentrygen.tt | 4 ++++ > .../prog/en/modules/reports/acquisitions_stats.tt | 3 +++ > .../prog/en/modules/reports/bor_issues_top.tt | 11 +++++++++-- > .../prog/en/modules/reports/borrowers_stats.tt | 6 ++++++ > .../prog/en/modules/reports/cash_register_stats.tt | 2 ++ > .../prog/en/modules/reports/cat_issues_top.tt | 7 ++++++- > .../prog/en/modules/reports/catalogue_out.tt | 4 ++++ > .../prog/en/modules/reports/catalogue_stats.tt | 4 ++++ > .../prog/en/modules/reports/issues_avg_stats.tt | 4 ++++ > .../prog/en/modules/reports/issues_stats.tt | 12 ++++++++++++ > .../prog/en/modules/reports/itemslost.tt | 4 ++++ > .../prog/en/modules/reports/itemtypes.tt | 6 ++++++ > .../prog/en/modules/reports/reserves_stats.tt | 12 ++++++++++++ > .../prog/en/modules/reports/serials_stats.tt | 4 ++++ > .../prog/en/modules/serials/checkexpiration.tt | 4 ++++ > .../prog/en/modules/serials/subscription-add.tt | 10 +++++++++- > .../prog/en/modules/suggestion/suggestion.tt | 8 ++++++++ > .../intranet-tmpl/prog/en/modules/tools/export.tt | 4 ++++ > .../prog/en/modules/tools/import_borrowers.tt | 6 ++++++ > .../prog/en/modules/tools/inventory.tt | 4 ++++ > .../opac-tmpl/bootstrap/en/includes/opac-facets.inc | 1 + > reports/acquisitions_stats.pl | 6 +++++- > reports/cash_register_stats.pl | 6 +++++- > reserve/request.pl | 4 ++++ > reviews/reviewswaiting.pl | 9 +++++++-- > tools/batchMod.pl | 3 +++ > tools/export.pl | 10 +++++++++- > tools/modborrowers.pl | 6 +++++- > 54 files changed, 281 insertions(+), 20 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_28642.perl > >diff --git a/C4/Context.pm b/C4/Context.pm >index b42f933b08..30bdd07189 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -900,8 +900,10 @@ sub mybranch { > =cut > > sub only_my_library { >+ my ( $class, $pref ) = @_; >+ $pref //= 'IndependentBranches'; > return >- C4::Context->preference('IndependentBranches') >+ C4::Context->preference($pref) > && C4::Context->userenv > && !C4::Context->IsSuperLibrarian() > && C4::Context->userenv->{branch}; >diff --git a/C4/Items.pm b/C4/Items.pm >index a7f06dd876..bd477bb765 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -773,6 +773,8 @@ sub GetItemsInfo { > my $userenv = C4::Context->userenv; > my $want_not_same_branch = C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian(); > while ( my $data = $sth->fetchrow_hashref ) { >+ next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $data->{homebranch} ne $userenv->{branch} ); >+ > if ( $data->{borrowernumber} && $want_not_same_branch) { > $data->{'NOTSAMEBRANCH'} = $data->{'bcode'} ne $userenv->{branch}; > } >@@ -870,7 +872,12 @@ sub GetItemsLocationInfo { > location, itemcallnumber, cn_sort > FROM items, branches as a, branches as b > WHERE homebranch = a.branchcode AND holdingbranch = b.branchcode >- AND biblionumber = ? >+ AND biblionumber = ?"; >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') &&( my $mybranch = C4::Context->userenv->{branch} ) ) { >+ $query .= " >+ AND homebranch = '$mybranch'"; >+ } >+ $query .= " > ORDER BY cn_sort ASC"; > my $sth = $dbh->prepare($query); > $sth->execute($biblionumber); >diff --git a/C4/Search.pm b/C4/Search.pm >index 85a02bf5a2..f08f0b3ff0 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1818,6 +1818,12 @@ sub searchResults { > next; > } > } >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ if ( $item->{homebranch} ne $userenv->{branch} ) { >+ $items_count--; >+ next; >+ } >+ } > > my $hbranch = C4::Context->preference('StaffSearchResultsDisplayBranch'); > my $otherbranch = $hbranch eq 'homebranch' ? 'holdingbranch' : 'homebranch'; >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index ca25d0db30..a0fa15baad 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -337,6 +337,10 @@ sub buildKohaItemsNamespace { > $items_rs = Koha::Items->new; > } > >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $query->{'me.homebranch'} = C4::Context->userenv->{branch}; >+ } >+ > my $items = $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } ); > > my $shelflocations = >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index 981c5b413d..5b6a4cce8a 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -103,8 +103,9 @@ sub all { > } > > sub InIndependentBranchesMode { >- my ( $self ) = @_; >- return ( not C4::Context->preference("IndependentBranches") or C4::Context::IsSuperLibrarian ); >+ my ( $self, $params ) = @_; >+ my $pref = $params->{syspref} || 'IndependentBranches'; >+ return ( C4::Context->preference($pref) and not C4::Context::IsSuperLibrarian ); > } > > sub pickup_locations { >diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm >index 5efe6ed796..afb12861fd 100644 >--- a/Koha/UI/Form/Builder/Item.pm >+++ b/Koha/UI/Form/Builder/Item.pm >@@ -470,8 +470,12 @@ sub edit_form { > my $branch_limit = $params->{branch_limit}; > my $default_branches_empty = $params->{default_branches_empty}; > >+ my $libraries_filter = {}; >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $libraries_filter->{branchcode} = C4::Context->userenv->{branch}; >+ } > my $libraries = >- Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; >+ Koha::Libraries->search( $libraries_filter, { order_by => ['branchname'] } )->unblessed; > for my $library (@$libraries) { > $library->{selected} = 1 if $branchcode && $library->{branchcode} eq $branchcode; > } >diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl >index 4ff6a03c54..6fd4dd58b8 100755 >--- a/catalogue/MARCdetail.pl >+++ b/catalogue/MARCdetail.pl >@@ -265,6 +265,7 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { > # loop through each tag > # warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary > # then construct template. >+my ($homebrtagf,$homebrtagsubf) = &GetMarcFromKohaField( "items.homebranch" ); > my @fields = $record->fields(); > my %witness > ; #---- stores the list of subfields used at least once, with the "meaning" of the code >@@ -302,6 +303,7 @@ foreach my $field (@fields) { > if grep { $kohafield eq $_ } > qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate ); > } >+ next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $item && $item->{$homebrtagsubf} ne C4::Context->userenv->{'branchname'} ); > push @item_loop, $item if $item; > } > >diff --git a/catalogue/export.pl b/catalogue/export.pl >index 3785116581..f4602b421a 100755 >--- a/catalogue/export.pl >+++ b/catalogue/export.pl >@@ -40,6 +40,19 @@ if ($op eq "export") { > } > } > >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ my $mybranch = C4::Context->userenv->{branch}; >+ my ($homebrtagf,$homebrtagsubf) = &GetMarcFromKohaField( "items.homebranch" ); >+ my @fields = $marc->field($homebrtagf); >+ my @delete; >+ foreach my $field (@fields) { >+ if ( $field->subfield($homebrtagsubf) ne $mybranch ) { >+ push @delete, $field; >+ } >+ } >+ $marc->delete_fields(@delete) if ( @delete ); >+ } >+ > if ($format =~ /endnote/) { > $marc = marc2endnote($marc); > $format = 'endnote'; >diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl >index 4f361367bf..1ea4228e90 100755 >--- a/catalogue/issuehistory.pl >+++ b/catalogue/issuehistory.pl >@@ -41,15 +41,19 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > > my $biblionumber = $query->param('biblionumber'); > >+my $issue_filter = { biblionumber => $biblionumber }; >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $issue_filter->{'item.homebranch'} = C4::Context->userenv->{branch}; >+} > my @checkouts = Koha::Checkouts->search( >- { biblionumber => $biblionumber }, >+ $issue_filter, > { > join => 'item', > order_by => 'timestamp', > } > )->as_list; > my @old_checkouts = Koha::Old::Checkouts->search( >- { biblionumber => $biblionumber }, >+ $issue_filter, > { > join => 'item', > order_by => 'timestamp', >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index e18524307c..dfcb14bd52 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -113,9 +113,13 @@ if ( defined $format ) { > filters => [], > }; > >+ # IndependentBranchesHideOtherBranchesItems forces homebranch filter >+ # if it isn't already set >+ my $got_branch = 0; > foreach my $p (qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan itemlost withdrawn)) { > if (my @q = $cgi->multi_param($p)) { > if ($q[0] ne '') { >+ if ( $p eq 'homebranch' ) { $got_branch = 1; } > my $f = { > field => $p, > query => \@q, >@@ -127,6 +131,9 @@ if ( defined $format ) { > } > } > } >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && ! $got_branch ) { >+ push @{ $filter->{filters} }, { field => 'homebranch', query => [ C4::Context->userenv->{branch} ] }; >+ } > > my @c = $cgi->multi_param('c'); > my @fields = $cgi->multi_param('f'); >@@ -276,7 +283,11 @@ if ( defined $format ) { > > # Display the search form > >-my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list; >+my $library_filter = {}; >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $library_filter->{'branchcode'} = C4::Context->userenv->{branch}; >+} >+my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( $library_filter, { order_by => 'branchname' } )->as_list; > my @itemtypes = map { value => $_->itemtype, label => $_->translated_description }, Koha::ItemTypes->search_with_localization->as_list; > > my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' }); >diff --git a/catalogue/search.pl b/catalogue/search.pl >index ef7f49088f..897cf40293 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -173,6 +173,9 @@ my @limits = map uri_unescape($_), $cgi->multi_param("limit"); > my @nolimits = map uri_unescape($_), $cgi->multi_param('nolimit'); > my %is_nolimit = map { $_ => 1 } @nolimits; > @limits = grep { not $is_nolimit{$_} } @limits; >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && ! grep { /^(multi|home|holding)?branch/ } @limits ) { >+ push @limits, 'homebranch: '. C4::Context->userenv->{branch}; >+} > if ( > !$cgi->param('edit_search') && > ( (@limits>=1) || (defined $cgi->param("q") && $cgi->param("q") ne "" ) || ($cgi->param('limit-yr')) ) >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index b7508db1a7..b8643710c6 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -509,6 +509,7 @@ if ($op) { > > my @items; > for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) { >+ next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $item->homebranch ne C4::Context->userenv->{branch} ); > push @items, $item->columns_to_str; > } > >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 178ec03041..2980b48ac4 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -80,6 +80,13 @@ our $logged_in_user = Koha::Patrons->find( $loggedinuser ); > > my $dbh = C4::Context->dbh; > >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && (my $mybranch = C4::Context->userenv->{branch}) ) { >+ $homebranchfilter = $mybranch; >+ $holdingbranchfilter = ''; >+ $filters->{homebranch} = $mybranch; >+ $filters->{holdingbranch} = $mybranch; >+} >+ > my $req; > $req = $dbh->prepare( "select categorycode, description from categories order by description"); > $req->execute; >diff --git a/installer/data/mysql/atomicupdate/bug_28642.perl b/installer/data/mysql/atomicupdate/bug_28642.perl >new file mode 100644 >index 0000000000..9c3d93d750 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_28642.perl >@@ -0,0 +1,5 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('IndependentBranchesHideOtherBranchesItems','0','','Hide other branches in selects. Hide items belonging to other branches in search results, holds, biblio and item details, and exports.','YesNo')" ); >+ NewVersion( $DBversion, 28642, "Add new systempreference IndependentBranchesHideOtherBranchesItems"); >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 1b029aa5ee..8f3a2c92f4 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -270,6 +270,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'), > ('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'), > ('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'), >+('IndependentBranchesHideOtherBranchesItems','0',NULL,'Hide other branches in selects. Hide items belonging to other branches in search results, holds, biblio and item details, and exports.','YesNo'), > ('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'), > ('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'), > ('RecordedBooksClientSecret','','30','Client key for RecordedBooks integration','Free'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >index d31ade3d23..8ac388e084 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >@@ -1,6 +1,7 @@ > [% USE raw %] > [% USE AuthorisedValues %] > [% USE Languages %] >+[% USE Branches %] > [% IF ( opacfacets ) %] > [% IF ( facets_loop ) %] > <div id="search-facets"> >@@ -36,6 +37,7 @@ > [% FOREACH facet IN facets_loo.facets %] > [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => facet.facet_label_value ) || facet.facet_label_value %][% END %] > [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %] >+ [% IF ( ( facets_loo.type_label_HomeLibrary || facets_loo.type_label_HoldingLibrary ) && Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) && facet.facet_link_value != Branches.GetLoggedInBranchcode() ) %][% NEXT %][% END %] > [% IF loop.count > 5 && !facet.active %] > <li class="collapsible-facet" style="display:none"> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index de738dab2b..20b5a7435a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -37,7 +37,6 @@ > <li> > <label for="branchcode_filter">Library:</label> > <select id="branchcode_filter"> >- [% SET libraries = Branches.all( only_from_group => 1 ) %] > [% IF libraries.size != 1 %] > <option value="">Any</option> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >index 8be858e6be..767e4d95f5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >@@ -376,9 +376,13 @@ > <li> > <label for="branch">Library:</label> > <select id="branch" name="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branch, unfiltered => 1 ) %] >+ [% ELSE %] > <option value="">All</option> > [%# FIXME Should not we filter the libraries %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %] >+ [% END %] > </select> > </li> > </ol> >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 2eab55ae03..9fcaaec56d 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 >@@ -124,6 +124,13 @@ Administration: > 1: "Yes" > 0: "No" > - "<p class='text-danger'><strong>Warning:</strong> Changing this system preference will radically alter the behavior of Koha. Changing preference on a production system is highly discouraged.</p>" >+ - >+ - "Prevent staff (but not superlibrarians) from selecting other libraries in dropdowns and seeing items belonging to other libraries: " >+ - pref: IndependentBranchesHideOtherBranchesItems >+ default: 0 >+ choices: >+ 1: "Yes" >+ 0: "No" > - > - "Prevent staff (but not superlibrarians) from viewing and approving/denying patron modification requests for patrons belonging to other libraries: " > - pref: IndependentBranchesPatronModifications >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 23ef320fb6..a9c6264cdf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -281,6 +281,9 @@ > > <fieldset id="select-libs"> > <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries prefix => "branch:" libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, unfiltered => 1 ) %] >+ [% ELSE %] > <option value="">All libraries</option> > [%# FIXME Should not we filter the libraries displayed? %] > [% PROCESS options_for_libraries prefix => "branch:" libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1, selected => limits.branch.0 ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index 27521c1635..6943efe2c5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -2,6 +2,7 @@ > [% USE To %] > [% USE Asset %] > [% USE AuthorisedValues %] >+[% USE Branches %] > > [%- BLOCK form_label -%] > [%- SWITCH label -%] >@@ -41,9 +42,11 @@ > <option value="!=" >is not</option> > </select> > <select id="[% name | html %]" name="[% name | html %]" multiple="multiple" size="[% options.size < 4 ? options.size + 1 : 4 | html %]"> >+ [% UNLESS ( name == 'homebranch' || name == 'holdingbranch' ) && Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] > <option value="" selected="selected"> > [% IF (empty_option) %][% INCLUDE form_label label=empty_option %][% ELSE %]<span>All</span>[% END %] > </option> >+ [% END %] > [% FOREACH option IN options %] > <option value="[% option.value | html %]">[% option.label | html %]</option> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >index afe0b09f72..d6ec211a0c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >@@ -228,16 +228,24 @@ > <li> > <label>Item home library:</label> > <select name="homebranch" id="homebranch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => filters.homebranch ) %] >+ [% ELSE %] > <option value="">Any</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.homebranch ) %] >+ [% END %] > </select> > </li> > > <li> > <label>Item holding library:</label> > <select name="holdingbranch" id="holdingbranch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => filters.holdingbranch ) %] >+ [% ELSE %] > <option value="">Any</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.holdingbranch ) %] >+ [% END %] > </select> > </li> > >@@ -245,7 +253,11 @@ > <label>Library of the patron:</label> > <select name="branch" id="branch"> > <option value="">Any</option> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => filters.branch, only_from_group => 1 ) %] >+ [% ELSE %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.branch, only_from_group => 1 ) %] >+ [% END %] > </select> > </li> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >index 6eeb9f65c6..f0aede0477 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >@@ -244,8 +244,12 @@ > <li> > <label for="branchlimit">Library: </label> > <select name="branchlimit" id="branchlimit"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, only_from_group => 1 ) %] >+ [% ELSE %] > <option value="">All</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchlimit, only_from_group => 1 ) %] >+ [% END %] > </select> > </li> > <li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt >index 0cd62451bf..2e6c98cff5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt >@@ -86,8 +86,12 @@ > <li> > <label for="club-template-branchcode">Library:</label> > <select name="branchcode" id="club-template-branchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => club.branch.branchcode ) %] >+ [% ELSE %] > <option value=""></option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => club.branch.branchcode ) %] >+ [% END %] > </select> > </li> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt >index c74f614aad..00cadb173f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt >@@ -97,8 +97,12 @@ > <li> > <label for="club-template-branchcode">Library:</label> > <select name="branchcode" id="club-template-branchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => club_template.branchcode ) %] >+ [% ELSE %] > <option value=""></option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => club_template.branchcode ) %] >+ [% END %] > </select> > <div class="hint">If set, only librarians logged in with this branch will be able to modify this club template.</div> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index 418bdfbccd..25c871f14c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -6,7 +6,11 @@ > [% USE Categories %] > [% SET footerjs = 1 %] > [% PROCESS 'patronfields.inc' %] >-[% SET libraries = Branches.all %] >+[% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% SET libraries = Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+[% ELSE %] >+ [% SET libraries = Branches.all %] >+[% END %] > [% SET categories = Categories.all.unblessed %] > [% SET columns = ['cardnumber', 'name-address', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'action'] %] > [% PROCESS 'patron-search.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index d01b2316bc..96800b8ca3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -902,7 +902,11 @@ legend:hover { > <li> > <label for="libraries" class="required">Library:</label> > <select name="branchcode" id="libraries"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => userbranch, only_from_group => 1 ) %] >+ [% ELSE %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %] >+ [% END %] > </select> > <span class="required">Required</span> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt >index aa41d41a16..62399535b4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt >@@ -1,3 +1,4 @@ >+[% USE Branches %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( do_it ) %]Acquisitions statistics › Results[% ELSE %]Acquisitions statistics[% END %] › Reports › Koha</title> >@@ -180,7 +181,9 @@ > <td><input type="radio" name="Column" value="items.homebranch" /></td> > <td> > <select name="Filter"> >+ [% UNLESS Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] > <option value="" selected="selected">All libraries</option> >+ [% END %] > [% FOREACH branch IN branches %] > <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >index af079b3e56..499edaf62c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >@@ -136,10 +136,17 @@ > </li> > <li> > <label for="branch">Library: </label> >-<select name="Filter" id="branch"><option value="" > Any library</option> >+<select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% FOREACH l IN Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, unfiltered => 1 ) %] >+ <option value="[% l.branchcode | html %]" >[% l.branchname | html %] </option> >+ [% END %] >+ [% ELSE %] >+ <option value="" > Any library</option> > [% FOREACH l IN Branches.all( unfiltered => 1 ) %] > <option value="[% l.branchcode | html %]" >[% l.branchname | html %] </option> >- [% END %] >+ [% END %] >+ [% END %] > </select> </li> > <li> > <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt >index 2017c62cf6..0b3382dcc4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt >@@ -169,10 +169,16 @@ > <td><input type="radio" name="Column" value="branchcode" /></td> > <td> > <select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% FOREACH l IN Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, unfiltered => 1 ) %] >+ <option value="[% l.branchcode | html %]">[% l.branchcode | html %] - [% l.branchname || 'UNKNOWN' | html %]</option> >+ [% END %] >+ [% ELSE %] > <option value=""></option> > [% FOREACH l IN Branches.all( unfiltered => 1 ) %] > <option value="[% l.branchcode | html %]">[% l.branchcode | html %] - [% l.branchname || 'UNKNOWN' | html %]</option> > [% END %] >+ [% END %] > </select> > </td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >index 2e3bc98874..c21e5ec433 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >@@ -108,7 +108,9 @@ > <li> > <label>Transaction library</label> > <select name="branch" id="branch"> >+ [% UNLESS Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] > <option value="ALL">All</option> >+ [% END %] > [% FOREACH branchloo IN branchloop %] > [% IF ( branchloo.selected ) %] > <option value="[% branchloo.branchcode | html %]" selected="selected">[% branchloo.branchname | html %]</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt >index 4a1f29c7e8..8ac93b71f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt >@@ -107,8 +107,13 @@ > </li> > <li> > <label for="branch">Library: </label> >- <select name="Filter" id="branch"><option value="" > Any library</option> >+ <select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] >+ <option value="" > Any library</option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </li> > <li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt >index 522f5cbcca..175ef9d590 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt >@@ -105,8 +105,12 @@ > <ol> > <li><label for="branch">Library: </label> > <select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value="">Any library</option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select></li> > <li> > <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >index 28ca91a789..6aaf397c06 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >@@ -156,8 +156,12 @@ > <td><input type="radio" checked="checked" name="Line" value="items.homebranch" /></td> > <td><input type="radio" name="Column" value="items.homebranch" /></td> > <td><select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >index 0cf4e3fdac..718d3e019a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >@@ -181,8 +181,12 @@ > <td><input type="radio" name="Column" value="branchcode" /></td> > <td> > <select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>''}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""></option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt >index 46dc8ac727..f91c0efcda 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt >@@ -205,8 +205,12 @@ > <td><input type="radio" checked="checked" name="Line" value="branch" /></td> > <td><input type="radio" name="Column" value="branch" /></td> > <td><select name="Filter" id="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >@@ -270,8 +274,12 @@ > <td><input type="radio" name="Line" value="items.homebranch" /></td> > <td><input type="radio" name="Column" value="items.homebranch" /></td> > <td><select name="Filter" id="homebranch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >@@ -280,8 +288,12 @@ > <td><input type="radio" name="Line" value="items.holdingbranch" /></td> > <td><input type="radio" name="Column" value="items.holdingbranch" /></td> > <td><select name="Filter" id="holdingbranch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >index 11552c85fb..d738bbca17 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >@@ -149,8 +149,12 @@ > > <li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li> > <li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value="">All</option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select></li> > <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter"> > <option value="">All</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >index 57fe194b5b..d838cda148 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >@@ -81,10 +81,16 @@ > <li> > <label for="value">Select a library:</label> > <select name="value" id="value"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""></option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> >+ [% UNLESS Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] > <span class="tip">Select none to see all libraries</span> >+ [% END %] > </li> > </ol> > </fieldset> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt >index 181fb4e188..cc26cf05bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt >@@ -208,8 +208,12 @@ > <td><input type="radio" name="Line" value="reserves.branchcode" checked="checked" /></td> > <td><input type="radio" name="Column" value="reserves.branchcode" /></td> > <td><select name="filter_reserves.branchcode" id="resbranchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >@@ -218,8 +222,12 @@ > <td><input type="radio" name="Line" value="items.holdingbranch" /></td> > <td><input type="radio" name="Column" value="items.holdingbranch" /></td> > <td><select name="filter_items.holdingbranch" id="holdingbranch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >@@ -228,8 +236,12 @@ > <td><input type="radio" name="Line" value="items.homebranch" /></td> > <td><input type="radio" name="Column" value="items.homebranch" /></td> > <td><select name="filter_items.homebranch" id="homebranch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value=""> </option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > </td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt >index f8d2304cfc..42efaab0dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt >@@ -95,8 +95,12 @@ > Library: > </label> > <select name="branchcode" id="branchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ [% ELSE %] > <option value="">Any library</option> > [% PROCESS options_for_libraries libraries => Branches.all() %] >+ [% END %] > </select> > > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >index 42f2f42626..180a86b5c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >@@ -47,8 +47,12 @@ > [% IF can_change_library %] > <li><label for="branch">Library:</label> > <select id="branch" name="branch"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branch ) %] >+ [% ELSE %] > <option value="">All</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] >+ [% END %] > </select> > </li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index 23c0a851a8..1e3d133d4e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -149,7 +149,14 @@ fieldset.rows table { clear: none; margin: 0; } > <li> > <label for="branchcode">Library:</label> > <select name="branchcode" id="branchcode"> >- [% UNLESS ( Independentbranches ) %] >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% IF CAN_user_serials_superserials %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode, unfiltered => 1 ) %] >+ [% ELSE %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode ) %] >+ [% END %] >+ [% ELSE %] >+ [% UNLESS ( Koha.Preference('Independentbranches') ) %] > <option value="">None</option> > [% END %] > [% IF CAN_user_serials_superserials %] >@@ -157,6 +164,7 @@ fieldset.rows table { clear: none; margin: 0; } > [% ELSE %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %] > [% END %] >+ [% END %] > </select> > </li> > <li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 22f161aea8..fbc05efe67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -579,8 +579,12 @@ > <li> > <label for="branchcode">Library:</label> > <select name="branchcode" id="branchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchfilter || branchcode ) %] >+ [% ELSE %] > <option value="">Any</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %] >+ [% END %] > </select> > </li> > <li> >@@ -666,8 +670,12 @@ > [% IF ( displayby != "branchcode" ) %] > <label for="branchcode">Viewing suggestions for library:</label> > <select name="branchcode" id="branchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchfilter || branchcode ) %] >+ [% ELSE %] > <option value="__ANY__">Any</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter || branchcode ) %] >+ [% END %] > </select> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >index 4e3924ce0a..34c1b8519f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >@@ -139,7 +139,11 @@ > </li> > <li> > <label for="strip_items_not_from_libraries">Remove items not owned by selected libraries:</label> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" checked="checked" /> >+ [% ELSE %] > <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" /> >+ [% END %] > </li> > <li> > <label for="export_remove_fields">Don't export fields:</label> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >index 1446b72b27..064a89599f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >@@ -252,10 +252,16 @@ > <li> > <label class="description" for="branchcode">[% borrower_fields.$borrower_db_column | html %]: </label> > <select id="branchcode" name="branchcode"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% FOREACH library IN Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %] >+ <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option> >+ [% END %] >+ [% ELSE %] > <option value="" selected="selected"></option> > [% FOREACH library IN Branches.all() %] > <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option> > [% END %] >+ [% END %] > </select> > <span class="field_hint">[% borrower_db_column | html %]</span> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >index 9aacf152de..d8c0d24059 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -99,8 +99,12 @@ > <input type="radio" name="branch" value="holdingbranch"> Current library</input> > </li><li> > <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode, unfiltered => 1, ) %] >+ [% ELSE %] > <option value="">All libraries</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %] >+ [% END %] > </select> > </li> > [% IF (authorised_values) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >index 5e6e638c0b..3940d4ab54 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >@@ -45,6 +45,7 @@ > [% FOREACH facet IN facets_loo.facets %] > [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => facet.facet_label_value, opac =>1 ) || facet.facet_label_value %][% END %] > [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %] >+ [% IF ( facets_loo.type_label_HomeLibrary || facets_loo.type_label_HoldingLibrary ) && opac_name && Koha.Preference('IndependentBranchesHideOtherBranchesItems') && facet.facet_link_value != opac_name %][% NEXT %][% END %] > [% IF loop.count > 5 && !facet.active %] > <li class="collapsible-facet" style="display:none"> > [% ELSE %] >diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl >index c804f72abe..cbd863f0c2 100755 >--- a/reports/acquisitions_stats.pl >+++ b/reports/acquisitions_stats.pl >@@ -181,7 +181,11 @@ else { > > my $CGIsepChoice = GetDelimiterChoices; > >- my $libraries = Koha::Libraries->search({}, { order_by => 'branchname' }); >+ my $libraries_filter = {}; >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $libraries_filter->{branchcode} = C4::Context->userenv->{branch}; >+ } >+ my $libraries = Koha::Libraries->search($libraries_filter, { order_by => 'branchname' }); > > my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode'); > my $ccode_label; >diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl >index e043044844..303baa01d9 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -191,11 +191,15 @@ if ($do_it) { > > } > >+my $libraries_filter = {}; >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $libraries_filter->{branchcode} = C4::Context->userenv->{branch}; >+} > $template->param( > beginDate => $fromDate, > endDate => $toDate, > transaction_type => $transaction_type, >- branchloop => Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed, >+ branchloop => Koha::Libraries->search($libraries_filter, { order_by => ['branchname'] })->unblessed, > debit_types => \@debit_types, > credit_types => \@credit_types, > registerid => $registerid, >diff --git a/reserve/request.pl b/reserve/request.pl >index c89a89ee90..bbf048725a 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -473,6 +473,10 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > unless ( C4::Context->IsSuperLibrarian ) { > $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} ); > } >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $item->{homebranch} ne $userenv->{branch} ) { >+ $item->{hide} = 1; >+ $hiddencount++; >+ } > } > } > >diff --git a/reviews/reviewswaiting.pl b/reviews/reviewswaiting.pl >index 6d50443618..38db04d3dd 100755 >--- a/reviews/reviewswaiting.pl >+++ b/reviews/reviewswaiting.pl >@@ -40,7 +40,12 @@ my $status = $query->param('status') || 0; > my $reviewid = $query->param('reviewid'); > my $page = $query->param('page') || 1; > my $count = C4::Context->preference('numSearchResults') || 20; >-my $total = Koha::Reviews->search_limited({ approved => $status })->count; >+my $review_filter = { approved => $status }; >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ # search_limited supplies the borrowernumber relation >+ $review_filter->{'borrowernumber.branchcode'} = C4::Context->userenv->{branch}; >+} >+my $total = Koha::Reviews->search_limited($review_filter)->count; > > if ( $op eq 'approve' ) { > my $review = Koha::Reviews->find( $reviewid ); >@@ -56,7 +61,7 @@ elsif ( $op eq 'delete' ) { > } > > my $reviews = Koha::Reviews->search_limited( >- { approved => $status }, >+ $review_filter, > { > rows => $count, > page => $page, >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index e24db19104..3252e8f3f3 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -232,6 +232,9 @@ if ($op eq "show"){ > if (defined $biblionumber && !@itemnumbers){ > my $biblio = Koha::Biblios->find($biblionumber); > @itemnumbers = $biblio ? $biblio->items->get_column('itemnumber') : (); >+ if ( $biblio && C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ @itemnumbers = $biblio->items->search({ homebranch => C4::Context->userenv->{branch} })->get_column('itemnumber'); >+ } > } > if ( my $list = $input->param('barcodelist') ) { > my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list ); >diff --git a/tools/export.pl b/tools/export.pl >index 4fe6ce5cc5..f905ae9a5a 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -71,6 +71,9 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > ); > > my @branch = $query->multi_param("branch"); >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ @branch = (C4::Context->userenv->{branch}); >+} > > my @messages; > if ( $op eq 'export' ) { >@@ -91,6 +94,7 @@ if ( $op eq "export" ) { > my @biblionumbers = $query->multi_param("biblionumbers"); > my @itemnumbers = $query->multi_param("itemnumbers"); > my $strip_items_not_from_libraries = $query->param('strip_items_not_from_libraries'); >+ $strip_items_not_from_libraries = 1 if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ); > > my $libraries = Koha::Libraries->search_filtered->unblessed; > my $only_export_items_for_branches = $strip_items_not_from_libraries ? \@branch : undef; >@@ -271,7 +275,11 @@ else { > > my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } ); > >- my $libraries = Koha::Libraries->search_filtered({}, { order_by => ['branchname'] })->unblessed; >+ my $library_filter = {}; >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $library_filter->{'branchcode'} = C4::Context->userenv->{branch}; >+ } >+ my $libraries = Koha::Libraries->search_filtered($library_filter, { order_by => ['branchname'] })->unblessed; > for my $library ( @$libraries ) { > $library->{selected} = 1 if grep { $library->{branchcode} eq $_ } @branch; > } >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 8aed3f4b4b..0c9e6b5f00 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -172,7 +172,11 @@ if ( $op eq 'show' ) { > $template->param( useborrowernumbers => $useborrowernumbers ); > > # Construct drop-down list values >- my $branches = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed; >+ my $library_filter = {}; >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $library_filter->{'branchcode'} = C4::Context->userenv->{branch}; >+ } >+ my $branches = Koha::Libraries->search($library_filter, { order_by => ['branchname'] })->unblessed; > my @branches_option; > push @branches_option, { value => $_->{branchcode}, lib => $_->{branchname} } for @$branches; > unshift @branches_option, { value => "", lib => "" }; >-- >2.25.1 >
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 28642
:
122509
|
124786
|
134174
|
135630