View | Details | Raw Unified | Return to bug 28642
Collapse All | Expand All

(-)a/C4/Context.pm (-1 / +3 lines)
Lines 899-906 sub mybranch { Link Here
899
=cut
899
=cut
900
900
901
sub only_my_library {
901
sub only_my_library {
902
    my ( $class, $pref ) = @_;
903
    $pref //= 'IndependentBranches';
902
    return
904
    return
903
         C4::Context->preference('IndependentBranches')
905
         C4::Context->preference($pref)
904
      && C4::Context->userenv
906
      && C4::Context->userenv
905
      && !C4::Context->IsSuperLibrarian()
907
      && !C4::Context->IsSuperLibrarian()
906
      && C4::Context->userenv->{branch};
908
      && C4::Context->userenv->{branch};
(-)a/C4/Items.pm (-1 / +8 lines)
Lines 766-771 sub GetItemsInfo { Link Here
766
    my $userenv = C4::Context->userenv;
766
    my $userenv = C4::Context->userenv;
767
    my $want_not_same_branch = C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian();
767
    my $want_not_same_branch = C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian();
768
    while ( my $data = $sth->fetchrow_hashref ) {
768
    while ( my $data = $sth->fetchrow_hashref ) {
769
        next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $data->{homebranch} ne $userenv->{branch} );
770
769
        if ( $data->{borrowernumber} && $want_not_same_branch) {
771
        if ( $data->{borrowernumber} && $want_not_same_branch) {
770
            $data->{'NOTSAMEBRANCH'} = $data->{'bcode'} ne $userenv->{branch};
772
            $data->{'NOTSAMEBRANCH'} = $data->{'bcode'} ne $userenv->{branch};
771
        }
773
        }
Lines 863-869 sub GetItemsLocationInfo { Link Here
863
			    location, itemcallnumber, cn_sort
865
			    location, itemcallnumber, cn_sort
864
		     FROM items, branches as a, branches as b
866
		     FROM items, branches as a, branches as b
865
		     WHERE homebranch = a.branchcode AND holdingbranch = b.branchcode 
867
		     WHERE homebranch = a.branchcode AND holdingbranch = b.branchcode 
866
		     AND biblionumber = ?
868
		     AND biblionumber = ?";
869
    if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') &&( my $mybranch = C4::Context->userenv->{branch} ) ) {
870
        $query .= "
871
             AND homebranch = '$mybranch'";
872
    }
873
    $query .= "
867
		     ORDER BY cn_sort ASC";
874
		     ORDER BY cn_sort ASC";
868
	my $sth = $dbh->prepare($query);
875
	my $sth = $dbh->prepare($query);
869
        $sth->execute($biblionumber);
876
        $sth->execute($biblionumber);
(-)a/C4/Search.pm (+6 lines)
Lines 1791-1796 sub searchResults { Link Here
1791
                    next;
1791
                    next;
1792
                }
1792
                }
1793
            }
1793
            }
1794
            if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
1795
                if ( $item->{homebranch} ne $userenv->{branch} ) {
1796
                    $items_count--;
1797
                    next;
1798
                }
1799
            }
1794
1800
1795
            my $hbranch     = C4::Context->preference('StaffSearchResultsDisplayBranch');
1801
            my $hbranch     = C4::Context->preference('StaffSearchResultsDisplayBranch');
1796
            my $otherbranch = $hbranch eq 'homebranch' ? 'holdingbranch' : 'homebranch';
1802
            my $otherbranch = $hbranch eq 'homebranch' ? 'holdingbranch' : 'homebranch';
(-)a/Koha/Template/Plugin/Branches.pm (-2 / +3 lines)
Lines 92-99 sub all { Link Here
92
}
92
}
93
93
94
sub InIndependentBranchesMode {
94
sub InIndependentBranchesMode {
95
    my ( $self ) = @_;
95
    my ( $self, $params ) = @_;
96
    return ( not C4::Context->preference("IndependentBranches") or C4::Context::IsSuperLibrarian );
96
    my $pref = $params->{syspref} || 'IndependentBranches';
97
    return ( C4::Context->preference($pref) and not C4::Context::IsSuperLibrarian );
97
}
98
}
98
99
99
sub pickup_locations {
100
sub pickup_locations {
(-)a/catalogue/MARCdetail.pl (+2 lines)
Lines 265-270 for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { Link Here
265
# loop through each tag
265
# loop through each tag
266
# warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary
266
# warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary
267
# then construct template.
267
# then construct template.
268
my ($homebrtagf,$homebrtagsubf) = &GetMarcFromKohaField( "items.homebranch" );
268
my @fields = $record->fields();
269
my @fields = $record->fields();
269
my %witness
270
my %witness
270
  ; #---- stores the list of subfields used at least once, with the "meaning" of the code
271
  ; #---- stores the list of subfields used at least once, with the "meaning" of the code
Lines 302-307 foreach my $field (@fields) { Link Here
302
          if grep { $kohafield eq $_ }
303
          if grep { $kohafield eq $_ }
303
              qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate );
304
              qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate );
304
    }
305
    }
306
    next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $item && $item->{$homebrtagsubf} ne C4::Context->userenv->{'branchname'} );
305
    push @item_loop, $item if $item;
307
    push @item_loop, $item if $item;
306
}
308
}
307
309
(-)a/catalogue/export.pl (+13 lines)
Lines 40-45 if ($op eq "export") { Link Here
40
                }
40
                }
41
            }
41
            }
42
42
43
            if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
44
                my $mybranch = C4::Context->userenv->{branch};
45
                my ($homebrtagf,$homebrtagsubf) = &GetMarcFromKohaField( "items.homebranch" );
46
                my @fields = $marc->field($homebrtagf);
47
                my @delete;
48
                foreach my $field (@fields) {
49
                    if ( $field->subfield($homebrtagsubf) ne $mybranch ) {
50
                        push @delete, $field;
51
                    }
52
                }
53
                $marc->delete_fields(@delete) if ( @delete );
54
            }
55
43
            if ($format =~ /endnote/) {
56
            if ($format =~ /endnote/) {
44
                $marc = marc2endnote($marc);
57
                $marc = marc2endnote($marc);
45
                $format = 'endnote';
58
                $format = 'endnote';
(-)a/catalogue/issuehistory.pl (-2 / +6 lines)
Lines 41-55 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
41
41
42
my $biblionumber = $query->param('biblionumber');
42
my $biblionumber = $query->param('biblionumber');
43
43
44
my $issue_filter = { biblionumber => $biblionumber };
45
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
46
    $issue_filter->{'item.homebranch'} = C4::Context->userenv->{branch};
47
}
44
my @checkouts = Koha::Checkouts->search(
48
my @checkouts = Koha::Checkouts->search(
45
    { biblionumber => $biblionumber },
49
    $issue_filter,
46
    {
50
    {
47
        join       => 'item',
51
        join       => 'item',
48
        order_by   => 'timestamp',
52
        order_by   => 'timestamp',
49
    }
53
    }
50
);
54
);
51
my @old_checkouts = Koha::Old::Checkouts->search(
55
my @old_checkouts = Koha::Old::Checkouts->search(
52
    { biblionumber => $biblionumber },
56
    $issue_filter,
53
    {
57
    {
54
        join       => 'item',
58
        join       => 'item',
55
        order_by   => 'timestamp',
59
        order_by   => 'timestamp',
(-)a/catalogue/itemsearch.pl (-1 / +12 lines)
Lines 113-121 if ( defined $format ) { Link Here
113
        filters => [],
113
        filters => [],
114
    };
114
    };
115
115
116
    # IndependentBranchesHideOtherBranchesItems forces homebranch filter
117
    #  if it isn't already set
118
    my $got_branch = 0;
116
    foreach my $p (qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan itemlost withdrawn)) {
119
    foreach my $p (qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan itemlost withdrawn)) {
117
        if (my @q = $cgi->multi_param($p)) {
120
        if (my @q = $cgi->multi_param($p)) {
118
            if ($q[0] ne '') {
121
            if ($q[0] ne '') {
122
                if ( $p eq 'homebranch' ) { $got_branch = 1; }
119
                my $f = {
123
                my $f = {
120
                    field => $p,
124
                    field => $p,
121
                    query => \@q,
125
                    query => \@q,
Lines 127-132 if ( defined $format ) { Link Here
127
            }
131
            }
128
        }
132
        }
129
    }
133
    }
134
    if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && ! $got_branch ) {
135
        push @{ $filter->{filters} }, { field => 'homebranch', query => [ C4::Context->userenv->{branch} ] };
136
    }
130
137
131
    my @c = $cgi->multi_param('c');
138
    my @c = $cgi->multi_param('c');
132
    my @fields = $cgi->multi_param('f');
139
    my @fields = $cgi->multi_param('f');
Lines 259-265 if ( defined $format ) { Link Here
259
266
260
# Display the search form
267
# Display the search form
261
268
262
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } );
269
my $library_filter = {};
270
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
271
    $library_filter->{'branchcode'} = C4::Context->userenv->{branch};
272
}
273
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( $library_filter, { order_by => 'branchname' } );
263
my @itemtypes;
274
my @itemtypes;
264
foreach my $itemtype ( Koha::ItemTypes->search_with_localization ) {
275
foreach my $itemtype ( Koha::ItemTypes->search_with_localization ) {
265
    push @itemtypes, {
276
    push @itemtypes, {
(-)a/catalogue/search.pl (+4 lines)
Lines 398-403 if ( $params->{'multibranchlimit'} ) { Link Here
398
    }
398
    }
399
}
399
}
400
400
401
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && ! grep { /branch:/ } @limits ) {
402
    push @limits, 'branch: '. C4::Context->userenv->{branch};
403
}
404
401
for ( my $i=0; $i<@limits; $i++ ) {
405
for ( my $i=0; $i<@limits; $i++ ) {
402
    if ( $limits[$i] =~ /^branch:/ ) {
406
    if ( $limits[$i] =~ /^branch:/ ) {
403
        my $branchfield  = C4::Context->preference('SearchLimitLibrary');
407
        my $branchfield  = C4::Context->preference('SearchLimitLibrary');
(-)a/cataloguing/additem.pl (-1 / +6 lines)
Lines 884-889 foreach my $field (@fields) { Link Here
884
        }
884
        }
885
    }
885
    }
886
    if (%this_row) {
886
    if (%this_row) {
887
        next if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $this_row{$branchtagsubfield} ne C4::Context->userenv->{branchname} );
887
        push(@big_array, \%this_row);
888
        push(@big_array, \%this_row);
888
    }
889
    }
889
}
890
}
Lines 944-950 my @loop_data =(); Link Here
944
my $i=0;
945
my $i=0;
945
946
946
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
947
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
947
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
948
my $libraries_filter = {};
949
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
950
    $libraries_filter->{branchcode} = C4::Context->userenv->{branch};
951
}
952
my $libraries = Koha::Libraries->search($libraries_filter, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
948
for my $library ( @$libraries ) {
953
for my $library ( @$libraries ) {
949
    $library->{selected} = 1 if $library->{branchcode} eq $branch
954
    $library->{selected} = 1 if $library->{branchcode} eq $branch
950
}
955
}
(-)a/circ/overdue.pl (+7 lines)
Lines 78-83 our $logged_in_user = Koha::Patrons->find( $loggedinuser ); Link Here
78
78
79
my $dbh = C4::Context->dbh;
79
my $dbh = C4::Context->dbh;
80
80
81
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && (my $mybranch = C4::Context->userenv->{branch}) ) {
82
    $homebranchfilter = $mybranch;
83
    $holdingbranchfilter = '';
84
    $filters->{homebranch} = $mybranch;
85
    $filters->{holdingbranch} = $mybranch;
86
}
87
81
my $req;
88
my $req;
82
$req = $dbh->prepare( "select categorycode, description from categories order by description");
89
$req = $dbh->prepare( "select categorycode, description from categories order by description");
83
$req->execute;
90
$req->execute;
(-)a/installer/data/mysql/atomicupdate/bug_28642.perl (+5 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $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')" );
4
    NewVersion( $DBversion, 28642, "Add new systempreference IndependentBranchesHideOtherBranchesItems");
5
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 264-269 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
264
('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'),
264
('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo'),
265
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
265
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
266
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
266
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
267
('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'),
267
('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
268
('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
268
('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'),
269
('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'),
269
('RecordedBooksClientSecret','','30','Client key for RecordedBooks integration','Free'),
270
('RecordedBooksClientSecret','','30','Client key for RecordedBooks integration','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc (+2 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE AuthorisedValues %]
2
[% USE AuthorisedValues %]
3
[% USE Languages %]
3
[% USE Languages %]
4
[% USE Branches %]
4
[% IF ( opacfacets ) %]
5
[% IF ( opacfacets ) %]
5
[% IF ( facets_loop ) %]
6
[% IF ( facets_loop ) %]
6
<div id="search-facets">
7
<div id="search-facets">
Lines 36-41 Link Here
36
  [% FOREACH facet IN facets_loo.facets %]
37
  [% FOREACH facet IN facets_loo.facets %]
37
  [% 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 %]
38
  [% 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 %]
38
  [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
39
  [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
40
  [% IF ( facets_loo.type_label_HomeLibrary && Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) && facet.facet_link_value != Branches.GetLoggedInBranchcode() ) %][% NEXT %][% END %]
39
  [% IF loop.count > 5 && !facet.active %]
41
  [% IF loop.count > 5 && !facet.active %]
40
    <li class="collapsible-facet" style="display:none">
42
    <li class="collapsible-facet" style="display:none">
41
  [% ELSE %]
43
  [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (+4 lines)
Lines 52-58 Link Here
52
52
53
        <p>
53
        <p>
54
            <label for="branchcode">Library: </label>
54
            <label for="branchcode">Library: </label>
55
            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
56
            [% SET branches = Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode_filter, only_from_group => 1 ) %]
57
            [% ELSE %]
55
            [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %]
58
            [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %]
59
            [% END %]
56
            <select name="branchcode_filter" id="branchcode">
60
            <select name="branchcode_filter" id="branchcode">
57
                [% IF branches.size != 1 %]
61
                [% IF branches.size != 1 %]
58
                  <option value="">Any</option>
62
                  <option value="">Any</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (+4 lines)
Lines 338-346 Link Here
338
          <li>
338
          <li>
339
            <label for="branch">Library:</label>
339
            <label for="branch">Library:</label>
340
            <select id="branch" name="branch">
340
            <select id="branch" name="branch">
341
              [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
342
              [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branch, unfiltered => 1 ) %]
343
              [% ELSE %]
341
              <option value="">All</option>
344
              <option value="">All</option>
342
              [%# FIXME Should not we filter the libraries %]
345
              [%# FIXME Should not we filter the libraries %]
343
              [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
346
              [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
347
              [% END %]
344
            </select>
348
            </select>
345
          </li>
349
          </li>
346
        </ol>
350
        </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+7 lines)
Lines 116-121 Administration: Link Here
116
                  1: "Yes"
116
                  1: "Yes"
117
                  0: "No"
117
                  0: "No"
118
            - "<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>"
118
            - "<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>"
119
        -
120
            - "Prevent staff (but not superlibrarians) from selecting other libraries in dropdowns and seeing items belonging to other libraries: "
121
            - pref: IndependentBranchesHideOtherBranchesItems
122
              default: 0
123
              choices:
124
                  1: "Yes"
125
                  0: "No"
119
        -
126
        -
120
            - "Prevent staff (but not superlibrarians) from viewing and approving/denying patron modification requests for patrons belonging to other libraries: "
127
            - "Prevent staff (but not superlibrarians) from viewing and approving/denying patron modification requests for patrons belonging to other libraries: "
121
            - pref: IndependentBranchesPatronModifications
128
            - pref: IndependentBranchesPatronModifications
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt (+4 lines)
Lines 285-293 Link Here
285
285
286
<fieldset id="select-libs">
286
<fieldset id="select-libs">
287
        <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop">
287
        <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop">
288
        [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
289
        [% PROCESS options_for_libraries prefix => "branch:" libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, unfiltered => 1 ) %]
290
        [% ELSE %]
288
        <option value="">All libraries</option>
291
        <option value="">All libraries</option>
289
        [%# FIXME Should not we filter the libraries displayed? %]
292
        [%# FIXME Should not we filter the libraries displayed? %]
290
        [% PROCESS options_for_libraries prefix => "branch:" libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %]
293
        [% PROCESS options_for_libraries prefix => "branch:" libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %]
294
        [% END %]
291
        </select></p>
295
        </select></p>
292
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
296
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
293
        [% IF search_groups %]
297
        [% IF search_groups %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt (+3 lines)
Lines 2-7 Link Here
2
[% USE To %]
2
[% USE To %]
3
[% USE Asset %]
3
[% USE Asset %]
4
[% USE AuthorisedValues %]
4
[% USE AuthorisedValues %]
5
[% USE Branches %]
5
6
6
[%- BLOCK form_label -%]
7
[%- BLOCK form_label -%]
7
  [%- SWITCH label -%]
8
  [%- SWITCH label -%]
Lines 41-49 Link Here
41
      <option value="!=" >is not</option>
42
      <option value="!=" >is not</option>
42
    </select>
43
    </select>
43
    <select id="[% name | html %]" name="[% name | html %]" multiple="multiple" size="[% options.size < 4 ? options.size + 1 : 4 | html %]">
44
    <select id="[% name | html %]" name="[% name | html %]" multiple="multiple" size="[% options.size < 4 ? options.size + 1 : 4 | html %]">
45
      [% UNLESS ( name == 'homebranch' || name == 'holdingbranch' ) && Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
44
      <option value="" selected="selected">
46
      <option value="" selected="selected">
45
        [% IF (empty_option) %][% INCLUDE form_label label=empty_option %][% ELSE %]<span>All</span>[% END %]
47
        [% IF (empty_option) %][% INCLUDE form_label label=empty_option %][% ELSE %]<span>All</span>[% END %]
46
      </option>
48
      </option>
49
      [% END %]
47
      [% FOREACH option IN options %]
50
      [% FOREACH option IN options %]
48
        <option value="[% option.value | html %]">[% option.label | html %]</option>
51
        <option value="[% option.value | html %]">[% option.label | html %]</option>
49
      [% END %]
52
      [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt (+12 lines)
Lines 227-242 Link Here
227
    <li>
227
    <li>
228
        <label>Item home library:</label>
228
        <label>Item home library:</label>
229
        <select name="homebranch" id="homebranch">
229
        <select name="homebranch" id="homebranch">
230
            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
231
            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => filters.homebranch ) %]
232
	    [% ELSE %]
230
            <option value="">Any</option>
233
            <option value="">Any</option>
231
            [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.homebranch ) %]
234
            [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.homebranch ) %]
235
	    [% END %]
232
        </select>
236
        </select>
233
    </li>
237
    </li>
234
238
235
    <li>
239
    <li>
236
        <label>Item holding library:</label>
240
        <label>Item holding library:</label>
237
        <select name="holdingbranch" id="holdingbranch">
241
        <select name="holdingbranch" id="holdingbranch">
242
            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
243
            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => filters.holdingbranch ) %]
244
	    [% ELSE %]
238
            <option value="">Any</option>
245
            <option value="">Any</option>
239
            [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.holdingbranch ) %]
246
            [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.holdingbranch ) %]
247
	    [% END %]
240
        </select>
248
        </select>
241
    </li>
249
    </li>
242
250
Lines 244-250 Link Here
244
        <label>Library of the patron:</label>
252
        <label>Library of the patron:</label>
245
        <select name="branch" id="branch">
253
        <select name="branch" id="branch">
246
            <option value="">Any</option>
254
            <option value="">Any</option>
255
            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
256
            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => filters.branch, only_from_group => 1 ) %]
257
            [% ELSE %]
247
            [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.branch, only_from_group => 1 ) %]
258
            [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.branch, only_from_group => 1 ) %]
259
            [% END %]
248
        </select>
260
        </select>
249
    </li>
261
    </li>
250
262
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (+4 lines)
Lines 206-213 Link Here
206
        <li>
206
        <li>
207
            <label for="branchlimit">Library: </label>
207
            <label for="branchlimit">Library: </label>
208
            <select name="branchlimit" id="branchlimit">
208
            <select name="branchlimit" id="branchlimit">
209
                [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
210
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, only_from_group => 1 ) %]
211
                [% ELSE %]
209
                <option value="">All</option>
212
                <option value="">All</option>
210
                [% PROCESS options_for_libraries libraries => Branches.all( only_from_group => 1 ) %]
213
                [% PROCESS options_for_libraries libraries => Branches.all( only_from_group => 1 ) %]
214
                [% END %]
211
            </select>
215
            </select>
212
        </li>
216
        </li>
213
    </ol></fieldset>
217
    </ol></fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt (+4 lines)
Lines 84-91 Link Here
84
                        <li>
84
                        <li>
85
                            <label for="club-template-branchcode">Library:</label>
85
                            <label for="club-template-branchcode">Library:</label>
86
                            <select name="branchcode" id="club-template-branchcode">
86
                            <select name="branchcode" id="club-template-branchcode">
87
                            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
88
                                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => club.branch.branchcode ) %]
89
                            [% ELSE %]
87
                                <option value=""></option>
90
                                <option value=""></option>
88
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => club.branch.branchcode ) %]
91
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => club.branch.branchcode ) %]
92
                            [% END %]
89
                            </select>
93
                            </select>
90
                        </li>
94
                        </li>
91
95
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt (+4 lines)
Lines 97-104 Link Here
97
                        <li>
97
                        <li>
98
                            <label for="club-template-branchcode">Library:</label>
98
                            <label for="club-template-branchcode">Library:</label>
99
                            <select name="branchcode" id="club-template-branchcode">
99
                            <select name="branchcode" id="club-template-branchcode">
100
                            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
101
                                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => club_template.branchcode ) %]
102
                            [% ELSE %]
100
                                <option value=""></option>
103
                                <option value=""></option>
101
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => club_template.branchcode ) %]
104
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => club_template.branchcode ) %]
105
                            [% END %]
102
                            </select>
106
                            </select>
103
                            <div class="hint">If set, only librarians logged in with this branch will be able to modify this club template.</div>
107
                            <div class="hint">If set, only librarians logged in with this branch will be able to modify this club template.</div>
104
                        </li>
108
                        </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt (+4 lines)
Lines 191-197 Link Here
191
                      </li>
191
                      </li>
192
                      <li>
192
                      <li>
193
                        <label for="branchcode_filter">Library:</label>
193
                        <label for="branchcode_filter">Library:</label>
194
                        [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
195
                        [% SET branches = Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode_filter, only_from_group => 1 ) %]
196
                        [% ELSE %]
194
                        [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %]
197
                        [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %]
198
                        [% END %]
195
                        <select id="branchcode_filter">
199
                        <select id="branchcode_filter">
196
                          [% IF branches.size != 1 %]
200
                          [% IF branches.size != 1 %]
197
                            <option value="">Any</option>
201
                            <option value="">Any</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+4 lines)
Lines 902-908 legend:hover { Link Here
902
                                            <li>
902
                                            <li>
903
                                                <label for="libraries" class="required">Library:</label>
903
                                                <label for="libraries" class="required">Library:</label>
904
                                                <select name="branchcode" id="libraries">
904
                                                <select name="branchcode" id="libraries">
905
                                                    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
906
                                                    [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => userbranch, only_from_group => 1 ) %]
907
                                                    [% ELSE %]
905
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
908
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
909
                                                    [% END %]
906
                                                </select>
910
                                                </select>
907
                                                <span class="required">Required</span>
911
                                                <span class="required">Required</span>
908
                                            </li>
912
                                            </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt (+3 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% SET footerjs = 1 %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>[% IF ( do_it ) %]Acquisitions statistics &rsaquo; Results[% ELSE %]Acquisitions statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
4
<title>[% IF ( do_it ) %]Acquisitions statistics &rsaquo; Results[% ELSE %]Acquisitions statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
Lines 178-184 Link Here
178
                <td><input type="radio" name="Column" value="items.homebranch" /></td>
179
                <td><input type="radio" name="Column" value="items.homebranch" /></td>
179
                <td>
180
                <td>
180
                    <select name="Filter">
181
                    <select name="Filter">
182
                        [% UNLESS Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
181
                        <option value="" selected="selected">All libraries</option>
183
                        <option value="" selected="selected">All libraries</option>
184
                        [% END %]
182
                        [% FOREACH branch IN branches %]
185
                        [% FOREACH branch IN branches %]
183
                            <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
186
                            <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
184
                        [% END %]
187
                        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt (-2 / +9 lines)
Lines 125-134 Link Here
125
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
125
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
126
			<li> 
126
			<li> 
127
				<label for="branch">Library: </label>
127
				<label for="branch">Library: </label>
128
<select name="Filter" id="branch"><option value="" > Any library</option>
128
<select name="Filter" id="branch">
129
    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
130
    [% FOREACH l IN Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, unfiltered => 1 ) %]
131
        <option value="[% l.branchcode | html %]" >[% l.branchname | html %] </option>
132
     [% END %]
133
    [% ELSE %]
134
        <option value="" > Any library</option>
129
    [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
135
    [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
130
        <option value="[% l.branchcode | html %]" >[% l.branchname | html %] </option>
136
        <option value="[% l.branchcode | html %]" >[% l.branchname | html %] </option>
131
     [% END %] 
137
     [% END %]
138
    [% END %]
132
    </select>			</li>
139
    </select>			</li>
133
			<li> 
140
			<li> 
134
                <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
141
                <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (+6 lines)
Lines 169-178 Link Here
169
			<td><input type="radio" name="Column" value="branchcode" /></td>
169
			<td><input type="radio" name="Column" value="branchcode" /></td>
170
			<td>
170
			<td>
171
                <select name="Filter" id="branch">
171
                <select name="Filter" id="branch">
172
                [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
173
                [% FOREACH l IN Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, unfiltered => 1 ) %]
174
                    <option value="[% l.branchcode | html %]">[% l.branchcode | html %] - [% l.branchname || 'UNKNOWN' | html %]</option>
175
                [% END %]
176
                [% ELSE %]
172
                <option value=""></option>
177
                <option value=""></option>
173
                [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
178
                [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
174
                    <option value="[% l.branchcode | html %]">[% l.branchcode | html %] - [% l.branchname || 'UNKNOWN' | html %]</option>
179
                    <option value="[% l.branchcode | html %]">[% l.branchcode | html %] - [% l.branchname || 'UNKNOWN' | html %]</option>
175
                [% END %]
180
                [% END %]
181
                [% END %]
176
                </select>
182
                </select>
177
			</td>
183
			</td>
178
			</tr>
184
			</tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt (+2 lines)
Lines 108-114 Link Here
108
                <li>
108
                <li>
109
                    <label>Transaction library</label>
109
                    <label>Transaction library</label>
110
                    <select name="branch" id="branch">
110
                    <select name="branch" id="branch">
111
                        [% UNLESS Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
111
                        <option value="ALL">All</option>
112
                        <option value="ALL">All</option>
113
                        [% END %]
112
                        [% FOREACH branchloo IN branchloop %]
114
                        [% FOREACH branchloo IN branchloop %]
113
                            [% IF ( branchloo.selected ) %]
115
                            [% IF ( branchloo.selected ) %]
114
                            <option value="[% branchloo.branchcode | html %]" selected="selected">[% branchloo.branchname | html %]</option>
116
                            <option value="[% branchloo.branchcode | html %]" selected="selected">[% branchloo.branchname | html %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt (-1 / +6 lines)
Lines 103-110 Link Here
103
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
103
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
104
        <li>
104
        <li>
105
            <label for="branch">Library: </label>
105
            <label for="branch">Library: </label>
106
            <select name="Filter" id="branch"><option value="" > Any library</option>
106
            <select name="Filter" id="branch">
107
	    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
108
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
109
	    [% ELSE %]
110
	        <option value="" > Any library</option>
107
                [% PROCESS options_for_libraries libraries => Branches.all() %]
111
                [% PROCESS options_for_libraries libraries => Branches.all() %]
112
            [% END %]
108
            </select>
113
            </select>
109
        </li>
114
        </li>
110
      <li> 
115
      <li> 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt (+4 lines)
Lines 105-112 Link Here
105
		<ol>
105
		<ol>
106
			<li><label for="branch">Library: </label>
106
			<li><label for="branch">Library: </label>
107
	<select name="Filter" id="branch">
107
	<select name="Filter" id="branch">
108
	[% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
109
        [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
110
	[% ELSE %]
108
        <option value="">Any library</option>
111
        <option value="">Any library</option>
109
        [% PROCESS options_for_libraries libraries => Branches.all() %]
112
        [% PROCESS options_for_libraries libraries => Branches.all() %]
113
	[% END %]
110
    </select></li>
114
    </select></li>
111
      <li> 
115
      <li> 
112
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
116
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt (+4 lines)
Lines 156-163 Link Here
156
                <td><input type="radio" checked="checked" name="Line" value="items.homebranch" /></td>
156
                <td><input type="radio" checked="checked" name="Line" value="items.homebranch" /></td>
157
				<td><input type="radio" name="Column" value="items.homebranch" /></td>
157
				<td><input type="radio" name="Column" value="items.homebranch" /></td>
158
				<td><select name="Filter" id="branch">
158
				<td><select name="Filter" id="branch">
159
                    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
160
                    [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
161
                    [% ELSE %]
159
                    <option value=""> </option>
162
                    <option value=""> </option>
160
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
163
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
164
                    [% END %]
161
                    </select>
165
                    </select>
162
				</td>
166
				</td>
163
			</tr>
167
			</tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt (+4 lines)
Lines 173-180 Link Here
173
				<td><input type="radio" name="Column" value="branchcode" /></td>
173
				<td><input type="radio" name="Column" value="branchcode" /></td>
174
                <td>
174
                <td>
175
                    <select name="Filter" id="branch">
175
                    <select name="Filter" id="branch">
176
                    [% IF Branches.InIndependentBranchesMode({syspref=>''}) %]
177
                        [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
178
                    [% ELSE %]
176
                        <option value=""></option>
179
                        <option value=""></option>
177
                        [% PROCESS options_for_libraries libraries => Branches.all() %]
180
                        [% PROCESS options_for_libraries libraries => Branches.all() %]
181
                    [% END %]
178
                    </select>
182
                    </select>
179
                </td>
183
                </td>
180
			</tr>
184
			</tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt (+12 lines)
Lines 203-210 Link Here
203
            <td><input type="radio" checked="checked" name="Line" value="branch" /></td>
203
            <td><input type="radio" checked="checked" name="Line" value="branch" /></td>
204
            <td><input type="radio" name="Column" value="branch" /></td>
204
            <td><input type="radio" name="Column" value="branch" /></td>
205
            <td><select name="Filter" id="branch">
205
            <td><select name="Filter" id="branch">
206
                [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
207
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
208
                [% ELSE %]
206
                <option value=""> </option>
209
                <option value=""> </option>
207
                [% PROCESS options_for_libraries libraries => Branches.all() %]
210
                [% PROCESS options_for_libraries libraries => Branches.all() %]
211
                [% END %]
208
               </select>
212
               </select>
209
             </td> 
213
             </td> 
210
        </tr>
214
        </tr>
Lines 268-275 Link Here
268
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
272
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
269
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
273
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
270
            <td><select name="Filter" id="homebranch">
274
            <td><select name="Filter" id="homebranch">
275
                    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
276
                    [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
277
                    [% ELSE %]
271
                    <option value=""> </option>
278
                    <option value=""> </option>
272
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
279
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
280
                    [% END %]
273
                </select>
281
                </select>
274
            </td>
282
            </td>
275
        </tr>
283
        </tr>
Lines 278-285 Link Here
278
            <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
286
            <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
279
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
287
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
280
            <td><select name="Filter" id="holdingbranch">
288
            <td><select name="Filter" id="holdingbranch">
289
                    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
290
                    [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
291
                    [% ELSE %]
281
                    <option value=""> </option>
292
                    <option value=""> </option>
282
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
293
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
294
                    [% END %]
283
                </select>
295
                </select>
284
            </td>
296
            </td>
285
        </tr>
297
        </tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt (+4 lines)
Lines 149-156 Link Here
149
149
150
	<li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
150
	<li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
151
	<li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
151
	<li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
152
            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
153
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
154
            [% ELSE %]
152
                <option value="">All</option>
155
                <option value="">All</option>
153
                [% PROCESS options_for_libraries libraries => Branches.all() %]
156
                [% PROCESS options_for_libraries libraries => Branches.all() %]
157
            [% END %]
154
            </select></li>
158
            </select></li>
155
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
159
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
156
                <option value="">All</option>
160
                <option value="">All</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt (+6 lines)
Lines 81-90 Link Here
81
              <li>
81
              <li>
82
                <label for="value">Select a library:</label>
82
                <label for="value">Select a library:</label>
83
                <select name="value" id="value">
83
                <select name="value" id="value">
84
                [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
85
                  [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
86
                [% ELSE %]
84
                  <option value=""></option>
87
                  <option value=""></option>
85
                  [% PROCESS options_for_libraries libraries => Branches.all() %]
88
                  [% PROCESS options_for_libraries libraries => Branches.all() %]
89
                [% END %]
86
                </select>
90
                </select>
91
		[% UNLESS Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
87
                <span class="tip">Select none to see all libraries</span>
92
                <span class="tip">Select none to see all libraries</span>
93
		[% END %]
88
              </li>
94
              </li>
89
            </ol>
95
            </ol>
90
          </fieldset>
96
          </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt (+12 lines)
Lines 188-195 Link Here
188
            <td><input type="radio" name="Line" value="reserves.branchcode" checked="checked" /></td>
188
            <td><input type="radio" name="Line" value="reserves.branchcode" checked="checked" /></td>
189
            <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
189
            <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
190
            <td><select name="filter_reserves.branchcode" id="resbranchcode">
190
            <td><select name="filter_reserves.branchcode" id="resbranchcode">
191
               [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
192
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
193
               [% ELSE %]
191
               <option value=""> </option>
194
               <option value=""> </option>
192
                [% PROCESS options_for_libraries libraries => Branches.all() %]
195
                [% PROCESS options_for_libraries libraries => Branches.all() %]
196
               [% END %]
193
               </select>
197
               </select>
194
             </td> 
198
             </td> 
195
        </tr>
199
        </tr>
Lines 198-205 Link Here
198
            <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
202
            <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
199
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
203
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
200
            <td><select name="filter_items.holdingbranch" id="holdingbranch">
204
            <td><select name="filter_items.holdingbranch" id="holdingbranch">
205
               [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
206
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
207
               [% ELSE %]
201
               <option value=""> </option>
208
               <option value=""> </option>
202
                [% PROCESS options_for_libraries libraries => Branches.all() %]
209
                [% PROCESS options_for_libraries libraries => Branches.all() %]
210
               [% END %]
203
               </select>
211
               </select>
204
             </td> 
212
             </td> 
205
        </tr>
213
        </tr>
Lines 208-215 Link Here
208
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
216
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
209
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
217
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
210
            <td><select name="filter_items.homebranch" id="homebranch">
218
            <td><select name="filter_items.homebranch" id="homebranch">
219
               [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
220
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
221
               [% ELSE %]
211
                <option value=""> </option>
222
                <option value=""> </option>
212
                [% PROCESS options_for_libraries libraries => Branches.all() %]
223
                [% PROCESS options_for_libraries libraries => Branches.all() %]
224
               [% END %]
213
               </select>
225
               </select>
214
             </td> 
226
             </td> 
215
        </tr>
227
        </tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt (+4 lines)
Lines 95-102 Link Here
95
					Library:
95
					Library:
96
		    	</label>
96
		    	</label>
97
		    	<select name="branchcode"  id="branchcode">
97
		    	<select name="branchcode"  id="branchcode">
98
                [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
99
                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
100
                [% ELSE %]
98
				<option value="">Any library</option>
101
				<option value="">Any library</option>
99
                [% PROCESS options_for_libraries libraries => Branches.all() %]
102
                [% PROCESS options_for_libraries libraries => Branches.all() %]
103
                [% END %]
100
		    	</select>
104
		    	</select>
101
105
102
		    </li>
106
		    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt (+4 lines)
Lines 47-54 Link Here
47
        [% IF can_change_library %]
47
        [% IF can_change_library %]
48
        <li><label for="branch">Library:</label>
48
        <li><label for="branch">Library:</label>
49
        <select id="branch" name="branch">
49
        <select id="branch" name="branch">
50
            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
51
            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branch ) %]
52
            [% ELSE %]
50
            <option value="">All</option>
53
            <option value="">All</option>
51
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
54
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
55
            [% END %]
52
        </select>
56
        </select>
53
        </li>
57
        </li>
54
        [% END %]
58
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +9 lines)
Lines 149-155 fieldset.rows table { clear: none; margin: 0; } Link Here
149
                                <li>
149
                                <li>
150
                                    <label for="branchcode">Library:</label>
150
                                    <label for="branchcode">Library:</label>
151
                                    <select name="branchcode" id="branchcode">
151
                                    <select name="branchcode" id="branchcode">
152
                                        [% UNLESS ( Independentbranches ) %]
152
                                    [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
153
                                        [% IF CAN_user_serials_superserials %]
154
                                            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode, unfiltered => 1 ) %]
155
                                        [% ELSE %]
156
                                            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode ) %]
157
                                        [% END %]
158
                                    [% ELSE %]
159
                                        [% UNLESS ( Koha.Preference('Independentbranches') ) %]
153
                                            <option value="">None</option>
160
                                            <option value="">None</option>
154
                                        [% END %]
161
                                        [% END %]
155
                                        [% IF CAN_user_serials_superserials %]
162
                                        [% IF CAN_user_serials_superserials %]
Lines 157-162 fieldset.rows table { clear: none; margin: 0; } Link Here
157
                                        [% ELSE %]
164
                                        [% ELSE %]
158
                                            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
165
                                            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
159
                                        [% END %]
166
                                        [% END %]
167
                                    [% END %]
160
                                    </select>
168
                                    </select>
161
                                </li>
169
                                </li>
162
                                <li>
170
                                <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (+8 lines)
Lines 579-586 Link Here
579
                        <li>
579
                        <li>
580
                            <label for="branchcode">Library:</label>
580
                            <label for="branchcode">Library:</label>
581
                            <select name="branchcode" id="branchcode">
581
                            <select name="branchcode" id="branchcode">
582
                            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
583
                                [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchfilter || branchcode ) %]
584
                            [% ELSE %]
582
                                <option value="">Any</option>
585
                                <option value="">Any</option>
583
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter || branchcode ) %]
586
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter || branchcode ) %]
587
                            [% END %]
584
                            </select>
588
                            </select>
585
                        </li>
589
                        </li>
586
                        <li>
590
                        <li>
Lines 666-673 Link Here
666
            [% IF ( displayby != "branchcode" ) %]
670
            [% IF ( displayby != "branchcode" ) %]
667
                <label for="branchcode">Viewing suggestions for library:</label>
671
                <label for="branchcode">Viewing suggestions for library:</label>
668
                <select name="branchcode" id="branchcode">
672
                <select name="branchcode" id="branchcode">
673
                [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
674
                    [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchfilter || branchcode ) %]
675
                [% ELSE %]
669
                    <option value="__ANY__">Any</option>
676
                    <option value="__ANY__">Any</option>
670
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter || branchcode ) %]
677
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter || branchcode ) %]
678
                [% END %]
671
                </select>
679
                </select>
672
            [% END %]
680
            [% END %]
673
681
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (+4 lines)
Lines 137-143 Link Here
137
        </li>
137
        </li>
138
        <li>
138
        <li>
139
        <label for="strip_items_not_from_libraries">Remove items not owned by selected libraries:</label>
139
        <label for="strip_items_not_from_libraries">Remove items not owned by selected libraries:</label>
140
	[% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
141
        <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" checked="checked" />
142
	[% ELSE %]
140
        <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" />
143
        <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" />
144
	[% END %]
141
        </li>
145
        </li>
142
        <li>
146
        <li>
143
        <label for="export_remove_fields">Don't export fields:</label>
147
        <label for="export_remove_fields">Don't export fields:</label>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt (+6 lines)
Lines 253-262 Link Here
253
                        <li>
253
                        <li>
254
                            <label class="description" for="branchcode">[% borrower_field.description | html %]: </label>
254
                            <label class="description" for="branchcode">[% borrower_field.description | html %]: </label>
255
                            <select id="branchcode" name="branchcode">
255
                            <select id="branchcode" name="branchcode">
256
                            [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
257
                                [% FOREACH library IN Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() } ) %]
258
                                    <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
259
                                [% END %]
260
                            [% ELSE %]
256
                                <option value="" selected="selected"></option>
261
                                <option value="" selected="selected"></option>
257
                                [% FOREACH library IN Branches.all() %]
262
                                [% FOREACH library IN Branches.all() %]
258
                                    <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
263
                                    <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
259
                                [% END %]
264
                                [% END %]
265
                            [% END %]
260
                            </select>
266
                            </select>
261
                            <span class="field_hint">[% borrower_field.field | html %]</span>
267
                            <span class="field_hint">[% borrower_field.field | html %]</span>
262
                        </li>
268
                        </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (+4 lines)
Lines 98-105 Link Here
98
            <input type="radio" name="branch" value="holdingbranch"> Current library</input>
98
            <input type="radio" name="branch" value="holdingbranch"> Current library</input>
99
        </li><li>
99
        </li><li>
100
        <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
100
        <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
101
        [% IF Branches.InIndependentBranchesMode({syspref=>'IndependentBranchesHideOtherBranchesItems'}) %]
102
            [% PROCESS options_for_libraries libraries => Branches.all( search_params => { branchcode => Branches.GetLoggedInBranchcode() }, selected => branchcode, unfiltered => 1, ) %]
103
        [% ELSE %]
101
            <option value="">All libraries</option>
104
            <option value="">All libraries</option>
102
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
105
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
106
        [% END %]
103
        </select>
107
        </select>
104
        </li>
108
        </li>
105
        [% IF (authorised_values) %]
109
        [% IF (authorised_values) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc (+1 lines)
Lines 45-50 Link Here
45
                            [% FOREACH facet IN facets_loo.facets %]
45
                            [% FOREACH facet IN facets_loo.facets %]
46
                            [% 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 %]
46
                            [% 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 %]
47
                            [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
47
                            [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
48
                            [% IF ( facets_loo.type_label_HomeLibrary || facets_loo.type_label_HoldingLibrary ) && opac_name && Koha.Preference('IndependentBranchesHideOtherBranchesItems') && facet.facet_link_value != opac_name %][% NEXT %][% END %]
48
                            [% IF loop.count > 5 && !facet.active %]
49
                            [% IF loop.count > 5 && !facet.active %]
49
                                <li class="collapsible-facet" style="display:none">
50
                                <li class="collapsible-facet" style="display:none">
50
                            [% ELSE %]
51
                            [% ELSE %]
(-)a/reports/acquisitions_stats.pl (-1 / +5 lines)
Lines 181-187 else { Link Here
181
181
182
    my $CGIsepChoice = GetDelimiterChoices;
182
    my $CGIsepChoice = GetDelimiterChoices;
183
183
184
    my @branches = Koha::Libraries->search({}, { order_by => 'branchname' });
184
    my $libraries_filter = {};
185
    if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
186
        $libraries_filter->{branchcode} = C4::Context->userenv->{branch};
187
    }
188
    my @branches = Koha::Libraries->search($libraries_filter, { order_by => 'branchname' });
185
189
186
    my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
190
    my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
187
    my $ccode_label;
191
    my $ccode_label;
(-)a/reports/cash_register_stats.pl (-1 / +5 lines)
Lines 190-200 if ($do_it) { Link Here
190
190
191
}
191
}
192
192
193
my $libraries_filter = {};
194
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
195
    $libraries_filter->{branchcode} = C4::Context->userenv->{branch};
196
}
193
$template->param(
197
$template->param(
194
    beginDate        => $fromDate,
198
    beginDate        => $fromDate,
195
    endDate          => $toDate,
199
    endDate          => $toDate,
196
    transaction_type => $transaction_type,
200
    transaction_type => $transaction_type,
197
    branchloop       => Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed,
201
    branchloop       => Koha::Libraries->search($libraries_filter, { order_by => ['branchname'] })->unblessed,
198
    debit_types      => \@debit_types,
202
    debit_types      => \@debit_types,
199
    credit_types     => \@credit_types,
203
    credit_types     => \@credit_types,
200
    registerid       => $registerid,
204
    registerid       => $registerid,
(-)a/reserve/request.pl (+4 lines)
Lines 560-565 foreach my $biblionumber (@biblionumbers) { Link Here
560
                    unless ( C4::Context->IsSuperLibrarian ) {
560
                    unless ( C4::Context->IsSuperLibrarian ) {
561
                        $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
561
                        $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
562
                    }
562
                    }
563
                    if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') && $item->{homebranch} ne $userenv->{branch} ) {
564
                        $item->{hide} = 1;
565
                        $hiddencount++;
566
                    }
563
                }
567
                }
564
            }
568
            }
565
569
(-)a/reviews/reviewswaiting.pl (-2 / +7 lines)
Lines 40-46 my $status = $query->param('status') || 0; Link Here
40
my $reviewid = $query->param('reviewid');
40
my $reviewid = $query->param('reviewid');
41
my $page     = $query->param('page') || 1;
41
my $page     = $query->param('page') || 1;
42
my $count    = C4::Context->preference('numSearchResults') || 20;
42
my $count    = C4::Context->preference('numSearchResults') || 20;
43
my $total    = Koha::Reviews->search_limited({ approved => $status })->count;
43
my $review_filter = { approved => $status };
44
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
45
    # search_limited supplies the borrowernumber relation
46
    $review_filter->{'borrowernumber.branchcode'} = C4::Context->userenv->{branch};
47
}
48
my $total    = Koha::Reviews->search_limited($review_filter)->count;
44
49
45
if ( $op eq 'approve' ) {
50
if ( $op eq 'approve' ) {
46
    my $review = Koha::Reviews->find( $reviewid );
51
    my $review = Koha::Reviews->find( $reviewid );
Lines 56-62 elsif ( $op eq 'delete' ) { Link Here
56
}
61
}
57
62
58
my $reviews = Koha::Reviews->search_limited(
63
my $reviews = Koha::Reviews->search_limited(
59
    { approved => $status },
64
    $review_filter,
60
    {
65
    {
61
        rows => $count,
66
        rows => $count,
62
        page => $page,
67
        page => $page,
(-)a/tools/batchMod.pl (-1 / +5 lines)
Lines 398-404 my @loop_data =(); Link Here
398
my $i=0;
398
my $i=0;
399
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
399
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
400
400
401
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
401
my $libraries_filter = {};
402
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
403
    $libraries_filter->{branchcode} = C4::Context->userenv->{branch};
404
}
405
my $libraries = Koha::Libraries->search($libraries_filter, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
402
406
403
# Adding a default choice, in case the user does not want to modify the branch
407
# Adding a default choice, in case the user does not want to modify the branch
404
my $nochange_branch = { branchname => '', value => '', selected => 1 };
408
my $nochange_branch = { branchname => '', value => '', selected => 1 };
(-)a/tools/export.pl (-1 / +9 lines)
Lines 71-76 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
71
);
71
);
72
72
73
my @branch = $query->multi_param("branch");
73
my @branch = $query->multi_param("branch");
74
if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
75
    @branch = (C4::Context->userenv->{branch});
76
}
74
77
75
my @messages;
78
my @messages;
76
if ( $op eq 'export' ) {
79
if ( $op eq 'export' ) {
Lines 91-96 if ( $op eq "export" ) { Link Here
91
    my @biblionumbers      = $query->multi_param("biblionumbers");
94
    my @biblionumbers      = $query->multi_param("biblionumbers");
92
    my @itemnumbers        = $query->multi_param("itemnumbers");
95
    my @itemnumbers        = $query->multi_param("itemnumbers");
93
    my $strip_items_not_from_libraries =  $query->param('strip_items_not_from_libraries');
96
    my $strip_items_not_from_libraries =  $query->param('strip_items_not_from_libraries');
97
    $strip_items_not_from_libraries = 1 if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') );
94
98
95
    my $libraries = Koha::Libraries->search_filtered->unblessed;
99
    my $libraries = Koha::Libraries->search_filtered->unblessed;
96
    my $only_export_items_for_branches = $strip_items_not_from_libraries ? \@branch : undef;
100
    my $only_export_items_for_branches = $strip_items_not_from_libraries ? \@branch : undef;
Lines 271-277 else { Link Here
271
275
272
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
276
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
273
277
274
    my $libraries = Koha::Libraries->search_filtered({}, { order_by => ['branchname'] })->unblessed;
278
    my $library_filter = {};
279
    if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
280
        $library_filter->{'branchcode'} = C4::Context->userenv->{branch};
281
    }
282
    my $libraries = Koha::Libraries->search_filtered($library_filter, { order_by => ['branchname'] })->unblessed;
275
    for my $library ( @$libraries ) {
283
    for my $library ( @$libraries ) {
276
        $library->{selected} = 1 if grep { $library->{branchcode} eq $_ } @branch;
284
        $library->{selected} = 1 if grep { $library->{branchcode} eq $_ } @branch;
277
    }
285
    }
(-)a/tools/modborrowers.pl (-2 / +5 lines)
Lines 170-176 if ( $op eq 'show' ) { Link Here
170
    $template->param( useborrowernumbers => $useborrowernumbers );
170
    $template->param( useborrowernumbers => $useborrowernumbers );
171
171
172
    # Construct drop-down list values
172
    # Construct drop-down list values
173
    my $branches = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
173
    my $library_filter = {};
174
    if ( C4::Context->only_my_library('IndependentBranchesHideOtherBranchesItems') ) {
175
        $library_filter->{'branchcode'} = C4::Context->userenv->{branch};
176
    }
177
    my $branches = Koha::Libraries->search($library_filter, { order_by => ['branchname'] })->unblessed;
174
    my @branches_option;
178
    my @branches_option;
175
    push @branches_option, { value => $_->{branchcode}, lib => $_->{branchname} } for @$branches;
179
    push @branches_option, { value => $_->{branchcode}, lib => $_->{branchname} } for @$branches;
176
    unshift @branches_option, { value => "", lib => "" };
180
    unshift @branches_option, { value => "", lib => "" };
177
- 

Return to bug 28642