Bugzilla – Attachment 122509 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]
Proposed patch
0001-Bug-28642-Expand-IndependentBranches-to-hide-others-i.patch (text/plain), 63.36 KB, created by
Michael Hafen
on 2021-06-30 15:07:12 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2021-06-30 15:07:12 UTC
Size:
63.36 KB
patch
obsolete
>From b6c10813ef0fecaf572a30c96d63eb117e4c4266 Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Tue, 29 Jun 2021 16:52:25 -0600 >Subject: [PATCH] Bug 28642 - Expand IndependentBranches to hide others items > and libraries > >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. >--- > C4/Context.pm | 4 +++- > C4/Items.pm | 9 ++++++++- > C4/Search.pm | 6 ++++++ > Koha/Template/Plugin/Branches.pm | 5 +++-- > catalogue/MARCdetail.pl | 2 ++ > catalogue/export.pl | 13 +++++++++++++ > catalogue/issuehistory.pl | 8 ++++++-- > catalogue/itemsearch.pl | 13 ++++++++++++- > catalogue/search.pl | 4 ++++ > cataloguing/additem.pl | 7 ++++++- > circ/overdue.pl | 7 +++++++ > installer/data/mysql/atomicupdate/bug_28642.perl | 5 +++++ > koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc | 2 ++ > .../prog/en/includes/patron-search.inc | 4 ++++ > .../prog/en/modules/admin/preferences/admin.pref | 7 +++++++ > .../prog/en/modules/catalogue/advsearch.tt | 4 ++++ > .../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 | 4 ++++ > .../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 ++++ > .../prog/en/modules/tools/koha-news.tt | 8 ++++++++ > reports/acquisitions_stats.pl | 6 +++++- > reports/cash_register_stats.pl | 6 +++++- > reserve/request.pl | 4 ++++ > reviews/reviewswaiting.pl | 9 +++++++-- > tools/batchMod.pl | 6 +++++- > tools/export.pl | 10 +++++++++- > tools/modborrowers.pl | 6 +++++- > 50 files changed, 286 insertions(+), 19 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_28642.perl > >diff --git a/C4/Context.pm b/C4/Context.pm >index db896ad473..75b8b72908 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -946,8 +946,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 1f0d560e86..789293f0f0 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -767,6 +767,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}; > } >@@ -864,7 +866,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 b0ebedcb57..ac1c07c7fb 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1836,6 +1836,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/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index 92c83be68c..c42d8df999 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -92,8 +92,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/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl >index e275077ac2..a168958aee 100755 >--- a/catalogue/MARCdetail.pl >+++ b/catalogue/MARCdetail.pl >@@ -261,6 +261,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 >@@ -298,6 +299,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 cb6f2d8129..42fb4e4b8d 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 e81ec56de5..c49d76cf2b 100755 >--- a/catalogue/issuehistory.pl >+++ b/catalogue/issuehistory.pl >@@ -42,15 +42,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', > } > ); > 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 0329f4b1d8..223a597eb1 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -114,9 +114,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, >@@ -128,6 +132,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'); >@@ -260,7 +267,11 @@ if ( defined $format ) { > > # Display the search form > >-my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } ); >+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' } ); > my @itemtypes; > foreach my $itemtype ( Koha::ItemTypes->search ) { > push @itemtypes, { >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 8bd70fc893..36d6347cd8 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -399,6 +399,10 @@ if ( $params->{'multibranchlimit'} ) { > } > } > >+if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && ! grep { /branch:/ } @limits ) { >+ push @limits, 'branch: '. C4::Context->userenv->{branch}; >+} >+ > for ( my $i=0; $i<@limits; $i++ ) { > if ( $limits[$i] =~ /^branch:/ ) { > my $branchfield = C4::Context->preference('SearchLimitLibrary'); >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index b1e0357398..3ac938cc42 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -873,6 +873,7 @@ foreach my $field (@fields) { > } > } > if (%this_row) { >+ next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $this_row{$branchtagsubfield} ne C4::Context->userenv->{branchname} ); > push(@big_array, \%this_row); > } > } >@@ -933,7 +934,11 @@ my @loop_data =(); > my $i=0; > > my $branch = $input->param('branch') || C4::Context->userenv->{branch}; >-my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. >+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'] })->unblessed;# build once ahead of time, instead of multiple times later. > for my $library ( @$libraries ) { > $library->{selected} = 1 if $library->{branchcode} eq $branch > } >diff --git a/circ/overdue.pl b/circ/overdue.pl >index c402588d19..3bdadfd4b9 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -78,6 +78,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..748d5a1c43 >--- /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','1','','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/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >index af01c0e88b..78a0b7b10d 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"> >@@ -45,6 +46,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 && 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 b8aee067d9..263c5c18c9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -52,7 +52,11 @@ > > <p> > <label for="branchcode">Library: </label> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% SET branches = Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode_filter, only_from_group => 1 ) %] >+ [% ELSE %] > [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %] >+ [% END %] > <select name="branchcode_filter" id="branchcode"> > [% IF branches.size != 1 %] > <option value="">Any</option> >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 a858b1d0da..68d84db1fb 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 >@@ -116,6 +116,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 6660d2ca8f..30823487b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -285,9 +285,13 @@ > > <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( selected => selected_branchcode, unfiltered => 1 ) %] >+ [% END %] > </select></p> > <!-- <input type="hidden" name="limit" value="branch: MAIN" /> --> > [% IF search_groups %] >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 3d23fdcd24..f257ee7b5f 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 3723357b3a..52e1c0cee5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >@@ -225,16 +225,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> > >@@ -242,7 +250,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 564ab5f54f..8bd2d2e288 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 >@@ -206,8 +206,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( only_from_group => 1 ) %] >+ [% END %] > </select> > </li> > </ol></fieldset> >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 8d89d44b4d..55e0425009 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 >@@ -84,8 +84,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 73b3b4348b..acdbfe7514 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 edcc5e050d..58f87e2a5d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -191,7 +191,11 @@ > </li> > <li> > <label for="branchcode_filter">Library:</label> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% SET branches = Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode_filter, only_from_group => 1 ) %] >+ [% ELSE %] > [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %] >+ [% END %] > <select id="branchcode_filter"> > [% IF branches.size != 1 %] > <option value="">Any</option> >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 f874e80de9..be1828d71c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -842,7 +842,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 af06dc3e35..099ce5ed2a 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> >@@ -178,7 +179,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 502ac75124..11a13fe27d 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 >@@ -125,10 +125,17 @@ > <span class="hint">[% INCLUDE 'date-format.inc' %]</span></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 db1e6eeff3..d5a1c943df 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 >@@ -168,10 +168,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 4ec821bc6d..b8faba7779 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 ecd1d44026..1371cf0503 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 >@@ -103,8 +103,13 @@ > <span class="hint">[% INCLUDE 'date-format.inc' %]</span></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 6d0b879213..33e49c5f1b 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 f976f1cffe..f88c0659ae 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 >@@ -173,8 +173,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 ddf42c2bec..a03ee01416 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 >@@ -203,8 +203,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> >@@ -268,8 +272,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> >@@ -278,8 +286,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 28cdac564d..daaa8cc728 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 dabfe169ea..db77a0c904 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 >@@ -188,8 +188,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> >@@ -198,8 +202,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> >@@ -208,8 +216,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 dd7c0e23ce..5bd96ca0b4 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 cdd8861dae..cefff1149f 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 789596e4ec..ecd3a5531b 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 5234d766a4..d58a35f291 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 => branchfilter || 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 04b7bc801c..918ddf5f9c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >@@ -137,7 +137,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 4237c8fcc9..d8569eb65c 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 >@@ -253,10 +253,16 @@ > <li> > <label class="description" for="branchcode">[% borrower_field.description | 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_field.field | 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 8edc3739b4..478448a312 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -98,8 +98,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/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index 16138cf171..15465d7412 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -98,12 +98,16 @@ > <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 => new_detail.branchcode, unfiltered => 1, ) %] >+ [% ELSE %] > [% IF ( new_detail.branchcode == '' ) %] > <option value="" selected="selected">All libraries</option> > [% ELSE %] > <option value="" >All libraries</option> > [% END %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %] >+ [% END %] > </select> > </li> > <li> >@@ -263,9 +267,13 @@ > <li> > <label for="news_library">Library: </label> > <select id="news_library" name="news_library"> >+ [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode, unfiltered => 1, ) %] >+ [% ELSE %] > <option value=""></option> > <option value="">All libraries</option> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %] >+ [% END %] > </select> > </li> > <li> >diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl >index 8fe531358e..a8b2f93b36 100755 >--- a/reports/acquisitions_stats.pl >+++ b/reports/acquisitions_stats.pl >@@ -182,7 +182,11 @@ else { > > my $CGIsepChoice = GetDelimiterChoices; > >- my @branches = Koha::Libraries->search({}, { order_by => 'branchname' }); >+ my $libraries_filter = {}; >+ if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) { >+ $libraries_filter->{branchcode} = C4::Context->userenv->{branch}; >+ } >+ my @branches = 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 3b790ff8ca..2391e82ae5 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -192,11 +192,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 bf13c3dfb2..4940ac6474 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -559,6 +559,10 @@ foreach my $biblionumber (@biblionumbers) { > 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 99a0d3f587..cb0c039919 100755 >--- a/reviews/reviewswaiting.pl >+++ b/reviews/reviewswaiting.pl >@@ -41,7 +41,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 ); >@@ -57,7 +62,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 6354d3bea2..679492a9fd 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -398,7 +398,11 @@ my @loop_data =(); > my $i=0; > my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; > >-my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. >+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'] })->unblessed;# build once ahead of time, instead of multiple times later. > > # Adding a default choice, in case the user does not want to modify the branch > my $nochange_branch = { branchname => '', value => '', selected => 1 }; >diff --git a/tools/export.pl b/tools/export.pl >index 588f1b9c93..b3b80421d9 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 ee896848d1..f5fed1953f 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -152,7 +152,11 @@ if ( $op eq 'show' ) { > if @notfoundcardnumbers; > > # 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