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::Caches;
34
use Koha::Caches;
Lines 514-520 sub get_template_and_user { Link Here
514
        $template->param(
513
        $template->param(
515
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
514
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
516
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
515
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
517
            BranchesLoop                          => GetBranchesLoop($opac_name),
518
            BranchCategoriesLoop                  => $library_categories,
516
            BranchCategoriesLoop                  => $library_categories,
519
            opac_name                             => $opac_name,
517
            opac_name                             => $opac_name,
520
            LibraryName                           => "" . C4::Context->preference("LibraryName"),
518
            LibraryName                           => "" . C4::Context->preference("LibraryName"),
Lines 1080-1086 sub checkauth { Link Here
1080
                        $branchcode = $query->param('branch');
1078
                        $branchcode = $query->param('branch');
1081
                        $branchname = Koha::Libraries->find($branchcode)->branchname;
1079
                        $branchname = Koha::Libraries->find($branchcode)->branchname;
1082
                    }
1080
                    }
1083
                    my $branches = GetBranches();
1081
                    my $branches = C4::Branch::GetBranches();
1084
                    if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
1082
                    if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
1085
1083
1086
                        # we have to check they are coming from the right ip range
1084
                        # we have to check they are coming from the right ip range
Lines 1091-1097 sub checkauth { Link Here
1091
                        }
1089
                        }
1092
                    }
1090
                    }
1093
1091
1094
                    my @branchesloop;
1095
                    foreach my $br ( keys %$branches ) {
1092
                    foreach my $br ( keys %$branches ) {
1096
1093
1097
                        #     now we work with the treatment of ip
1094
                        #     now we work with the treatment of ip
Lines 1208-1214 sub checkauth { Link Here
1208
    my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
1205
    my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
1209
    my $template = C4::Templates::gettemplate( $template_name, $type, $query );
1206
    my $template = C4::Templates::gettemplate( $template_name, $type, $query );
1210
    $template->param(
1207
    $template->param(
1211
        branchloop                            => GetBranchesLoop(),
1212
        OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
1208
        OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
1213
        opaclayoutstylesheet                  => C4::Context->preference("opaclayoutstylesheet"),
1209
        opaclayoutstylesheet                  => C4::Context->preference("opaclayoutstylesheet"),
1214
        login                                 => 1,
1210
        login                                 => 1,
Lines 1532-1539 sub check_api_auth { Link Here
1532
                    $branchcode = $query->param('branch');
1528
                    $branchcode = $query->param('branch');
1533
                    $branchname = Koha::Libraries->find($branchcode)->branchname;
1529
                    $branchname = Koha::Libraries->find($branchcode)->branchname;
1534
                }
1530
                }
1535
                my $branches = GetBranches();
1531
                my $branches = C4::Branch::GetBranches();
1536
                my @branchesloop;
1537
                foreach my $br ( keys %$branches ) {
1532
                foreach my $br ( keys %$branches ) {
1538
1533
1539
                    #     now we work with the treatment of ip
1534
                    #     now we work with the treatment of ip
(-)a/C4/Branch.pm (-19 lines)
Lines 29-35 BEGIN { Link Here
29
	@EXPORT = qw(
29
	@EXPORT = qw(
30
		&GetBranch
30
		&GetBranch
31
		&GetBranches
31
		&GetBranches
32
		&GetBranchesLoop
33
		&mybranch
32
		&mybranch
34
	);
33
	);
35
    @EXPORT_OK = qw( &onlymine &mybranch );
34
    @EXPORT_OK = qw( &onlymine &mybranch );
Lines 83-90 Create a branch selector with the following code. Link Here
83
            [% END %]
82
            [% END %]
84
    </select>
83
    </select>
85
84
86
=head4 Note that you often will want to just use GetBranchesLoop, for exactly the example above.
87
88
=cut
85
=cut
89
86
90
sub GetBranches {
87
sub GetBranches {
Lines 135-156 sub mybranch { Link Here
135
    return C4::Context->userenv->{branch} || '';
132
    return C4::Context->userenv->{branch} || '';
136
}
133
}
137
134
138
sub GetBranchesLoop {  # since this is what most pages want anyway
139
    my $branch   = @_ ? shift : mybranch();     # optional first argument is branchcode of "my branch", if preselection is wanted.
140
    my $onlymine = @_ ? shift : onlymine();
141
    my $branches = GetBranches($onlymine);
142
    my @loop;
143
    foreach my $branchcode ( sort { uc($branches->{$a}->{branchname}) cmp uc($branches->{$b}->{branchname}) } keys %$branches ) {
144
        push @loop, {
145
            value      => $branchcode,
146
            branchcode => $branchcode,
147
            selected   => ($branchcode eq $branch) ? 1 : 0,
148
            branchname => $branches->{$branchcode}->{branchname},
149
        };
150
    }
151
    return \@loop;
152
}
153
154
=head2 GetBranch
135
=head2 GetBranch
155
136
156
$branch = GetBranch( $query, $branches );
137
$branch = GetBranch( $query, $branches );
(-)a/C4/Search.pm (+3 lines)
Lines 337-342 sub getRecords { Link Here
337
    my @results;
337
    my @results;
338
    my $results_hashref = ();
338
    my $results_hashref = ();
339
339
340
    # TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter
341
    $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search };
342
340
    # Initialize variables for the faceted results objects
343
    # Initialize variables for the faceted results objects
341
    my $facets_counter = {};
344
    my $facets_counter = {};
342
    my $facets_info    = {};
345
    my $facets_info    = {};
(-)a/Koha/Template/Plugin/Branches.pm (-10 / +11 lines)
Lines 67-90 sub all { Link Here
67
        SELECT branchcode, branchname
67
        SELECT branchcode, branchname
68
        FROM branches
68
        FROM branches
69
    |;
69
    |;
70
    if (    C4::Branch::onlymine
70
    if (    C4::Context->preference('IndependentBranches')
71
        and C4::Context->userenv
71
        and C4::Context->userenv
72
        && !C4::Context->IsSuperLibrarian()
72
        and C4::Context->userenv->{branch} )
73
        and C4::Context->userenv->{branch} )
73
    {
74
    {
74
        $query .= q| WHERE branchcode = ? |;
75
        $query .= q| WHERE branchcode = ? |;
75
        push @params, C4::Context->userenv->{branch};
76
        push @params, C4::Context->userenv->{branch};
76
    }
77
    }
77
    $query .= q| ORDER BY branchname|;
78
    my $libraries = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
78
    my $branches = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
79
79
80
    for my $l ( @$libraries ) {
80
    if ( $selected ) {
81
        if (       $selected and $l->{branchcode} eq $selected
81
        for my $branch ( @$branches ) {
82
            or not $selected and C4::Context->userenv and $l->{branchcode} eq C4::Context->userenv->{branch}
82
            if ( $branch->{branchcode} eq $selected ) {
83
        ) {
83
                $branch->{selected} = 1;
84
            $l->{selected} = 1;
84
            }
85
        }
85
        }
86
    }
86
    }
87
    return $branches;
87
88
    return $libraries;
88
}
89
}
89
90
90
1;
91
1;
(-)a/acqui/basketgroup.pl (-5 / +2 lines)
Lines 52-58 use C4::Output; Link Here
52
use CGI qw ( -utf8 );
52
use CGI qw ( -utf8 );
53
53
54
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
54
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/;
55
use C4::Branch qw/GetBranches/;
56
use C4::Members qw/GetMember/;
55
use C4::Members qw/GetMember/;
57
use Koha::EDI qw/create_edi_order get_edifact_ean/;
56
use Koha::EDI qw/create_edi_order get_edifact_ean/;
58
57
Lines 272-281 if ( $op eq "add" ) { Link Here
272
    $billingplace  = $billingplace  || $borrower->{'branchcode'};
271
    $billingplace  = $billingplace  || $borrower->{'branchcode'};
273
    $deliveryplace = $deliveryplace || $borrower->{'branchcode'};
272
    $deliveryplace = $deliveryplace || $borrower->{'branchcode'};
274
273
275
    my $branches = C4::Branch::GetBranchesLoop( $billingplace );
274
    $template->param( billingplace => $billingplace );
276
    $template->param( billingplaceloop => $branches );
275
    $template->param( deliveryplace => $deliveryplace );
277
    $branches = C4::Branch::GetBranchesLoop( $deliveryplace );
278
    $template->param( deliveryplaceloop => $branches );
279
    $template->param( booksellerid => $booksellerid );
276
    $template->param( booksellerid => $booksellerid );
280
277
281
    # the template will display a unique basketgroup
278
    # the template will display a unique basketgroup
(-)a/acqui/basketheader.pl (-8 / +2 lines)
Lines 121-140 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
                    is_standing => $basket->{is_standing},
124
                    is_standing => $basket->{is_standing},
127
    );
125
    );
128
126
129
    my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"};
127
    my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"};
130
    my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"};
128
    my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"};
131
129
132
    # Build the combobox to select the billing place
130
    $template->param( billingplace => $billingplace );
133
131
    $template->param( deliveryplace => $deliveryplace );
134
    my $branches = C4::Branch::GetBranchesLoop( $billingplace );
135
    $template->param( billingplaceloop => $branches );
136
    $branches = C4::Branch::GetBranchesLoop( $deliveryplace );
137
    $template->param( deliveryplaceloop => $branches );
138
132
139
#End Edit
133
#End Edit
140
} elsif ( $op eq 'add_validate' ) {
134
} elsif ( $op eq 'add_validate' ) {
(-)a/acqui/neworderempty.pl (-18 lines)
Lines 210-233 $suggestion = GetSuggestionInfo($suggestionid) if $suggestionid; Link Here
210
my @currencies = Koha::Acquisition::Currencies->search;
210
my @currencies = Koha::Acquisition::Currencies->search;
211
my $active_currency = Koha::Acquisition::Currencies->get_active;
211
my $active_currency = Koha::Acquisition::Currencies->get_active;
212
212
213
# build branches list
214
my $onlymine =
215
     C4::Context->preference('IndependentBranches')
216
  && C4::Context->userenv
217
  && !C4::Context->IsSuperLibrarian()
218
  && C4::Context->userenv->{branch};
219
my $branches = GetBranches($onlymine);
220
my @branchloop;
221
foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
222
    my %row = (
223
        value      => $thisbranch,
224
        branchname => $branches->{$thisbranch}->{'branchname'},
225
    );
226
    $row{'selected'} = 1 if( $thisbranch && $data->{branchcode} && $thisbranch eq $data->{branchcode}) ;
227
    push @branchloop, \%row;
228
}
229
$template->param( branchloop => \@branchloop );
230
231
# build bookfund list
213
# build bookfund list
232
my $borrower= GetMember('borrowernumber' => $loggedinuser);
214
my $borrower= GetMember('borrowernumber' => $loggedinuser);
233
my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
215
my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
(-)a/admin/aqbudgetperiods.pl (-3 lines)
Lines 281-294 foreach my $result ( @{$results} ) { Link Here
281
    push( @period_inactive_loop, $budgetperiod );
281
    push( @period_inactive_loop, $budgetperiod );
282
}
282
}
283
283
284
my $branchloop = C4::Branch::GetBranchesLoop();
285
286
my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
284
my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
287
$template->param(
285
$template->param(
288
    period_active_loop      => \@period_active_loop,
286
    period_active_loop      => \@period_active_loop,
289
    period_inactive_loop    => \@period_inactive_loop,
287
    period_inactive_loop    => \@period_inactive_loop,
290
    tab                     => $tab,
288
    tab                     => $tab,
291
    branchloop              => $branchloop,
292
);
289
);
293
290
294
$template->param($op=>1);
291
$template->param($op=>1);
(-)a/admin/aqbudgets.pl (-4 / +2 lines)
Lines 96-107 my $user_branchcode = $user->{'branchcode'}; Link Here
96
$template->param(
96
$template->param(
97
    show_mine   => $show_mine,
97
    show_mine   => $show_mine,
98
    op  => $op,
98
    op  => $op,
99
    selected_branchcode => $filter_budgetbranch,
99
);
100
);
100
101
101
my $budget;
102
my $budget;
102
103
103
my $branchloop = C4::Branch::GetBranchesLoop($filter_budgetbranch);
104
105
$template->param(auth_cats_loop => GetBudgetAuthCats( $budget_period_id ))
104
$template->param(auth_cats_loop => GetBudgetAuthCats( $budget_period_id ))
106
    if $budget_period_id;
105
    if $budget_period_id;
107
106
Lines 153-159 if ($op eq 'add_form') { Link Here
153
        $row{selected} = 1 if $budget and $thisbranch eq $budget->{'budget_branchcode'};
152
        $row{selected} = 1 if $budget and $thisbranch eq $budget->{'budget_branchcode'};
154
        push @branchloop_select, \%row;
153
        push @branchloop_select, \%row;
155
    }
154
    }
156
    
155
157
    # populates the YUI planning button
156
    # populates the YUI planning button
158
    my $categories = GetAuthorisedValueCategories();
157
    my $categories = GetAuthorisedValueCategories();
159
    my @auth_cats_loop1 = ();
158
    my @auth_cats_loop1 = ();
Lines 343-349 if ( $op eq 'list' ) { Link Here
343
        spent_total            => $spent_total,
342
        spent_total            => $spent_total,
344
        ordered_total          => $ordered_total,
343
        ordered_total          => $ordered_total,
345
        available_total        => $available_total,
344
        available_total        => $available_total,
346
        branchloop             => $branchloop,
347
        filter_budgetname      => $filter_budgetname,
345
        filter_budgetname      => $filter_budgetname,
348
    );
346
    );
349
347
(-)a/admin/aqplan.pl (-2 lines)
Lines 394-400 if ( $output eq "file" ) { Link Here
394
    exit(1);
394
    exit(1);
395
}
395
}
396
396
397
my $branchloop = C4::Branch::GetBranchesLoop();
398
$template->param(
397
$template->param(
399
    authvals_row              => \@authvals_row,
398
    authvals_row              => \@authvals_row,
400
    budget_lines              => \@budget_lines,
399
    budget_lines              => \@budget_lines,
Lines 411-417 $template->param( Link Here
411
410
412
    authvals              => \@authvals_row,
411
    authvals              => \@authvals_row,
413
    hide_cols_loop              => \@hide_cols,
412
    hide_cols_loop              => \@hide_cols,
414
    branchloop                => $branchloop,
415
);
413
);
416
414
417
output_html_with_http_headers $input, $cookie, $template->output;
415
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 461-476 $template->param( Link Here
461
    defaultRefundRule     => Koha::RefundLostItemFeeRules->_default_rule
461
    defaultRefundRule     => Koha::RefundLostItemFeeRules->_default_rule
462
);
462
);
463
463
464
my $branches = GetBranches();
465
my @branchloop;
466
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
467
    push @branchloop, {
468
        value      => $thisbranch,
469
        selected   => $thisbranch eq $branch,
470
        branchname => $branches->{$thisbranch}->{'branchname'},
471
    };
472
}
473
474
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
464
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
475
465
476
my @row_loop;
466
my @row_loop;
Lines 624-631 $template->param( Link Here
624
    patron_categories => $patron_categories,
614
    patron_categories => $patron_categories,
625
                        itemtypeloop => \@itemtypes,
615
                        itemtypeloop => \@itemtypes,
626
                        rules => \@sorted_row_loop,
616
                        rules => \@sorted_row_loop,
627
                        branchloop => \@branchloop,
617
                        humanbranch => ($branch ne '*' ? $branch : ''),
628
                        humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''),
629
                        current_branch => $branch,
618
                        current_branch => $branch,
630
                        definedbranch => scalar(@sorted_row_loop)>0
619
                        definedbranch => scalar(@sorted_row_loop)>0
631
                        );
620
                        );
(-)a/catalogue/search.pl (-18 / +2 lines)
Lines 214-238 if($cgi->cookie("intranet_bib_list")){ Link Here
214
}
214
}
215
215
216
# load the branches
216
# load the branches
217
my $branches = GetBranches();
218
219
# Populate branch_loop with all branches sorted by their name.  If
220
# IndependentBranches is activated, set the default branch to the borrower
221
# branch, except for superlibrarian who need to search all libraries.
222
my $user = C4::Context->userenv;
223
my @branch_loop = map {
224
     {
225
        value      => $_,
226
        branchname => $branches->{$_}->{branchname},
227
        selected   => $user->{branch} eq $_ && C4::Branch::onlymine(),
228
     }
229
} sort {
230
    $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
231
} keys %$branches;
232
233
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
217
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
234
218
235
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
219
$template->param(searchdomainloop => $categories);
236
220
237
# load the Type stuff
221
# load the Type stuff
238
my $itemtypes = GetItemTypes;
222
my $itemtypes = GetItemTypes;
Lines 537-543 eval { Link Here
537
    my $itemtypes = GetItemTypes;
521
    my $itemtypes = GetItemTypes;
538
    ( $error, $results_hashref, $facets ) = $searcher->search_compat(
522
    ( $error, $results_hashref, $facets ) = $searcher->search_compat(
539
        $query,            $simple_query, \@sort_by,       \@servers,
523
        $query,            $simple_query, \@sort_by,       \@servers,
540
        $results_per_page, $offset,       $expanded_facet, $branches,
524
        $results_per_page, $offset,       $expanded_facet, undef,
541
        $itemtypes,        $query_type,   $scan
525
        $itemtypes,        $query_type,   $scan
542
    );
526
    );
543
};
527
};
(-)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;
31
use C4::Koha;
32
use C4::Branch;
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 175-183 sub generate_subfield_form { Link Here
175
            # builds list, depending on authorised value...
175
            # builds list, depending on authorised value...
176
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
176
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
177
                foreach my $thisbranch (@$branches) {
177
                foreach my $thisbranch (@$branches) {
178
                    push @authorised_values, $thisbranch->{value};
178
                    push @authorised_values, $thisbranch->{branchcode};
179
                    $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
179
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
180
                    $value = $thisbranch->{value} if $thisbranch->{selected} && !$value;
180
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
181
                }
181
                }
182
            }
182
            }
183
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
183
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
Lines 863-875 my $i=0; Link Here
863
863
864
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
864
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
865
865
866
my $onlymine =
867
     C4::Context->preference('IndependentBranches')
868
  && C4::Context->userenv
869
  && !C4::Context->IsSuperLibrarian()
870
  && C4::Context->userenv->{branch};
871
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
866
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
872
my $branches = GetBranchesLoop($branch,$onlymine);  # build once ahead of time, instead of multiple times later.
867
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
868
for my $library ( @$libraries ) {
869
    $library->{selected} = 1 if $library->{branchcode} eq $branch
870
}
873
871
874
# We generate form, from actuel record
872
# We generate form, from actuel record
875
@fields = ();
873
@fields = ();
Lines 884-890 if($itemrecord){ Link Here
884
882
885
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
883
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
886
884
887
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
885
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
888
            push @fields, "$tag$subfieldtag";
886
            push @fields, "$tag$subfieldtag";
889
            push (@loop_data, $subfield_data);
887
            push (@loop_data, $subfield_data);
890
            $i++;
888
            $i++;
Lines 908-914 foreach my $tag ( keys %{$tagslib}){ Link Here
908
        my @values = (undef);
906
        my @values = (undef);
909
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
907
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
910
        for my $value (@values){
908
        for my $value (@values){
911
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
909
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
912
            push (@loop_data, $subfield_data);
910
            push (@loop_data, $subfield_data);
913
            $i++;
911
            $i++;
914
        }
912
        }
(-)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 214-222 if (@patron_attr_filter_loop) { Link Here
214
214
215
$template->param(
215
$template->param(
216
    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
216
    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
217
    branchloop   => GetBranchesLoop($branchfilter, $onlymine),
218
    homebranchloop => GetBranchesLoop( $homebranchfilter, $onlymine ),
219
    holdingbranchloop => GetBranchesLoop( $holdingbranchfilter, $onlymine ),
220
    branchfilter => $branchfilter,
217
    branchfilter => $branchfilter,
221
    homebranchfilter => $homebranchfilter,
218
    homebranchfilter => $homebranchfilter,
222
    holdingbranchfilter => $homebranchfilter,
219
    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-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
<div class="gradient">
3
<div class="gradient">
3
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Fund Admin Resident Search Box -->
4
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Fund Admin Resident Search Box -->
4
5
Lines 10-20 Link Here
10
            <label for="filter_budgetbranch">Library: </label>
11
            <label for="filter_budgetbranch">Library: </label>
11
            <select name="filter_budgetbranch" id="filter_budgetbranch" style="width:10em;">
12
            <select name="filter_budgetbranch" id="filter_budgetbranch" style="width:10em;">
12
                <option value=""></option>
13
                <option value=""></option>
13
                    [% FOREACH branchloo IN branchloop %]
14
                    [% FOREACH branchloo IN Branches.all( selected => selected_branchcode ) %]
14
                        [% IF ( branchloo.selected ) %]
15
                        [% IF branchloo.selected %]
15
                        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
16
                        <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
16
                        [% ELSE %]
17
                        [% ELSE %]
17
                        <option value="[% branchloo.value %]" >[% branchloo.branchname %]</option>
18
                        <option value="[% branchloo.branchcode %]" >[% branchloo.branchname %]</option>
18
                        [% END %]
19
                        [% END %]
19
                    [% END %]
20
                    [% END %]
20
            </select>
21
            </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+1 lines)
Lines 43-48 Link Here
43
<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script>
43
<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script>
44
44
45
[% INCLUDE 'validator-strings.inc' %]
45
[% INCLUDE 'validator-strings.inc' %]
46
[% PROCESS 'html_helpers.inc' %]
46
[% IF ( IntranetUserJS ) %]
47
[% IF ( IntranetUserJS ) %]
47
    <script type="text/javascript">
48
    <script type="text/javascript">
48
    //<![CDATA[
49
    //<![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 | html %]" selected="selected">[% l.branchname %]</option>
5
        [% ELSE %]
6
            <option value="[% l.branchcode | html %]">[% l.branchname %]</option>
7
        [% END%]
8
    [% END %]
9
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-19 / +5 lines)
Lines 202-219 function submitForm(form) { Link Here
202
                                                <label for="billingplace">Billing place:</label>
202
                                                <label for="billingplace">Billing place:</label>
203
                                                <select name="billingplace" id="billingplace" style="width:13em;">
203
                                                <select name="billingplace" id="billingplace" style="width:13em;">
204
                                                    <option value="">--</option>
204
                                                    <option value="">--</option>
205
                                                    [% FOREACH billingplaceloo IN billingplaceloop %]
205
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
206
                                                        [% IF ( billingplaceloo.selected ) %]<option value="[% billingplaceloo.value %]" selected="selected">[% billingplaceloo.branchname %]</option>
207
                                                        [% ELSE %]<option value="[% billingplaceloo.value %]">[% billingplaceloo.branchname %]</option>[% END%]
208
                                                    [% END %]
209
                                                </select>
206
                                                </select>
210
                                            [% ELSE %]
207
                                            [% ELSE %]
211
                                                <span class="label">Billing place:</span>
208
                                                <span class="label">Billing place:</span>
212
                                                [% FOREACH billingplaceloo IN billingplaceloop %]
209
                                                <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace %]" />[% Branches.GetName( billingplace ) %]
213
                                                    [% IF ( billingplaceloo.selected ) %]
214
                                                        <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplaceloo.value %]" />[% billingplaceloo.branchname %]
215
                                                    [% END %]
216
                                                [% END %]
217
                                            [% END %]
210
                                            [% END %]
218
                                        </li>
211
                                        </li>
219
                                        [% UNLESS (closedbg) %]
212
                                        [% UNLESS (closedbg) %]
Lines 221-231 function submitForm(form) { Link Here
221
                                                <label for="deliveryplace">Delivery place:</label>
214
                                                <label for="deliveryplace">Delivery place:</label>
222
                                                <select name="deliveryplace" id="deliveryplace" style="width:13em;">
215
                                                <select name="deliveryplace" id="deliveryplace" style="width:13em;">
223
                                                    <option value="">--</option>
216
                                                    <option value="">--</option>
224
                                                    [% FOREACH deliveryplaceloo IN deliveryplaceloop %]
217
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
225
                                                        [% IF ( deliveryplaceloo.selected ) %]<option value="[% deliveryplaceloo.value %]" selected="selected">[% deliveryplaceloo.branchname %]</option>
218
                                                <select>
226
                                                        [% ELSE %]<option value="[% deliveryplaceloo.value %]">[% deliveryplaceloo.branchname %]</option>[% END %]
227
                                                    [% END %]
228
                                                    <select>
229
                                            </li>
219
                                            </li>
230
                                            <li><p>or</p></li>
220
                                            <li><p>or</p></li>
231
                                            <li>
221
                                            <li>
Lines 239-249 function submitForm(form) { Link Here
239
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace %]" />[% freedeliveryplace %]
229
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace %]" />[% freedeliveryplace %]
240
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
230
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
241
                                                    [% ELSE %]
231
                                                    [% ELSE %]
242
                                                        [% FOREACH deliveryplaceloo IN deliveryplaceloop %]
232
                                                        <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace %]" />[% Branches.GetName( deliveryplace ) %]
243
                                                            [% IF ( deliveryplaceloo.selected ) %]
244
                                                                <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplaceloo.value %]" />[% deliveryplaceloo.branchname %]
245
                                                            [% END %]
246
                                                        [% END %]
247
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
233
                                                        <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
248
                                                    [% END %]
234
                                                    [% END %]
249
                                                </li>
235
                                                </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 521-530 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
521
    <li>
521
    <li>
522
    <label for="budget_branchcode">Library: </label>
522
    <label for="budget_branchcode">Library: </label>
523
    <select name="budget_branchcode" id="budget_branchcode">
523
    <select name="budget_branchcode" id="budget_branchcode">
524
    <option value=""></option>
524
        <option value=""></option>
525
    [% FOREACH branchloop_selec IN branchloop_select %]
525
        [% PROCESS options_for_libraries libraries => branchloop_select %]
526
        [% 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>
527
    [% END %]
528
    </select>
526
    </select>
529
    </li>
527
    </li>
530
528
Lines 655-665 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
655
            <label for="filter_budgetbranch2">Library: </label>
653
            <label for="filter_budgetbranch2">Library: </label>
656
            <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
654
            <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
657
                <option value=""></option>
655
                <option value=""></option>
658
                [% FOREACH branchloo IN branchloop %]
656
                [% PROCESS options_for_libraries libraries => branchloop_select %]
659
                [% UNLESS ( branchloo.selected ) %]<option value="[% branchloo.value %]">
660
                [% ELSE %]<option value="[% branchloo.value %]" selected="selected">[% END %]
661
                [% branchloo.branchname %]</option>
662
                [% END %]
663
            </select>
657
            </select>
664
        </li>
658
        </li>
665
        <li class="radio">
659
        <li class="radio">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/clone-rules.tt (-38 / +25 lines)
Lines 29-73 Link Here
29
    [% ELSE %]
29
    [% ELSE %]
30
30
31
    <p class="help">Use carefully! If the destination library already has circulation and fine rules, they will be deleted without warning!</p>
31
    <p class="help">Use carefully! If the destination library already has circulation and fine 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
    <a href="/cgi-bin/koha/admin/smart-rules.pl" class="cancel">Cancel</a>
70
	</form>
71
58
72
    [% END %]
59
    [% END %]
73
    </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 117-124 $(document).ready(function() { Link Here
117
    <div id="yui-main">
118
    <div id="yui-main">
118
    <div class="yui-b">
119
    <div class="yui-b">
119
    <h1 class="parameters">
120
    <h1 class="parameters">
120
        [% IF ( humanbranch ) %]
121
        [% IF humanbranch %]
121
            Defining circulation and fine rules for "[% humanbranch %]"
122
            Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) %]"
122
        [% ELSE %]
123
        [% ELSE %]
123
            Defining circulation and fine rules for all libraries
124
            Defining circulation and fine rules for all libraries
124
        [% END %]
125
        [% END %]
Lines 142-155 $(document).ready(function() { Link Here
142
        Select a library :
143
        Select a library :
143
            <select name="branch" id="branch" style="width:20em;">
144
            <select name="branch" id="branch" style="width:20em;">
144
                <option value="*">All libraries</option>
145
                <option value="*">All libraries</option>
145
            [% FOREACH branchloo IN branchloop %]
146
                [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch ) %]
146
				[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
147
            [% END %]
148
            </select>
147
            </select>
149
        </form>
148
        </form>
150
[% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label 
149
        [% IF ( definedbranch ) %]
151
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" />
150
            <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
152
            <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 %]
151
                <label for="tobranch"><strong>Clone these rules to:</strong></label>
152
                <input type="hidden" name="frombranch" value="[% current_branch %]" />
153
                <select name="tobranch" id="tobranch">
154
                    [% FOREACH l IN Branches.all() %]
155
                        <option value="[% l.value %]">[% l.branchname %]</option>
156
                    [% END %]
157
                </select>
158
                <input type="submit" value="Clone" />
159
            </form>
160
        [% END %]
153
161
154
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
162
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
155
            <input type="hidden" name="op" value="add" />
163
            <input type="hidden" name="op" value="add" />
Lines 387-393 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
387
        </form>
395
        </form>
388
    </div>
396
    </div>
389
    <div id="defaults-for-this-library" class="container">
397
    <div id="defaults-for-this-library" class="container">
390
    <h3>Default checkout, hold and return policy[% IF ( humanbranch ) %] for [% humanbranch %][% END %]</h3>
398
    <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
391
        <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>
399
        <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>
392
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
400
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
393
            <input type="hidden" name="op" value="set-branch-defaults" />
401
            <input type="hidden" name="op" value="set-branch-defaults" />
Lines 499-505 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
499
    </div>
507
    </div>
500
    [% IF ( show_branch_cat_rule_form ) %]
508
    [% IF ( show_branch_cat_rule_form ) %]
501
    <div id="holds-policy-by-patron-category" class="container">
509
    <div id="holds-policy-by-patron-category" class="container">
502
    <h3>[% IF humanbranch %]Checkout limit by patron category for [% humanbranch %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
510
    <h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
503
        <p>For this library, you can specify the maximum number of loans that
511
        <p>For this library, you can specify the maximum number of loans that
504
            a patron of a given category can make, regardless of the item type.
512
            a patron of a given category can make, regardless of the item type.
505
        </p>
513
        </p>
Lines 643-649 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
643
    </div>
651
    </div>
644
652
645
    <div id="holds-policy-by-item-type" class="container">
653
    <div id="holds-policy-by-item-type" class="container">
646
    <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3>
654
    <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) %][% ELSE %]Default holds policy by item type[% END %]</h3>
647
        <p>
655
        <p>
648
            For this library, you can edit rules for given itemtypes, regardless
656
            For this library, you can edit rules for given itemtypes, regardless
649
            of the patron's category.
657
            of the patron's category.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.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; Administration &rsaquo; Transport cost matrix</title>
3
<title>Koha &rsaquo; Administration &rsaquo; Transport cost matrix</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 100-107 $(document).ready(function(){ Link Here
100
                <table>
101
                <table>
101
                    <tr>
102
                    <tr>
102
                        <th>From \ To</th>
103
                        <th>From \ To</th>
103
                        [% FOR b IN branchloop %]
104
                        [% FOR b IN Branches.all() %]
104
                        <th>[% b.name %]</th>
105
                        <th>[% b.branchname %]</th>
105
                        [% END %]
106
                        [% END %]
106
                    </tr>
107
                    </tr>
107
                [% FOR bf IN branchfromloop %]
108
                [% 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 252-264 Link Here
252
<fieldset id="select-libs">
252
<fieldset id="select-libs">
253
        <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;}'>
253
        <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;}'>
254
        <option value="">All libraries</option>
254
        <option value="">All libraries</option>
255
        [% FOREACH branchloo IN branchloop %]
255
        [% PROCESS options_for_libraries libraries => Branches.all() %]
256
        [% IF ( branchloo.selected ) %]
257
        <option value="branch:[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
258
        [% ELSE %]
259
        <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option>
260
        [% END %]
261
        [% END %]
262
        </select></p>
256
        </select></p>
263
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
257
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
264
        [% IF ( searchdomainloop ) %]
258
        [% IF ( searchdomainloop ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt (-6 / +6 lines)
Lines 38-53 $(document).ready(function(){ Link Here
38
        <th>No. of times checked out</th>
38
        <th>No. of times checked out</th>
39
        <th>Last seen</th>
39
        <th>Last seen</th>
40
    </tr>
40
    </tr>
41
    [% FOREACH branchloo IN branchloop %]
41
    [% FOREACH library IN libraries %]
42
    [% IF ( branchloo.selected ) %]
42
    [% IF library.selected %]
43
        <tr class="mybranch">
43
        <tr class="mybranch">
44
    [% ELSE %]
44
    [% ELSE %]
45
        <tr>
45
        <tr>
46
    [% END %]
46
    [% END %]
47
            <td>[% branchloo.branchname %]</td>
47
            <td>[% library.branchname %]</td>
48
            <td>[% branchloo.issues %]</td>
48
            <td>[% library.issues %]</td>
49
            <td>[% IF ( branchloo.seen ) %]
49
            <td>[% IF library.seen %]
50
                    [% branchloo.seen | $KohaDates with_hours => 1 %]
50
                    [% library.seen | $KohaDates with_hours => 1 %]
51
                [% ELSE %]
51
                [% ELSE %]
52
                    <span>Never</span>
52
                    <span>Never</span>
53
                [% END %]
53
                [% 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 213-245 Link Here
213
        <label>Item home library:</label>
213
        <label>Item home library:</label>
214
        <select name="homebranch" id="homebranch">
214
        <select name="homebranch" id="homebranch">
215
            <option value="">Any</option>
215
            <option value="">Any</option>
216
            [% FOREACH homebranchloo IN homebranchloop %][% IF ( homebranchloo.selected ) %]
216
            [% PROCESS options_for_libraries libraries => Branches.all( selected => homebranchfilter ) %]
217
            <option value="[% homebranchloo.value |html %]" selected="selected">[% homebranchloo.branchname %]</option>[% ELSE %]
218
            <option value="[% homebranchloo.value |html %]">[% homebranchloo.branchname %]</option>[% END %]
219
            [% END %]
220
        </select>
217
        </select>
221
    </li>
218
    </li>
222
219
223
    <li>
220
    <li>
224
        <label>Item holding library:</label>
221
        <label>Item holding library:</label>
225
            <select name="holdingbranch" id="holdingbranch">
222
        <select name="holdingbranch" id="holdingbranch">
226
            <option value="">Any</option>
223
            <option value="">Any</option>
227
            [% FOREACH holdingbranchloo IN holdingbranchloop %][% IF ( holdingbranchloo.selected ) %]
224
            [% PROCESS options_for_libraries libraries => Branches.all( selected => holdingbranchfilter ) %]
228
            <option value="[% holdingbranchloo.value |html %]" selected="selected">[% holdingbranchloo.branchname %]</option>[% ELSE %]
229
            <option value="[% holdingbranchloo.value |html %]">[% holdingbranchloo.branchname %]</option>[% END %]
230
            [% END %]
231
        </select>
225
        </select>
232
    </li>
226
    </li>
233
227
234
    <li>
228
    <li>
235
    <label>Library of the patron:</label><select name="branch" id="branch">
229
        <label>Library of the patron:</label>
236
        <option value="">Any</option>
230
        <select name="branch" id="branch">
237
      [% FOREACH branchloo IN branchloop %]
231
            <option value="">Any</option>
238
        [% IF ( branchloo.selected ) %]
232
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
239
        <option value="[% branchloo.value |html %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]
233
        </select>
240
        <option value="[% branchloo.value |html %]">[% branchloo.branchname %]</option>[% END %]
241
      [% END %]
242
      </select>
243
    </li>
234
    </li>
244
235
245
    <li><label for="order">Sort by:</label> <select name="order" id="order">
236
    <li><label for="order">Sort by:</label> <select name="order" id="order">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt (-7 / +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; Circulation &rsaquo; Set library</title>
3
<title>Koha &rsaquo; Circulation &rsaquo; Set library</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 54-66 Updated:<ul> Link Here
54
    [% ELSE %]
55
    [% ELSE %]
55
        <li><label for="branch">Choose library:</label>
56
        <li><label for="branch">Choose library:</label>
56
        <select name="branch" id="branch">
57
        <select name="branch" id="branch">
57
        [% FOREACH branchloo IN branchloop %]
58
            [% 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>
59
        </select></li>
65
    [% END %]
60
    [% END %]
66
<!--
61
<!--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (-8 / +6 lines)
Lines 192-206 $(document).ready(function() { Link Here
192
<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post">
192
<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post">
193
	<fieldset class="rows">
193
	<fieldset class="rows">
194
	<ol>
194
	<ol>
195
	<li><label for="branchlimit">Library: </label><select name="branchlimit" id="branchlimit">
195
        <li>
196
            <label for="branchlimit">Library: </label>
197
            <select name="branchlimit" id="branchlimit">
196
                <option value="">All</option>
198
                <option value="">All</option>
197
            [% FOREACH branchloo IN branchloop %]
199
                [% PROCESS options_for_libraries libraries => Branches.all() %]
198
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
200
            </select>
199
				[% ELSE %]
201
        </li>
200
				<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
201
				[% END %]
202
            [% END %]
203
            </select></li>
204
			<!-- FIXME Not working yet
202
			<!-- FIXME Not working yet
205
			<li><label for="itemtypeslimit">Item Type: </label><select name="itemtypeslimit" id="itemtypeslimit">
203
			<li><label for="itemtypeslimit">Item Type: </label><select name="itemtypeslimit" id="itemtypeslimit">
206
                <option value="">All</option>
204
                <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 506-518 function filterByFirstLetterSurname(letter) { Link Here
506
                [% IF branches.size != 1 %]
506
                [% IF branches.size != 1 %]
507
                  <option value="">Any</option>
507
                  <option value="">Any</option>
508
                [% END %]
508
                [% END %]
509
                [% FOREACH b IN branches %]
509
                [% PROCESS options_for_libraries libraries => branches %]
510
                  [% IF b.selected %]
511
                    <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
512
                  [% ELSE %]
513
                    <option value="[% b.branchcode %]">[% b.branchname %]</option>
514
                  [% END %]
515
                [% END %]
516
              </select>
510
              </select>
517
            </li>
511
            </li>
518
          </ol>
512
          </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 628-642 $(document).ready(function() { Link Here
628
    <li>
629
    <li>
629
        <label for="libraries" class="required">Library:</label>
630
        <label for="libraries" class="required">Library:</label>
630
        <select name="branchcode" size="1" id="libraries">
631
        <select name="branchcode" size="1" id="libraries">
631
        [%- FOREACH branchloo IN branchloop %]
632
            [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch ) %]
632
          [% IF ( branchloo.selected ) -%]
633
        </select>
633
            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
634
        <span class="required">Required</span>
634
          [%- ELSE -%]
635
            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
636
          [%- END -%]
637
        [%- END %]
638
      </select>
639
      <span class="required">Required</span>
640
    </li>
635
    </li>
641
        [% END %]
636
        [% END %]
642
    <li>
637
    <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 139-150 Link Here
139
			<td><input type="radio" name="Line"   value="branchcode" /></td>
140
			<td><input type="radio" name="Line"   value="branchcode" /></td>
140
			<td><input type="radio" name="Column" value="branchcode" /></td>
141
			<td><input type="radio" name="Column" value="branchcode" /></td>
141
			<td>
142
			<td>
142
				<select name="Filter"  size="1" id="branch">
143
                <select name="Filter"  size="1" id="branch">
143
				<option value=""></option>
144
                <option value=""></option>
144
				[% FOREACH BRANCH_LOO IN BRANCH_LOOP %]
145
                [% FOREACH l IN Branches.all() %]
145
					<option value="[% BRANCH_LOO.branchcode %]">[% BRANCH_LOO.branchcode %] - [% BRANCH_LOO.branchname %]</option>
146
                    <option value="[% l.branchcode %]">[% l.branchcode %] - [% l.branchname || 'UNKNOWN' %]</option>
146
				[% END %]
147
                [% END %]
147
				</select>
148
                </select>
148
			</td>
149
			</td>
149
			</tr>
150
			</tr>
150
		    <tr>
151
		    <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 92-104 Link Here
92
			<li><label for="branch">Library: </label>
92
			<li><label for="branch">Library: </label>
93
	<select name="Filter" id="branch">
93
	<select name="Filter" id="branch">
94
        <option value="">Any library</option>
94
        <option value="">Any library</option>
95
    [% FOREACH branchloo IN branchloop %]
95
        [% PROCESS options_for_libraries libraries => Branches.all() %]
96
      [% IF ( branchloo.selected ) %]
97
        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
98
      [% ELSE %]
99
        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
100
      [% END %]
101
    [% END %]
102
    </select></li>
96
    </select></li>
103
      <li> 
97
      <li> 
104
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
98
        <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 155-164 Link Here
155
            <td><input type="radio" name="Line" value="branch" /></td>
156
            <td><input type="radio" name="Line" value="branch" /></td>
156
            <td><input type="radio" name="Column" value="branch" /></td>
157
            <td><input type="radio" name="Column" value="branch" /></td>
157
            <td><select name="Filter" id="branch">
158
            <td><select name="Filter" id="branch">
158
               <option value=""> </option>
159
                <option value=""> </option>
159
               [% FOREACH branchloo IN branchloop %]
160
                [% PROCESS options_for_libraries libraries => Branches.all() %]
160
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
161
				[% END %]
162
               </select>
161
               </select>
163
             </td> 
162
             </td> 
164
        </tr>
163
        </tr>
Lines 223-231 Link Here
223
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
222
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
224
            <td><select name="Filter" id="homebranch">
223
            <td><select name="Filter" id="homebranch">
225
                    <option value=""> </option>
224
                    <option value=""> </option>
226
                    [% FOREACH branchloo IN branchloop %]
225
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
227
                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
228
				    [% END %]
229
                </select>
226
                </select>
230
            </td>
227
            </td>
231
        </tr>
228
        </tr>
Lines 235-243 Link Here
235
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
232
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
236
            <td><select name="Filter" id="holdingbranch">
233
            <td><select name="Filter" id="holdingbranch">
237
                    <option value=""> </option>
234
                    <option value=""> </option>
238
                    [% FOREACH branchloo IN branchloop %]
235
                    [% PROCESS options_for_libraries libraries => Branches.all() %]
239
                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
240
				    [% END %]
241
                </select>
236
                </select>
242
            </td>
237
            </td>
243
        </tr>
238
        </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 234-242 Link Here
234
            <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
235
            <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
235
            <td><select name="filter_reserves.branchcode" id="resbranchcode">
236
            <td><select name="filter_reserves.branchcode" id="resbranchcode">
236
               <option value=""> </option>
237
               <option value=""> </option>
237
               [% FOREACH branchloo IN branchloop %]
238
                [% PROCESS options_for_libraries libraries => Branches.all() %]
238
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
239
				[% END %]
240
               </select>
239
               </select>
241
             </td> 
240
             </td> 
242
        </tr>
241
        </tr>
Lines 246-254 Link Here
246
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
245
            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
247
            <td><select name="filter_items.holdingbranch" id="holdingbranch">
246
            <td><select name="filter_items.holdingbranch" id="holdingbranch">
248
               <option value=""> </option>
247
               <option value=""> </option>
249
               [% FOREACH branchloo IN branchloop %]
248
                [% PROCESS options_for_libraries libraries => Branches.all() %]
250
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
251
				[% END %]
252
               </select>
249
               </select>
253
             </td> 
250
             </td> 
254
        </tr>
251
        </tr>
Lines 257-266 Link Here
257
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
254
            <td><input type="radio" name="Line" value="items.homebranch" /></td>
258
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
255
            <td><input type="radio" name="Column" value="items.homebranch" /></td>
259
            <td><select name="filter_items.homebranch" id="homebranch">
256
            <td><select name="filter_items.homebranch" id="homebranch">
260
               <option value=""> </option>
257
                <option value=""> </option>
261
               [% FOREACH branchloo IN branchloop %]
258
                [% PROCESS options_for_libraries libraries => Branches.all() %]
262
[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
263
				[% END %]
264
               </select>
259
               </select>
265
             </td> 
260
             </td> 
266
        </tr>
261
        </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 / +4 lines)
Lines 374-386 function checkMultiHold() { Link Here
374
        <li>
374
        <li>
375
            <label for="pickup">Pickup at:</label>
375
            <label for="pickup">Pickup at:</label>
376
            <select name="pickup" size="1" id="pickup">
376
            <select name="pickup" size="1" id="pickup">
377
            [%- FOREACH branchloo IN branchloop %]
377
                [% PROCESS options_for_libraries libraries => Branches.all() %]
378
              [% IF ( branchloo.selected ) -%]
379
                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
380
              [%- ELSE -%]
381
                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
382
              [%- END -%]
383
            [%- END %]
384
            </select>
378
            </select>
385
        </li>
379
        </li>
386
380
Lines 810-826 function checkMultiHold() { Link Here
810
            Item being transferred to <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" />
804
            Item being transferred to <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" />
811
         [% END %]
805
         [% END %]
812
    [% ELSE %]
806
    [% ELSE %]
813
          <select name="pickup">
807
        <select name="pickup">
814
      [% FOREACH branchloo IN reserveloo.branchloop %]
808
            [% PROCESS options_for_libraries libraries => Branches.all( selected => reserveloo.branchcode ) %]
815
        [% IF ( branchloo.selected ) %]
809
        </select>
816
            <option value="[% branchloo.branchcode %]" selected="selected">
817
        [% ELSE %]
818
            <option value="[% branchloo.branchcode %]">
819
        [% END %]
820
              [% branchloo.branchname %]
821
            </option>
822
      [% END %]
823
          </select>
824
    [% END %]
810
    [% END %]
825
        </td>
811
        </td>
826
        <td>
812
        <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 | html %]" /></li>
56
        <input id="issn" type="text" name="issn" size="15" value="[% issn | html %]" /></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 114-120 Link Here
114
                [% END %]
107
                [% END %]
115
                </a>
108
                </a>
116
            </td>
109
            </td>
117
            [% IF ( branches_loop.size ) %]<td>
110
            [% IF can_change_library %]<td>
118
                [% Branches.GetName( subscriptions_loo.branchcode ) %]
111
                [% Branches.GetName( subscriptions_loo.branchcode ) %]
119
            </td>[% END %]
112
            </td>[% END %]
120
            <td>
113
            <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt (-9 / +3 lines)
Lines 239-251 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl Link Here
239
    <div class="yui-u first">
239
    <div class="yui-u first">
240
        <label for="branch">Define the holidays for:</label>
240
        <label for="branch">Define the holidays for:</label>
241
            <select id="branch" name="branch">
241
            <select id="branch" name="branch">
242
                [% FOREACH branchloo IN branchloop %]
242
                [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
243
                    [% IF ( branchloo.selected ) %]
244
                        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
245
                    [% ELSE %]
246
                        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
247
                    [% END %]
248
                [% END %]
249
            </select>
243
            </select>
250
    
244
    
251
    <!-- ******************************** FLAT PANELS ******************************************* -->
245
    <!-- ******************************** FLAT PANELS ******************************************* -->
Lines 410-417 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl Link Here
410
  <label for="branchcode">Copy holidays to:</label>
404
  <label for="branchcode">Copy holidays to:</label>
411
  <select id="branchcode" name="branchcode">
405
  <select id="branchcode" name="branchcode">
412
    <option value=""></option>
406
    <option value=""></option>
413
    [% FOREACH branchloo IN branchloop %]
407
    [% FOREACH l IN Branches.all() %]
414
    <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
408
    <option value="[% l.branchcode %]">[% l.branchname %]</option>
415
    [% END %]
409
    [% END %]
416
  </select>
410
  </select>
417
    <input type="submit" value="Copy" />
411
    <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 137-145 Link Here
137
        <label class="description" for="branchcode">[% borrower_field.description %]: </label>
138
        <label class="description" for="branchcode">[% borrower_field.description %]: </label>
138
        <select id="branchcode" name="branchcode">
139
        <select id="branchcode" name="branchcode">
139
            <option value="" selected="selected"></option>
140
            <option value="" selected="selected"></option>
140
        [% FOREACH branch IN branches %]
141
        [% FOREACH library IN Branches.all() %]
141
            <option value="[% branch.branchcode %]">
142
            <option value="[% library.branchcode %]">
142
                [% branch.branchname %]</option>
143
                [% library.branchname %]</option>
143
        [% END %]
144
        [% END %]
144
        </select><span class="field_hint">[% borrower_field.field %]</span>
145
        </select><span class="field_hint">[% borrower_field.field %]</span>
145
    </li>
146
    </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 165-173 $(document).ready(function() { Link Here
165
        Select a library :
165
        Select a library :
166
            <select name="branchcode" id="branch" style="width:20em;">
166
            <select name="branchcode" id="branch" style="width:20em;">
167
                <option value="*">All libraries</option>
167
                <option value="*">All libraries</option>
168
            [% FOREACH branchloo IN branchloop %]
168
                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
169
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
170
            [% END %]
171
            </select>
169
            </select>
172
      </p>
170
      </p>
173
    [% END %]
171
    [% END %]
Lines 183-190 $(document).ready(function() { Link Here
183
		[% IF ( letter && !independant_branch) %]
181
		[% IF ( letter && !independant_branch) %]
184
            [% select_for_copy = BLOCK %]
182
            [% select_for_copy = BLOCK %]
185
            <select name="branchcode">
183
            <select name="branchcode">
186
                [% FOREACH branchloo IN branchloop %]
184
                [% FOREACH l IN Branches.all() %]
187
                <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
185
                <option value="[% l.branchcode %]">Copy to [% l.branchname %]</option>
188
                [% END %]
186
                [% END %]
189
            </select>
187
            </select>
190
            [% END %]
188
            [% END %]
Lines 276-284 $(document).ready(function() { Link Here
276
                    <label for="branch">Library:</label>
274
                    <label for="branch">Library:</label>
277
                    <select name="branchcode" id="branch" style="width:20em;">
275
                    <select name="branchcode" id="branch" style="width:20em;">
278
                        <option value="">All libraries</option>
276
                        <option value="">All libraries</option>
279
                    [% FOREACH branchloo IN branchloop %]
277
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
280
                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
281
                    [% END %]
282
                    </select>
278
                    </select>
283
                [% ELSE %]
279
                [% ELSE %]
284
                    <span class="label">Library:</span>
280
                    <span class="label">Library:</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt (-7 / +1 lines)
Lines 44-56 $(document).ready(function() { Link Here
44
            <label for="branch">Select a library:</label>
44
            <label for="branch">Select a library:</label>
45
                <select id="branch" name="branch">
45
                <select id="branch" name="branch">
46
                    <option value="">Default</option>
46
                    <option value="">Default</option>
47
                    [% FOREACH branchloo IN branchloop %]
47
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
48
                        [% IF ( branchloo.selected ) %]
49
                            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
50
                        [% ELSE %]
51
                            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
52
                        [% END %]
53
                    [% END %]
54
                </select>
48
                </select>
55
                <input type="submit" value="Select" />
49
                <input type="submit" value="Select" />
56
            </form>
50
            </form>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc (+1 lines)
Lines 55-57 Link Here
55
</script>
55
</script>
56
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/modernizr.min.js"></script>
56
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/modernizr.min.js"></script>
57
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/font-awesome/css/font-awesome.min.css" />
57
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/font-awesome/css/font-awesome.min.css" />
58
[% 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 228-236 Link Here
228
                                        <select name="branch_group_limit" id="select_library">
229
                                        <select name="branch_group_limit" id="select_library">
229
                                            <option value="">All libraries</option>
230
                                            <option value="">All libraries</option>
230
                                            [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %]
231
                                            [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %]
231
                                                [% FOREACH BranchesLoo IN BranchesLoop %]
232
                                                [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
232
                                                    [% IF ( BranchesLoo.selected ) %]<option selected="selected" value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
233
                                                    [% IF BranchesLoo.selected %]
233
                                                    [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>[% END %]
234
                                                        <option selected="selected" value="branch:[% BranchesLoo.branchcode %]">[% BranchesLoo.branchname %]</option>
235
                                                    [% ELSE %]
236
                                                        <option value="branch:[% BranchesLoo.branchcode %]">[% BranchesLoo.branchname %]</option>
237
                                                    [% END %]
234
                                                [% END %]
238
                                                [% END %]
235
                                            [% IF BranchCategoriesLoop %]
239
                                            [% IF BranchCategoriesLoop %]
236
                                                </optgroup>
240
                                                </optgroup>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc (-9 / +2 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
3
3
<div id="search-facets">
4
<div id="search-facets">
4
    <form method="get" action="/cgi-bin/koha/opac-topissues.pl">
5
    <form method="get" action="/cgi-bin/koha/opac-topissues.pl">
Lines 18-32 Link Here
18
                <li><label for="branch">From: </label>
19
                <li><label for="branch">From: </label>
19
                            <select name="branch" id="branch">
20
                            <select name="branch" id="branch">
20
                                <option value="">All libraries</option>
21
                                <option value="">All libraries</option>
21
                                [% FOREACH branchloo IN branchloop %]
22
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
22
                                    [% IF ( branchloo.selected ) %]
23
                                        <option value="[% branchloo.value %]" selected="selected">
24
                                    [% ELSE %]
25
                                        <option value="[% branchloo.value %]">
26
                                    [% END %]
27
                                            [% branchloo.branchname %]
28
                                        </option>
29
                                [% END %]
30
                            </select></li>
23
                            </select></li>
31
24
32
                [% AdvancedSearchTypes = Koha.Preference('AdvancedSearchTypes').split('\|') %]
25
                [% AdvancedSearchTypes = Koha.Preference('AdvancedSearchTypes').split('\|') %]
(-)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-5 Link Here
1
[% USE Categories %]
1
[% USE Categories %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Branches %]
3
[% USE KohaDates %]
4
[% USE KohaDates %]
4
[% SET userupdateview = 1 %]
5
[% SET userupdateview = 1 %]
5
6
Lines 156-168 Link Here
156
                                        Home library:</label>
157
                                        Home library:</label>
157
158
158
                                        <select id="borrower_branchcode" name="borrower_branchcode">
159
                                        <select id="borrower_branchcode" name="borrower_branchcode">
159
                                            [% FOREACH b IN branches %]
160
                                            [% PROCESS options_for_libraries libraries => Branches.all( selected => borrower.branchcode ) %]
160
                                                [% IF b.value == borrower.branchcode %]
161
                                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
162
                                                [% ELSE %]
163
                                                    <option value="[% b.value %]">[% b.branchname %]</option>
164
                                                [% END %]
165
                                            [% END %]
166
                                        </select>
161
                                        </select>
167
                                    </li>
162
                                    </li>
168
                                [% END %]
163
                                [% 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
[% USE ItemTypes %]
5
[% USE ItemTypes %]
Lines 214-236 Link Here
214
                                                                <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
215
                                                                <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
215
                                                                [% UNLESS ( bibitemloo.holdable ) %]
216
                                                                [% UNLESS ( bibitemloo.holdable ) %]
216
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
217
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
217
                                                                        [% FOREACH branchloo IN bibitemloo.branchloop %]
218
                                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
218
                                                                            [% IF ( branchloo.selected ) %]
219
                                                                                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
220
                                                                            [% ELSE %]
221
                                                                                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
222
                                                                            [% END %]
223
                                                                        [% END %]
224
                                                                    </select>
219
                                                                    </select>
225
                                                                [% ELSE %]
220
                                                                [% ELSE %]
226
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
221
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
227
                                                                        [% FOREACH branchloo IN bibitemloo.branchloop %]
222
                                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
228
                                                                            [% IF ( branchloo.selected ) %]
229
                                                                                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
230
                                                                            [% ELSE %]
231
                                                                                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
232
                                                                            [% END %]
233
                                                                        [% END %]
234
                                                                    </select>
223
                                                                    </select>
235
                                                                [% END # / UNLESS bibitemloo.holdable %]
224
                                                                [% END # / UNLESS bibitemloo.holdable %]
236
                                                            </li>
225
                                                            </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
[% USE KohaDates %]
4
[% USE KohaDates %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
Lines 54-69 Link Here
54
                                        <li><label for="itemtype">Item type:</label>
55
                                        <li><label for="itemtype">Item type:</label>
55
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
56
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
56
                                        </li>
57
                                        </li>
57
                                        [% IF ( branchloop ) %]
58
                                        [% IF branchcode %]
58
                                            <li><label for="branch">Library:</label>
59
                                            <li><label for="branch">Library:</label>
59
                                                <select name="branchcode" id="branch">
60
                                                <select name="branchcode" id="branch">
60
                                                    [% FOREACH branchloo IN branchloop %]
61
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
61
                                                        [% IF ( branchloo.selected ) %]
62
                                                            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
63
                                                        [% ELSE %]
64
                                                            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
65
                                                        [% END %]
66
                                                    [% END %]
67
                                                </select>
62
                                                </select>
68
                                            </li>
63
                                            </li>
69
                                        [% END %]
64
                                        [% END %]
(-)a/members/memberentry.pl (-6 / +5 lines)
Lines 42-47 use C4::Form::MessagingPreferences; Link Here
42
use Koha::Patron::Debarments;
42
use Koha::Patron::Debarments;
43
use Koha::Cities;
43
use Koha::Cities;
44
use Koha::DateUtils;
44
use Koha::DateUtils;
45
use Koha::Libraries;
45
use Koha::Patron::Categories;
46
use Koha::Patron::Categories;
46
use Koha::Token;
47
use Koha::Token;
47
use Email::Valid;
48
use Email::Valid;
Lines 595-602 foreach (keys(%flags)) { Link Here
595
}
596
}
596
597
597
# get Branch Loop
598
# get Branch Loop
598
# in modify mod: userbranch value for GetBranchesLoop() comes from borrowers table
599
# in modify mod: userbranch value comes from borrowers table
599
# in add    mod: userbranch value come from branches table (ip correspondence)
600
# in add    mod: userbranch value comes from branches table (ip correspondence)
600
601
601
my $userbranch = '';
602
my $userbranch = '';
602
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
603
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
Lines 606-615 if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { Link Here
606
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category_type eq 'C' ) )) {
607
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category_type eq 'C' ) )) {
607
    $userbranch = $data{'branchcode'};
608
    $userbranch = $data{'branchcode'};
608
}
609
}
610
$template->param( userbranch => $userbranch );
609
611
610
my $branchloop = GetBranchesLoop( $userbranch );
612
if ( Koha::Libraries->search->count < 1 ){
611
612
if( !$branchloop ){
613
    $no_add = 1;
613
    $no_add = 1;
614
    $template->param(no_branches => 1);
614
    $template->param(no_branches => 1);
615
}
615
}
Lines 681-687 $template->param( Link Here
681
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
681
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
682
  "op$op"   => 1);
682
  "op$op"   => 1);
683
683
684
$template->param( branchloop => $branchloop ) if ( $branchloop );
685
$template->param(
684
$template->param(
686
  nodouble  => $nodouble,
685
  nodouble  => $nodouble,
687
  borrowernumber  => $borrowernumber, #register number
686
  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::Patron::Modifications;
27
use Koha::Patron::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->id,
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 29-35 use C4::Form::MessagingPreferences; Link Here
29
use Koha::Patrons;
29
use Koha::Patrons;
30
use Koha::Patron::Modification;
30
use Koha::Patron::Modification;
31
use Koha::Patron::Modifications;
31
use Koha::Patron::Modifications;
32
use C4::Branch qw(GetBranchesLoop);
33
use C4::Scrubber;
32
use C4::Scrubber;
34
use Email::Valid;
33
use Email::Valid;
35
use Koha::DateUtils;
34
use Koha::DateUtils;
Lines 70-76 $template->param( Link Here
70
    action            => $action,
69
    action            => $action,
71
    hidden            => GetHiddenFields( $mandatory, 'registration' ),
70
    hidden            => GetHiddenFields( $mandatory, 'registration' ),
72
    mandatory         => $mandatory,
71
    mandatory         => $mandatory,
73
    branches          => GetBranchesLoop(),
74
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
72
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
75
);
73
);
76
74
(-)a/opac/opac-reserve.pl (-4 / +1 lines)
Lines 127-135 my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->us Link Here
127
($branches->{$branch}) or $branch = "";     # Confirm branch is real
127
($branches->{$branch}) or $branch = "";     # Confirm branch is real
128
$template->param( branch => $branch );
128
$template->param( branch => $branch );
129
129
130
# make branch selection options...
131
my $branchloop = GetBranchesLoop($branch);
132
133
# Is the person allowed to choose their branch
130
# Is the person allowed to choose their branch
134
my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
131
my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
135
132
Lines 383-389 foreach my $biblioNum (@biblionumbers) { Link Here
383
380
384
    my $record = GetMarcBiblio($biblioNum);
381
    my $record = GetMarcBiblio($biblioNum);
385
    # Init the bib item with the choices for branch pickup
382
    # Init the bib item with the choices for branch pickup
386
    my %biblioLoopIter = ( branchloop => $branchloop );
383
    my %biblioLoopIter;
387
384
388
    # Get relevant biblio data.
385
    # Get relevant biblio data.
389
    my $biblioData = $biblioDataHash{$biblioNum};
386
    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 202-210 if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { Link Here
202
    }
201
    }
203
    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
202
    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
204
203
205
# make branch selection options...
204
    $template->param( branchcode => $branchcode );
206
    my $branchloop = GetBranchesLoop($branchcode);
207
    $template->param( branchloop => $branchloop );
208
}
205
}
209
206
210
my $mandatoryfields = '';
207
my $mandatoryfields = '';
(-)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 272-295 if ($show_barcode) { Link Here
272
}
272
}
273
$template->param( show_barcode => 1 ) if $show_barcode;
273
$template->param( show_barcode => 1 ) if $show_barcode;
274
274
275
# load the branches
276
my $branches = GetBranches();
277
my @branch_loop;
278
for my $branch_hash ( sort keys %{$branches} ) {
279
    my $selected;
280
    if ( C4::Context->preference('SearchMyLibraryFirst') ) {
281
        $selected =
282
          ( C4::Context->userenv
283
              && ( $branch_hash eq C4::Context->userenv->{branch} ) );
284
    }
285
    push @branch_loop,
286
      { value      => "branch: $branch_hash",
287
        branchname => $branches->{$branch_hash}->{'branchname'},
288
        selected   => $selected,
289
      };
290
}
291
$template->param( branchloop => \@branch_loop );
292
293
# now the reserved items....
275
# now the reserved items....
294
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
276
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
295
277
(-)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 29-41 use C4::Auth qw/:DEFAULT get_session/; Link Here
29
use C4::Output;
29
use C4::Output;
30
use C4::Debug;
30
use C4::Debug;
31
use C4::Koha qw/GetFrameworksLoop/;
31
use C4::Koha qw/GetFrameworksLoop/;
32
use C4::Branch;
33
use C4::Context;
32
use C4::Context;
34
use Koha::Caches;
33
use Koha::Caches;
35
use C4::Log;
34
use C4::Log;
36
use Koha::DateUtils qw/dt_from_string output_pref/;
35
use Koha::DateUtils qw/dt_from_string output_pref/;
37
use Koha::AuthorisedValue;
36
use Koha::AuthorisedValue;
38
use Koha::AuthorisedValues;
37
use Koha::AuthorisedValues;
38
use Koha::Libraries;
39
use Koha::Patron::Categories;
39
use Koha::Patron::Categories;
40
40
41
=head1 NAME
41
=head1 NAME
Lines 664-673 elsif ($phase eq 'Run this report'){ Link Here
664
                    my %authorised_lib;
664
                    my %authorised_lib;
665
                    # builds list, depending on authorised value...
665
                    # builds list, depending on authorised value...
666
                    if ( $authorised_value eq "branches" ) {
666
                    if ( $authorised_value eq "branches" ) {
667
                        my $branches = GetBranchesLoop();
667
                        my $libraries = Koha::Libraries->search( {}, { order_by => ['branchname'] } );
668
                        foreach my $thisbranch (@$branches) {
668
                        while ( my $library = $libraries->next ) {
669
                            push @authorised_values, $thisbranch->{value};
669
                            push @authorised_values, $library->branchcode;
670
                            $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
670
                            $authorised_lib{$library->branchcode} = $library->branchname;
671
                        }
671
                        }
672
                    }
672
                    }
673
                    elsif ( $authorised_value eq "itemtypes" ) {
673
                    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 / +1 lines)
Lines 67-78 my $showallitems = $input->param('showallitems'); Link Here
67
my $branches = GetBranches();
67
my $branches = GetBranches();
68
my $itemtypes = GetItemTypes();
68
my $itemtypes = GetItemTypes();
69
69
70
my $userbranch = '';
71
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
72
    $userbranch = C4::Context->userenv->{'branch'};
73
}
74
75
76
# Select borrowers infos
70
# Select borrowers infos
77
my $findborrower = $input->param('findborrower');
71
my $findborrower = $input->param('findborrower');
78
$findborrower = '' unless defined $findborrower;
72
$findborrower = '' unless defined $findborrower;
Lines 588-600 foreach my $biblionumber (@biblionumbers) { Link Here
588
        $reserve{'suspend_until'}  = $res->suspend_until();
582
        $reserve{'suspend_until'}  = $res->suspend_until();
589
        $reserve{'reserve_id'}     = $res->reserve_id();
583
        $reserve{'reserve_id'}     = $res->reserve_id();
590
        $reserve{itemtype}         = $res->itemtype();
584
        $reserve{itemtype}         = $res->itemtype();
591
585
        $reserve{branchcode}       = $res->branchcode();
592
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
593
            $reserve{'branchloop'} = [ Koha::Libraries->find( $res->branchcode() ) ];
594
        }
595
        else {
596
            $reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() );
597
        }
598
586
599
        push( @reserveloop, \%reserve );
587
        push( @reserveloop, \%reserve );
600
    }
588
    }
Lines 603-609 foreach my $biblionumber (@biblionumbers) { Link Here
603
    my $time = time();
591
    my $time = time();
604
592
605
    $template->param(
593
    $template->param(
606
                     branchloop  => GetBranchesLoop($userbranch),
607
                     time        => $time,
594
                     time        => $time,
608
                     fixedRank   => $fixedRank,
595
                     fixedRank   => $fixedRank,
609
                    );
596
                    );
(-)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 (-3 lines)
Lines 25-31 use C4::Acquisition; Link Here
25
use C4::Output;
25
use C4::Output;
26
use C4::Context;
26
use C4::Context;
27
use C4::Letters;
27
use C4::Letters;
28
use C4::Branch;    # GetBranches GetBranchesLoop
29
use C4::Koha qw( GetAuthorisedValues );
28
use C4::Koha qw( GetAuthorisedValues );
30
29
31
use Koha::AdditionalField;
30
use Koha::AdditionalField;
Lines 65-71 for my $field ( @$additional_fields ) { Link Here
65
    }
64
    }
66
}
65
}
67
66
68
my $branchloop = GetBranchesLoop();
69
67
70
my @serialnums=$input->multi_param('serialid');
68
my @serialnums=$input->multi_param('serialid');
71
if (@serialnums) { # i.e. they have been flagged to generate claims
69
if (@serialnums) { # i.e. they have been flagged to generate claims
Lines 105-111 $template->param( Link Here
105
        missingissues => \@missingissues,
103
        missingissues => \@missingissues,
106
        supplierid => $supplierid,
104
        supplierid => $supplierid,
107
        claimletter => $claimletter,
105
        claimletter => $claimletter,
108
        branchloop   => $branchloop,
109
        additional_fields_for_subscription => $additional_fields,
106
        additional_fields_for_subscription => $additional_fields,
110
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql' }) ],
107
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql' }) ],
111
        letters => $letters,
108
        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 113-122 my $notes = ''; Link Here
113
my $checkitem      = undef;
113
my $checkitem      = undef;
114
my $found          = undef;
114
my $found          = undef;
115
115
116
my @branches = GetBranchesLoop();
116
my $branchcode = Koha::Libraries->search->next->branchcode;
117
my $branch = $branches[0][0]{value};
118
117
119
AddReserve($branch,    $borrowernumber, $biblionumber,
118
AddReserve($branchcode,    $borrowernumber, $biblionumber,
120
        $bibitems,  $priority, $resdate, $expdate, $notes,
119
        $bibitems,  $priority, $resdate, $expdate, $notes,
121
        $title,      $checkitem, $found);
120
        $title,      $checkitem, $found);
122
121
(-)a/tools/batchMod.pl (-9 / +9 lines)
Lines 292-302 $query .= qq{ AND ( branchcode = ? OR branchcode IS NULL ) } if $branch_limit; Link Here
292
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
292
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
293
my $authorised_values_sth = $dbh->prepare( $query );
293
my $authorised_values_sth = $dbh->prepare( $query );
294
294
295
my $branches = GetBranchesLoop();  # build once ahead of time, instead of multiple times later.
295
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
296
296
297
# Adding a default choice, in case the user does not want to modify the branch
297
# Adding a default choice, in case the user does not want to modify the branch
298
my $nochange_branch = { branchname => '', value => '', selected => 1 };
298
my $nochange_branch = { branchname => '', value => '', selected => 1 };
299
unshift (@$branches, $nochange_branch);
299
unshift (@$libraries, $nochange_branch);
300
300
301
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
301
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
302
302
Lines 350-363 foreach my $tag (sort keys %{$tagslib}) { Link Here
350
	my @authorised_values;
350
	my @authorised_values;
351
	my %authorised_lib;
351
	my %authorised_lib;
352
	# builds list, depending on authorised value...
352
	# builds list, depending on authorised value...
353
  
353
354
	if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
354
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
355
	    foreach my $thisbranch (@$branches) {
355
        foreach my $library (@$libraries) {
356
		push @authorised_values, $thisbranch->{value};
356
            push @authorised_values, $library->{branchcode};
357
		$authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
357
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
358
	    }
358
        }
359
        $value = "";
359
        $value = "";
360
	}
360
    }
361
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
361
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
362
        push @authorised_values, "";
362
        push @authorised_values, "";
363
        my $itemtypes = GetItemTypes( style => 'array' );
363
        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 85-93 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ Link Here
85
        debug           => 1,
84
        debug           => 1,
86
});
85
});
87
86
88
# get the branches and pass them to the template
89
my $branches = GetBranchesLoop();
90
$template->param( branches => $branches ) if ( $branches );
91
# get the patron categories and pass them to the template
87
# get the patron categories and pass them to the template
92
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
88
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
93
$template->param( categories => \@patron_categories );
89
$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