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

(-)a/Koha/Template/Plugin/Branches.pm (-7 lines)
Lines 27-39 use C4::Koha; Link Here
27
use C4::Context;
27
use C4::Context;
28
use Koha::Libraries;
28
use Koha::Libraries;
29
29
30
sub GetBranches {
31
    my ($self) = @_;
32
33
    my $dbh = C4::Context->dbh;
34
    return $dbh->selectall_arrayref( "SELECT * FROM branches", { Slice => {} } );
35
}
36
37
sub GetName {
30
sub GetName {
38
    my ( $self, $branchcode ) = @_;
31
    my ( $self, $branchcode ) = @_;
39
32
(-)a/Koha/Template/Plugin/Koha.pm (-5 lines)
Lines 58-66 sub Version { Link Here
58
    };
58
    };
59
}
59
}
60
60
61
sub UserEnv {
62
    my ( $self, $key ) = @_;
63
    my $userenv = C4::Context->userenv;
64
    return $userenv ? $userenv->{$key} : undef;
65
}
66
1;
61
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt (-7 / +1 lines)
Lines 66-78 Link Here
66
                        <label for="name">Library:</label>
66
                        <label for="name">Library:</label>
67
                        <select name="branchcode" id="club-template-branchcode">
67
                        <select name="branchcode" id="club-template-branchcode">
68
                            <option value="">&nbsp</option>
68
                            <option value="">&nbsp</option>
69
                            [% FOREACH b IN Branches.GetBranches() %]
69
                            [% PROCESS options_for_libraries libraries => Branches.all( selected => club.branch.branchcode ) %]
70
                                [% IF b.branchcode == club.branch.branchcode %]
71
                                    <option value="[% b.branchcode %]" selected="selected">[% b.branchname %]</option>
72
                                [% ELSE %]
73
                                    <option value="[% b.branchcode %]">[% b.branchname %]</option>
74
                                [% END %]
75
                            [% END %]
76
                        </select>
70
                        </select>
77
                    </li>
71
                    </li>
78
72
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt (-2 / +2 lines)
Lines 4-10 Link Here
4
<title>Koha &rsaquo; Tools &rsaquo; Patron clubs</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Patron clubs</title>
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
6
7
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
8
[% INCLUDE 'datatables.inc' %]
8
[% INCLUDE 'datatables.inc' %]
9
9
10
<script type="text/javascript">
10
<script type="text/javascript">
Lines 153-159 Link Here
153
                [% IF CAN_user_clubs_edit_clubs %]
153
                [% IF CAN_user_clubs_edit_clubs %]
154
                    <div class="btn-toolbar">
154
                    <div class="btn-toolbar">
155
                        <div class="btn-group">
155
                        <div class="btn-group">
156
                            <button class="btn dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
156
                            <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
157
                            <ul class="dropdown-menu">
157
                            <ul class="dropdown-menu">
158
                                [% FOREACH t IN club_templates %]
158
                                [% FOREACH t IN club_templates %]
159
                                    <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id %]">[% t.name %]</a></li>
159
                                    <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id %]">[% t.name %]</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt (-29 / +5 lines)
Lines 1-6 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE AuthorisedValues %]
2
[% USE AuthorisedValues %]
3
[% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Tools &rsaquo; Patron clubs &rsaquo; Club template</title>
4
<title>Koha &rsaquo; Tools &rsaquo; Patron clubs &rsaquo; Club template</title>
6
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 69-81 Link Here
69
                        <label for="name">Library:</label>
68
                        <label for="name">Library:</label>
70
                        <select name="branchcode" id="club-template-branchcode">
69
                        <select name="branchcode" id="club-template-branchcode">
71
                            <option value="">&nbsp</option>
70
                            <option value="">&nbsp</option>
72
                            [% FOREACH b IN Branches.GetBranches() %]
71
                            [% PROCESS options_for_libraries libraries => Branches.all( selected => club_template.branchcode ) %]
73
                                [% IF b.branchcode == club_template.branchcode %]
74
                                    <option value="[% b.branchcode %]" selected="selected">[% b.branchname %]</option>
75
                                [% ELSE %]
76
                                    <option value="[% b.branchcode %]">[% b.branchname %]</option>
77
                                [% END %]
78
                            [% END %]
79
                        </select>
72
                        </select>
80
                        <span class="hint">If set, only librarians logged in with this branch will be able to modify this club template.</span>
73
                        <span class="hint">If set, only librarians logged in with this branch will be able to modify this club template.</span>
81
                    </li>
74
                    </li>
Lines 102-114 Link Here
102
                                <label for="field-description-[% f.id %]">Authorised value category:</label>
95
                                <label for="field-description-[% f.id %]">Authorised value category:</label>
103
                                <select name="club_template_field_authorised_value_category" id="field-authorised-value-category-[% f.id %]">
96
                                <select name="club_template_field_authorised_value_category" id="field-authorised-value-category-[% f.id %]">
104
                                    <option value="">&nbsp;</option>
97
                                    <option value="">&nbsp;</option>
105
                                    [% FOREACH c IN AuthorisedValuesCategories %]
98
                                    [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => f.authorised_value_category) %]
106
                                        [% IF f.authorised_value_category == c %]
107
                                            <option selected="selected" value="[% c %]">[% c %]</option>
108
                                        [% ELSE %]
109
                                            <option value="[% c %]">[% c %]</option>
110
                                        [% END %]
111
                                    [% END %]
112
                                </select>
99
                                </select>
113
                            </li>
100
                            </li>
114
101
Lines 147-159 Link Here
147
                                <label for="enrollment-field-description-[% f.id %]">Authorised value category:</label>
134
                                <label for="enrollment-field-description-[% f.id %]">Authorised value category:</label>
148
                                <select name="club_template_enrollment_field_authorised_value_category" id="enrollment-field-authorised-value-category-[% f.id %]">
135
                                <select name="club_template_enrollment_field_authorised_value_category" id="enrollment-field-authorised-value-category-[% f.id %]">
149
                                    <option value="">&nbsp;</option>
136
                                    <option value="">&nbsp;</option>
150
                                    [% FOREACH c IN AuthorisedValuesCategories %]
137
                                    [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => f.authorised_value_category) %]
151
                                        [% IF f.authorised_value_category == c %]
152
                                            <option selected="selected" value="[% c %]">[% c %]</option>
153
                                        [% ELSE %]
154
                                            <option value="[% c %]">[% c %]</option>
155
                                        [% END %]
156
                                    [% END %]
157
                                </select>
138
                                </select>
158
                            </li>
139
                            </li>
159
140
Lines 201-209 Link Here
201
            <label for="club_template_field_authorised_value_category">Authorised value category:</label>
182
            <label for="club_template_field_authorised_value_category">Authorised value category:</label>
202
            <select name="club_template_field_authorised_value_category">
183
            <select name="club_template_field_authorised_value_category">
203
                <option value="">&nbsp;</option>
184
                <option value="">&nbsp;</option>
204
                [% FOREACH c IN AuthorisedValuesCategories %]
185
                [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
205
                    <option value="[% c %]">[% c %]</option>
206
                [% END %]
207
            </select>
186
            </select>
208
        </li>
187
        </li>
209
188
Lines 231-239 Link Here
231
            <label for="club_template_enrollment_field_authorised_value_category">Authorised value category:</label>
210
            <label for="club_template_enrollment_field_authorised_value_category">Authorised value category:</label>
232
            <select name="club_template_enrollment_field_authorised_value_category">
211
            <select name="club_template_enrollment_field_authorised_value_category">
233
                <option value="">&nbsp;</option>
212
                <option value="">&nbsp;</option>
234
                [% FOREACH c IN AuthorisedValuesCategories %]
213
                [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
235
                    <option value="[% c %]">[% c %]</option>
236
                [% END %]
237
            </select>
214
            </select>
238
        </li>
215
        </li>
239
216
240
- 

Return to bug 12461