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

(-)a/C4/Auth.pm (-7 / +2 lines)
Lines 29-35 require Exporter; Link Here
29
use C4::Context;
29
use C4::Context;
30
use C4::Templates;    # to get the template
30
use C4::Templates;    # to get the template
31
use C4::Languages;
31
use C4::Languages;
32
use C4::Branch;       # GetBranches
33
use C4::Search::History;
32
use C4::Search::History;
34
use Koha;
33
use Koha;
35
use Koha::AuthUtils qw(hash_password);
34
use Koha::AuthUtils qw(hash_password);
Lines 513-519 sub get_template_and_user { Link Here
513
        $template->param(
512
        $template->param(
514
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
513
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
515
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
514
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
516
            BranchesLoop                          => GetBranchesLoop($opac_name),
517
            BranchCategoriesLoop                  => $library_categories,
515
            BranchCategoriesLoop                  => $library_categories,
518
            opac_name                             => $opac_name,
516
            opac_name                             => $opac_name,
519
            LibraryName                           => "" . C4::Context->preference("LibraryName"),
517
            LibraryName                           => "" . C4::Context->preference("LibraryName"),
Lines 1079-1085 sub checkauth { Link Here
1079
                        $branchcode = $query->param('branch');
1077
                        $branchcode = $query->param('branch');
1080
                        $branchname = Koha::Libraries->find($branchcode)->branchname;
1078
                        $branchname = Koha::Libraries->find($branchcode)->branchname;
1081
                    }
1079
                    }
1082
                    my $branches = GetBranches();
1080
                    my $branches = C4::Branch::GetBranches();
1083
                    if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
1081
                    if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
1084
1082
1085
                        # we have to check they are coming from the right ip range
1083
                        # we have to check they are coming from the right ip range
Lines 1090-1096 sub checkauth { Link Here
1090
                        }
1088
                        }
1091
                    }
1089
                    }
1092
1090
1093
                    my @branchesloop;
1094
                    foreach my $br ( keys %$branches ) {
1091
                    foreach my $br ( keys %$branches ) {
1095
1092
1096
                        #     now we work with the treatment of ip
1093
                        #     now we work with the treatment of ip
Lines 1207-1213 sub checkauth { Link Here
1207
    my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
1204
    my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
1208
    my $template = C4::Templates::gettemplate( $template_name, $type, $query );
1205
    my $template = C4::Templates::gettemplate( $template_name, $type, $query );
1209
    $template->param(
1206
    $template->param(
1210
        branchloop                            => GetBranchesLoop(),
1211
        OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
1207
        OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
1212
        opaclayoutstylesheet                  => C4::Context->preference("opaclayoutstylesheet"),
1208
        opaclayoutstylesheet                  => C4::Context->preference("opaclayoutstylesheet"),
1213
        login                                 => 1,
1209
        login                                 => 1,
Lines 1531-1538 sub check_api_auth { Link Here
1531
                    $branchcode = $query->param('branch');
1527
                    $branchcode = $query->param('branch');
1532
                    $branchname = Koha::Libraries->find($branchcode)->branchname;
1528
                    $branchname = Koha::Libraries->find($branchcode)->branchname;
1533
                }
1529
                }
1534
                my $branches = GetBranches();
1530
                my $branches = C4::Branch::GetBranches();
1535
                my @branchesloop;
1536
                foreach my $br ( keys %$branches ) {
1531
                foreach my $br ( keys %$branches ) {
1537
1532
1538
                    #     now we work with the treatment of ip
1533
                    #     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/Koha/Template/Plugin/Branches.pm (-9 / +10 lines)
Lines 63-86 sub all { Link Here
63
        SELECT branchcode, branchname
63
        SELECT branchcode, branchname
64
        FROM branches
64
        FROM branches
65
    |;
65
    |;
66
    if (    C4::Branch::onlymine
66
    if (    C4::Context->preference('IndependentBranches')
67
        and C4::Context->userenv
67
        and C4::Context->userenv
68
        && !C4::Context->IsSuperLibrarian()
68
        and C4::Context->userenv->{branch} )
69
        and C4::Context->userenv->{branch} )
69
    {
70
    {
70
        $query .= q| WHERE branchcode = ? |;
71
        $query .= q| WHERE branchcode = ? |;
71
        push @params, C4::Context->userenv->{branch};
72
        push @params, C4::Context->userenv->{branch};
72
    }
73
    }
73
    $query .= q| ORDER BY branchname|;
74
    my $libraries = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
74
    my $branches = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
75
75
76
    if ( $selected ) {
76
    for my $l ( @$libraries ) {
77
        for my $branch ( @$branches ) {
77
        if (       $selected and $l->{branchcode} eq $selected
78
            if ( $branch->{branchcode} eq $selected ) {
78
            or not $selected and C4::Context->userenv and $l->{branchcode} eq C4::Context->userenv->{branch}
79
                $branch->{selected} = 1;
79
        ) {
80
            }
80
            $l->{selected} = 1;
81
        }
81
        }
82
    }
82
    }
83
    return $branches;
83
84
    return $libraries;
84
}
85
}
85
86
86
1;
87
1;
(-)a/acqui/basketgroup.pl (-5 / +2 lines)
Lines 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 425-440 elsif ($op eq "add-branch-item") { Link Here
425
    }
425
    }
426
}
426
}
427
427
428
my $branches = GetBranches();
429
my @branchloop;
430
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
431
    push @branchloop, {
432
        value      => $thisbranch,
433
        selected   => $thisbranch eq $branch,
434
        branchname => $branches->{$thisbranch}->{'branchname'},
435
    };
436
}
437
438
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
428
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
439
429
440
my @row_loop;
430
my @row_loop;
Lines 588-595 $template->param( Link Here
588
    patron_categories => $patron_categories,
578
    patron_categories => $patron_categories,
589
                        itemtypeloop => \@itemtypes,
579
                        itemtypeloop => \@itemtypes,
590
                        rules => \@sorted_row_loop,
580
                        rules => \@sorted_row_loop,
591
                        branchloop => \@branchloop,
581
                        humanbranch => ($branch ne '*' ? $branch : ''),
592
                        humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''),
593
                        current_branch => $branch,
582
                        current_branch => $branch,
594
                        definedbranch => scalar(@sorted_row_loop)>0
583
                        definedbranch => scalar(@sorted_row_loop)>0
595
                        );
584
                        );
(-)a/catalogue/search.pl (-18 / +1 lines)
Lines 205-230 if($cgi->cookie("holdfor")){ Link Here
205
    );
205
    );
206
}
206
}
207
207
208
# load the branches
209
my $branches = GetBranches();
210
211
# Populate branch_loop with all branches sorted by their name.  If
212
# IndependentBranches is activated, set the default branch to the borrower
213
# branch, except for superlibrarian who need to search all libraries.
214
my $user = C4::Context->userenv;
215
my @branch_loop = map {
216
     {
217
        value      => $_,
218
        branchname => $branches->{$_}->{branchname},
219
        selected   => $user->{branch} eq $_ && C4::Branch::onlymine(),
220
     }
221
} sort {
222
    $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
223
} keys %$branches;
224
225
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
208
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
226
209
227
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
210
$template->param(searchdomainloop => $categories);
228
211
229
# load the Type stuff
212
# load the Type stuff
230
my $itemtypes = GetItemTypes;
213
my $itemtypes = GetItemTypes;
(-)a/cataloguing/additem.pl (-12 / +10 lines)
Lines 29-37 use C4::Items; Link Here
29
use C4::Context;
29
use C4::Context;
30
use C4::Circulation;
30
use C4::Circulation;
31
use C4::Koha;
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 170-178 sub generate_subfield_form { Link Here
170
            # builds list, depending on authorised value...
170
            # builds list, depending on authorised value...
171
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
171
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
172
                foreach my $thisbranch (@$branches) {
172
                foreach my $thisbranch (@$branches) {
173
                    push @authorised_values, $thisbranch->{value};
173
                    push @authorised_values, $thisbranch->{branchcode};
174
                    $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
174
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
175
                    $value = $thisbranch->{value} if $thisbranch->{selected} && !$value;
175
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
176
                }
176
                }
177
            }
177
            }
178
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
178
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
Lines 852-864 my $i=0; Link Here
852
852
853
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
853
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
854
854
855
my $onlymine =
856
     C4::Context->preference('IndependentBranches')
857
  && C4::Context->userenv
858
  && !C4::Context->IsSuperLibrarian()
859
  && C4::Context->userenv->{branch};
860
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
855
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
861
my $branches = GetBranchesLoop($branch,$onlymine);  # build once ahead of time, instead of multiple times later.
856
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
857
for my $library ( @$libraries ) {
858
    $library->{selected} = 1 if $library->{branchcode} eq $branch
859
}
862
860
863
# We generate form, from actuel record
861
# We generate form, from actuel record
864
@fields = ();
862
@fields = ();
Lines 873-879 if($itemrecord){ Link Here
873
871
874
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
872
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
875
873
876
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
874
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
877
            push @fields, "$tag$subfieldtag";
875
            push @fields, "$tag$subfieldtag";
878
            push (@loop_data, $subfield_data);
876
            push (@loop_data, $subfield_data);
879
            $i++;
877
            $i++;
Lines 897-903 foreach my $tag ( keys %{$tagslib}){ Link Here
897
        my @values = (undef);
895
        my @values = (undef);
898
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
896
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
899
        for my $value (@values){
897
        for my $value (@values){
900
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
898
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
901
            push (@loop_data, $subfield_data);
899
            push (@loop_data, $subfield_data);
902
            $i++;
900
            $i++;
903
        }
901
        }
(-)a/circ/bookcount.pl (-5 / +7 lines)
Lines 32-37 use C4::Auth; Link Here
32
use C4::Branch; # GetBranches
32
use C4::Branch; # GetBranches
33
use C4::Biblio; # GetBiblioItemData
33
use C4::Biblio; # GetBiblioItemData
34
use Koha::DateUtils;
34
use Koha::DateUtils;
35
use Koha::Libraries;
35
36
36
my $input        = new CGI;
37
my $input        = new CGI;
37
my $itm          = $input->param('itm');
38
my $itm          = $input->param('itm');
Lines 69-78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
69
    }
70
    }
70
);
71
);
71
72
72
my $branchloop = GetBranchesLoop(C4::Context->userenv->{branch});
73
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
73
foreach (@$branchloop) {
74
for my $library ( @$libraries ) {
74
    $_->{issues}     = issuesat($itm, $_->{value});
75
    $library->{selected} = 1 if $library->{branchcode} eq C4::Context->userenv->{branch};
75
    $_->{seen}       = lastseenat( $itm, $_->{value} ) || undef;
76
    $library->{issues}     = issuesat($itm, $library->{branchcode});
77
    $library->{seen}       = lastseenat( $itm, $library->{branchcode} ) || undef;
76
}
78
}
77
79
78
$template->param(
80
$template->param(
Lines 85-91 $template->param( Link Here
85
    holdingbranch           => $holdingbranch,
87
    holdingbranch           => $holdingbranch,
86
    lastdate                => $lastdate ? $lastdate : 0,
88
    lastdate                => $lastdate ? $lastdate : 0,
87
    count                   => $count,
89
    count                   => $count,
88
    branchloop              => $branchloop,
90
    libraries               => $libraries,
89
);
91
);
90
92
91
output_html_with_http_headers $input, $cookie, $template->output;
93
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/circ/branchtransfers.pl (-1 lines)
Lines 236-242 $template->param( Link Here
236
    cancelled               => $cancelled,
236
    cancelled               => $cancelled,
237
    setwaiting              => $setwaiting,
237
    setwaiting              => $setwaiting,
238
    trsfitemloop            => \@trsfitemloop,
238
    trsfitemloop            => \@trsfitemloop,
239
    branchoptionloop        => GetBranchesLoop($tobranchcd),
240
    errmsgloop              => \@errmsgloop,
239
    errmsgloop              => \@errmsgloop,
241
    CircAutocompl           => C4::Context->preference("CircAutocompl")
240
    CircAutocompl           => C4::Context->preference("CircAutocompl")
242
);
241
);
(-)a/circ/overdue.pl (-3 lines)
Lines 213-221 if (@patron_attr_filter_loop) { Link Here
213
213
214
$template->param(
214
$template->param(
215
    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
215
    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
216
    branchloop   => GetBranchesLoop($branchfilter, $onlymine),
217
    homebranchloop => GetBranchesLoop( $homebranchfilter, $onlymine ),
218
    holdingbranchloop => GetBranchesLoop( $holdingbranchfilter, $onlymine ),
219
    branchfilter => $branchfilter,
216
    branchfilter => $branchfilter,
220
    homebranchfilter => $homebranchfilter,
217
    homebranchfilter => $homebranchfilter,
221
    holdingbranchfilter => $homebranchfilter,
218
    holdingbranchfilter => $homebranchfilter,
(-)a/circ/selectbranchprinter.pl (-2 / +2 lines)
Lines 26-32 use C4::Output; Link Here
26
use C4::Auth qw/:DEFAULT get_session/;
26
use C4::Auth qw/:DEFAULT get_session/;
27
use C4::Print;  # GetPrinters
27
use C4::Print;  # GetPrinters
28
use C4::Koha;
28
use C4::Koha;
29
use C4::Branch; # GetBranches GetBranchesLoop
29
use C4::Branch; # GetBranches
30
30
31
use Koha::Libraries;
31
use Koha::Libraries;
32
32
Lines 136-142 if (scalar @updated and not scalar @recycle_loop) { Link Here
136
$template->param(
136
$template->param(
137
    referer     => $referer,
137
    referer     => $referer,
138
    printerloop => \@printerloop,
138
    printerloop => \@printerloop,
139
    branchloop  => GetBranchesLoop($branch),
139
    branch      => $branch,
140
    recycle_loop=> \@recycle_loop,
140
    recycle_loop=> \@recycle_loop,
141
);
141
);
142
142
(-)a/circ/view_holdsqueue.pl (-2 lines)
Lines 30-36 use C4::Output; Link Here
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::Items;
31
use C4::Items;
32
use C4::Koha;   # GetItemTypes
32
use C4::Koha;   # GetItemTypes
33
use C4::Branch; # GetBranches
34
use C4::HoldsQueue qw(GetHoldsQueueItems);
33
use C4::HoldsQueue qw(GetHoldsQueueItems);
35
34
36
my $query = new CGI;
35
my $query = new CGI;
Lines 72-78 foreach my $thisitemtype ( sort keys %$itemtypes ) { Link Here
72
}
71
}
73
72
74
$template->param(
73
$template->param(
75
     branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
76
   itemtypeloop => \@itemtypesloop,
74
   itemtypeloop => \@itemtypesloop,
77
);
75
);
78
76
(-)a/course_reserves/add_items.pl (-2 lines)
Lines 26-32 use C4::Auth; Link Here
26
use C4::Output;
26
use C4::Output;
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Biblio;
28
use C4::Biblio;
29
use C4::Branch;
30
29
31
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
30
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
32
31
Lines 73-79 if ( $action eq 'lookup' ) { Link Here
73
        ccodes    => GetAuthorisedValues('CCODE'),
72
        ccodes    => GetAuthorisedValues('CCODE'),
74
        locations => GetAuthorisedValues('LOC'),
73
        locations => GetAuthorisedValues('LOC'),
75
        itypes    => GetItemTypes( style => 'array' ),
74
        itypes    => GetItemTypes( style => 'array' ),
76
        branches  => GetBranchesLoop(),
77
        return    => $return,
75
        return    => $return,
78
    );
76
    );
79
77
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-search.inc (-4 / +5 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
<div class="gradient">
2
<div class="gradient">
2
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Fund Admin Resident Search Box -->
3
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Fund Admin Resident Search Box -->
3
4
Lines 9-19 Link Here
9
            <label for="filter_budgetbranch">Library: </label>
10
            <label for="filter_budgetbranch">Library: </label>
10
            <select name="filter_budgetbranch" id="filter_budgetbranch" style="width:10em;">
11
            <select name="filter_budgetbranch" id="filter_budgetbranch" style="width:10em;">
11
                <option value=""></option>
12
                <option value=""></option>
12
                    [% FOREACH branchloo IN branchloop %]
13
                    [% FOREACH branchloo IN Branches.all( selected => selected_branchcode ) %]
13
                        [% IF ( branchloo.selected ) %]
14
                        [% IF branchloo.selected %]
14
                        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
15
                        <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
15
                        [% ELSE %]
16
                        [% ELSE %]
16
                        <option value="[% branchloo.value %]" >[% branchloo.branchname %]</option>
17
                        <option value="[% branchloo.branchcode %]" >[% branchloo.branchname %]</option>
17
                        [% END %]
18
                        [% END %]
18
                    [% END %]
19
                    [% END %]
19
            </select>
20
            </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+1 lines)
Lines 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 116-123 $(document).ready(function() { Link Here
116
    <div id="yui-main">
117
    <div id="yui-main">
117
    <div class="yui-b">
118
    <div class="yui-b">
118
    <h1 class="parameters">
119
    <h1 class="parameters">
119
        [% IF ( humanbranch ) %]
120
        [% IF humanbranch %]
120
            Defining circulation and fine rules for "[% humanbranch %]"
121
            Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) %]"
121
        [% ELSE %]
122
        [% ELSE %]
122
            Defining circulation and fine rules for all libraries
123
            Defining circulation and fine rules for all libraries
123
        [% END %]
124
        [% END %]
Lines 141-154 $(document).ready(function() { Link Here
141
        Select a library :
142
        Select a library :
142
            <select name="branch" id="branch" style="width:20em;">
143
            <select name="branch" id="branch" style="width:20em;">
143
                <option value="*">All libraries</option>
144
                <option value="*">All libraries</option>
144
            [% FOREACH branchloo IN branchloop %]
145
                [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch ) %]
145
				[% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
146
            [% END %]
147
            </select>
146
            </select>
148
        </form>
147
        </form>
149
[% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label 
148
        [% IF ( definedbranch ) %]
150
for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" />
149
            <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
151
            <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 %]
150
                <label for="tobranch"><strong>Clone these rules to:</strong></label>
151
                <input type="hidden" name="frombranch" value="[% current_branch %]" />
152
                <select name="tobranch" id="tobranch">
153
                    [% FOREACH l IN Branches.all() %]
154
                        <option value="[% l.value %]">[% l.branchname %]</option>
155
                    [% END %]
156
                </select>
157
                <input type="submit" value="Clone" />
158
            </form>
159
        [% END %]
152
160
153
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
161
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
154
            <input type="hidden" name="op" value="add" />
162
            <input type="hidden" name="op" value="add" />
Lines 382-388 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
382
        </form>
390
        </form>
383
    </div>
391
    </div>
384
    <div id="defaults-for-this-library" class="container">
392
    <div id="defaults-for-this-library" class="container">
385
    <h3>Default checkout, hold and return policy[% IF ( humanbranch ) %] for [% humanbranch %][% END %]</h3>
393
    <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
386
        <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>
394
        <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>
387
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
395
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
388
            <input type="hidden" name="op" value="set-branch-defaults" />
396
            <input type="hidden" name="op" value="set-branch-defaults" />
Lines 494-500 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
494
    </div>
502
    </div>
495
    [% IF ( show_branch_cat_rule_form ) %]
503
    [% IF ( show_branch_cat_rule_form ) %]
496
    <div id="holds-policy-by-patron-category" class="container">
504
    <div id="holds-policy-by-patron-category" class="container">
497
    <h3>[% IF humanbranch %]Checkout limit by patron category for [% humanbranch %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
505
    <h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
498
        <p>For this library, you can specify the maximum number of loans that
506
        <p>For this library, you can specify the maximum number of loans that
499
            a patron of a given category can make, regardless of the item type.
507
            a patron of a given category can make, regardless of the item type.
500
        </p>
508
        </p>
Lines 558-564 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
558
    </div>
566
    </div>
559
    [% END %]
567
    [% END %]
560
    <div id="holds-policy-by-item-type" class="container">
568
    <div id="holds-policy-by-item-type" class="container">
561
    <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3>
569
    <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) %][% ELSE %]Default holds policy by item type[% END %]</h3>
562
        <p>
570
        <p>
563
            For this library, you can edit rules for given itemtypes, regardless
571
            For this library, you can edit rules for given itemtypes, regardless
564
            of the patron's category.
572
            of the patron's category.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt (-2 / +2 lines)
Lines 100-107 $(document).ready(function(){ Link Here
100
                <table>
100
                <table>
101
                    <tr>
101
                    <tr>
102
                        <th>From \ To</th>
102
                        <th>From \ To</th>
103
                        [% FOR b IN branchloop %]
103
                        [% FOR b IN Branches.all() %]
104
                        <th>[% b.name %]</th>
104
                        <th>[% b.branchname %]</th>
105
                        [% END %]
105
                        [% END %]
106
                    </tr>
106
                    </tr>
107
                [% FOR bf IN branchfromloop %]
107
                [% 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 203-235 overdue as of [% todaysdate %][% IF ( isfiltered ) %] <span style="font-size:70% Link Here
203
        <label>Item home library:</label>
203
        <label>Item home library:</label>
204
        <select name="homebranch" id="homebranch">
204
        <select name="homebranch" id="homebranch">
205
            <option value="">Any</option>
205
            <option value="">Any</option>
206
            [% FOREACH homebranchloo IN homebranchloop %][% IF ( homebranchloo.selected ) %]
206
            [% PROCESS options_for_libraries libraries => Branches.all( selected => homebranchfilter ) %]
207
            <option value="[% homebranchloo.value |html %]" selected="selected">[% homebranchloo.branchname %]</option>[% ELSE %]
208
            <option value="[% homebranchloo.value |html %]">[% homebranchloo.branchname %]</option>[% END %]
209
            [% END %]
210
        </select>
207
        </select>
211
    </li>
208
    </li>
212
209
213
    <li>
210
    <li>
214
        <label>Item holding library:</label>
211
        <label>Item holding library:</label>
215
            <select name="holdingbranch" id="holdingbranch">
212
        <select name="holdingbranch" id="holdingbranch">
216
            <option value="">Any</option>
213
            <option value="">Any</option>
217
            [% FOREACH holdingbranchloo IN holdingbranchloop %][% IF ( holdingbranchloo.selected ) %]
214
            [% PROCESS options_for_libraries libraries => Branches.all( selected => holdingbranchfilter ) %]
218
            <option value="[% holdingbranchloo.value |html %]" selected="selected">[% holdingbranchloo.branchname %]</option>[% ELSE %]
219
            <option value="[% holdingbranchloo.value |html %]">[% holdingbranchloo.branchname %]</option>[% END %]
220
            [% END %]
221
        </select>
215
        </select>
222
    </li>
216
    </li>
223
217
224
    <li>
218
    <li>
225
    <label>Library of the patron:</label><select name="branch" id="branch">
219
        <label>Library of the patron:</label>
226
        <option value="">Any</option>
220
        <select name="branch" id="branch">
227
      [% FOREACH branchloo IN branchloop %]
221
            <option value="">Any</option>
228
        [% IF ( branchloo.selected ) %]
222
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
229
        <option value="[% branchloo.value |html %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]
223
        </select>
230
        <option value="[% branchloo.value |html %]">[% branchloo.branchname %]</option>[% END %]
231
      [% END %]
232
      </select>
233
    </li>
224
    </li>
234
225
235
    <li><label for="order">Sort by:</label> <select name="order" id="order">
226
    <li><label for="order">Sort by:</label> <select name="order" id="order">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt (-7 / +1 lines)
Lines 54-66 Updated:<ul> Link Here
54
    [% ELSE %]
54
    [% ELSE %]
55
        <li><label for="branch">Choose library:</label>
55
        <li><label for="branch">Choose library:</label>
56
        <select name="branch" id="branch">
56
        <select name="branch" id="branch">
57
        [% FOREACH branchloo IN branchloop %]
57
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
58
            [% IF ( branchloo.selected ) %]
59
            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
60
            [% ELSE %]
61
            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
62
            [% END %]
63
        [% END %]
64
        </select></li>
58
        </select></li>
65
    [% END %]
59
    [% END %]
66
<!--
60
<!--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (-8 / +6 lines)
Lines 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 503-515 function filterByFirstLetterSurname(letter) { Link Here
503
                [% IF branches.size != 1 %]
503
                [% IF branches.size != 1 %]
504
                  <option value="">Any</option>
504
                  <option value="">Any</option>
505
                [% END %]
505
                [% END %]
506
                [% FOREACH b IN branches %]
506
                [% PROCESS options_for_libraries libraries => branches %]
507
                  [% IF b.selected %]
508
                    <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
509
                  [% ELSE %]
510
                    <option value="[% b.branchcode %]">[% b.branchname %]</option>
511
                  [% END %]
512
                [% END %]
513
              </select>
507
              </select>
514
            </li>
508
            </li>
515
          </ol>
509
          </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 535-549 $(document).ready(function() { Link Here
535
    <li>
536
    <li>
536
        <label for="libraries" class="required">Library:</label>
537
        <label for="libraries" class="required">Library:</label>
537
        <select name="branchcode" size="1" id="libraries">
538
        <select name="branchcode" size="1" id="libraries">
538
        [%- FOREACH branchloo IN branchloop %]
539
            [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch ) %]
539
          [% IF ( branchloo.selected ) -%]
540
        </select>
540
            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
541
        <span class="required">Required</span>
541
          [%- ELSE -%]
542
            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
543
          [%- END -%]
544
        [%- END %]
545
      </select>
546
      <span class="required">Required</span>
547
    </li>
542
    </li>
548
        [% END %]
543
        [% END %]
549
    <li>
544
    <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 363-375 function checkMultiHold() { Link Here
363
        <li>
363
        <li>
364
            <label for="pickup">Pickup at:</label>
364
            <label for="pickup">Pickup at:</label>
365
            <select name="pickup" size="1" id="pickup">
365
            <select name="pickup" size="1" id="pickup">
366
            [%- FOREACH branchloo IN branchloop %]
366
                [% PROCESS options_for_libraries libraries => Branches.all() %]
367
              [% IF ( branchloo.selected ) -%]
368
                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
369
              [%- ELSE -%]
370
                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
371
              [%- END -%]
372
            [%- END %]
373
            </select>
367
            </select>
374
        </li>
368
        </li>
375
369
Lines 739-755 function checkMultiHold() { Link Here
739
            Item being transferred to <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" />
733
            Item being transferred to <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" />
740
         [% END %]
734
         [% END %]
741
    [% ELSE %]
735
    [% ELSE %]
742
          <select name="pickup">
736
        <select name="pickup">
743
      [% FOREACH branchloo IN reserveloo.branchloop %]
737
            [% PROCESS options_for_libraries libraries => Branches.all( selected => reserveloo.branchcode ) %]
744
        [% IF ( branchloo.selected ) %]
738
        </select>
745
            <option value="[% branchloo.branchcode %]" selected="selected">
746
        [% ELSE %]
747
            <option value="[% branchloo.branchcode %]">
748
        [% END %]
749
              [% branchloo.branchname %]
750
            </option>
751
      [% END %]
752
          </select>
753
    [% END %]
739
    [% END %]
754
        </td>
740
        </td>
755
        <td>
741
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt (-12 / +5 lines)
Lines 1-3 Link Here
1
[% USE Branches %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Serials &rsaquo; Check expiration</title>
4
<title>Koha &rsaquo; Serials &rsaquo; Check expiration</title>
Lines 53-71 Link Here
53
54
54
        <li><label for="issn">ISSN:</label>
55
        <li><label for="issn">ISSN:</label>
55
        <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li>
56
        <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li>
56
        [% IF (branches_loop.size) %]
57
        [% IF can_change_library %]
57
        <li><label for="branch">Library:</label>
58
        <li><label for="branch">Library:</label>
58
        <select id="branch" name="branch">
59
        <select id="branch" name="branch">
59
            <option value="">All</option>
60
            <option value="">All</option>
60
            [% FOREACH branch IN branches_loop %]
61
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
61
                [% IF branch.selected %]
62
                    <option selected="selected" value="[% branch.branchcode %]">
63
                [% ELSE %]
64
                    <option value="[% branch.branchcode %]">
65
                [% END %]
66
                    [% branch.branchname %]
67
                </option>
68
            [% END %]
69
        </select>
62
        </select>
70
        </li>
63
        </li>
71
        [% END %]
64
        [% END %]
Lines 96-102 Link Here
96
        <tr>
89
        <tr>
97
            <th>ISSN</th>
90
            <th>ISSN</th>
98
            <th>Title</th>
91
            <th>Title</th>
99
            [% IF ( branches_loop.size ) %]<th>Library</th>[% END %]
92
            [% IF can_change_library %]<th>Library</th>[% END %]
100
            <th>OPAC note</th>
93
            <th>OPAC note</th>
101
            <th>Nonpublic note</th>
94
            <th>Nonpublic note</th>
102
            <th>Expiration date</th>
95
            <th>Expiration date</th>
Lines 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 232-244 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl Link Here
232
    <div class="yui-u first">
232
    <div class="yui-u first">
233
        <label for="branch">Define the holidays for:</label>
233
        <label for="branch">Define the holidays for:</label>
234
            <select id="branch" name="branch">
234
            <select id="branch" name="branch">
235
                [% FOREACH branchloo IN branchloop %]
235
                [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
236
                    [% IF ( branchloo.selected ) %]
237
                        <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
238
                    [% ELSE %]
239
                        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
240
                    [% END %]
241
                [% END %]
242
            </select>
236
            </select>
243
    
237
    
244
    <!-- ******************************** FLAT PANELS ******************************************* -->
238
    <!-- ******************************** FLAT PANELS ******************************************* -->
Lines 403-410 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl Link Here
403
  <label for="branchcode">Copy holidays to:</label>
397
  <label for="branchcode">Copy holidays to:</label>
404
  <select id="branchcode" name="branchcode">
398
  <select id="branchcode" name="branchcode">
405
    <option value=""></option>
399
    <option value=""></option>
406
    [% FOREACH branchloo IN branchloop %]
400
    [% FOREACH l IN Branches.all() %]
407
    <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
401
    <option value="[% l.branchcode %]">[% l.branchname %]</option>
408
    [% END %]
402
    [% END %]
409
  </select>
403
  </select>
410
    <input type="submit" value="Copy" />
404
    <input type="submit" value="Copy" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt (-3 / +4 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 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 / +2 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Tools &rsaquo; Notice triggers</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Notice triggers</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 43-55 $(document).ready(function() { Link Here
43
            <label for="branch">Select a library:</label>
44
            <label for="branch">Select a library:</label>
44
                <select id="branch" name="branch">
45
                <select id="branch" name="branch">
45
                    <option value="">Default</option>
46
                    <option value="">Default</option>
46
                    [% FOREACH branchloo IN branchloop %]
47
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
47
                        [% IF ( branchloo.selected ) %]
48
                            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
49
                        [% ELSE %]
50
                            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
51
                        [% END %]
52
                    [% END %]
53
                </select>
48
                </select>
54
                <input type="submit" value="Select" />
49
                <input type="submit" value="Select" />
55
            </form>
50
            </form>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc (+1 lines)
Lines 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/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 153-165 Link Here
153
                                        Home library:</label>
154
                                        Home library:</label>
154
155
155
                                        <select id="borrower_branchcode" name="borrower_branchcode">
156
                                        <select id="borrower_branchcode" name="borrower_branchcode">
156
                                            [% FOREACH b IN branches %]
157
                                            [% PROCESS options_for_libraries libraries => Branches.all( selected => borrower.branchcode ) %]
157
                                                [% IF b.value == borrower.branchcode %]
158
                                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
159
                                                [% ELSE %]
160
                                                    <option value="[% b.value %]">[% b.branchname %]</option>
161
                                                [% END %]
162
                                            [% END %]
163
                                        </select>
158
                                        </select>
164
                                    </li>
159
                                    </li>
165
                                [% END %]
160
                                [% 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 206-228 Link Here
206
                                                                <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
207
                                                                <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
207
                                                                [% UNLESS ( bibitemloo.holdable ) %]
208
                                                                [% UNLESS ( bibitemloo.holdable ) %]
208
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
209
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
209
                                                                        [% FOREACH branchloo IN bibitemloo.branchloop %]
210
                                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
210
                                                                            [% IF ( branchloo.selected ) %]
211
                                                                                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
212
                                                                            [% ELSE %]
213
                                                                                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
214
                                                                            [% END %]
215
                                                                        [% END %]
216
                                                                    </select>
211
                                                                    </select>
217
                                                                [% ELSE %]
212
                                                                [% ELSE %]
218
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
213
                                                                    <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
219
                                                                        [% FOREACH branchloo IN bibitemloo.branchloop %]
214
                                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
220
                                                                            [% IF ( branchloo.selected ) %]
221
                                                                                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
222
                                                                            [% ELSE %]
223
                                                                                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
224
                                                                            [% END %]
225
                                                                        [% END %]
226
                                                                    </select>
215
                                                                    </select>
227
                                                                [% END # / UNLESS bibitemloo.holdable %]
216
                                                                [% END # / UNLESS bibitemloo.holdable %]
228
                                                            </li>
217
                                                            </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 46-61 Link Here
46
                                        <li><label for="itemtype">Item type:</label>
47
                                        <li><label for="itemtype">Item type:</label>
47
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
48
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
48
                                        </li>
49
                                        </li>
49
                                        [% IF ( branchloop ) %]
50
                                        [% IF branchcode %]
50
                                            <li><label for="branch">Library:</label>
51
                                            <li><label for="branch">Library:</label>
51
                                                <select name="branchcode" id="branch">
52
                                                <select name="branchcode" id="branch">
52
                                                    [% FOREACH branchloo IN branchloop %]
53
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
53
                                                        [% IF ( branchloo.selected ) %]
54
                                                            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
55
                                                        [% ELSE %]
56
                                                            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
57
                                                        [% END %]
58
                                                    [% END %]
59
                                                </select>
54
                                                </select>
60
                                            </li>
55
                                            </li>
61
                                        [% END %]
56
                                        [% 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 Email::Valid;
47
use Email::Valid;
47
use Module::Load;
48
use Module::Load;
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 27-33 use C4::Members; Link Here
27
use C4::Form::MessagingPreferences;
27
use C4::Form::MessagingPreferences;
28
use Koha::Patrons;
28
use Koha::Patrons;
29
use Koha::Patron::Modifications;
29
use Koha::Patron::Modifications;
30
use C4::Branch qw(GetBranchesLoop);
31
use C4::Scrubber;
30
use C4::Scrubber;
32
use Email::Valid;
31
use Email::Valid;
33
use Koha::DateUtils;
32
use Koha::DateUtils;
Lines 68-74 $template->param( Link Here
68
    hidden            => GetHiddenFields( $mandatory, 'registration' ),
67
    hidden            => GetHiddenFields( $mandatory, 'registration' ),
69
    mandatory         => $mandatory,
68
    mandatory         => $mandatory,
70
    member_titles     => GetTitles() || undef,
69
    member_titles     => GetTitles() || undef,
71
    branches          => GetBranchesLoop(),
72
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
70
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
73
);
71
);
74
72
(-)a/opac/opac-reserve.pl (-4 / +1 lines)
Lines 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 394-400 foreach my $biblioNum (@biblionumbers) { Link Here
394
391
395
    my $record = GetMarcBiblio($biblioNum);
392
    my $record = GetMarcBiblio($biblioNum);
396
    # Init the bib item with the choices for branch pickup
393
    # Init the bib item with the choices for branch pickup
397
    my %biblioLoopIter = ( branchloop => $branchloop );
394
    my %biblioLoopIter;
398
395
399
    # Get relevant biblio data.
396
    # Get relevant biblio data.
400
    my $biblioData = $biblioDataHash{$biblioNum};
397
    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 181-189 if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { Link Here
181
    }
180
    }
182
    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
181
    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
183
182
184
# make branch selection options...
183
    $template->param( branchcode => $branchcode );
185
    my $branchloop = GetBranchesLoop($branchcode);
186
    $template->param( branchloop => $branchloop );
187
}
184
}
188
185
189
$template->param(
186
$template->param(
(-)a/opac/opac-topissues.pl (-2 lines)
Lines 100-105 $template->param( Link Here
100
    results => \@results,
100
    results => \@results,
101
);
101
);
102
102
103
$template->param(branchloop => GetBranchesLoop($branch));
104
105
output_html_with_http_headers $input, $cookie, $template->output;
103
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/opac/opac-user.pl (-18 lines)
Lines 264-287 if ($show_barcode) { Link Here
264
}
264
}
265
$template->param( show_barcode => 1 ) if $show_barcode;
265
$template->param( show_barcode => 1 ) if $show_barcode;
266
266
267
# load the branches
268
my $branches = GetBranches();
269
my @branch_loop;
270
for my $branch_hash ( sort keys %{$branches} ) {
271
    my $selected;
272
    if ( C4::Context->preference('SearchMyLibraryFirst') ) {
273
        $selected =
274
          ( C4::Context->userenv
275
              && ( $branch_hash eq C4::Context->userenv->{branch} ) );
276
    }
277
    push @branch_loop,
278
      { value      => "branch: $branch_hash",
279
        branchname => $branches->{$branch_hash}->{'branchname'},
280
        selected   => $selected,
281
      };
282
}
283
$template->param( branchloop => \@branch_loop );
284
285
# now the reserved items....
267
# now the reserved items....
286
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
268
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
287
269
(-)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-40 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 C4::Log;
33
use C4::Log;
35
use Koha::DateUtils qw/dt_from_string output_pref/;
34
use Koha::DateUtils qw/dt_from_string output_pref/;
36
use Koha::AuthorisedValue;
35
use Koha::AuthorisedValue;
37
use Koha::AuthorisedValues;
36
use Koha::AuthorisedValues;
37
use Koha::Libraries;
38
use Koha::Patron::Categories;
38
use Koha::Patron::Categories;
39
39
40
=head1 NAME
40
=head1 NAME
Lines 663-672 elsif ($phase eq 'Run this report'){ Link Here
663
                    my %authorised_lib;
663
                    my %authorised_lib;
664
                    # builds list, depending on authorised value...
664
                    # builds list, depending on authorised value...
665
                    if ( $authorised_value eq "branches" ) {
665
                    if ( $authorised_value eq "branches" ) {
666
                        my $branches = GetBranchesLoop();
666
                        my $libraries = Koha::Libraries->search;
667
                        foreach my $thisbranch (@$branches) {
667
                        while ( my $library = $libraries->next ) {
668
                            push @authorised_values, $thisbranch->{value};
668
                            push @authorised_values, $library->branchcode;
669
                            $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
669
                            $authorised_lib{$library->branchcode} = $library->branchname;
670
                        }
670
                        }
671
                    }
671
                    }
672
                    elsif ( $authorised_value eq "itemtypes" ) {
672
                    elsif ( $authorised_value eq "itemtypes" ) {
(-)a/reports/issues_avg_stats.pl (-1 lines)
Lines 154-160 if ($do_it) { Link Here
154
    $template->param(
154
    $template->param(
155
                    patron_categories => $patron_categories,
155
                    patron_categories => $patron_categories,
156
                    itemtypes    => $itemtypes,
156
                    itemtypes    => $itemtypes,
157
                    branchloop   => GetBranchesLoop(),
158
                    hassort1     => $hassort1,
157
                    hassort1     => $hassort1,
159
                    hassort2     => $hassort2,
158
                    hassort2     => $hassort2,
160
                    HlghtSort2   => $hglghtsort2,
159
                    HlghtSort2   => $hglghtsort2,
(-)a/reports/issues_by_borrower_category.plugin (-2 lines)
Lines 66-73 the hashes are then translated to hash / arrays to be returned to manager.pl & s Link Here
66
sub set_parameters {
66
sub set_parameters {
67
    my ($template) = @_;
67
    my ($template) = @_;
68
68
69
    $template->param( branchloop => GetBranchesLoop() );
70
71
    my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
69
    my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
72
    $template->param( patron_categories => $patron_categories );
70
    $template->param( patron_categories => $patron_categories );
73
    return $template;
71
    return $template;
(-)a/reports/issues_stats.pl (-2 lines)
Lines 26-32 use Date::Manip; Link Here
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Debug;
27
use C4::Debug;
28
use C4::Context;
28
use C4::Context;
29
use C4::Branch; # GetBranches
30
use C4::Koha;
29
use C4::Koha;
31
use C4::Output;
30
use C4::Output;
32
use C4::Circulation;
31
use C4::Circulation;
Lines 156-162 $template->param( Link Here
156
	itemtypeloop => \@itemtypeloop,
155
	itemtypeloop => \@itemtypeloop,
157
	locationloop => \@locations,
156
	locationloop => \@locations,
158
	   ccodeloop => \@ccodes,
157
	   ccodeloop => \@ccodes,
159
	  branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
160
	hassort1=> $hassort1,
158
	hassort1=> $hassort1,
161
	hassort2=> $hassort2,
159
	hassort2=> $hassort2,
162
	Bsort1 => $Bsort1,
160
	Bsort1 => $Bsort1,
(-)a/reports/itemslost.pl (-6 / +1 lines)
Lines 34-40 use C4::Output; Link Here
34
use C4::Biblio;
34
use C4::Biblio;
35
use C4::Items;
35
use C4::Items;
36
use C4::Koha;                  # GetItemTypes
36
use C4::Koha;                  # GetItemTypes
37
use C4::Branch; # GetBranches
38
use Koha::DateUtils;
37
use Koha::DateUtils;
39
38
40
my $query = new CGI;
39
my $query = new CGI;
Lines 80-89 if ( $get_items ) { Link Here
80
                 );
79
                 );
81
}
80
}
82
81
83
# getting all branches.
84
#my $branches = GetBranches;
85
#my $branch   = C4::Context->userenv->{"branchname"};
86
87
# getting all itemtypes
82
# getting all itemtypes
88
my $itemtypes = &GetItemTypes();
83
my $itemtypes = &GetItemTypes();
89
my @itemtypesloop;
84
my @itemtypesloop;
Lines 98-104 foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp Link Here
98
# get lost statuses
93
# get lost statuses
99
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
94
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
100
95
101
$template->param( branchloop     => GetBranchesLoop(C4::Context->userenv->{'branch'}),
96
$template->param(
102
                  itemtypeloop   => \@itemtypesloop,
97
                  itemtypeloop   => \@itemtypesloop,
103
                  loststatusloop => $lost_status_loop,
98
                  loststatusloop => $lost_status_loop,
104
);
99
);
(-)a/reports/itemtypes.plugin (-6 lines)
Lines 25-42 use C4::Context; Link Here
25
use C4::Search;
25
use C4::Search;
26
use C4::Output;
26
use C4::Output;
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Branch; # GetBranches
29
=head1
28
=head1
30
29
31
=cut
30
=cut
32
31
33
sub set_parameters {
32
sub set_parameters {
34
    my ($template) = @_;
33
    my ($template) = @_;
35
    my $userbranch = '';
36
    if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
37
        $userbranch = C4::Context->userenv->{'branch'};
38
    }
39
    $template->param( branchloop => GetBranchesLoop($userbranch) );
40
    return $template;
34
    return $template;
41
}
35
}
42
36
(-)a/reports/reserves_stats.pl (-2 lines)
Lines 26-32 use CGI qw ( -utf8 ); Link Here
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Debug;
27
use C4::Debug;
28
use C4::Context;
28
use C4::Context;
29
use C4::Branch; # GetBranches
30
use C4::Koha;
29
use C4::Koha;
31
use C4::Output;
30
use C4::Output;
32
use C4::Reports;
31
use C4::Reports;
Lines 164-170 $template->param( Link Here
164
	itemtypeloop => \@itemtypeloop,
163
	itemtypeloop => \@itemtypeloop,
165
	locationloop => \@locations,
164
	locationloop => \@locations,
166
	   ccodeloop => \@ccodes,
165
	   ccodeloop => \@ccodes,
167
	  branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
168
	hassort1=> $hassort1,
166
	hassort1=> $hassort1,
169
	hassort2=> $hassort2,
167
	hassort2=> $hassort2,
170
	Bsort1 => $Bsort1,
168
	Bsort1 => $Bsort1,
(-)a/reports/serials_stats.pl (-2 / +1 lines)
Lines 22-28 use warnings; Link Here
22
use C4::Auth;
22
use C4::Auth;
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use C4::Context;
24
use C4::Context;
25
use C4::Branch; # GetBranches
26
use C4::Output;
25
use C4::Output;
27
use C4::Koha;
26
use C4::Koha;
28
use C4::Reports;
27
use C4::Reports;
Lines 153-159 if($do_it){ Link Here
153
		CGIextChoice => $CGIextChoice,
152
		CGIextChoice => $CGIextChoice,
154
		CGIsepChoice => $CGIsepChoice,
153
		CGIsepChoice => $CGIsepChoice,
155
        booksellers  => \@booksellers,
154
        booksellers  => \@booksellers,
156
        branches     => GetBranchesLoop(C4::Context->userenv->{'branch'}));
155
    );
157
}
156
}
158
157
159
output_html_with_http_headers $input, $cookie, $template->output;
158
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/reserve/request.pl (-14 lines)
Lines 68-79 my $showallitems = $input->param('showallitems'); Link Here
68
my $branches = GetBranches();
68
my $branches = GetBranches();
69
my $itemtypes = GetItemTypes();
69
my $itemtypes = GetItemTypes();
70
70
71
my $userbranch = '';
72
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
73
    $userbranch = C4::Context->userenv->{'branch'};
74
}
75
76
77
# Select borrowers infos
71
# Select borrowers infos
78
my $findborrower = $input->param('findborrower');
72
my $findborrower = $input->param('findborrower');
79
$findborrower = '' unless defined $findborrower;
73
$findborrower = '' unless defined $findborrower;
Lines 569-581 foreach my $biblionumber (@biblionumbers) { Link Here
569
        $reserve{'reserve_id'}     = $res->reserve_id();
563
        $reserve{'reserve_id'}     = $res->reserve_id();
570
        $reserve{itemtype}         = $res->itemtype();
564
        $reserve{itemtype}         = $res->itemtype();
571
565
572
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
573
            $reserve{'branchloop'} = [ Koha::Libraries->find( $res->branchcode() ) ];
574
        }
575
        else {
576
            $reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() );
577
        }
578
579
        push( @reserveloop, \%reserve );
566
        push( @reserveloop, \%reserve );
580
    }
567
    }
581
568
Lines 583-589 foreach my $biblionumber (@biblionumbers) { Link Here
583
    my $time = time();
570
    my $time = time();
584
571
585
    $template->param(
572
    $template->param(
586
                     branchloop  => GetBranchesLoop($userbranch),
587
                     time        => $time,
573
                     time        => $time,
588
                     fixedRank   => $fixedRank,
574
                     fixedRank   => $fixedRank,
589
                    );
575
                    );
(-)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 26-32 use C4::Acquisition; Link Here
26
use C4::Output;
26
use C4::Output;
27
use C4::Context;
27
use C4::Context;
28
use C4::Letters;
28
use C4::Letters;
29
use C4::Branch;    # GetBranches GetBranchesLoop
30
use C4::Koha qw( GetAuthorisedValues );
29
use C4::Koha qw( GetAuthorisedValues );
31
use Koha::AdditionalField;
30
use Koha::AdditionalField;
32
use C4::Csv qw( GetCsvProfiles );
31
use C4::Csv qw( GetCsvProfiles );
Lines 65-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 => C4::Csv::GetCsvProfiles( "sql" ),
107
        csv_profiles => C4::Csv::GetCsvProfiles( "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 111-120 my $notes = ''; Link Here
111
my $checkitem      = undef;
111
my $checkitem      = undef;
112
my $found          = undef;
112
my $found          = undef;
113
113
114
my @branches = GetBranchesLoop();
114
my $branchcode = Koha::Libraries->search->next->branchcode;
115
my $branch = $branches[0][0]{value};
116
115
117
AddReserve($branch,    $borrowernumber, $biblionumber,
116
AddReserve($branchcode,    $borrowernumber, $biblionumber,
118
        $bibitems,  $priority, $resdate, $expdate, $notes,
117
        $bibitems,  $priority, $resdate, $expdate, $notes,
119
        $title,      $checkitem, $found);
118
        $title,      $checkitem, $found);
120
119
(-)a/tools/batchMod.pl (-9 / +9 lines)
Lines 289-299 $query .= qq{ AND ( branchcode = ? OR branchcode IS NULL ) } if $branch_limit; Link Here
289
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
289
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
290
my $authorised_values_sth = $dbh->prepare( $query );
290
my $authorised_values_sth = $dbh->prepare( $query );
291
291
292
my $branches = GetBranchesLoop();  # build once ahead of time, instead of multiple times later.
292
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
293
293
294
# Adding a default choice, in case the user does not want to modify the branch
294
# Adding a default choice, in case the user does not want to modify the branch
295
my $nochange_branch = { branchname => '', value => '', selected => 1 };
295
my $nochange_branch = { branchname => '', value => '', selected => 1 };
296
unshift (@$branches, $nochange_branch);
296
unshift (@$libraries, $nochange_branch);
297
297
298
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
298
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
299
299
Lines 347-360 foreach my $tag (sort keys %{$tagslib}) { Link Here
347
	my @authorised_values;
347
	my @authorised_values;
348
	my %authorised_lib;
348
	my %authorised_lib;
349
	# builds list, depending on authorised value...
349
	# builds list, depending on authorised value...
350
  
350
351
	if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
351
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
352
	    foreach my $thisbranch (@$branches) {
352
        foreach my $library (@$libraries) {
353
		push @authorised_values, $thisbranch->{value};
353
            push @authorised_values, $library->{branchcode};
354
		$authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
354
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
355
	    }
355
        }
356
        $value = "";
356
        $value = "";
357
	}
357
    }
358
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
358
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
359
        push @authorised_values, "";
359
        push @authorised_values, "";
360
        my $itemtypes = GetItemTypes( style => 'array' );
360
        my $itemtypes = GetItemTypes( style => 'array' );
(-)a/tools/holidays.pl (-21 lines)
Lines 51-76 my $keydate = output_pref( { dt => $calendarinput_dt, dateonly => 1, dateformat Link Here
51
$keydate =~ s/-/\//g;
51
$keydate =~ s/-/\//g;
52
52
53
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
53
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
54
# Set all the branches.
55
my $onlymine =
56
  (      C4::Context->preference('IndependentBranches')
57
      && C4::Context->userenv
58
      && !C4::Context->IsSuperLibrarian()
59
      && C4::Context->userenv->{branch} ? 1 : 0 );
60
if ( $onlymine ) { 
61
    $branch = C4::Context->userenv->{'branch'};
62
}
63
my $branches   = GetBranches($onlymine);
64
my @branchloop;
65
for my $thisbranch (
66
    sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
67
    keys %{$branches} ) {
68
    push @branchloop,
69
      { value      => $thisbranch,
70
        selected   => $thisbranch eq $branch,
71
        branchname => $branches->{$thisbranch}->{'branchname'},
72
      };
73
}
74
54
75
# branches calculated - put branch codes in a single string so they can be passed in a form
55
# branches calculated - put branch codes in a single string so they can be passed in a form
76
my $branchcodes = join '|', keys %{$branches};
56
my $branchcodes = join '|', keys %{$branches};
Lines 145-151 foreach my $yearMonthDay (keys %$single_holidays) { Link Here
145
125
146
$template->param(
126
$template->param(
147
    WEEK_DAYS_LOOP           => \@week_days,
127
    WEEK_DAYS_LOOP           => \@week_days,
148
    branchloop               => \@branchloop,
149
    HOLIDAYS_LOOP            => \@holidays,
128
    HOLIDAYS_LOOP            => \@holidays,
150
    EXCEPTION_HOLIDAYS_LOOP  => \@exception_holidays,
129
    EXCEPTION_HOLIDAYS_LOOP  => \@exception_holidays,
151
    DAY_MONTH_HOLIDAYS_LOOP  => \@day_month_holidays,
130
    DAY_MONTH_HOLIDAYS_LOOP  => \@day_month_holidays,
(-)a/tools/import_borrowers.pl (-4 lines)
Lines 40-46 use warnings; Link Here
40
use C4::Auth;
40
use C4::Auth;
41
use C4::Output;
41
use C4::Output;
42
use C4::Context;
42
use C4::Context;
43
use C4::Branch qw/GetBranchesLoop/;
44
use C4::Members;
43
use C4::Members;
45
use C4::Members::Attributes qw(:all);
44
use C4::Members::Attributes qw(:all);
46
use C4::Members::AttributeTypes;
45
use C4::Members::AttributeTypes;
Lines 82-90 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ Link Here
82
        debug           => 1,
81
        debug           => 1,
83
});
82
});
84
83
85
# get the branches and pass them to the template
86
my $branches = GetBranchesLoop();
87
$template->param( branches => $branches ) if ( $branches );
88
# get the patron categories and pass them to the template
84
# get the patron categories and pass them to the template
89
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
85
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
90
$template->param( categories => \@patron_categories );
86
$template->param( categories => \@patron_categories );
(-)a/tools/inventory.pl (-11 lines)
Lines 64-79 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
64
    }
64
    }
65
);
65
);
66
66
67
68
my $branches = GetBranches();
69
my @branch_loop;
70
for my $branch_hash (keys %$branches) {
71
    push @branch_loop, {value => "$branch_hash",
72
                       branchname => $branches->{$branch_hash}->{'branchname'},
73
                       selected => ($branch_hash eq $branchcode?1:0)};
74
}
75
76
@branch_loop = sort {$a->{branchname} cmp $b->{branchname}} @branch_loop;
77
my @authorised_value_list;
67
my @authorised_value_list;
78
my $authorisedvalue_categories = '';
68
my $authorisedvalue_categories = '';
79
69
Lines 128-134 for my $authvfield (@$statuses) { Link Here
128
}
118
}
129
$statussth =~ s, and $,,g;
119
$statussth =~ s, and $,,g;
130
$template->param(
120
$template->param(
131
    branchloop               => \@branch_loop,
132
    authorised_values        => \@authorised_value_list,
121
    authorised_values        => \@authorised_value_list,
133
    today                    => dt_from_string,
122
    today                    => dt_from_string,
134
    minlocation              => $minlocation,
123
    minlocation              => $minlocation,
(-)a/tools/letter.pl (-19 / +1 lines)
Lines 104-110 if ($op eq 'copy_form') { Link Here
104
    $template->param(
104
    $template->param(
105
        oldbranchcode => $oldbranchcode,
105
        oldbranchcode => $oldbranchcode,
106
        branchcode => $branchcode,
106
        branchcode => $branchcode,
107
        branchloop => _branchloop($branchcode),
108
        copying => 1,
107
        copying => 1,
109
        modify => 0,
108
        modify => 0,
110
    );
109
    );
Lines 240-246 sub add_form { Link Here
240
239
241
    $template->param(
240
    $template->param(
242
        module     => $module,
241
        module     => $module,
243
        branchloop => _branchloop($branchcode),
244
        SQLfieldnames => $field_selection,
242
        SQLfieldnames => $field_selection,
245
        branchcode => $branchcode,
243
        branchcode => $branchcode,
246
    );
244
    );
Lines 379-404 sub default_display { Link Here
379
377
380
    $template->param(
378
    $template->param(
381
        letter => $loop_data,
379
        letter => $loop_data,
382
        branchloop => _branchloop($branchcode),
380
        branchcode => $branchcode,
383
    );
381
    );
384
}
382
}
385
383
386
sub _branchloop {
387
    my ($branchcode) = @_;
388
389
    my $branches = GetBranches();
390
    my @branchloop;
391
    for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
392
        push @branchloop, {
393
            value      => $thisbranch,
394
            selected   => $branchcode && $thisbranch eq $branchcode,
395
            branchname => $branches->{$thisbranch}->{'branchname'},
396
        };
397
    }
398
399
    return \@branchloop;
400
}
401
402
sub add_fields {
384
sub add_fields {
403
    my @tables = @_;
385
    my @tables = @_;
404
    my @fields = ();
386
    my @fields = ();
(-)a/tools/modborrowers.pl (-2 / +2 lines)
Lines 28-34 Link Here
28
use Modern::Perl;
28
use Modern::Perl;
29
use CGI qw ( -utf8 );
29
use CGI qw ( -utf8 );
30
use C4::Auth;
30
use C4::Auth;
31
use C4::Branch;
32
use C4::Koha;
31
use C4::Koha;
33
use C4::Members;
32
use C4::Members;
34
use C4::Members::Attributes;
33
use C4::Members::Attributes;
Lines 37-42 use C4::Output; Link Here
37
use List::MoreUtils qw /any uniq/;
36
use List::MoreUtils qw /any uniq/;
38
use Koha::DateUtils qw( dt_from_string );
37
use Koha::DateUtils qw( dt_from_string );
39
use Koha::List::Patron;
38
use Koha::List::Patron;
39
use Koha::Libraries;
40
use Koha::Patron::Categories;
40
use Koha::Patron::Categories;
41
41
42
my $input = new CGI;
42
my $input = new CGI;
Lines 145-151 if ( $op eq 'show' ) { Link Here
145
        if @notfoundcardnumbers;
145
        if @notfoundcardnumbers;
146
146
147
    # Construct drop-down list values
147
    # Construct drop-down list values
148
    my $branches = GetBranchesLoop;
148
    my $branches = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
149
    my @branches_option;
149
    my @branches_option;
150
    push @branches_option, { value => $_->{value}, lib => $_->{branchname} } for @$branches;
150
    push @branches_option, { value => $_->{value}, lib => $_->{branchname} } for @$branches;
151
    unshift @branches_option, { value => "", lib => "" };
151
    unshift @branches_option, { value => "", lib => "" };
(-)a/tools/overduerules.pl (-4 lines)
Lines 24-30 use C4::Context; Link Here
24
use C4::Output;
24
use C4::Output;
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Branch;
28
use C4::Letters;
27
use C4::Letters;
29
use C4::Members;
28
use C4::Members;
30
use C4::Overdues;
29
use C4::Overdues;
Lines 210-216 if ($op eq 'save') { Link Here
210
        $input_saved = 1;
209
        $input_saved = 1;
211
    }
210
    }
212
}
211
}
213
my $branchloop = GetBranchesLoop($branch);
214
212
215
my $letters = C4::Letters::GetLettersAvailableForALibrary(
213
my $letters = C4::Letters::GetLettersAvailableForALibrary(
216
    {
214
    {
Lines 310-316 my @tabs = ( Link Here
310
308
311
$template->param(
309
$template->param(
312
    table => ( @first or @second or @third ? 1 : 0 ),
310
    table => ( @first or @second or @third ? 1 : 0 ),
313
    branchloop => $branchloop,
314
    branch => $branch,
311
    branch => $branch,
315
    tabs => \@tabs,
312
    tabs => \@tabs,
316
    message_transport_types => $message_transport_types,
313
    message_transport_types => $message_transport_types,
317
- 

Return to bug 15758