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

(-)a/C4/Auth.pm (-7 / +2 lines)
Lines 29-35 require Exporter; Link Here
29
use C4::Context;
29
use C4::Context;
30
use C4::Templates;    # to get the template
30
use C4::Templates;    # to get the template
31
use C4::Languages;
31
use C4::Languages;
32
use C4::Branch;       # GetBranches
33
use C4::Search::History;
32
use C4::Search::History;
34
use Koha;
33
use Koha;
35
use Koha::AuthUtils qw(hash_password);
34
use Koha::AuthUtils qw(hash_password);
Lines 509-515 sub get_template_and_user { Link Here
509
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
508
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
510
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
509
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
511
            AuthorisedValueImages                 => C4::Context->preference("AuthorisedValueImages"),
510
            AuthorisedValueImages                 => C4::Context->preference("AuthorisedValueImages"),
512
            BranchesLoop                          => GetBranchesLoop($opac_name),
513
            BranchCategoriesLoop                  => $library_categories,
511
            BranchCategoriesLoop                  => $library_categories,
514
            opac_name                             => $opac_name,
512
            opac_name                             => $opac_name,
515
            LibraryName                           => "" . C4::Context->preference("LibraryName"),
513
            LibraryName                           => "" . C4::Context->preference("LibraryName"),
Lines 1074-1080 sub checkauth { Link Here
1074
                        $branchcode = $query->param('branch');
1072
                        $branchcode = $query->param('branch');
1075
                        $branchname = Koha::Libraries->find($branchcode)->branchname;
1073
                        $branchname = Koha::Libraries->find($branchcode)->branchname;
1076
                    }
1074
                    }
1077
                    my $branches = GetBranches();
1075
                    my $branches = C4::Branch::GetBranches();
1078
                    if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
1076
                    if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
1079
1077
1080
                        # we have to check they are coming from the right ip range
1078
                        # we have to check they are coming from the right ip range
Lines 1085-1091 sub checkauth { Link Here
1085
                        }
1083
                        }
1086
                    }
1084
                    }
1087
1085
1088
                    my @branchesloop;
1089
                    foreach my $br ( keys %$branches ) {
1086
                    foreach my $br ( keys %$branches ) {
1090
1087
1091
                        #     now we work with the treatment of ip
1088
                        #     now we work with the treatment of ip
Lines 1202-1208 sub checkauth { Link Here
1202
    my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
1199
    my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
1203
    my $template = C4::Templates::gettemplate( $template_name, $type, $query );
1200
    my $template = C4::Templates::gettemplate( $template_name, $type, $query );
1204
    $template->param(
1201
    $template->param(
1205
        branchloop                            => GetBranchesLoop(),
1206
        OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
1202
        OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
1207
        opaclayoutstylesheet                  => C4::Context->preference("opaclayoutstylesheet"),
1203
        opaclayoutstylesheet                  => C4::Context->preference("opaclayoutstylesheet"),
1208
        login                                 => 1,
1204
        login                                 => 1,
Lines 1515-1522 sub check_api_auth { Link Here
1515
                    $branchcode = $query->param('branch');
1511
                    $branchcode = $query->param('branch');
1516
                    $branchname = Koha::Libraries->find($branchcode)->branchname;
1512
                    $branchname = Koha::Libraries->find($branchcode)->branchname;
1517
                }
1513
                }
1518
                my $branches = GetBranches();
1514
                my $branches = C4::Branch::GetBranches();
1519
                my @branchesloop;
1520
                foreach my $br ( keys %$branches ) {
1515
                foreach my $br ( keys %$branches ) {
1521
1516
1522
                    #     now we work with the treatment of ip
1517
                    #     now we work with the treatment of ip
(-)a/C4/Branch.pm (-19 lines)
Lines 31-37 BEGIN { Link Here
31
	@EXPORT = qw(
31
	@EXPORT = qw(
32
		&GetBranch
32
		&GetBranch
33
		&GetBranches
33
		&GetBranches
34
		&GetBranchesLoop
35
		&mybranch
34
		&mybranch
36
	);
35
	);
37
    @EXPORT_OK = qw( &onlymine &mybranch );
36
    @EXPORT_OK = qw( &onlymine &mybranch );
Lines 85-92 Create a branch selector with the following code. Link Here
85
            [% END %]
84
            [% END %]
86
    </select>
85
    </select>
87
86
88
=head4 Note that you often will want to just use GetBranchesLoop, for exactly the example above.
89
90
=cut
87
=cut
91
88
92
sub GetBranches {
89
sub GetBranches {
Lines 137-158 sub mybranch { Link Here
137
    return C4::Context->userenv->{branch} || '';
134
    return C4::Context->userenv->{branch} || '';
138
}
135
}
139
136
140
sub GetBranchesLoop {  # since this is what most pages want anyway
141
    my $branch   = @_ ? shift : mybranch();     # optional first argument is branchcode of "my branch", if preselection is wanted.
142
    my $onlymine = @_ ? shift : onlymine();
143
    my $branches = GetBranches($onlymine);
144
    my @loop;
145
    foreach my $branchcode ( sort { uc($branches->{$a}->{branchname}) cmp uc($branches->{$b}->{branchname}) } keys %$branches ) {
146
        push @loop, {
147
            value      => $branchcode,
148
            branchcode => $branchcode,
149
            selected   => ($branchcode eq $branch) ? 1 : 0,
150
            branchname => $branches->{$branchcode}->{branchname},
151
        };
152
    }
153
    return \@loop;
154
}
155
156
=head2 GetBranch
137
=head2 GetBranch
157
138
158
$branch = GetBranch( $query, $branches );
139
$branch = GetBranch( $query, $branches );
(-)a/Koha/Template/Plugin/Branches.pm (-9 / +10 lines)
Lines 63-86 sub all { Link Here
63
        SELECT branchcode, branchname
63
        SELECT branchcode, branchname
64
        FROM branches
64
        FROM branches
65
    |;
65
    |;
66
    if (    C4::Branch::onlymine
66
    if (    C4::Context->preference('IndependentBranches')
67
        and C4::Context->userenv
67
        and C4::Context->userenv
68
        && !C4::Context->IsSuperLibrarian()
68
        and C4::Context->userenv->{branch} )
69
        and C4::Context->userenv->{branch} )
69
    {
70
    {
70
        $query .= q| WHERE branchcode = ? |;
71
        $query .= q| WHERE branchcode = ? |;
71
        push @params, C4::Context->userenv->{branch};
72
        push @params, C4::Context->userenv->{branch};
72
    }
73
    }
73
    $query .= q| ORDER BY branchname|;
74
    my $libraries = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
74
    my $branches = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
75
75
76
    if ( $selected ) {
76
    for my $l ( @$libraries ) {
77
        for my $branch ( @$branches ) {
77
        if (       $selected and $l->{branchcode} eq $selected
78
            if ( $branch->{branchcode} eq $selected ) {
78
            or not $selected and C4::Context->userenv and $l->{branchcode} eq C4::Context->userenv->{branch}
79
                $branch->{selected} = 1;
79
        ) {
80
            }
80
            $l->{selected} = 1;
81
        }
81
        }
82
    }
82
    }
83
    return $branches;
83
84
    return $libraries;
84
}
85
}
85
86
86
1;
87
1;
(-)a/acqui/basketgroup.pl (-5 / +2 lines)
Lines 53-59 use CGI qw ( -utf8 ); Link Here
53
53
54
use C4::Budgets qw/ConvertCurrency/;
54
use C4::Budgets qw/ConvertCurrency/;
55
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
55
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
56
use C4::Branch qw/GetBranches/;
57
use C4::Members qw/GetMember/;
56
use C4::Members qw/GetMember/;
58
57
59
use Koha::Acquisition::Bookseller;
58
use Koha::Acquisition::Bookseller;
Lines 260-269 if ( $op eq "add" ) { Link Here
260
    $billingplace  = $billingplace  || $borrower->{'branchcode'};
259
    $billingplace  = $billingplace  || $borrower->{'branchcode'};
261
    $deliveryplace = $deliveryplace || $borrower->{'branchcode'};
260
    $deliveryplace = $deliveryplace || $borrower->{'branchcode'};
262
261
263
    my $branches = C4::Branch::GetBranchesLoop( $billingplace );
262
    $template->param( billingplace => $billingplace );
264
    $template->param( billingplaceloop => $branches );
263
    $template->param( deliveryplace => $deliveryplace );
265
    $branches = C4::Branch::GetBranchesLoop( $deliveryplace );
266
    $template->param( deliveryplaceloop => $branches );
267
    $template->param( booksellerid => $booksellerid );
264
    $template->param( booksellerid => $booksellerid );
268
265
269
    # the template will display a unique basketgroup
266
    # the template will display a unique basketgroup
(-)a/acqui/basketheader.pl (-8 / +2 lines)
Lines 121-139 if ( $op eq 'add_form' ) { Link Here
121
                    booksellerid => $booksellerid,
121
                    booksellerid => $booksellerid,
122
                    basketno => $basketno,
122
                    basketno => $basketno,
123
                    booksellers => \@booksellers,
123
                    booksellers => \@booksellers,
124
                    deliveryplace => $basket->{deliveryplace},
125
                    billingplace => $basket->{billingplace},
126
    );
124
    );
127
125
128
    my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"};
126
    my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"};
129
    my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"};
127
    my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"};
130
128
131
    # Build the combobox to select the billing place
129
    $template->param( billingplace => $billingplace );
132
130
    $template->param( deliveryplace => $deliveryplace );
133
    my $branches = C4::Branch::GetBranchesLoop( $billingplace );
134
    $template->param( billingplaceloop => $branches );
135
    $branches = C4::Branch::GetBranchesLoop( $deliveryplace );
136
    $template->param( deliveryplaceloop => $branches );
137
131
138
#End Edit
132
#End Edit
139
} elsif ( $op eq 'add_validate' ) {
133
} elsif ( $op eq 'add_validate' ) {
(-)a/acqui/neworderempty.pl (-18 lines)
Lines 238-261 for my $curr ( @rates ) { Link Here
238
    }
238
    }
239
}
239
}
240
240
241
# build branches list
242
my $onlymine =
243
     C4::Context->preference('IndependentBranches')
244
  && C4::Context->userenv
245
  && !C4::Context->IsSuperLibrarian()
246
  && C4::Context->userenv->{branch};
247
my $branches = GetBranches($onlymine);
248
my @branchloop;
249
foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
250
    my %row = (
251
        value      => $thisbranch,
252
        branchname => $branches->{$thisbranch}->{'branchname'},
253
    );
254
    $row{'selected'} = 1 if( $thisbranch && $data->{branchcode} && $thisbranch eq $data->{branchcode}) ;
255
    push @branchloop, \%row;
256
}
257
$template->param( branchloop => \@branchloop );
258
259
# build bookfund list
241
# build bookfund list
260
my $borrower= GetMember('borrowernumber' => $loggedinuser);
242
my $borrower= GetMember('borrowernumber' => $loggedinuser);
261
my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
243
my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
(-)a/admin/aqbudgetperiods.pl (-3 lines)
Lines 291-298 $url = "aqbudgetperiods.pl?tab=2"; Link Here
291
$url .= "&apage=$activepage" if($activepage != 1);
291
$url .= "&apage=$activepage" if($activepage != 1);
292
my $inactive_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $inactivepagesize), $inactivepage, "ipage");
292
my $inactive_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $inactivepagesize), $inactivepage, "ipage");
293
293
294
my $branchloop = C4::Branch::GetBranchesLoop();
295
296
my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
294
my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
297
$template->param(
295
$template->param(
298
    period_active_loop      => \@period_active_loop,
296
    period_active_loop      => \@period_active_loop,
Lines 300-306 $template->param( Link Here
300
    active_pagination_bar   => $active_pagination_bar,
298
    active_pagination_bar   => $active_pagination_bar,
301
    inactive_pagination_bar => $inactive_pagination_bar,
299
    inactive_pagination_bar => $inactive_pagination_bar,
302
    tab                     => $tab,
300
    tab                     => $tab,
303
    branchloop              => $branchloop,
304
);
301
);
305
302
306
$template->param($op=>1);
303
$template->param($op=>1);
(-)a/admin/aqbudgets.pl (-4 / +2 lines)
Lines 95-106 my $user_branchcode = $user->{'branchcode'}; Link Here
95
$template->param(
95
$template->param(
96
    show_mine   => $show_mine,
96
    show_mine   => $show_mine,
97
    op  => $op,
97
    op  => $op,
98
    selected_branchcode => $filter_budgetbranch,
98
);
99
);
99
100
100
my $budget;
101
my $budget;
101
102
102
my $branchloop = C4::Branch::GetBranchesLoop($filter_budgetbranch);
103
104
$template->param(auth_cats_loop => GetBudgetAuthCats( $budget_period_id ))
103
$template->param(auth_cats_loop => GetBudgetAuthCats( $budget_period_id ))
105
    if $budget_period_id;
104
    if $budget_period_id;
106
105
Lines 152-158 if ($op eq 'add_form') { Link Here
152
        $row{selected} = 1 if $budget and $thisbranch eq $budget->{'budget_branchcode'};
151
        $row{selected} = 1 if $budget and $thisbranch eq $budget->{'budget_branchcode'};
153
        push @branchloop_select, \%row;
152
        push @branchloop_select, \%row;
154
    }
153
    }
155
    
154
156
    # populates the YUI planning button
155
    # populates the YUI planning button
157
    my $categories = GetAuthorisedValueCategories();
156
    my $categories = GetAuthorisedValueCategories();
158
    my @auth_cats_loop1 = ();
157
    my @auth_cats_loop1 = ();
Lines 342-348 if ( $op eq 'list' ) { Link Here
342
        spent_total            => $spent_total,
341
        spent_total            => $spent_total,
343
        ordered_total          => $ordered_total,
342
        ordered_total          => $ordered_total,
344
        available_total        => $available_total,
343
        available_total        => $available_total,
345
        branchloop             => $branchloop,
346
        filter_budgetname      => $filter_budgetname,
344
        filter_budgetname      => $filter_budgetname,
347
    );
345
    );
348
346
(-)a/admin/aqplan.pl (-2 lines)
Lines 393-399 if ( $output eq "file" ) { Link Here
393
    exit(1);
393
    exit(1);
394
}
394
}
395
395
396
my $branchloop = C4::Branch::GetBranchesLoop();
397
$template->param(
396
$template->param(
398
    authvals_row              => \@authvals_row,
397
    authvals_row              => \@authvals_row,
399
    budget_lines              => \@budget_lines,
398
    budget_lines              => \@budget_lines,
Lines 410-416 $template->param( Link Here
410
409
411
    authvals              => \@authvals_row,
410
    authvals              => \@authvals_row,
412
    hide_cols_loop              => \@hide_cols,
411
    hide_cols_loop              => \@hide_cols,
413
    branchloop                => $branchloop,
414
);
412
);
415
413
416
output_html_with_http_headers $input, $cookie, $template->output;
414
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/admin/clone-rules.pl (-4 lines)
Lines 33-39 use C4::Output; Link Here
33
use C4::Auth;
33
use C4::Auth;
34
use C4::Koha;
34
use C4::Koha;
35
use C4::Debug;
35
use C4::Debug;
36
use C4::Branch; # GetBranchesLoop
37
36
38
my $input = new CGI;
37
my $input = new CGI;
39
my $dbh = C4::Context->dbh;
38
my $dbh = C4::Context->dbh;
Lines 49-61 my ($template, $loggedinuser, $cookie) Link Here
49
48
50
my $frombranch = $input->param("frombranch");
49
my $frombranch = $input->param("frombranch");
51
my $tobranch   = $input->param("tobranch");
50
my $tobranch   = $input->param("tobranch");
52
my $branchloop = GetBranchesLoop;
53
51
54
$template->param(frombranch     => $frombranch)                if ($frombranch);
52
$template->param(frombranch     => $frombranch)                if ($frombranch);
55
$template->param(tobranch       => $tobranch)                  if ($tobranch);
53
$template->param(tobranch       => $tobranch)                  if ($tobranch);
56
54
57
$template->param(branchloop => $branchloop);
58
59
if ($frombranch && $tobranch) {
55
if ($frombranch && $tobranch) {
60
56
61
    my $error;	
57
    my $error;	
(-)a/admin/smart-rules.pl (-12 / +1 lines)
Lines 421-436 elsif ($op eq "add-branch-item") { Link Here
421
    }
421
    }
422
}
422
}
423
423
424
my $branches = GetBranches();
425
my @branchloop;
426
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
427
    push @branchloop, {
428
        value      => $thisbranch,
429
        selected   => $thisbranch eq $branch,
430
        branchname => $branches->{$thisbranch}->{'branchname'},
431
    };
432
}
433
434
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
424
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
435
425
436
my @row_loop;
426
my @row_loop;
Lines 583-590 $template->param( Link Here
583
    patron_categories => $patron_categories,
573
    patron_categories => $patron_categories,
584
                        itemtypeloop => \@itemtypes,
574
                        itemtypeloop => \@itemtypes,
585
                        rules => \@sorted_row_loop,
575
                        rules => \@sorted_row_loop,
586
                        branchloop => \@branchloop,
576
                        humanbranch => ($branch ne '*' ? $branch : ''),
587
                        humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''),
588
                        current_branch => $branch,
577
                        current_branch => $branch,
589
                        definedbranch => scalar(@sorted_row_loop)>0
578
                        definedbranch => scalar(@sorted_row_loop)>0
590
                        );
579
                        );
(-)a/catalogue/search.pl (-18 / +1 lines)
Lines 227-252 if($cgi->cookie("holdfor")){ Link Here
227
#    exit;
227
#    exit;
228
#}
228
#}
229
229
230
# load the branches
231
my $branches = GetBranches();
232
233
# Populate branch_loop with all branches sorted by their name.  If
234
# IndependentBranches is activated, set the default branch to the borrower
235
# branch, except for superlibrarian who need to search all libraries.
236
my $user = C4::Context->userenv;
237
my @branch_loop = map {
238
     {
239
        value      => $_,
240
        branchname => $branches->{$_}->{branchname},
241
        selected   => $user->{branch} eq $_ && C4::Branch::onlymine(),
242
     }
243
} sort {
244
    $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
245
} keys %$branches;
246
247
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
230
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
248
231
249
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
232
$template->param(searchdomainloop => $categories);
250
233
251
# load the Type stuff
234
# load the Type stuff
252
my $itemtypes = GetItemTypes;
235
my $itemtypes = GetItemTypes;
(-)a/cataloguing/additem.pl (-12 / +10 lines)
Lines 29-37 use C4::Items; Link Here
29
use C4::Context;
29
use C4::Context;
30
use C4::Circulation;
30
use C4::Circulation;
31
use C4::Koha; # XXX subfield_is_koha_internal_p
31
use C4::Koha; # XXX subfield_is_koha_internal_p
32
use C4::Branch; # XXX subfield_is_koha_internal_p
33
use C4::ClassSource;
32
use C4::ClassSource;
34
use Koha::DateUtils;
33
use Koha::DateUtils;
34
use Koha::Libraries;
35
use List::MoreUtils qw/any/;
35
use List::MoreUtils qw/any/;
36
use C4::Search;
36
use C4::Search;
37
use Storable qw(thaw freeze);
37
use Storable qw(thaw freeze);
Lines 170-178 sub generate_subfield_form { Link Here
170
            # builds list, depending on authorised value...
170
            # builds list, depending on authorised value...
171
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
171
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
172
                foreach my $thisbranch (@$branches) {
172
                foreach my $thisbranch (@$branches) {
173
                    push @authorised_values, $thisbranch->{value};
173
                    push @authorised_values, $thisbranch->{branchcode};
174
                    $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
174
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
175
                    $value = $thisbranch->{value} if $thisbranch->{selected} && !$value;
175
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
176
                }
176
                }
177
            }
177
            }
178
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
178
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
Lines 852-864 my $i=0; Link Here
852
852
853
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
853
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
854
854
855
my $onlymine =
856
     C4::Context->preference('IndependentBranches')
857
  && C4::Context->userenv
858
  && !C4::Context->IsSuperLibrarian()
859
  && C4::Context->userenv->{branch};
860
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
855
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
861
my $branches = GetBranchesLoop($branch,$onlymine);  # build once ahead of time, instead of multiple times later.
856
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
857
for my $library ( @$libraries ) {
858
    $library->{selected} = 1 if $library->{branchcode} eq $branch
859
}
862
860
863
# We generate form, from actuel record
861
# We generate form, from actuel record
864
@fields = ();
862
@fields = ();
Lines 874-880 if($itemrecord){ Link Here
874
            next if subfield_is_koha_internal_p($subfieldtag);
872
            next if subfield_is_koha_internal_p($subfieldtag);
875
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
873
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
876
874
877
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
875
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
878
            push @fields, "$tag$subfieldtag";
876
            push @fields, "$tag$subfieldtag";
879
            push (@loop_data, $subfield_data);
877
            push (@loop_data, $subfield_data);
880
            $i++;
878
            $i++;
Lines 898-904 foreach my $tag ( keys %{$tagslib}){ Link Here
898
        my @values = (undef);
896
        my @values = (undef);
899
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
897
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
900
        for my $value (@values){
898
        for my $value (@values){
901
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
899
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
902
            push (@loop_data, $subfield_data);
900
            push (@loop_data, $subfield_data);
903
            $i++;
901
            $i++;
904
        }
902
        }
(-)a/circ/bookcount.pl (-5 / +7 lines)
Lines 32-37 use C4::Auth; Link Here
32
use C4::Branch; # GetBranches
32
use C4::Branch; # GetBranches
33
use C4::Biblio; # GetBiblioItemData
33
use C4::Biblio; # GetBiblioItemData
34
use Koha::DateUtils;
34
use Koha::DateUtils;
35
use Koha::Libraries;
35
36
36
my $input        = new CGI;
37
my $input        = new CGI;
37
my $itm          = $input->param('itm');
38
my $itm          = $input->param('itm');
Lines 69-78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
69
    }
70
    }
70
);
71
);
71
72
72
my $branchloop = GetBranchesLoop(C4::Context->userenv->{branch});
73
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
73
foreach (@$branchloop) {
74
for my $library ( @$libraries ) {
74
    $_->{issues}     = issuesat($itm, $_->{value});
75
    $library->{selected} = 1 if $library->{branchcode} eq C4::Context->userenv->{branch};
75
    $_->{seen}       = lastseenat( $itm, $_->{value} ) || undef;
76
    $library->{issues}     = issuesat($itm, $library->{branchcode});
77
    $library->{seen}       = lastseenat( $itm, $library->{branchcode} ) || undef;
76
}
78
}
77
79
78
$template->param(
80
$template->param(
Lines 85-91 $template->param( Link Here
85
    holdingbranch           => $holdingbranch,
87
    holdingbranch           => $holdingbranch,
86
    lastdate                => $lastdate ? $lastdate : 0,
88
    lastdate                => $lastdate ? $lastdate : 0,
87
    count                   => $count,
89
    count                   => $count,
88
    branchloop              => $branchloop,
90
    libraries               => $libraries,
89
);
91
);
90
92
91
output_html_with_http_headers $input, $cookie, $template->output;
93
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/circ/branchtransfers.pl (-1 lines)
Lines 236-242 $template->param( Link Here
236
    cancelled               => $cancelled,
236
    cancelled               => $cancelled,
237
    setwaiting              => $setwaiting,
237
    setwaiting              => $setwaiting,
238
    trsfitemloop            => \@trsfitemloop,
238
    trsfitemloop            => \@trsfitemloop,
239
    branchoptionloop        => GetBranchesLoop($tobranchcd),
240
    errmsgloop              => \@errmsgloop,
239
    errmsgloop              => \@errmsgloop,
241
    CircAutocompl           => C4::Context->preference("CircAutocompl")
240
    CircAutocompl           => C4::Context->preference("CircAutocompl")
242
);
241
);
(-)a/circ/overdue.pl (-3 lines)
Lines 213-221 if (@patron_attr_filter_loop) { Link Here
213
213
214
$template->param(
214
$template->param(
215
    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
215
    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
216
    branchloop   => GetBranchesLoop($branchfilter, $onlymine),
217
    homebranchloop => GetBranchesLoop( $homebranchfilter, $onlymine ),
218
    holdingbranchloop => GetBranchesLoop( $holdingbranchfilter, $onlymine ),
219
    branchfilter => $branchfilter,
216
    branchfilter => $branchfilter,
220
    homebranchfilter => $homebranchfilter,
217
    homebranchfilter => $homebranchfilter,
221
    holdingbranchfilter => $homebranchfilter,
218
    holdingbranchfilter => $homebranchfilter,
(-)a/circ/selectbranchprinter.pl (-2 / +2 lines)
Lines 26-32 use C4::Output; Link Here
26
use C4::Auth qw/:DEFAULT get_session/;
26
use C4::Auth qw/:DEFAULT get_session/;
27
use C4::Print;  # GetPrinters
27
use C4::Print;  # GetPrinters
28
use C4::Koha;
28
use C4::Koha;
29
use C4::Branch; # GetBranches GetBranchesLoop
29
use C4::Branch; # GetBranches
30
30
31
use Koha::Libraries;
31
use Koha::Libraries;
32
32
Lines 136-142 if (scalar @updated and not scalar @recycle_loop) { Link Here
136
$template->param(
136
$template->param(
137
    referer     => $referer,
137
    referer     => $referer,
138
    printerloop => \@printerloop,
138
    printerloop => \@printerloop,
139
    branchloop  => GetBranchesLoop($branch),
139
    branch      => $branch,
140
    recycle_loop=> \@recycle_loop,
140
    recycle_loop=> \@recycle_loop,
141
);
141
);
142
142
(-)a/circ/view_holdsqueue.pl (-2 lines)
Lines 30-36 use C4::Output; Link Here
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::Items;
31
use C4::Items;
32
use C4::Koha;   # GetItemTypes
32
use C4::Koha;   # GetItemTypes
33
use C4::Branch; # GetBranches
34
use C4::HoldsQueue qw(GetHoldsQueueItems);
33
use C4::HoldsQueue qw(GetHoldsQueueItems);
35
34
36
my $query = new CGI;
35
my $query = new CGI;
Lines 72-78 foreach my $thisitemtype ( sort keys %$itemtypes ) { Link Here
72
}
71
}
73
72
74
$template->param(
73
$template->param(
75
     branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
76
   itemtypeloop => \@itemtypesloop,
74
   itemtypeloop => \@itemtypesloop,
77
);
75
);
78
76
(-)a/course_reserves/add_items.pl (-2 lines)
Lines 26-32 use C4::Auth; Link Here
26
use C4::Output;
26
use C4::Output;
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Biblio;
28
use C4::Biblio;
29
use C4::Branch;
30
29
31
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
30
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
32
31
Lines 73-79 if ( $action eq 'lookup' ) { Link Here
73
        ccodes    => GetAuthorisedValues('CCODE'),
72
        ccodes    => GetAuthorisedValues('CCODE'),
74
        locations => GetAuthorisedValues('LOC'),
73
        locations => GetAuthorisedValues('LOC'),
75
        itypes    => GetItemTypes( style => 'array' ),
74
        itypes    => GetItemTypes( style => 'array' ),
76
        branches  => GetBranchesLoop(),
77
        return    => $return,
75
        return    => $return,
78
    );
76
    );
79
77
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-search.inc (-4 / +5 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
<div class="gradient">
2
<div class="gradient">
2
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Fund Admin Resident Search Box -->
3
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Fund Admin Resident Search Box -->
3
4
Lines 9-19 Link Here
9
            <label for="filter_budgetbranch">Library: </label>
10
            <label for="filter_budgetbranch">Library: </label>
10
            <select name="filter_budgetbranch" id="filter_budgetbranch" style="width:10em;">
11
            <select name="filter_budgetbranch" id="filter_budgetbranch" style="width:10em;">
11
                <option value=""></option>
12
                <option value=""></option>
12
                    [% FOREACH branchloo IN branchloop %]
13
                    [% FOREACH branchloo IN Branches.all( selected => selected_branchcode ) %]
13
                        [% IF ( branchloo.selected ) %]
14
                        [% IF branchloo.selected %]
14
                        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
15
                        <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
15
                        [% ELSE %]
16
                        [% ELSE %]
16
                        <option value="[% branchloo.value %]" >[% branchloo.branchname %]</option>
17
                        <option value="[% branchloo.branchcode %]" >[% branchloo.branchname %]</option>
17
                        [% END %]
18
                        [% END %]
18
                    [% END %]
19
                    [% END %]
19
            </select>
20
            </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+1 lines)
Lines 28-33 Link Here
28
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
28
<script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
29
29
30
[% INCLUDE 'validator-strings.inc' %]
30
[% INCLUDE 'validator-strings.inc' %]
31
[% PROCESS 'html_helpers.inc' %]
31
[% IF ( IntranetUserJS ) %]
32
[% IF ( IntranetUserJS ) %]
32
    <script type="text/javascript">
33
    <script type="text/javascript">
33
    //<![CDATA[
34
    //<![CDATA[
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (+9 lines)
Line 0 Link Here
1
[% BLOCK options_for_libraries %]
2
    [% FOREACH l IN libraries %]
3
        [% IF l.selected %]
4
            <option value="[% l.branchcode %]" selected="selected">[% l.branchname %]</option>
5
        [% ELSE %]
6
            <option value="[% l.branchcode %]">[% l.branchname %]</option>
7
        [% END%]
8
    [% END %]
9
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-19 / +5 lines)
Lines 203-220 function submitForm(form) { Link Here
203
                                                <label for="billingplace">Billing place:</label>
203
                                                <label for="billingplace">Billing place:</label>
204
                                                <select name="billingplace" id="billingplace" style="width:13em;">
204
                                                <select name="billingplace" id="billingplace" style="width:13em;">
205
                                                    <option value="">--</option>
205
                                                    <option value="">--</option>
206
                                                    [% FOREACH billingplaceloo IN billingplaceloop %]
206
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
207
                                                        [% IF ( billingplaceloo.selected ) %]<option value="[% billingplaceloo.value %]" selected="selected">[% billingplaceloo.branchname %]</option>
208
                                                        [% ELSE %]<option value="[% billingplaceloo.value %]">[% billingplaceloo.branchname %]</option>[% END%]
209
                                                    [% END %]
210
                                                </select>
207
                                                </select>
211
                                            [% ELSE %]
208
                                            [% ELSE %]
212
                                                <span class="label">Billing place:</span>
209
                                                <span class="label">Billing place:</span>
213
                                                [% FOREACH billingplaceloo IN billingplaceloop %]
210
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace %]" />[% Branches.GetName( billingplace ) %]
214
                                                    [% IF ( billingplaceloo.selected ) %]
215
                                                        <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplaceloo.value %]" />[% billingplaceloo.branchname %]
216
                                                    [% END %]
217
                                                [% END %]
218
                                            [% END %]
211
                                            [% END %]
219
                                        </li>
212
                                        </li>
220
                                        [% UNLESS (closedbg) %]
213
                                        [% UNLESS (closedbg) %]
Lines 222-232 function submitForm(form) { Link Here
222
                                                <label for="deliveryplace">Delivery place:</label>
215
                                                <label for="deliveryplace">Delivery place:</label>
223
                                                <select name="deliveryplace" id="deliveryplace" style="width:13em;">
216
                                                <select name="deliveryplace" id="deliveryplace" style="width:13em;">
224
                                                    <option value="">--</option>
217
                                                    <option value="">--</option>
225
                                                    [% FOREACH deliveryplaceloo IN deliveryplaceloop %]
218
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
226
                                                        [% IF ( deliveryplaceloo.selected ) %]<option value="[% deliveryplaceloo.value %]" selected="selected">[% deliveryplaceloo.branchname %]</option>
219
                                                <select>
227
                                                        [% ELSE %]<option value="[% deliveryplaceloo.value %]">[% deliveryplaceloo.branchname %]</option>[% END %]
228
                                                    [% END %]
229
                                                    <select>
230
                                            </li>
220
                                            </li>
231
                                            <li><p>or</p></li>
221
                                            <li><p>or</p></li>
232
                                            <li>
222
                                            <li>
Lines 240-250 function submitForm(form) { Link Here
240
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace %]" />[% freedeliveryplace %]
230
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace %]" />[% freedeliveryplace %]
241
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
231
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
242
                                                    [% ELSE %]
232
                                                    [% ELSE %]
243
                                                        [% FOREACH deliveryplaceloo IN deliveryplaceloop %]
233
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace %]" />[% Branches.GetName( deliveryplace ) %]
244
                                                            [% IF ( deliveryplaceloo.selected ) %]
245
                                                                <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplaceloo.value %]" />[% deliveryplaceloo.branchname %]
246
                                                            [% END %]
247
                                                        [% END %]
248
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
234
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
249
                                                    [% END %]
235
                                                    [% END %]
250
                                                </li>
236
                                                </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-18 / +3 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions &rsaquo;
3
<title>Koha &rsaquo; Acquisitions &rsaquo;
3
[% IF ( add_form ) %]
4
[% IF ( add_form ) %]
Lines 53-82 Link Here
53
                    <label for="billingplace">Billing place:</label>
54
                    <label for="billingplace">Billing place:</label>
54
                    <select name="billingplace" id="billingplace">
55
                    <select name="billingplace" id="billingplace">
55
                        <option value="">--</option>
56
                        <option value="">--</option>
56
                        [% FOREACH billingplace IN billingplaceloop %]
57
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
57
                            [% IF ( billingplace.selected ) %]
58
                                <option value="[% billingplace.value %]" selected="selected">
59
                            [% ELSE %]
60
                                <option value="[% billingplace.value %]">
61
                            [% END %]
62
                                [% billingplace.branchname %]
63
                            </option>
64
                        [% END %]
65
                    </select>
58
                    </select>
66
                </li>
59
                </li>
67
                <li>
60
                <li>
68
                    <label for="deliveryplace">Delivery place:</label>
61
                    <label for="deliveryplace">Delivery place:</label>
69
                    <select name="deliveryplace" id="deliveryplace">
62
                    <select name="deliveryplace" id="deliveryplace">
70
                        <option value="">--</option>
63
                        <option value="">--</option>
71
                        [% FOREACH deliveryplace IN deliveryplaceloop %]
64
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
72
                            [% IF ( deliveryplace.selected ) %]
73
                                <option value="[% deliveryplace.value %]" selected="selected">
74
                            [% ELSE %]
75
                                <option value="[% deliveryplace.value %]">
76
                            [% END %]
77
                                [% deliveryplace.branchname %]
78
                            </option>
79
                        [% END %]
80
                    </select>
65
                    </select>
81
                </li>
66
                </li>
82
                <li>
67
                <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-9 / +3 lines)
Lines 520-529 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
520
    <li>
520
    <li>
521
    <label for="budget_branchcode">Library: </label>
521
    <label for="budget_branchcode">Library: </label>
522
    <select name="budget_branchcode" id="budget_branchcode">
522
    <select name="budget_branchcode" id="budget_branchcode">
523
    <option value=""></option>
523
        <option value=""></option>
524
    [% FOREACH branchloop_selec IN branchloop_select %]
524
        [% PROCESS options_for_libraries libraries => branchloop_select %]
525
        [% UNLESS ( branchloop_selec.selected ) %] <option value="[% branchloop_selec.value %]" > [% ELSE %] <option value="[% branchloop_selec.value %]" selected="selected"> [% END %] [% branchloop_selec.value %]-[% branchloop_selec.branchname %]</option>
526
    [% END %]
527
    </select>
525
    </select>
528
    </li>
526
    </li>
529
527
Lines 654-664 If you delete this fund, all orders linked to this fund will be deleted! Link Here
654
            <label for="filter_budgetbranch2">Library: </label>
652
            <label for="filter_budgetbranch2">Library: </label>
655
            <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
653
            <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
656
                <option value=""></option>
654
                <option value=""></option>
657
                [% FOREACH branchloo IN branchloop %]
655
                [% PROCESS options_for_libraries libraries => branchloop_select %]
658
                [% UNLESS ( branchloo.selected ) %]<option value="[% branchloo.value %]">
659
                [% ELSE %]<option value="[% branchloo.value %]" selected="selected">[% END %]
660
                [% branchloo.branchname %]</option>
661
                [% END %]
662
            </select>
656
            </select>
663
        </li>
657
        </li>
664
        <li class="radio">
658
        <li class="radio">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/clone-rules.tt (-37 / +25 lines)
Lines 29-72 Link Here
29
    [% ELSE %]
29
    [% ELSE %]
30
30
31
	<p class="help">Use carefully! If the destination library already has issuing rules, they will be deleted without warning!</p>
31
	<p class="help">Use carefully! If the destination library already has issuing rules, they will be deleted without warning!</p>
32
	<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
32
    <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
33
	    [% UNLESS ( frombranch ) %]
33
        [% UNLESS ( frombranch ) %]
34
	    <fieldset>
34
            <fieldset>
35
		<legend>Please choose a library to clone rules from:</legend> 
35
                <legend>Please choose a library to clone rules from:</legend>
36
		<label for="frombranch">Source library:</label>
36
                <label for="frombranch">Source library:</label>
37
		<select name="frombranch" id="frombranch">
37
                <select name="frombranch" id="frombranch">
38
			<option value="">Default</option>
38
                    <option value="">Default</option>
39
			[% FOREACH branchloo IN branchloop %]
39
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
40
				[% IF ( branchloo.selected ) %]
40
                </select>
41
					<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
41
                [% IF ( tobranch ) %]<input type="hidden" name="tobranch" value="[% tobranch %]" />[% END %]
42
				[% ELSE %]
42
            </fieldset>
43
					<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
43
        [% END %]
44
				[% END %]
45
			[% END %]
46
		</select>
47
		[% IF ( tobranch ) %]<input type="hidden" name="tobranch" value="[% tobranch %]" />[% END %]
48
	    </fieldset>
49
	    [% END %]
50
44
51
	    [% UNLESS ( tobranch ) %]
45
        [% UNLESS ( tobranch ) %]
52
	    <fieldset>
46
            <fieldset>
53
		<legend>Please choose the library to clone the rules to:</legend> 
47
            <legend>Please choose the library to clone the rules to:</legend>
54
		<label for="tobranch">Destination library:</label>
48
            <label for="tobranch">Destination library:</label>
55
		<select name="tobranch" id="tobranch">
49
            <select name="tobranch" id="tobranch">
56
			<option value="">Default</option>
50
                <option value="">Default</option>
57
			[% FOREACH branchloo IN branchloop %]
51
                [% PROCESS options_for_libraries libraries => Branches.all() %]
58
				[% IF ( branchloo.selected ) %]
52
            </select>
59
					<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
53
            [% IF ( frombranch ) %]<input type="hidden" name="frombranch" value="[% frombranch %]" />[% END %]
60
				[% ELSE %]
54
            </fieldset>
61
					<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
55
        [% END %]
62
				[% END %]
56
        <input type="submit" value="Submit" />
63
			[% END %]
57
    </form>
64
		</select>
65
		[% IF ( frombranch ) %]<input type="hidden" name="frombranch" value="[% frombranch %]" />[% END %]
66
	    </fieldset>
67
	[% END %]
68
	<input type="submit" value="Submit" />
69
	</form>
70
58
71
    [% END %]
59
    [% END %]
72
    </div>
60
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-11 / +19 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
3
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 110-117 $(document).ready(function() { Link Here
110
    <div id="yui-main">
111
    <div id="yui-main">
111
    <div class="yui-b">
112
    <div class="yui-b">
112
    <h1 class="parameters">
113
    <h1 class="parameters">
113
        [% IF ( humanbranch ) %]
114
        [% IF humanbranch %]
114
            Defining circulation and fine rules for "[% humanbranch %]"
115
            Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) %]"
115
        [% ELSE %]
116
        [% ELSE %]
116
            Defining circulation and fine rules for all libraries
117
            Defining circulation and fine rules for all libraries
117
        [% END %]
118
        [% END %]
Lines 135-148 $(document).ready(function() { Link Here
135
        Select a library :
136
        Select a library :
136
            <select name="branch" id="branch" style="width:20em;">
137
            <select name="branch" id="branch" style="width:20em;">
137
                <option value="*">All libraries</option>
138
                <option value="*">All libraries</option>
138
            [% FOREACH branchloo IN branchloop %]
139
                [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch ) %]
139
				[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
140
            [% END %]
141
            </select>
140
            </select>
142
        </form>
141
        </form>
143
[% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label 
142
        [% IF ( definedbranch ) %]
144
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" />
143
            <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
145
            <select name="tobranch" id="tobranch">[% FOREACH branchloo IN branchloop %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]</select> <input type="submit" value="Clone" /></form>[% END %]
144
                <label for="tobranch"><strong>Clone these rules to:</strong></label>
145
                <input type="hidden" name="frombranch" value="[% current_branch %]" />
146
                <select name="tobranch" id="tobranch">
147
                    [% FOREACH l IN Branches.all() %]
148
                        <option value="[% l.value %]">[% l.branchname %]</option>
149
                    [% END %]
150
                </select>
151
                <input type="submit" value="Clone" />
152
            </form>
153
        [% END %]
146
154
147
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
155
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
148
            <input type="hidden" name="op" value="add" />
156
            <input type="hidden" name="op" value="add" />
Lines 368-374 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
368
        </form>
376
        </form>
369
    </div>
377
    </div>
370
    <div id="defaults-for-this-library" class="container">
378
    <div id="defaults-for-this-library" class="container">
371
    <h3>Default checkout, hold and return policy[% IF ( humanbranch ) %] for [% humanbranch %][% END %]</h3>
379
    <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
372
        <p>You can set a default maximum number of checkouts, hold policy and return policy that will be used if none is defined below for a particular item type or category.</p>
380
        <p>You can set a default maximum number of checkouts, hold policy and return policy that will be used if none is defined below for a particular item type or category.</p>
373
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
381
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
374
            <input type="hidden" name="op" value="set-branch-defaults" />
382
            <input type="hidden" name="op" value="set-branch-defaults" />
Lines 447-453 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
447
    </div>
455
    </div>
448
    [% IF ( show_branch_cat_rule_form ) %]
456
    [% IF ( show_branch_cat_rule_form ) %]
449
    <div id="holds-policy-by-patron-category" class="container">
457
    <div id="holds-policy-by-patron-category" class="container">
450
    <h3>[% IF humanbranch %]Checkout limit by patron category for [% humanbranch %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
458
    <h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
451
        <p>For this library, you can specify the maximum number of loans that
459
        <p>For this library, you can specify the maximum number of loans that
452
            a patron of a given category can make, regardless of the item type.
460
            a patron of a given category can make, regardless of the item type.
453
        </p>
461
        </p>
Lines 511-517 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
511
    </div>
519
    </div>
512
    [% END %]
520
    [% END %]
513
    <div id="holds-policy-by-item-type" class="container">
521
    <div id="holds-policy-by-item-type" class="container">
514
    <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3>
522
    <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) %][% ELSE %]Default holds policy by item type[% END %]</h3>
515
        <p>
523
        <p>
516
            For this library, you can edit rules for given itemtypes, regardless
524
            For this library, you can edit rules for given itemtypes, regardless
517
            of the patron's category.
525
            of the patron's category.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt (-2 / +2 lines)
Lines 86-93 function form_submit (f) { Link Here
86
                <table>
86
                <table>
87
                    <tr>
87
                    <tr>
88
                        <th>From \ To</th>
88
                        <th>From \ To</th>
89
                        [% FOR b IN branchloop %]
89
                        [% FOR b IN Branches.all() %]
90
                        <th>[% b.name %]</th>
90
                        <th>[% b.branchname %]</th>
91
                        [% END %]
91
                        [% END %]
92
                    </tr>
92
                    </tr>
93
                [% FOR bf IN branchfromloop %]
93
                [% FOR bf IN branchfromloop %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt (-2 / +2 lines)
Lines 57-64 Link Here
57
<p><label for="branch">Library:</label>
57
<p><label for="branch">Library:</label>
58
    <select name="branch" id="branch" class="input" tabindex="3">
58
    <select name="branch" id="branch" class="input" tabindex="3">
59
    <option value="">My library</option>
59
    <option value="">My library</option>
60
    [% FOREACH branchloo IN branchloop %]
60
    [% FOREACH l IN Branches.all() %]
61
    <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
61
        <option value="[% l.branchcode %]">[% l.branchname %]</option>
62
    [% END %]
62
    [% END %]
63
    </select>
63
    </select>
64
    </p>[% END %]
64
    </p>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt (-7 / +1 lines)
Lines 238-250 Link Here
238
<fieldset id="select-libs">
238
<fieldset id="select-libs">
239
        <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
239
        <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
240
        <option value="">All libraries</option>
240
        <option value="">All libraries</option>
241
        [% FOREACH branchloo IN branchloop %]
241
        [% PROCESS options_for_libraries libraries => Branches.all() %]
242
        [% IF ( branchloo.selected ) %]
243
        <option value="branch:[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
244
        [% ELSE %]
245
        <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option>
246
        [% END %]
247
        [% END %]
248
        </select></p>
242
        </select></p>
249
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
243
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
250
        [% IF ( searchdomainloop ) %]
244
        [% IF ( searchdomainloop ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt (-6 / +6 lines)
Lines 39-54 $(document).ready(function(){ Link Here
39
        <th>No. of times checked out</th>
39
        <th>No. of times checked out</th>
40
        <th>Last seen</th>
40
        <th>Last seen</th>
41
    </tr>
41
    </tr>
42
    [% FOREACH branchloo IN branchloop %]
42
    [% FOREACH library IN libraries %]
43
    [% IF ( branchloo.selected ) %]
43
    [% IF library.selected %]
44
        <tr class="mybranch">
44
        <tr class="mybranch">
45
    [% ELSE %]
45
    [% ELSE %]
46
        <tr>
46
        <tr>
47
    [% END %]
47
    [% END %]
48
            <td>[% branchloo.branchname %]</td>
48
            <td>[% library.branchname %]</td>
49
            <td>[% branchloo.issues %]</td>
49
            <td>[% library.issues %]</td>
50
            <td>[% IF ( branchloo.seen ) %]
50
            <td>[% IF library.seen %]
51
                    [% branchloo.seen | $KohaDates with_hours => 1 %]
51
                    [% library.seen | $KohaDates with_hours => 1 %]
52
                [% ELSE %]
52
                [% ELSE %]
53
                    <span>Never</span>
53
                    <span>Never</span>
54
                [% END %]
54
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt (-9 / +2 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE ItemTypes %]
3
[% USE ItemTypes %]
3
[% USE AuthorisedValues %]
4
[% USE AuthorisedValues %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
Lines 145-159 Link Here
145
			<li>
146
			<li>
146
                <label for="tobranchcd">Destination library: </label>
147
                <label for="tobranchcd">Destination library: </label>
147
                    <select name="tobranchcd" id="tobranchcd">
148
                    <select name="tobranchcd" id="tobranchcd">
148
                        [% FOREACH branchoptionloo IN branchoptionloop %]
149
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd ) %]
149
						[% IF ( branchoptionloo.selected ) %]
150
                            <option value="[% branchoptionloo.value %]" selected="selected">
151
						[% ELSE %]
152
                            <option value="[% branchoptionloo.value %]">
153
						[% END %]
154
                                [% branchoptionloo.branchname %]
155
                            </option>
156
                        [% END %]
157
                    </select>
150
                    </select>
158
            </li>
151
            </li>
159
            <li>
152
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt (-17 / +8 lines)
Lines 203-235 overdue as of [% todaysdate %][% IF ( isfiltered ) %] <span style="font-size:70% Link Here
203
        <label>Item home library:</label>
203
        <label>Item home library:</label>
204
        <select name="homebranch" id="homebranch">
204
        <select name="homebranch" id="homebranch">
205
            <option value="">Any</option>
205
            <option value="">Any</option>
206
            [% FOREACH homebranchloo IN homebranchloop %][% IF ( homebranchloo.selected ) %]
206
            [% PROCESS options_for_libraries libraries => Branches.all( selected => homebranchfilter ) %]
207
            <option value="[% homebranchloo.value %]" selected="selected">[% homebranchloo.branchname %]</option>[% ELSE %]
208
            <option value="[% homebranchloo.value %]">[% homebranchloo.branchname %]</option>[% END %]
209
            [% END %]
210
        </select>
207
        </select>
211
    </li>
208
    </li>
212
209
213
    <li>
210
    <li>
214
        <label>Item holding library:</label>
211
        <label>Item holding library:</label>
215
            <select name="holdingbranch" id="holdingbranch">
212
        <select name="holdingbranch" id="holdingbranch">
216
            <option value="">Any</option>
213
            <option value="">Any</option>
217
            [% FOREACH holdingbranchloo IN holdingbranchloop %][% IF ( holdingbranchloo.selected ) %]
214
            [% PROCESS options_for_libraries libraries => Branches.all( selected => holdingbranchfilter ) %]
218
            <option value="[% holdingbranchloo.value %]" selected="selected">[% holdingbranchloo.branchname %]</option>[% ELSE %]
219
            <option value="[% holdingbranchloo.value %]">[% holdingbranchloo.branchname %]</option>[% END %]
220
            [% END %]
221
        </select>
215
        </select>
222
    </li>
216
    </li>
223
217
224
    <li>
218
    <li>
225
    <label>Library of the patron:</label><select name="branch" id="branch">
219
        <label>Library of the patron:</label>
226
        <option value="">Any</option>
220
        <select name="branch" id="branch">
227
      [% FOREACH branchloo IN branchloop %]
221
            <option value="">Any</option>
228
        [% IF ( branchloo.selected ) %]
222
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
229
        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]
223
        </select>
230
        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
231
      [% END %]
232
      </select>
233
    </li>
224
    </li>
234
225
235
    <li><label for="order">Sort by:</label> <select name="order" id="order">
226
    <li><label for="order">Sort by:</label> <select name="order" id="order">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt (-7 / +1 lines)
Lines 54-66 Updated:<ul> Link Here
54
    [% ELSE %]
54
    [% ELSE %]
55
        <li><label for="branch">Choose library:</label>
55
        <li><label for="branch">Choose library:</label>
56
        <select name="branch" id="branch">
56
        <select name="branch" id="branch">
57
        [% FOREACH branchloo IN branchloop %]
57
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
58
            [% IF ( branchloo.selected ) %]
59
            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
60
            [% ELSE %]
61
            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
62
            [% END %]
63
        [% END %]
64
        </select></li>
58
        </select></li>
65
    [% END %]
59
    [% END %]
66
<!--
60
<!--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (-8 / +6 lines)
Lines 115-129 $(document).ready(function() { Link Here
115
<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post">
115
<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post">
116
	<fieldset class="rows">
116
	<fieldset class="rows">
117
	<ol>
117
	<ol>
118
	<li><label for="branchlimit">Library: </label><select name="branchlimit" id="branchlimit">
118
        <li>
119
            <label for="branchlimit">Library: </label>
120
            <select name="branchlimit" id="branchlimit">
119
                <option value="">All</option>
121
                <option value="">All</option>
120
            [% FOREACH branchloo IN branchloop %]
122
                [% PROCESS options_for_libraries libraries => Branches.all() %]
121
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
123
            </select>
122
				[% ELSE %]
124
        </li>
123
				<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
124
				[% END %]
125
            [% END %]
126
            </select></li>
127
			<!-- FIXME Not working yet
125
			<!-- FIXME Not working yet
128
			<li><label for="itemtypeslimit">Item Type: </label><select name="itemtypeslimit" id="itemtypeslimit">
126
			<li><label for="itemtypeslimit">Item Type: </label><select name="itemtypeslimit" id="itemtypeslimit">
129
                <option value="">All</option>
127
                <option value="">All</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt (-4 / +4 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
3
<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 81-92 Link Here
81
                        <label class="required" for="holdingbranch">Holding library:</label>
82
                        <label class="required" for="holdingbranch">Holding library:</label>
82
                        <select id="holdingbranch" name="holdingbranch">
83
                        <select id="holdingbranch" name="holdingbranch">
83
                            <option value="">LEAVE UNCHANGED</option>
84
                            <option value="">LEAVE UNCHANGED</option>
84
85
                            [% FOREACH b IN Branches.all() %]
85
                            [% FOREACH b IN branches %]
86
                                [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %]
86
                                [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %]
87
                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
87
                                    <option value="[% b.branchcode %]" selected="selected">[% b.branchname %]</option>
88
                                [% ELSE %]
88
                                [% ELSE %]
89
                                    <option value="[% b.value %]">[% b.branchname %]</option>
89
                                    <option value="[% b.branchcode %]">[% b.branchname %]</option>
90
                                [% END %]
90
                                [% END %]
91
                            [% END %]
91
                            [% END %]
92
                        </select>
92
                        </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt (-7 / +1 lines)
Lines 497-509 function filterByFirstLetterSurname(letter) { Link Here
497
                [% IF branches.size != 1 %]
497
                [% IF branches.size != 1 %]
498
                  <option value="">Any</option>
498
                  <option value="">Any</option>
499
                [% END %]
499
                [% END %]
500
                [% FOREACH b IN branches %]
500
                [% PROCESS options_for_libraries libraries => branches %]
501
                  [% IF b.selected %]
502
                    <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
503
                  [% ELSE %]
504
                    <option value="[% b.branchcode %]">[% b.branchname %]</option>
505
                  [% END %]
506
                [% END %]
507
              </select>
501
              </select>
508
            </li>
502
            </li>
509
          </ol>
503
          </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-9 / +4 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Branches %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Patrons &rsaquo; [% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron [% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</title>
5
<title>Koha &rsaquo; Patrons &rsaquo; [% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron [% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
Lines 652-666 Link Here
652
    <li>
653
    <li>
653
        <label for="libraries" class="required">Library:</label>
654
        <label for="libraries" class="required">Library:</label>
654
        <select name="branchcode" size="1" id="libraries">
655
        <select name="branchcode" size="1" id="libraries">
655
        [%- FOREACH branchloo IN branchloop %]
656
            [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch ) %]
656
          [% IF ( branchloo.selected ) -%]
657
        </select>
657
            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
658
        <span class="required">Required</span>
658
          [%- ELSE -%]
659
            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
660
          [%- END -%]
661
        [%- END %]
662
      </select>
663
      <span class="required">Required</span>
664
    </li>
659
    </li>
665
        [% END %]
660
        [% END %]
666
    <li>
661
    <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt (-2 / +2 lines)
Lines 141-148 function Dopop(link) { Link Here
141
			<li> 
141
			<li> 
142
				<label for="branch">Library: </label>
142
				<label for="branch">Library: </label>
143
<select name="Filter" id="branch"><option value="" > Any library</option>
143
<select name="Filter" id="branch"><option value="" > Any library</option>
144
    [% FOREACH branchloo IN branchloop %]
144
    [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
145
        <option value="[% branchloo.value %]" >[% branchloo.branchname %] </option>  
145
        <option value="[% l.branchcode %]" >[% l.branchname %] </option>
146
     [% END %] 
146
     [% END %] 
147
    </select>			</li>
147
    </select>			</li>
148
			<li> 
148
			<li> 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (-6 / +7 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Patrons statistics &rsaquo; Results[% ELSE %]&rsaquo; Patrons statistics[% END %]</title>
3
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Patrons statistics &rsaquo; Results[% ELSE %]&rsaquo; Patrons statistics[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 140-151 Link Here
140
			<td><input type="radio" name="Line"   value="branchcode" /></td>
141
			<td><input type="radio" name="Line"   value="branchcode" /></td>
141
			<td><input type="radio" name="Column" value="branchcode" /></td>
142
			<td><input type="radio" name="Column" value="branchcode" /></td>
142
			<td>
143
			<td>
143
				<select name="Filter"  size="1" id="branch">
144
                <select name="Filter"  size="1" id="branch">
144
				<option value=""></option>
145
                <option value=""></option>
145
				[% FOREACH BRANCH_LOO IN BRANCH_LOOP %]
146
                [% FOREACH l IN Branches.all() %]
146
					<option value="[% BRANCH_LOO.branchcode %]">[% BRANCH_LOO.branchcode %] - [% BRANCH_LOO.branchname %]</option>
147
                    <option value="[% l.branchcode %]">[% l.branchcode %] - [% l.branchname || 'UNKNOWN' %]</option>
147
				[% END %]
148
                [% END %]
148
				</select>
149
                </select>
149
			</td>
150
			</td>
150
			</tr>
151
			</tr>
151
		    <tr>
152
		    <tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt (-6 / +7 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Most-circulated items[% IF ( do_it ) %] &rsaquo; Results[% END %]</title>
3
<title>Koha &rsaquo; Reports &rsaquo; Most-circulated items[% IF ( do_it ) %] &rsaquo; Results[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 111-122 Link Here
111
        <li><label for="fromRO">Check-in date from</label> <input type="text" size="10" id="fromRO" name="Filter" />
112
        <li><label for="fromRO">Check-in date from</label> <input type="text" size="10" id="fromRO" name="Filter" />
112
        <label for="toRO" class="inline">To: </label> <input type="text" size="10" id="toRO" name="Filter" value="" />
113
        <label for="toRO" class="inline">To: </label> <input type="text" size="10" id="toRO" name="Filter" value="" />
113
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
114
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
114
				<li><label for="branch">Library: </label>
115
        <li>
115
<select name="Filter" id="branch"><option value="" > Any library</option>
116
            <label for="branch">Library: </label>
116
    [% FOREACH branchloo IN branchloop %]
117
            <select name="Filter" id="branch"><option value="" > Any library</option>
117
        <option value="[% branchloo.value %]" >[% branchloo.branchname %] </option>  
118
                [% PROCESS options_for_libraries libraries => Branches.all() %]
118
     [% END %] 
119
            </select>
119
    </select>     </li>
120
        </li>
120
      <li> 
121
      <li> 
121
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
122
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
122
    [% FOREACH itemtypeloo IN itemtypeloop %]
123
    [% FOREACH itemtypeloo IN itemtypeloop %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt (-7 / +1 lines)
Lines 93-105 Link Here
93
			<li><label for="branch">Library: </label>
93
			<li><label for="branch">Library: </label>
94
	<select name="Filter" id="branch">
94
	<select name="Filter" id="branch">
95
        <option value="">Any library</option>
95
        <option value="">Any library</option>
96
    [% FOREACH branchloo IN branchloop %]
96
        [% PROCESS options_for_libraries libraries => Branches.all() %]
97
      [% IF ( branchloo.selected ) %]
98
        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
99
      [% ELSE %]
100
        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
101
      [% END %]
102
    [% END %]
103
    </select></li>
97
    </select></li>
104
      <li> 
98
      <li> 
105
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
99
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt (-5 / +4 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Catalog statistics &rsaquo; Results[% ELSE %]&rsaquo; Catalog statistics[% END %]</title>
3
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Catalog statistics &rsaquo; Results[% ELSE %]&rsaquo; Catalog statistics[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 160-170 Link Here
160
				<td><input type="radio" name="Line" value="items.homebranch" /></td>
161
				<td><input type="radio" name="Line" value="items.homebranch" /></td>
161
				<td><input type="radio" name="Column" value="items.homebranch" /></td>
162
				<td><input type="radio" name="Column" value="items.homebranch" /></td>
162
				<td><select name="Filter" id="branch">
163
				<td><select name="Filter" id="branch">
163
					<option value=""> </option>
164
                    <option value=""> </option>
164
					[% FOREACH CGIBranc IN CGIBranch %]
165
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
165
					[% IF ( CGIBranc.selected ) %]<option value="[% CGIBranc.value %]" selected="selected">[% CGIBranc.branchname %]</option>[% ELSE %]<option value="[% CGIBranc.value %]">[% CGIBranc.branchname %]</option>[% END %]
166
                    </select>
166
					[% END %]
167
					</select>
168
				</td>
167
				</td>
169
			</tr>
168
			</tr>
170
			<tr>
169
			<tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt (-3 / +2 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Average checkout period</title>
3
<title>Koha &rsaquo; Reports &rsaquo; Average checkout period</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 181-189 Link Here
181
                <td>
182
                <td>
182
                    <select name="Filter" size="1" id="branch">
183
                    <select name="Filter" size="1" id="branch">
183
                        <option value=""></option>
184
                        <option value=""></option>
184
                        [%- FOREACH branchloo IN branchloop %]
185
                        [% PROCESS options_for_libraries libraries => Branches.all() %]
185
                        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
186
                        [%- END %]
187
                    </select>
186
                    </select>
188
                </td>
187
                </td>
189
			</tr>
188
			</tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_by_borrower_category.tt (-2 / +3 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Checkouts by patron category</title>
3
<title>Koha &rsaquo; Reports &rsaquo; Checkouts by patron category</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 68-75 Link Here
68
                <label for="branch">Select a library:</label>
69
                <label for="branch">Select a library:</label>
69
                <select name="value" size="1" id="branch">
70
                <select name="value" size="1" id="branch">
70
                  <option value=""></option>
71
                  <option value=""></option>
71
                [%- FOREACH branchloo IN branchloop %]
72
                [%- FOREACH l IN Branches.all() %]
72
                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
73
                  <option value="[% l.branchcode %]">[% l.branchname %]</option>
73
                [%- END %]
74
                [%- END %]
74
               </select>
75
               </select>
75
              </li>
76
              </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt (-10 / +5 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Circulation statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
3
<title>Koha &rsaquo; Reports &rsaquo; Circulation statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 159-168 Link Here
159
            <td><input type="radio" name="Line" value="branch" /></td>
160
            <td><input type="radio" name="Line" value="branch" /></td>
160
            <td><input type="radio" name="Column" value="branch" /></td>
161
            <td><input type="radio" name="Column" value="branch" /></td>
161
            <td><select name="Filter" id="branch">
162
            <td><select name="Filter" id="branch">
162
               <option value=""> </option>
163
                <option value=""> </option>
163
               [% FOREACH branchloo IN branchloop %]
164
                [% PROCESS options_for_libraries libraries => Branches.all() %]
164
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
165
				[% END %]
166
               </select>
165
               </select>
167
             </td> 
166
             </td> 
168
        </tr>
167
        </tr>
Lines 227-235 Link Here
227
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
226
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
228
            <td><select name="Filter" id="homebranch">
227
            <td><select name="Filter" id="homebranch">
229
                    <option value=""> </option>
228
                    <option value=""> </option>
230
                    [% FOREACH branchloo IN branchloop %]
229
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
231
                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
232
				    [% END %]
233
                </select>
230
                </select>
234
            </td>
231
            </td>
235
        </tr>
232
        </tr>
Lines 239-247 Link Here
239
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
236
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
240
            <td><select name="Filter" id="holdingbranch">
237
            <td><select name="Filter" id="holdingbranch">
241
                    <option value=""> </option>
238
                    <option value=""> </option>
242
                    [% FOREACH branchloo IN branchloop %]
239
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
243
                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
244
				    [% END %]
245
                </select>
240
                </select>
246
            </td>
241
            </td>
247
        </tr>
242
        </tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt (-6 / +1 lines)
Lines 102-113 Link Here
102
	<li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
102
	<li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
103
	<li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
103
	<li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
104
                <option value="">All</option>
104
                <option value="">All</option>
105
            [% FOREACH branchloo IN branchloop %]
105
                [% PROCESS options_for_libraries libraries => Branches.all() %]
106
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
107
				[% ELSE %]
108
				<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
109
				[% END %]
110
            [% END %]
111
            </select></li>
106
            </select></li>
112
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
107
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
113
                <option value="">All</option>
108
                <option value="">All</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt (-7 / +1 lines)
Lines 65-77 $(document).ready(function(){ Link Here
65
                <label for="value">Select a library</label>
65
                <label for="value">Select a library</label>
66
                <select name="value" size="1" id="value">
66
                <select name="value" size="1" id="value">
67
                  <option value=""></option>
67
                  <option value=""></option>
68
                [%- FOREACH branchloo IN branchloop %]
68
                  [% PROCESS options_for_libraries libraries => Branches.all() %]
69
                 [% IF ( branchloo.selected ) -%]
70
                  <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
71
                 [%- ELSE -%]
72
                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
73
                 [%- END -%]
74
                [%- END %]
75
                </select>
69
                </select>
76
                <span class="tip">Select none to see all libraries</span>
70
                <span class="tip">Select none to see all libraries</span>
77
              </li>
71
              </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt (-10 / +5 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Holds statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
3
<title>Koha &rsaquo; Reports &rsaquo; Holds statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 238-246 Link Here
238
            <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
239
            <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
239
            <td><select name="filter_reserves.branchcode" id="resbranchcode">
240
            <td><select name="filter_reserves.branchcode" id="resbranchcode">
240
               <option value=""> </option>
241
               <option value=""> </option>
241
               [% FOREACH branchloo IN branchloop %]
242
                [% PROCESS options_for_libraries libraries => Branches.all() %]
242
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
243
				[% END %]
244
               </select>
243
               </select>
245
             </td> 
244
             </td> 
246
        </tr>
245
        </tr>
Lines 250-258 Link Here
250
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
249
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
251
            <td><select name="filter_items.holdingbranch" id="holdingbranch">
250
            <td><select name="filter_items.holdingbranch" id="holdingbranch">
252
               <option value=""> </option>
251
               <option value=""> </option>
253
               [% FOREACH branchloo IN branchloop %]
252
                [% PROCESS options_for_libraries libraries => Branches.all() %]
254
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
255
				[% END %]
256
               </select>
253
               </select>
257
             </td> 
254
             </td> 
258
        </tr>
255
        </tr>
Lines 261-270 Link Here
261
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
258
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
262
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
259
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
263
            <td><select name="filter_items.homebranch" id="homebranch">
260
            <td><select name="filter_items.homebranch" id="homebranch">
264
               <option value=""> </option>
261
                <option value=""> </option>
265
               [% FOREACH branchloo IN branchloop %]
262
                [% PROCESS options_for_libraries libraries => Branches.all() %]
266
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
267
				[% END %]
268
               </select>
263
               </select>
269
             </td> 
264
             </td> 
270
        </tr>
265
        </tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt (-7 / +1 lines)
Lines 93-105 Link Here
93
		    	</label>
93
		    	</label>
94
		    	<select name="branchcode"  id="branchcode">
94
		    	<select name="branchcode"  id="branchcode">
95
				<option value="">Any library</option>
95
				<option value="">Any library</option>
96
                    [% FOREACH branche IN branches %]
96
                [% PROCESS options_for_libraries libraries => Branches.all() %]
97
                        [% IF ( branche.selected ) %]
98
                            <option value="[% branche.value %]" selected="selected">[% branche.branchname %]</option>
99
                        [% ELSE %]
100
                            <option value="[% branche.value %]">[% branche.branchname %]</option>
101
                        [% END %]
102
					[% END %]
103
		    	</select>
97
		    	</select>
104
98
105
		    </li>
99
		    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-18 / +5 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Branches %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% UNLESS ( multi_hold ) %]
5
[% UNLESS ( multi_hold ) %]
5
    <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Place a hold on [% title %]</title>
6
    <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Place a hold on [% title %]</title>
Lines 400-412 function checkMultiHold() { Link Here
400
        <li>
401
        <li>
401
            <label for="pickup">Pickup at:</label>
402
            <label for="pickup">Pickup at:</label>
402
            <select name="pickup" size="1" id="pickup">
403
            <select name="pickup" size="1" id="pickup">
403
            [%- FOREACH branchloo IN branchloop %]
404
                [% PROCESS options_for_libraries libraries => Branches.all() %]
404
              [% IF ( branchloo.selected ) -%]
405
                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
406
              [%- ELSE -%]
407
                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
408
              [%- END -%]
409
            [%- END %]
410
            </select>
405
            </select>
411
        </li>
406
        </li>
412
407
Lines 762-778 function checkMultiHold() { Link Here
762
            Item being transferred to <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" />
757
            Item being transferred to <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" />
763
         [% END %]
758
         [% END %]
764
    [% ELSE %]
759
    [% ELSE %]
765
          <select name="pickup">
760
        <select name="pickup">
766
      [% FOREACH branchloo IN reserveloo.branchloop %]
761
            [% PROCESS options_for_libraries libraries => Branches.all( selected => reserveloo.branchcode ) %]
767
        [% IF ( branchloo.selected ) %]
762
        </select>
768
            <option value="[% branchloo.branchcode %]" selected="selected">
769
        [% ELSE %]
770
            <option value="[% branchloo.branchcode %]">
771
        [% END %]
772
              [% branchloo.branchname %]
773
            </option>
774
      [% END %]
775
          </select>
776
    [% END %]
763
    [% END %]
777
        </td>
764
        </td>
778
        <td>
765
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt (-12 / +5 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Serials &rsaquo; Check expiration</title>
4
<title>Koha &rsaquo; Serials &rsaquo; Check expiration</title>
Lines 53-71 Link Here
53
54
54
        <li><label for="issn">ISSN:</label>
55
        <li><label for="issn">ISSN:</label>
55
        <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li>
56
        <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li>
56
        [% IF (branches_loop.size) %]
57
        [% IF can_change_library %]
57
        <li><label for="branch">Library:</label>
58
        <li><label for="branch">Library:</label>
58
        <select id="branch" name="branch">
59
        <select id="branch" name="branch">
59
            <option value="">All</option>
60
            <option value="">All</option>
60
            [% FOREACH branch IN branches_loop %]
61
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
61
                [% IF branch.selected %]
62
                    <option selected="selected" value="[% branch.branchcode %]">
63
                [% ELSE %]
64
                    <option value="[% branch.branchcode %]">
65
                [% END %]
66
                    [% branch.branchname %]
67
                </option>
68
            [% END %]
69
        </select>
62
        </select>
70
        </li>
63
        </li>
71
        [% END %]
64
        [% END %]
Lines 96-102 Link Here
96
        <tr>
89
        <tr>
97
            <th>ISSN</th>
90
            <th>ISSN</th>
98
            <th>Title</th>
91
            <th>Title</th>
99
            [% IF ( branches_loop.size ) %]<th>Library</th>[% END %]
92
            [% IF can_change_library %]<th>Library</th>[% END %]
100
            <th>OPAC note</th>
93
            <th>OPAC note</th>
101
            <th>Nonpublic note</th>
94
            <th>Nonpublic note</th>
102
            <th>Expiration date</th>
95
            <th>Expiration date</th>
Lines 118-124 Link Here
118
                [% END %]
111
                [% END %]
119
                </a>
112
                </a>
120
            </td>
113
            </td>
121
            [% IF ( branches_loop.size ) %]<td>
114
            [% IF can_change_library %]<td>
122
                [% Branches.GetName( subscriptions_loo.branchcode ) %]
115
                [% Branches.GetName( subscriptions_loo.branchcode ) %]
123
            </td>[% END %]
116
            </td>[% END %]
124
            <td>
117
            <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt (-9 / +3 lines)
Lines 232-244 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl Link Here
232
    <div class="yui-u first">
232
    <div class="yui-u first">
233
        <label for="branch">Define the holidays for:</label>
233
        <label for="branch">Define the holidays for:</label>
234
            <select id="branch" name="branch">
234
            <select id="branch" name="branch">
235
                [% FOREACH branchloo IN branchloop %]
235
                [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
236
                    [% IF ( branchloo.selected ) %]
237
                        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
238
                    [% ELSE %]
239
                        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
240
                    [% END %]
241
                [% END %]
242
            </select>
236
            </select>
243
    
237
    
244
    <!-- ******************************** FLAT PANELS ******************************************* -->
238
    <!-- ******************************** FLAT PANELS ******************************************* -->
Lines 403-410 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl Link Here
403
  <label for="branchcode">Copy holidays to:</label>
397
  <label for="branchcode">Copy holidays to:</label>
404
  <select id="branchcode" name="branchcode">
398
  <select id="branchcode" name="branchcode">
405
    <option value=""></option>
399
    <option value=""></option>
406
    [% FOREACH branchloo IN branchloop %]
400
    [% FOREACH l IN Branches.all() %]
407
    <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
401
    <option value="[% l.branchcode %]">[% l.branchname %]</option>
408
    [% END %]
402
    [% END %]
409
  </select>
403
  </select>
410
    <input type="submit" value="Copy" />
404
    <input type="submit" value="Copy" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt (-3 / +4 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 132-140 Link Here
132
        <label class="description" for="branchcode">[% borrower_field.description %]: </label>
133
        <label class="description" for="branchcode">[% borrower_field.description %]: </label>
133
        <select id="branchcode" name="branchcode">
134
        <select id="branchcode" name="branchcode">
134
            <option value="" selected="selected"></option>
135
            <option value="" selected="selected"></option>
135
        [% FOREACH branch IN branches %]
136
        [% FOREACH library IN Branches.all() %]
136
            <option value="[% branch.branchcode %]">
137
            <option value="[% library.branchcode %]">
137
                [% branch.branchname %]</option>
138
                [% library.branchname %]</option>
138
        [% END %]
139
        [% END %]
139
        </select><span class="field_hint">[% borrower_field.field %]</span>
140
        </select><span class="field_hint">[% borrower_field.field %]</span>
140
    </li>
141
    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (-7 / +1 lines)
Lines 139-151 $(document).ready(function(){ Link Here
139
        </li><li>
139
        </li><li>
140
        <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
140
        <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
141
            <option value="">All libraries</option>
141
            <option value="">All libraries</option>
142
        [% FOREACH branchloo IN branchloop %]
142
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
143
            [% IF ( branchloo.selected ) %]
144
                <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
145
            [% ELSE %]
146
                <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
147
            [% END %]
148
        [% END %]
149
        </select>
143
        </select>
150
        </li>
144
        </li>
151
        [% IF (authorised_values) %]
145
        [% IF (authorised_values) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-8 / +4 lines)
Lines 167-175 $(document).ready(function() { Link Here
167
        Select a library :
167
        Select a library :
168
            <select name="branchcode" id="branch" style="width:20em;">
168
            <select name="branchcode" id="branch" style="width:20em;">
169
                <option value="*">All libraries</option>
169
                <option value="*">All libraries</option>
170
            [% FOREACH branchloo IN branchloop %]
170
                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
171
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
172
            [% END %]
173
            </select>
171
            </select>
174
      </p>
172
      </p>
175
    [% END %]
173
    [% END %]
Lines 185-192 $(document).ready(function() { Link Here
185
		[% IF ( letter && !independant_branch) %]
183
		[% IF ( letter && !independant_branch) %]
186
            [% select_for_copy = BLOCK %]
184
            [% select_for_copy = BLOCK %]
187
            <select name="branchcode">
185
            <select name="branchcode">
188
                [% FOREACH branchloo IN branchloop %]
186
                [% FOREACH l IN Branches.all() %]
189
                <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
187
                <option value="[% l.branchcode %]">Copy to [% l.branchname %]</option>
190
                [% END %]
188
                [% END %]
191
            </select>
189
            </select>
192
            [% END %]
190
            [% END %]
Lines 281-289 $(document).ready(function() { Link Here
281
                [% IF adding %]
279
                [% IF adding %]
282
                    <select name="branchcode" id="branch" style="width:20em;">
280
                    <select name="branchcode" id="branch" style="width:20em;">
283
                        <option value="">All libraries</option>
281
                        <option value="">All libraries</option>
284
                    [% FOREACH branchloo IN branchloop %]
282
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
285
                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
286
                    [% END %]
287
                    </select>
283
                    </select>
288
                [% ELSE %]
284
                [% ELSE %]
289
                    <input type="hidden" id="branch" name="branchcode" value="[% branchcode %]" />
285
                    <input type="hidden" id="branch" name="branchcode" value="[% branchcode %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt (-7 / +2 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Tools &rsaquo; Notice triggers</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Notice triggers</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 43-55 $(document).ready(function() { Link Here
43
            <label for="branch">Select a library:</label>
44
            <label for="branch">Select a library:</label>
44
                <select id="branch" name="branch">
45
                <select id="branch" name="branch">
45
                    <option value="">Default</option>
46
                    <option value="">Default</option>
46
                    [% FOREACH branchloo IN branchloop %]
47
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
47
                        [% IF ( branchloo.selected ) %]
48
                            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
49
                        [% ELSE %]
50
                            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
51
                        [% END %]
52
                    [% END %]
53
                </select>
48
                </select>
54
                <input type="submit" value="Select" />
49
                <input type="submit" value="Select" />
55
            </form>
50
            </form>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc (+1 lines)
Lines 49-51 Link Here
49
</script>
49
</script>
50
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/modernizr.min.js"></script>
50
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/modernizr.min.js"></script>
51
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/font-awesome/css/font-awesome.min.css" />
51
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/font-awesome/css/font-awesome.min.css" />
52
[% PROCESS 'html_helpers.inc' %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc (+9 lines)
Line 0 Link Here
1
[% BLOCK options_for_libraries %]
2
    [% FOREACH l IN libraries %]
3
        [% IF l.selected %]
4
            <option value="[% l.branchcode %]" selected="selected">[% l.branchname %]</option>
5
        [% ELSE %]
6
            <option value="[% l.branchcode %]">[% l.branchname %]</option>
7
        [% END%]
8
    [% END %]
9
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-3 / +7 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
3
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
3
<div id="wrap">
4
<div id="wrap">
4
    <div id="header-region" class="noprint">
5
    <div id="header-region" class="noprint">
Lines 226-234 Link Here
226
                                        <select name="branch_group_limit" id="select_library">
227
                                        <select name="branch_group_limit" id="select_library">
227
                                            <option value="">All libraries</option>
228
                                            <option value="">All libraries</option>
228
                                            [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %]
229
                                            [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %]
229
                                                [% FOREACH BranchesLoo IN BranchesLoop %]
230
                                                [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
230
                                                    [% IF ( BranchesLoo.selected ) %]<option selected="selected" value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
231
                                                    [% IF BranchesLoo.selected %]
231
                                                    [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>[% END %]
232
                                                        <option selected="selected" value="branch:[% BranchesLoo.branchcode %]">[% BranchesLoo.branchname %]</option>
233
                                                    [% ELSE %]
234
                                                        <option value="branch:[% BranchesLoo.branchcode %]">[% BranchesLoo.branchname %]</option>
235
                                                    [% END %]
232
                                                [% END %]
236
                                                [% END %]
233
                                            [% IF BranchCategoriesLoop %]
237
                                            [% IF BranchCategoriesLoop %]
234
                                                </optgroup>
238
                                                </optgroup>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt (-4 / +5 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Advanced search</title>
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Advanced search</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 214-224 Link Here
214
                                    <label for="branchloop">Library:</label>
215
                                    <label for="branchloop">Library:</label>
215
                                    <select name="limit" id="branchloop">
216
                                    <select name="limit" id="branchloop">
216
                                    <option value="">All libraries</option>
217
                                    <option value="">All libraries</option>
217
                                    [% FOREACH BranchesLoo IN BranchesLoop %]
218
                                    [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
218
                                        [% IF ( BranchesLoo.selected ) %]
219
                                        [% IF BranchesLoo.selected %]
219
                                            <option value="branch:[% BranchesLoo.value %]" selected="selected">[% BranchesLoo.branchname %]</option>
220
                                            <option value="branch:[% BranchesLoo.branchcode %]" selected="selected">[% BranchesLoo.branchname %]</option>
220
                                        [% ELSE %]
221
                                        [% ELSE %]
221
                                            <option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
222
                                            <option value="branch:[% BranchesLoo.branchcode %]">[% BranchesLoo.branchname %]</option>
222
                                        [% END %]
223
                                        [% END %]
223
                                    [% END %]
224
                                    [% END %]
224
                                    </select>
225
                                    </select>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-7 / +2 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE KohaDates %]
3
[% USE KohaDates %]
3
[% SET userupdateview = 1 %]
4
[% SET userupdateview = 1 %]
4
5
Lines 127-139 Link Here
127
                                        Home library:</label>
128
                                        Home library:</label>
128
129
129
                                        <select id="borrower_branchcode" name="borrower_branchcode">
130
                                        <select id="borrower_branchcode" name="borrower_branchcode">
130
                                            [% FOREACH b IN branches %]
131
                                            [% PROCESS options_for_libraries libraries => Branches.all( selected => borrower.branchcode ) %]
131
                                                [% IF b.value == borrower.branchcode %]
132
                                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
133
                                                [% ELSE %]
134
                                                    <option value="[% b.value %]">[% b.branchname %]</option>
135
                                                [% END %]
136
                                            [% END %]
137
                                        </select>
132
                                        </select>
138
                                    </li>
133
                                    </li>
139
                                [% END %]
134
                                [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-14 / +3 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE KohaDates %]
3
[% USE KohaDates %]
3
[% USE Price %]
4
[% USE Price %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
Lines 205-227 Link Here
205
                                                                <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
206
                                                                <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
206
                                                                [% UNLESS ( bibitemloo.holdable ) %]
207
                                                                [% UNLESS ( bibitemloo.holdable ) %]
207
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
208
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
208
                                                                        [% FOREACH branchloo IN bibitemloo.branchloop %]
209
                                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
209
                                                                            [% IF ( branchloo.selected ) %]
210
                                                                                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
211
                                                                            [% ELSE %]
212
                                                                                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
213
                                                                            [% END %]
214
                                                                        [% END %]
215
                                                                    </select>
210
                                                                    </select>
216
                                                                [% ELSE %]
211
                                                                [% ELSE %]
217
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
212
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
218
                                                                        [% FOREACH branchloo IN bibitemloo.branchloop %]
213
                                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
219
                                                                            [% IF ( branchloo.selected ) %]
220
                                                                                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
221
                                                                            [% ELSE %]
222
                                                                                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
223
                                                                            [% END %]
224
                                                                        [% END %]
225
                                                                    </select>
214
                                                                    </select>
226
                                                                [% END # / UNLESS bibitemloo.holdable %]
215
                                                                [% END # / UNLESS bibitemloo.holdable %]
227
                                                            </li>
216
                                                            </li>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-8 / +3 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
5
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
Lines 45-60 Link Here
45
                                        <li><label for="itemtype">Item type:</label>
46
                                        <li><label for="itemtype">Item type:</label>
46
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
47
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
47
                                        </li>
48
                                        </li>
48
                                        [% IF ( branchloop ) %]
49
                                        [% IF branchcode %]
49
                                            <li><label for="branch">Library:</label>
50
                                            <li><label for="branch">Library:</label>
50
                                                <select name="branchcode" id="branch">
51
                                                <select name="branchcode" id="branch">
51
                                                    [% FOREACH branchloo IN branchloop %]
52
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
52
                                                        [% IF ( branchloo.selected ) %]
53
                                                            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
54
                                                        [% ELSE %]
55
                                                            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
56
                                                        [% END %]
57
                                                    [% END %]
58
                                                </select>
53
                                                </select>
59
                                            </li>
54
                                            </li>
60
                                        [% END %]
55
                                        [% END %]
(-)a/members/memberentry.pl (-6 / +5 lines)
Lines 41-46 use C4::Branch; # GetBranches Link Here
41
use C4::Form::MessagingPreferences;
41
use C4::Form::MessagingPreferences;
42
use Koha::Borrower::Debarments;
42
use Koha::Borrower::Debarments;
43
use Koha::DateUtils;
43
use Koha::DateUtils;
44
use Koha::Libraries;
44
use Koha::Patron::Categories;
45
use Koha::Patron::Categories;
45
use Email::Valid;
46
use Email::Valid;
46
use Module::Load;
47
use Module::Load;
Lines 607-614 foreach (keys(%flags)) { Link Here
607
}
608
}
608
609
609
# get Branch Loop
610
# get Branch Loop
610
# in modify mod: userbranch value for GetBranchesLoop() comes from borrowers table
611
# in modify mod: userbranch value comes from borrowers table
611
# in add    mod: userbranch value come from branches table (ip correspondence)
612
# in add    mod: userbranch value comes from branches table (ip correspondence)
612
613
613
my $userbranch = '';
614
my $userbranch = '';
614
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
615
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
Lines 618-627 if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { Link Here
618
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category_type eq 'C' ) )) {
619
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category_type eq 'C' ) )) {
619
    $userbranch = $data{'branchcode'};
620
    $userbranch = $data{'branchcode'};
620
}
621
}
622
$template->param( userbranch => $userbranch );
621
623
622
my $branchloop = GetBranchesLoop( $userbranch );
624
if ( Koha::Libraries->search->count < 1 ){
623
624
if( !$branchloop ){
625
    $no_add = 1;
625
    $no_add = 1;
626
    $template->param(no_branches => 1);
626
    $template->param(no_branches => 1);
627
}
627
}
Lines 694-700 $template->param( Link Here
694
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
694
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
695
  "op$op"   => 1);
695
  "op$op"   => 1);
696
696
697
$template->param( branchloop => $branchloop ) if ( $branchloop );
698
$template->param(
697
$template->param(
699
  nodouble  => $nodouble,
698
  nodouble  => $nodouble,
700
  borrowernumber  => $borrowernumber, #register number
699
  borrowernumber  => $borrowernumber, #register number
(-)a/members/members-home.pl (-29 / +1 lines)
Lines 24-30 use C4::Auth; Link Here
24
use C4::Output;
24
use C4::Output;
25
use C4::Context;
25
use C4::Context;
26
use C4::Members;
26
use C4::Members;
27
use C4::Branch;
28
use Koha::Borrower::Modifications;
27
use Koha::Borrower::Modifications;
29
use Koha::Libraries;
28
use Koha::Libraries;
30
use Koha::List::Patron;
29
use Koha::List::Patron;
Lines 44-80 my ($template, $loggedinuser, $cookie) Link Here
44
                 debug => 1,
43
                 debug => 1,
45
                 });
44
                 });
46
45
47
my $branches = GetBranches;
48
my @branchloop;
49
if ( C4::Branch::onlymine ) {
50
    my $userenv = C4::Context->userenv;
51
    my $library = Koha::Libraries->find( $userenv->{'branch'} );
52
    push @branchloop, {
53
        value => $library->branchcode,
54
        branchcode => $library->branchcode,
55
        branchname => $library->branchname,
56
        selected => 1
57
    }
58
} else {
59
    foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) {
60
        my $selected = 0;
61
        $selected = 1 if $branch and $branch eq $_;
62
        push @branchloop, {
63
            value => $_,
64
            branchcode => $_,
65
            branchname => $branches->{$_}->{branchname},
66
            selected => $selected
67
        };
68
    }
69
}
70
71
my $no_add = 0;
46
my $no_add = 0;
72
if(scalar(@branchloop) < 1){
47
if( Koha::Libraries->search->count < 1){
73
    $no_add = 1;
48
    $no_add = 1;
74
    $template->param(no_branches => 1);
49
    $template->param(no_branches => 1);
75
} 
76
else {
77
    $template->param(branchloop=>\@branchloop);
78
}
50
}
79
51
80
my @categories = Koha::Patron::Categories->search_limited;
52
my @categories = Koha::Patron::Categories->search_limited;
(-)a/opac/opac-memberentry.pl (-2 lines)
Lines 27-33 use C4::Members; Link Here
27
use C4::Form::MessagingPreferences;
27
use C4::Form::MessagingPreferences;
28
use Koha::Borrowers;
28
use Koha::Borrowers;
29
use Koha::Borrower::Modifications;
29
use Koha::Borrower::Modifications;
30
use C4::Branch qw(GetBranchesLoop);
31
use C4::Scrubber;
30
use C4::Scrubber;
32
use Email::Valid;
31
use Email::Valid;
33
use Koha::DateUtils;
32
use Koha::DateUtils;
Lines 68-74 $template->param( Link Here
68
    hidden            => $hidden,
67
    hidden            => $hidden,
69
    mandatory         => $mandatory,
68
    mandatory         => $mandatory,
70
    member_titles     => GetTitles() || undef,
69
    member_titles     => GetTitles() || undef,
71
    branches          => GetBranchesLoop(),
72
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
70
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
73
);
71
);
74
72
(-)a/opac/opac-reserve.pl (-4 / +1 lines)
Lines 126-134 my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->us Link Here
126
($branches->{$branch}) or $branch = "";     # Confirm branch is real
126
($branches->{$branch}) or $branch = "";     # Confirm branch is real
127
$template->param( branch => $branch );
127
$template->param( branch => $branch );
128
128
129
# make branch selection options...
130
my $branchloop = GetBranchesLoop($branch);
131
132
# Is the person allowed to choose their branch
129
# Is the person allowed to choose their branch
133
my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
130
my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
134
131
Lines 392-398 foreach my $biblioNum (@biblionumbers) { Link Here
392
389
393
    my $record = GetMarcBiblio($biblioNum);
390
    my $record = GetMarcBiblio($biblioNum);
394
    # Init the bib item with the choices for branch pickup
391
    # Init the bib item with the choices for branch pickup
395
    my %biblioLoopIter = ( branchloop => $branchloop );
392
    my %biblioLoopIter;
396
393
397
    # Get relevant biblio data.
394
    # Get relevant biblio data.
398
    my $biblioData = $biblioDataHash{$biblioNum};
395
    my $biblioData = $biblioDataHash{$biblioNum};
(-)a/opac/opac-suggestions.pl (-4 / +1 lines)
Lines 22-28 use CGI qw ( -utf8 ); Link Here
22
use Encode qw( encode );
22
use Encode qw( encode );
23
use C4::Auth;    # get_template_and_user
23
use C4::Auth;    # get_template_and_user
24
use C4::Members;
24
use C4::Members;
25
use C4::Branch;
26
use C4::Koha;
25
use C4::Koha;
27
use C4::Output;
26
use C4::Output;
28
use C4::Suggestions;
27
use C4::Suggestions;
Lines 176-184 if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { Link Here
176
    }
175
    }
177
    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
176
    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
178
177
179
# make branch selection options...
178
    $template->param( branchcode => $branchcode );
180
    my $branchloop = GetBranchesLoop($branchcode);
181
    $template->param( branchloop => $branchloop );
182
}
179
}
183
180
184
$template->param(
181
$template->param(
(-)a/opac/opac-topissues.pl (-2 lines)
Lines 100-105 $template->param( Link Here
100
    results => \@results,
100
    results => \@results,
101
);
101
);
102
102
103
$template->param(branchloop => GetBranchesLoop($branch));
104
105
output_html_with_http_headers $input, $cookie, $template->output;
103
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/opac/opac-user.pl (-18 lines)
Lines 258-281 if ($show_barcode) { Link Here
258
}
258
}
259
$template->param( show_barcode => 1 ) if $show_barcode;
259
$template->param( show_barcode => 1 ) if $show_barcode;
260
260
261
# load the branches
262
my $branches = GetBranches();
263
my @branch_loop;
264
for my $branch_hash ( sort keys %{$branches} ) {
265
    my $selected;
266
    if ( C4::Context->preference('SearchMyLibraryFirst') ) {
267
        $selected =
268
          ( C4::Context->userenv
269
              && ( $branch_hash eq C4::Context->userenv->{branch} ) );
270
    }
271
    push @branch_loop,
272
      { value      => "branch: $branch_hash",
273
        branchname => $branches->{$branch_hash}->{'branchname'},
274
        selected   => $selected,
275
      };
276
}
277
$template->param( branchloop => \@branch_loop );
278
279
# now the reserved items....
261
# now the reserved items....
280
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
262
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
281
263
(-)a/reports/bor_issues_top.pl (-12 lines)
Lines 23-29 use CGI qw ( -utf8 ); Link Here
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Output;
24
use C4::Output;
25
use C4::Context;
25
use C4::Context;
26
use C4::Branch; # GetBranches
27
use C4::Koha;
26
use C4::Koha;
28
use C4::Circulation;
27
use C4::Circulation;
29
use C4::Members;
28
use C4::Members;
Lines 110-125 my @values; Link Here
110
# here each element returned by map is a hashref, get it?
109
# here each element returned by map is a hashref, get it?
111
my @mime  = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
110
my @mime  = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
112
my $delims = GetDelimiterChoices;
111
my $delims = GetDelimiterChoices;
113
my $branches = GetBranches;
114
my @branchloop;
115
foreach (sort keys %$branches) {
116
# 	my $selected = 1 if $thisbranch eq $branch;
117
	my %row = ( value => $_,
118
#				selected => $selected,
119
				branchname => $branches->{$_}->{branchname},
120
			);
121
	push @branchloop, \%row;
122
}
123
112
124
my $itemtypes = GetItemTypes;
113
my $itemtypes = GetItemTypes;
125
my @itemtypeloop;
114
my @itemtypeloop;
Lines 135-141 my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by = Link Here
135
$template->param(
124
$template->param(
136
	    mimeloop => \@mime,
125
	    mimeloop => \@mime,
137
	  CGIseplist => $delims,
126
	  CGIseplist => $delims,
138
	  branchloop => \@branchloop,
139
	itemtypeloop => \@itemtypeloop,
127
	itemtypeloop => \@itemtypeloop,
140
patron_categories => $patron_categories,
128
patron_categories => $patron_categories,
141
);
129
);
(-)a/reports/borrowers_stats.pl (-10 lines)
Lines 65-73 my $output = $input->param("output"); Link Here
65
my $basename = $input->param("basename");
65
my $basename = $input->param("basename");
66
our $sep     = $input->param("sep");
66
our $sep     = $input->param("sep");
67
$sep = "\t" if ($sep and $sep eq 'tabulation');
67
$sep = "\t" if ($sep and $sep eq 'tabulation');
68
my $selected_branch; # = $input->param("?");
69
70
our $branches = GetBranches;
71
68
72
my ($template, $borrowernumber, $cookie)
69
my ($template, $borrowernumber, $cookie)
73
	= get_template_and_user({template_name => $fullreportname,
70
	= get_template_and_user({template_name => $fullreportname,
Lines 121-133 if ($do_it) { Link Here
121
	my $req;
118
	my $req;
122
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
119
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
123
    $template->param( patron_categories => $patron_categories );
120
    $template->param( patron_categories => $patron_categories );
124
	my @branchloop;
125
	foreach (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
126
		my $line = {branchcode => $_, branchname => $branches->{$_}->{branchname} || 'UNKNOWN'};
127
		$line->{selected} = 'selected' if ($selected_branch and $selected_branch eq $_);
128
		push @branchloop, $line;
129
	}
130
	$template->param(BRANCH_LOOP => \@branchloop);
131
 	$req = $dbh->prepare("SELECT DISTINCTROW zipcode FROM borrowers WHERE zipcode IS NOT NULL AND zipcode <> '' ORDER BY zipcode");
121
 	$req = $dbh->prepare("SELECT DISTINCTROW zipcode FROM borrowers WHERE zipcode IS NOT NULL AND zipcode <> '' ORDER BY zipcode");
132
 	$req->execute;
122
 	$req->execute;
133
	$template->param(   ZIP_LOOP => $req->fetchall_arrayref({}));
123
	$template->param(   ZIP_LOOP => $req->fetchall_arrayref({}));
(-)a/reports/cat_issues_top.pl (-2 lines)
Lines 23-29 use strict; Link Here
23
use C4::Auth;
23
use C4::Auth;
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use C4::Context;
25
use C4::Context;
26
use C4::Branch; # GetBranches
27
use C4::Output;
26
use C4::Output;
28
use C4::Koha;
27
use C4::Koha;
29
use C4::Circulation;
28
use C4::Circulation;
Lines 159-165 if ($do_it) { Link Here
159
    $template->param(
158
    $template->param(
160
                    CGIextChoice => $CGIextChoice,
159
                    CGIextChoice => $CGIextChoice,
161
                    CGIsepChoice => $CGIsepChoice,
160
                    CGIsepChoice => $CGIsepChoice,
162
                    branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
163
                    itemtypeloop =>\@itemtypeloop,
161
                    itemtypeloop =>\@itemtypeloop,
164
                    ccodeloop =>\@ccodeloop,
162
                    ccodeloop =>\@ccodeloop,
165
                    shelvinglocloop =>\@shelvinglocloop,
163
                    shelvinglocloop =>\@shelvinglocloop,
(-)a/reports/catalogue_out.pl (-2 lines)
Lines 24-30 use CGI qw ( -utf8 ); Link Here
24
use C4::Auth;
24
use C4::Auth;
25
use C4::Context;
25
use C4::Context;
26
use C4::Debug;
26
use C4::Debug;
27
use C4::Branch;    # GetBranchesLoop
28
use C4::Output;
27
use C4::Output;
29
use C4::Koha;      # GetItemTypes
28
use C4::Koha;      # GetItemTypes
30
# use Date::Manip;  # TODO: add not borrowed since date X criteria
29
# use Date::Manip;  # TODO: add not borrowed since date X criteria
Lines 78-84 foreach ( Link Here
78
77
79
$template->param(
78
$template->param(
80
    itemtypeloop => \@itemtypeloop,
79
    itemtypeloop => \@itemtypeloop,
81
    branchloop   => GetBranchesLoop(),
82
);
80
);
83
output_html_with_http_headers $input, $cookie, $template->output;
81
output_html_with_http_headers $input, $cookie, $template->output;
84
82
(-)a/reports/catalogue_stats.pl (-2 lines)
Lines 23-29 use strict; Link Here
23
use C4::Auth;
23
use C4::Auth;
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use C4::Context;
25
use C4::Context;
26
use C4::Branch; # GetBranches
27
use C4::Output;
26
use C4::Output;
28
use C4::Koha;
27
use C4::Koha;
29
use C4::Reports;
28
use C4::Reports;
Lines 156-162 if ($do_it) { Link Here
156
155
157
    $template->param(
156
    $template->param(
158
        itemtypes    => $itemtypes,
157
        itemtypes    => $itemtypes,
159
        CGIBranch    => GetBranchesLoop( C4::Context->userenv->{'branch'} ),
160
        locationloop => \@locations,
158
        locationloop => \@locations,
161
        authvals     => \@authvals,
159
        authvals     => \@authvals,
162
        CGIextChoice => \@mime,
160
        CGIextChoice => \@mime,
(-)a/reports/guided_reports.pl (-5 / +5 lines)
Lines 28-38 use C4::Reports::Guided; Link Here
28
use C4::Auth qw/:DEFAULT get_session/;
28
use C4::Auth qw/:DEFAULT get_session/;
29
use C4::Output;
29
use C4::Output;
30
use C4::Debug;
30
use C4::Debug;
31
use C4::Branch; # XXX subfield_is_koha_internal_p
32
use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/;
31
use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/;
33
use C4::Context;
32
use C4::Context;
34
use C4::Log;
33
use C4::Log;
35
use Koha::DateUtils qw/dt_from_string output_pref/;
34
use Koha::DateUtils qw/dt_from_string output_pref/;
35
use Koha::Libraries;
36
use Koha::Patron::Categories;
36
use Koha::Patron::Categories;
37
37
38
=head1 NAME
38
=head1 NAME
Lines 661-670 elsif ($phase eq 'Run this report'){ Link Here
661
                    my %authorised_lib;
661
                    my %authorised_lib;
662
                    # builds list, depending on authorised value...
662
                    # builds list, depending on authorised value...
663
                    if ( $authorised_value eq "branches" ) {
663
                    if ( $authorised_value eq "branches" ) {
664
                        my $branches = GetBranchesLoop();
664
                        my $libraries = Koha::Libraries->search;
665
                        foreach my $thisbranch (@$branches) {
665
                        while ( my $library = $libraries->next ) {
666
                            push @authorised_values, $thisbranch->{value};
666
                            push @authorised_values, $library->branchcode;
667
                            $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
667
                            $authorised_lib{$library->branchcode} = $library->branchname;
668
                        }
668
                        }
669
                    }
669
                    }
670
                    elsif ( $authorised_value eq "itemtypes" ) {
670
                    elsif ( $authorised_value eq "itemtypes" ) {
(-)a/reports/issues_avg_stats.pl (-1 lines)
Lines 154-160 if ($do_it) { Link Here
154
    $template->param(
154
    $template->param(
155
                    patron_categories => $patron_categories,
155
                    patron_categories => $patron_categories,
156
                    itemtypes    => $itemtypes,
156
                    itemtypes    => $itemtypes,
157
                    branchloop   => GetBranchesLoop(),
158
                    hassort1     => $hassort1,
157
                    hassort1     => $hassort1,
159
                    hassort2     => $hassort2,
158
                    hassort2     => $hassort2,
160
                    HlghtSort2   => $hglghtsort2,
159
                    HlghtSort2   => $hglghtsort2,
(-)a/reports/issues_by_borrower_category.plugin (-2 lines)
Lines 66-73 the hashes are then translated to hash / arrays to be returned to manager.pl & s Link Here
66
sub set_parameters {
66
sub set_parameters {
67
    my ($template) = @_;
67
    my ($template) = @_;
68
68
69
    $template->param( branchloop => GetBranchesLoop() );
70
71
    my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
69
    my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
72
    $template->param( patron_categories => $patron_categories );
70
    $template->param( patron_categories => $patron_categories );
73
    return $template;
71
    return $template;
(-)a/reports/issues_stats.pl (-2 lines)
Lines 26-32 use Date::Manip; Link Here
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Debug;
27
use C4::Debug;
28
use C4::Context;
28
use C4::Context;
29
use C4::Branch; # GetBranches
30
use C4::Koha;
29
use C4::Koha;
31
use C4::Output;
30
use C4::Output;
32
use C4::Circulation;
31
use C4::Circulation;
Lines 156-162 $template->param( Link Here
156
	itemtypeloop => \@itemtypeloop,
155
	itemtypeloop => \@itemtypeloop,
157
	locationloop => \@locations,
156
	locationloop => \@locations,
158
	   ccodeloop => \@ccodes,
157
	   ccodeloop => \@ccodes,
159
	  branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
160
	hassort1=> $hassort1,
158
	hassort1=> $hassort1,
161
	hassort2=> $hassort2,
159
	hassort2=> $hassort2,
162
	Bsort1 => $Bsort1,
160
	Bsort1 => $Bsort1,
(-)a/reports/itemslost.pl (-6 / +1 lines)
Lines 34-40 use C4::Output; Link Here
34
use C4::Biblio;
34
use C4::Biblio;
35
use C4::Items;
35
use C4::Items;
36
use C4::Koha;                  # GetItemTypes
36
use C4::Koha;                  # GetItemTypes
37
use C4::Branch; # GetBranches
38
use Koha::DateUtils;
37
use Koha::DateUtils;
39
38
40
my $query = new CGI;
39
my $query = new CGI;
Lines 80-89 if ( $get_items ) { Link Here
80
                 );
79
                 );
81
}
80
}
82
81
83
# getting all branches.
84
#my $branches = GetBranches;
85
#my $branch   = C4::Context->userenv->{"branchname"};
86
87
# getting all itemtypes
82
# getting all itemtypes
88
my $itemtypes = &GetItemTypes();
83
my $itemtypes = &GetItemTypes();
89
my @itemtypesloop;
84
my @itemtypesloop;
Lines 98-104 foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp Link Here
98
# get lost statuses
93
# get lost statuses
99
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
94
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
100
95
101
$template->param( branchloop     => GetBranchesLoop(C4::Context->userenv->{'branch'}),
96
$template->param(
102
                  itemtypeloop   => \@itemtypesloop,
97
                  itemtypeloop   => \@itemtypesloop,
103
                  loststatusloop => $lost_status_loop,
98
                  loststatusloop => $lost_status_loop,
104
);
99
);
(-)a/reports/itemtypes.plugin (-6 lines)
Lines 25-42 use C4::Context; Link Here
25
use C4::Search;
25
use C4::Search;
26
use C4::Output;
26
use C4::Output;
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Branch; # GetBranches
29
=head1
28
=head1
30
29
31
=cut
30
=cut
32
31
33
sub set_parameters {
32
sub set_parameters {
34
    my ($template) = @_;
33
    my ($template) = @_;
35
    my $userbranch = '';
36
    if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
37
        $userbranch = C4::Context->userenv->{'branch'};
38
    }
39
    $template->param( branchloop => GetBranchesLoop($userbranch) );
40
    return $template;
34
    return $template;
41
}
35
}
42
36
(-)a/reports/reserves_stats.pl (-2 lines)
Lines 26-32 use CGI qw ( -utf8 ); Link Here
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Debug;
27
use C4::Debug;
28
use C4::Context;
28
use C4::Context;
29
use C4::Branch; # GetBranches
30
use C4::Koha;
29
use C4::Koha;
31
use C4::Output;
30
use C4::Output;
32
use C4::Reports;
31
use C4::Reports;
Lines 164-170 $template->param( Link Here
164
	itemtypeloop => \@itemtypeloop,
163
	itemtypeloop => \@itemtypeloop,
165
	locationloop => \@locations,
164
	locationloop => \@locations,
166
	   ccodeloop => \@ccodes,
165
	   ccodeloop => \@ccodes,
167
	  branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
168
	hassort1=> $hassort1,
166
	hassort1=> $hassort1,
169
	hassort2=> $hassort2,
167
	hassort2=> $hassort2,
170
	Bsort1 => $Bsort1,
168
	Bsort1 => $Bsort1,
(-)a/reports/serials_stats.pl (-2 / +1 lines)
Lines 22-28 use warnings; Link Here
22
use C4::Auth;
22
use C4::Auth;
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use C4::Context;
24
use C4::Context;
25
use C4::Branch; # GetBranches
26
use C4::Output;
25
use C4::Output;
27
use C4::Koha;
26
use C4::Koha;
28
use C4::Reports;
27
use C4::Reports;
Lines 153-159 if($do_it){ Link Here
153
		CGIextChoice => $CGIextChoice,
152
		CGIextChoice => $CGIextChoice,
154
		CGIsepChoice => $CGIsepChoice,
153
		CGIsepChoice => $CGIsepChoice,
155
        booksellers  => \@booksellers,
154
        booksellers  => \@booksellers,
156
        branches     => GetBranchesLoop(C4::Context->userenv->{'branch'}));
155
    );
157
}
156
}
158
157
159
output_html_with_http_headers $input, $cookie, $template->output;
158
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/reserve/request.pl (-14 lines)
Lines 68-79 my $showallitems = $input->param('showallitems'); Link Here
68
my $branches = GetBranches();
68
my $branches = GetBranches();
69
my $itemtypes = GetItemTypes();
69
my $itemtypes = GetItemTypes();
70
70
71
my $userbranch = '';
72
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
73
    $userbranch = C4::Context->userenv->{'branch'};
74
}
75
76
77
# Select borrowers infos
71
# Select borrowers infos
78
my $findborrower = $input->param('findborrower');
72
my $findborrower = $input->param('findborrower');
79
$findborrower = '' unless defined $findborrower;
73
$findborrower = '' unless defined $findborrower;
Lines 564-576 foreach my $biblionumber (@biblionumbers) { Link Here
564
        $reserve{'suspend_until'}  = $res->suspend_until();
558
        $reserve{'suspend_until'}  = $res->suspend_until();
565
        $reserve{'reserve_id'}     = $res->reserve_id();
559
        $reserve{'reserve_id'}     = $res->reserve_id();
566
560
567
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
568
            $reserve{'branchloop'} = [ Koha::Libraries->find( $res->branchcode() ) ];
569
        }
570
        else {
571
            $reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() );
572
        }
573
574
        push( @reserveloop, \%reserve );
561
        push( @reserveloop, \%reserve );
575
    }
562
    }
576
563
Lines 578-584 foreach my $biblionumber (@biblionumbers) { Link Here
578
    my $time = time();
565
    my $time = time();
579
566
580
    $template->param(
567
    $template->param(
581
                     branchloop  => GetBranchesLoop($userbranch),
582
                     time        => $time,
568
                     time        => $time,
583
                     fixedRank   => $fixedRank,
569
                     fixedRank   => $fixedRank,
584
                    );
570
                    );
(-)a/serials/checkexpiration.pl (-4 / +4 lines)
Lines 47-53 use warnings; Link Here
47
use CGI qw ( -utf8 );
47
use CGI qw ( -utf8 );
48
use C4::Auth;
48
use C4::Auth;
49
use C4::Serials; # GetExpirationDate
49
use C4::Serials; # GetExpirationDate
50
use C4::Branch;
51
use C4::Output;
50
use C4::Output;
52
use C4::Context;
51
use C4::Context;
53
use Koha::DateUtils;
52
use Koha::DateUtils;
Lines 113-130 if ($date) { Link Here
113
    );
112
    );
114
}
113
}
115
114
116
my $branches_loop;
115
my $can_change_library;;
117
if (  !C4::Context->preference("IndependentBranches")
116
if (  !C4::Context->preference("IndependentBranches")
118
    or C4::Context->IsSuperLibrarian()
117
    or C4::Context->IsSuperLibrarian()
119
    or ( ref $flags->{serials}  and $flags->{serials}->{superserials} )
118
    or ( ref $flags->{serials}  and $flags->{serials}->{superserials} )
120
    or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
119
    or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
121
{
120
{
122
    $branches_loop = C4::Branch::GetBranchesLoop( $branch );
121
    $can_change_library = 1;
123
}
122
}
124
123
125
$template->param (
124
$template->param (
126
    (uc(C4::Context->preference("marcflavour"))) => 1,
125
    (uc(C4::Context->preference("marcflavour"))) => 1,
127
    branches_loop   => $branches_loop,
126
    can_change_library => $can_change_library,
127
    branch => $branch,
128
);
128
);
129
129
130
output_html_with_http_headers $query, $cookie, $template->output;
130
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/claims.pl (-4 lines)
Lines 26-32 use C4::Acquisition; Link Here
26
use C4::Output;
26
use C4::Output;
27
use C4::Context;
27
use C4::Context;
28
use C4::Letters;
28
use C4::Letters;
29
use C4::Branch;    # GetBranches GetBranchesLoop
30
use C4::Koha qw( GetAuthorisedValues );
29
use C4::Koha qw( GetAuthorisedValues );
31
use Koha::AdditionalField;
30
use Koha::AdditionalField;
32
use C4::Csv qw( GetCsvProfiles );
31
use C4::Csv qw( GetCsvProfiles );
Lines 65-72 for my $field ( @$additional_fields ) { Link Here
65
    }
64
    }
66
}
65
}
67
66
68
my $branchloop = GetBranchesLoop();
69
70
my @serialnums=$input->param('serialid');
67
my @serialnums=$input->param('serialid');
71
if (@serialnums) { # i.e. they have been flagged to generate claims
68
if (@serialnums) { # i.e. they have been flagged to generate claims
72
    my $err;
69
    my $err;
Lines 105-111 $template->param( Link Here
105
        missingissues => \@missingissues,
102
        missingissues => \@missingissues,
106
        supplierid => $supplierid,
103
        supplierid => $supplierid,
107
        claimletter => $claimletter,
104
        claimletter => $claimletter,
108
        branchloop   => $branchloop,
109
        additional_fields_for_subscription => $additional_fields,
105
        additional_fields_for_subscription => $additional_fields,
110
        csv_profiles => C4::Csv::GetCsvProfiles( "sql" ),
106
        csv_profiles => C4::Csv::GetCsvProfiles( "sql" ),
111
        letters => $letters,
107
        letters => $letters,
(-)a/t/db_dependent/Branch.t (-5 lines)
Lines 38-44 can_ok( Link Here
38
    'C4::Branch', qw(
38
    'C4::Branch', qw(
39
      GetBranch
39
      GetBranch
40
      GetBranches
40
      GetBranches
41
      GetBranchesLoop
42
      mybranch
41
      mybranch
43
      )
42
      )
44
);
43
);
Lines 198-205 is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two categories adde Link Here
198
#TODO later: test mybranchine and onlymine
197
#TODO later: test mybranchine and onlymine
199
# Actually we cannot mock C4::Context->userenv in unit tests
198
# Actually we cannot mock C4::Context->userenv in unit tests
200
199
201
#Test GetBranchesLoop
202
my $loop = GetBranchesLoop;
203
is( scalar(@$loop), Koha::Libraries->search->count, 'There is the right number of branches' );
204
205
$schema->storage->txn_rollback;
200
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Holds/LocalHoldsPriority.t (-3 lines)
Lines 63-71 foreach ( 1 .. $borrowers_count ) { Link Here
63
63
64
my $biblionumber = $bibnum;
64
my $biblionumber = $bibnum;
65
65
66
my @branches = GetBranchesLoop();
67
my $branch   = $branches[0][0]{value};
68
69
# Create five item level holds
66
# Create five item level holds
70
my $i = 1;
67
my $i = 1;
71
foreach my $borrowernumber (@borrowernumbers) {
68
foreach my $borrowernumber (@borrowernumbers) {
(-)a/t/db_dependent/Holds/RevertWaitingStatus.t (-3 / +4 lines)
Lines 13-18 use C4::Items; Link Here
13
use C4::Members;
13
use C4::Members;
14
use C4::Reserves;
14
use C4::Reserves;
15
15
16
use Koha::Libraries;
17
16
use t::lib::TestBuilder;
18
use t::lib::TestBuilder;
17
19
18
my $schema = Koha::Database->schema;
20
my $schema = Koha::Database->schema;
Lines 61-73 foreach my $i ( 1 .. $borrowers_count ) { Link Here
61
63
62
my $biblionumber = $bibnum;
64
my $biblionumber = $bibnum;
63
65
64
my @branches = GetBranchesLoop();
66
my $branchcode = Koha::Libraries->search->next->branchcode;
65
my $branch   = $branches[0][0]{value};
66
67
67
# Create five item level holds
68
# Create five item level holds
68
foreach my $borrowernumber (@borrowernumbers) {
69
foreach my $borrowernumber (@borrowernumbers) {
69
    AddReserve(
70
    AddReserve(
70
        $branch,
71
        $branchcode,
71
        $borrowernumber,
72
        $borrowernumber,
72
        $biblionumber,
73
        $biblionumber,
73
        my $bibitems   = q{},
74
        my $bibitems   = q{},
(-)a/t/db_dependent/Reserves.t (-3 / +2 lines)
Lines 111-120 my $notes = ''; Link Here
111
my $checkitem      = undef;
111
my $checkitem      = undef;
112
my $found          = undef;
112
my $found          = undef;
113
113
114
my @branches = GetBranchesLoop();
114
my $branchcode = Koha::Libraries->search->next->branchcode;
115
my $branch = $branches[0][0]{value};
116
115
117
AddReserve($branch,    $borrowernumber, $biblionumber,
116
AddReserve($branchcode,    $borrowernumber, $biblionumber,
118
        $bibitems,  $priority, $resdate, $expdate, $notes,
117
        $bibitems,  $priority, $resdate, $expdate, $notes,
119
        $title,      $checkitem, $found);
118
        $title,      $checkitem, $found);
120
119
(-)a/tools/batchMod.pl (-9 / +9 lines)
Lines 289-299 $query .= qq{ AND ( branchcode = ? OR branchcode IS NULL ) } if $branch_limit; Link Here
289
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
289
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
290
my $authorised_values_sth = $dbh->prepare( $query );
290
my $authorised_values_sth = $dbh->prepare( $query );
291
291
292
my $branches = GetBranchesLoop();  # build once ahead of time, instead of multiple times later.
292
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
293
293
294
# Adding a default choice, in case the user does not want to modify the branch
294
# Adding a default choice, in case the user does not want to modify the branch
295
my $nochange_branch = { branchname => '', value => '', selected => 1 };
295
my $nochange_branch = { branchname => '', value => '', selected => 1 };
296
unshift (@$branches, $nochange_branch);
296
unshift (@$libraries, $nochange_branch);
297
297
298
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
298
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
299
299
Lines 347-360 foreach my $tag (sort keys %{$tagslib}) { Link Here
347
	my @authorised_values;
347
	my @authorised_values;
348
	my %authorised_lib;
348
	my %authorised_lib;
349
	# builds list, depending on authorised value...
349
	# builds list, depending on authorised value...
350
  
350
351
	if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
351
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
352
	    foreach my $thisbranch (@$branches) {
352
        foreach my $library (@$libraries) {
353
		push @authorised_values, $thisbranch->{value};
353
            push @authorised_values, $library->{branchcode};
354
		$authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
354
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
355
	    }
355
        }
356
        $value = "";
356
        $value = "";
357
	}
357
    }
358
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
358
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
359
        push @authorised_values, "";
359
        push @authorised_values, "";
360
        my $itemtypes = GetItemTypes( style => 'array' );
360
        my $itemtypes = GetItemTypes( style => 'array' );
(-)a/tools/holidays.pl (-21 lines)
Lines 51-76 my $keydate = output_pref( { dt => $calendarinput_dt, dateonly => 1, dateformat Link Here
51
$keydate =~ s/-/\//g;
51
$keydate =~ s/-/\//g;
52
52
53
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
53
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
54
# Set all the branches.
55
my $onlymine =
56
  (      C4::Context->preference('IndependentBranches')
57
      && C4::Context->userenv
58
      && !C4::Context->IsSuperLibrarian()
59
      && C4::Context->userenv->{branch} ? 1 : 0 );
60
if ( $onlymine ) { 
61
    $branch = C4::Context->userenv->{'branch'};
62
}
63
my $branches   = GetBranches($onlymine);
64
my @branchloop;
65
for my $thisbranch (
66
    sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
67
    keys %{$branches} ) {
68
    push @branchloop,
69
      { value      => $thisbranch,
70
        selected   => $thisbranch eq $branch,
71
        branchname => $branches->{$thisbranch}->{'branchname'},
72
      };
73
}
74
54
75
# branches calculated - put branch codes in a single string so they can be passed in a form
55
# branches calculated - put branch codes in a single string so they can be passed in a form
76
my $branchcodes = join '|', keys %{$branches};
56
my $branchcodes = join '|', keys %{$branches};
Lines 145-151 foreach my $yearMonthDay (keys %$single_holidays) { Link Here
145
125
146
$template->param(
126
$template->param(
147
    WEEK_DAYS_LOOP           => \@week_days,
127
    WEEK_DAYS_LOOP           => \@week_days,
148
    branchloop               => \@branchloop,
149
    HOLIDAYS_LOOP            => \@holidays,
128
    HOLIDAYS_LOOP            => \@holidays,
150
    EXCEPTION_HOLIDAYS_LOOP  => \@exception_holidays,
129
    EXCEPTION_HOLIDAYS_LOOP  => \@exception_holidays,
151
    DAY_MONTH_HOLIDAYS_LOOP  => \@day_month_holidays,
130
    DAY_MONTH_HOLIDAYS_LOOP  => \@day_month_holidays,
(-)a/tools/import_borrowers.pl (-4 lines)
Lines 40-46 use warnings; Link Here
40
use C4::Auth;
40
use C4::Auth;
41
use C4::Output;
41
use C4::Output;
42
use C4::Context;
42
use C4::Context;
43
use C4::Branch qw/GetBranchesLoop/;
44
use C4::Members;
43
use C4::Members;
45
use C4::Members::Attributes qw(:all);
44
use C4::Members::Attributes qw(:all);
46
use C4::Members::AttributeTypes;
45
use C4::Members::AttributeTypes;
Lines 82-90 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ Link Here
82
        debug           => 1,
81
        debug           => 1,
83
});
82
});
84
83
85
# get the branches and pass them to the template
86
my $branches = GetBranchesLoop();
87
$template->param( branches => $branches ) if ( $branches );
88
# get the patron categories and pass them to the template
84
# get the patron categories and pass them to the template
89
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
85
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
90
$template->param( categories => \@patron_categories );
86
$template->param( categories => \@patron_categories );
(-)a/tools/inventory.pl (-11 lines)
Lines 64-79 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
64
    }
64
    }
65
);
65
);
66
66
67
68
my $branches = GetBranches();
69
my @branch_loop;
70
for my $branch_hash (keys %$branches) {
71
    push @branch_loop, {value => "$branch_hash",
72
                       branchname => $branches->{$branch_hash}->{'branchname'},
73
                       selected => ($branch_hash eq $branchcode?1:0)};
74
}
75
76
@branch_loop = sort {$a->{branchname} cmp $b->{branchname}} @branch_loop;
77
my @authorised_value_list;
67
my @authorised_value_list;
78
my $authorisedvalue_categories = '';
68
my $authorisedvalue_categories = '';
79
69
Lines 128-134 for my $authvfield (@$statuses) { Link Here
128
}
118
}
129
$statussth =~ s, and $,,g;
119
$statussth =~ s, and $,,g;
130
$template->param(
120
$template->param(
131
    branchloop               => \@branch_loop,
132
    authorised_values        => \@authorised_value_list,
121
    authorised_values        => \@authorised_value_list,
133
    today                    => dt_from_string,
122
    today                    => dt_from_string,
134
    minlocation              => $minlocation,
123
    minlocation              => $minlocation,
(-)a/tools/letter.pl (-19 / +1 lines)
Lines 104-110 if ($op eq 'copy_form') { Link Here
104
    $template->param(
104
    $template->param(
105
        oldbranchcode => $oldbranchcode,
105
        oldbranchcode => $oldbranchcode,
106
        branchcode => $branchcode,
106
        branchcode => $branchcode,
107
        branchloop => _branchloop($branchcode),
108
        copying => 1,
107
        copying => 1,
109
        modify => 0,
108
        modify => 0,
110
    );
109
    );
Lines 240-246 sub add_form { Link Here
240
239
241
    $template->param(
240
    $template->param(
242
        module     => $module,
241
        module     => $module,
243
        branchloop => _branchloop($branchcode),
244
        SQLfieldnames => $field_selection,
242
        SQLfieldnames => $field_selection,
245
        branchcode => $branchcode,
243
        branchcode => $branchcode,
246
    );
244
    );
Lines 379-404 sub default_display { Link Here
379
377
380
    $template->param(
378
    $template->param(
381
        letter => $loop_data,
379
        letter => $loop_data,
382
        branchloop => _branchloop($branchcode),
380
        branchcode => $branchcode,
383
    );
381
    );
384
}
382
}
385
383
386
sub _branchloop {
387
    my ($branchcode) = @_;
388
389
    my $branches = GetBranches();
390
    my @branchloop;
391
    for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
392
        push @branchloop, {
393
            value      => $thisbranch,
394
            selected   => $branchcode && $thisbranch eq $branchcode,
395
            branchname => $branches->{$thisbranch}->{'branchname'},
396
        };
397
    }
398
399
    return \@branchloop;
400
}
401
402
sub add_fields {
384
sub add_fields {
403
    my @tables = @_;
385
    my @tables = @_;
404
    my @fields = ();
386
    my @fields = ();
(-)a/tools/modborrowers.pl (-2 / +2 lines)
Lines 28-34 Link Here
28
use Modern::Perl;
28
use Modern::Perl;
29
use CGI qw ( -utf8 );
29
use CGI qw ( -utf8 );
30
use C4::Auth;
30
use C4::Auth;
31
use C4::Branch;
32
use C4::Koha;
31
use C4::Koha;
33
use C4::Members;
32
use C4::Members;
34
use C4::Members::Attributes;
33
use C4::Members::Attributes;
Lines 37-42 use C4::Output; Link Here
37
use List::MoreUtils qw /any uniq/;
36
use List::MoreUtils qw /any uniq/;
38
use Koha::DateUtils qw( dt_from_string );
37
use Koha::DateUtils qw( dt_from_string );
39
use Koha::List::Patron;
38
use Koha::List::Patron;
39
use Koha::Libraries;
40
use Koha::Patron::Categories;
40
use Koha::Patron::Categories;
41
41
42
my $input = new CGI;
42
my $input = new CGI;
Lines 145-151 if ( $op eq 'show' ) { Link Here
145
        if @notfoundcardnumbers;
145
        if @notfoundcardnumbers;
146
146
147
    # Construct drop-down list values
147
    # Construct drop-down list values
148
    my $branches = GetBranchesLoop;
148
    my $branches = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
149
    my @branches_option;
149
    my @branches_option;
150
    push @branches_option, { value => $_->{value}, lib => $_->{branchname} } for @$branches;
150
    push @branches_option, { value => $_->{value}, lib => $_->{branchname} } for @$branches;
151
    unshift @branches_option, { value => "", lib => "" };
151
    unshift @branches_option, { value => "", lib => "" };
(-)a/tools/overduerules.pl (-4 lines)
Lines 24-30 use C4::Context; Link Here
24
use C4::Output;
24
use C4::Output;
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Branch;
28
use C4::Letters;
27
use C4::Letters;
29
use C4::Members;
28
use C4::Members;
30
use C4::Overdues;
29
use C4::Overdues;
Lines 210-216 if ($op eq 'save') { Link Here
210
        $input_saved = 1;
209
        $input_saved = 1;
211
    }
210
    }
212
}
211
}
213
my $branchloop = GetBranchesLoop($branch);
214
212
215
my $letters = C4::Letters::GetLettersAvailableForALibrary(
213
my $letters = C4::Letters::GetLettersAvailableForALibrary(
216
    {
214
    {
Lines 310-316 my @tabs = ( Link Here
310
308
311
$template->param(
309
$template->param(
312
    table => ( @first or @second or @third ? 1 : 0 ),
310
    table => ( @first or @second or @third ? 1 : 0 ),
313
    branchloop => $branchloop,
314
    branch => $branch,
311
    branch => $branch,
315
    tabs => \@tabs,
312
    tabs => \@tabs,
316
    message_transport_types => $message_transport_types,
313
    message_transport_types => $message_transport_types,
317
- 

Return to bug 15758