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

(-)a/admin/debit_types.pl (-2 / +3 lines)
Lines 43-48 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
43
    }
43
    }
44
);
44
);
45
45
46
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'account_debit_types' } )->as_list;
47
$template->param( additional_fields => \@additional_fields, );
48
46
my $debit_type;
49
my $debit_type;
47
if ($code) {
50
if ($code) {
48
    $debit_type = Koha::Account::DebitTypes->find($code);
51
    $debit_type = Koha::Account::DebitTypes->find($code);
Lines 67-79 if ( $op eq 'add_form' ) { Link Here
67
            };
70
            };
68
    }
71
    }
69
72
70
    my @additional_fields       = Koha::AdditionalFields->search( { tablename => 'account_debit_types' } )->as_list;
71
    my @additional_field_values = $debit_type ? $debit_type->get_additional_field_values_for_template : ();
73
    my @additional_field_values = $debit_type ? $debit_type->get_additional_field_values_for_template : ();
72
74
73
    $template->param(
75
    $template->param(
74
        debit_type              => $debit_type,
76
        debit_type              => $debit_type,
75
        branches_loop           => \@branches_loop,
77
        branches_loop           => \@branches_loop,
76
        additional_fields       => \@additional_fields,
77
        additional_field_values => @additional_field_values,
78
        additional_field_values => @additional_field_values,
78
    );
79
    );
79
} elsif ( $op eq 'cud-add_validate' ) {
80
} elsif ( $op eq 'cud-add_validate' ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt (-208 / +221 lines)
Lines 7-24 Link Here
7
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
8
[% PROCESS 'accounts.inc' %]
8
[% PROCESS 'accounts.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
10
<title>[% FILTER collapse %]
10
<title
11
    [% IF op =='add_form' %]
11
    >[% FILTER collapse %]
12
       [% IF debit_type.code %]
12
        [% IF op =='add_form' %]
13
           [% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %]
13
            [% IF debit_type.code %]
14
       [% ELSE %]
14
                [% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %]
15
           [% t("New debit type") | html %]
15
            [% ELSE %]
16
       [% END %] &rsaquo;
16
                [% t("New debit type") | html %]
17
    [% END %]
17
            [% END %]
18
    [% t("Debit types") | html %] &rsaquo;
18
            &rsaquo;
19
    [% t("Administration") | html %] &rsaquo;
19
        [% END %]
20
    [% t("Koha") | html %]
20
        [% t("Debit types") | html %]
21
[% END %]</title>
21
        &rsaquo; [% t("Administration") | html %] &rsaquo; [% t("Koha") | html %]
22
    [% END %]</title
23
>
22
[% INCLUDE 'doc-head-close.inc' %]
24
[% INCLUDE 'doc-head-close.inc' %]
23
</head>
25
</head>
24
26
Lines 44-50 Link Here
44
                    <span>New debit type</span>
46
                    <span>New debit type</span>
45
                [% END %]
47
                [% END %]
46
            [% END %]
48
            [% END %]
47
48
        [% ELSE %]
49
        [% ELSE %]
49
            [% WRAPPER breadcrumb_item bc_active= 1 %]
50
            [% WRAPPER breadcrumb_item bc_active= 1 %]
50
                <span>Debit types</span>
51
                <span>Debit types</span>
Lines 55-263 Link Here
55
56
56
[% WRAPPER 'main-container.inc' aside='admin-menu' %]
57
[% WRAPPER 'main-container.inc' aside='admin-menu' %]
57
58
58
                [% FOREACH m IN messages %]
59
    [% FOREACH m IN messages %]
59
                <div class="alert alert-[% m.type | html %]">
60
        <div class="alert alert-[% m.type | html %]">
60
                    [% SWITCH m.code %]
61
            [% SWITCH m.code %]
61
                    [% CASE 'success_on_saving' %]
62
            [% CASE 'success_on_saving' %]
62
                        <span>Debit type saved successfully.</span>
63
                <span>Debit type saved successfully.</span>
63
                    [% CASE 'error_on_saving' %]
64
            [% CASE 'error_on_saving' %]
64
                        <span>An error occurred when saving this debit type. Check the logs for details.</span>
65
                <span>An error occurred when saving this debit type. Check the logs for details.</span>
65
                    [% CASE 'success_on_archive' %]
66
            [% CASE 'success_on_archive' %]
66
                        <span>Debit type archived successfully.</span>
67
                <span>Debit type archived successfully.</span>
67
                    [% CASE 'success_on_restore' %]
68
            [% CASE 'success_on_restore' %]
68
                        <span>Debit type restored successfully.</span>
69
                <span>Debit type restored successfully.</span>
69
                    [% CASE %]
70
            [% CASE %]
70
                        <span>[% m.code | html %]</span>
71
                <span>[% m.code | html %]</span>
71
                    [% END %]
72
            [% END %]
72
                </div>
73
        </div>
73
                [% END %]
74
    [% END %]
74
75
75
                [% IF op == 'add_form' %]
76
    [% IF op == 'add_form' %]
76
                    [% IF debit_type %]
77
        [% IF debit_type %]
77
                        <h1>[% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %]</h1>
78
            <h1>[% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %]</h1>
78
                    [% ELSE %]
79
        [% ELSE %]
79
                        <h1>New debit type</h1>
80
            <h1>New debit type</h1>
80
                    [% END %]
81
        [% END %]
81
82
82
                    <form action="/cgi-bin/koha/admin/debit_types.pl" name="Aform" method="post" class="validated">
83
        <form action="/cgi-bin/koha/admin/debit_types.pl" name="Aform" method="post" class="validated">
83
                        [% INCLUDE 'csrf-token.inc' %]
84
            [% INCLUDE 'csrf-token.inc' %]
84
                        <input type="hidden" name="op" value="cud-add_validate" />
85
            <input type="hidden" name="op" value="cud-add_validate" />
85
                        <fieldset class="rows">
86
            <fieldset class="rows">
86
                            <ol>
87
                <ol>
87
                                <li>
88
                    <li>
88
                                    <label for="code" class="required">Debit type code: </label>
89
                        <label for="code" class="required">Debit type code: </label>
89
                                    [% IF debit_type %]
90
                        [% IF debit_type %]
90
                                        <strong>[% debit_type.code | html %]</strong>
91
                            <strong>[% debit_type.code | html %]</strong>
91
                                        <input type="hidden" name="code" value="[% code | html %]" />
92
                            <input type="hidden" name="code" value="[% code | html %]" />
92
                                    [% ELSE %]
93
                        [% ELSE %]
93
                                    <input type="text" name="code" id="code" size="80" maxlength="64" class="required focus" required="required"><span class="required">Required. Maximum length is 64 letters</span>
94
                            <input type="text" name="code" id="code" size="80" maxlength="64" class="required focus" required="required" /><span class="required">Required. Maximum length is 64 letters</span>
94
                                    [% END %]
95
                                </li>
96
                                <li>
97
                                    <label for="default_amount">Default amount: </label>
98
                                    <input type="text" pattern="^\d+(\.\d{2})?$" name="default_amount" id="default_amount" size="80" maxlength="100" value="[% debit_type.default_amount | $Price on_editing => 1 %]" step="any" min="0"/>
99
                                </li>
100
                                <li>
101
                                    <label for="description" class="required">Description: </label>
102
                                    [% IF debit_type && debit_type.is_system %]
103
                                        <span>[%- PROCESS debit_type_description debit_type = debit_type -%]</span>
104
                                    [% ELSE %]
105
                                        <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
106
                                    [% END %]
107
                                </li>
108
                                <li>
109
                                    <label for="can_be_invoiced">Can be manually invoiced? </label>
110
                                    [% IF debit_type.can_be_invoiced %]
111
                                        <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" checked="checked" value="1" />
112
                                    [% ELSE %]
113
                                        <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" value="1" />
114
                                    [% END %]
115
                                </li>
116
                                <li>
117
                                    <label for="can_be_sold">Can be sold? </label>
118
                                    [% IF debit_type.can_be_sold %]
119
                                        <input type="checkbox" name="can_be_sold" id="can_be_sold" checked="checked" value="1" />
120
                                    [% ELSE %]
121
                                        <input type="checkbox" name="can_be_sold" id="can_be_sold" value="1" />
122
                                    [% END %]
123
                                </li>
124
                                <li>
125
                                    <label for="restricts_checkouts">Included in noissuescharge? </label>
126
                                    [% IF debit_type.restricts_checkouts %]
127
                                        <input type="checkbox" name="restricts_checkouts" id="restricts_checkouts" checked="checked" value="1" />
128
                                    [% ELSE %]
129
                                        <input type="checkbox" name="restricts_checkouts" id="restricts_checkouts" value="1" />
130
                                    [% END %]
131
                                </li>
132
                                <li>
133
                                    <label for="branches">Libraries limitation: </label>
134
                                    <select id="branches" name="branches" multiple size="10">
135
                                        <option value="">All libraries</option>
136
                                        [% FOREACH branch IN branches_loop %]
137
                                        [% IF ( branch.selected ) %]
138
                                        <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
139
                                        [% ELSE %]
140
                                        <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
141
                                        [% END %]
142
                                        [% END %]
143
                                    </select>
144
                                    <div class="hint">Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.</div>
145
                                </li>
146
                            </ol>
147
                        </fieldset>
148
                        [% IF additional_fields.size %]
149
                            [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %]
150
                        [% END %]
95
                        [% END %]
151
                        <fieldset class="action">
96
                    </li>
152
                            <button id="save_debit_type" class="btn btn-primary">Save</button>
97
                    <li>
153
                            <a class="cancel" href="/cgi-bin/koha/admin/debit_types.pl">Cancel</a>
98
                        <label for="default_amount">Default amount: </label>
154
                        </fieldset>
99
                        <input type="text" pattern="^\d+(\.\d{2})?$" name="default_amount" id="default_amount" size="80" maxlength="100" value="[% debit_type.default_amount | $Price on_editing => 1 %]" step="any" min="0" />
155
                    </form>
100
                    </li>
156
                [% END %]
101
                    <li>
102
                        <label for="description" class="required">Description: </label>
103
                        [% IF debit_type && debit_type.is_system %]
104
                            <span>[%- PROCESS debit_type_description debit_type = debit_type -%]</span>
105
                        [% ELSE %]
106
                            <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
107
                        [% END %]
108
                    </li>
109
                    <li>
110
                        <label for="can_be_invoiced">Can be manually invoiced? </label>
111
                        [% IF debit_type.can_be_invoiced %]
112
                            <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" checked="checked" value="1" />
113
                        [% ELSE %]
114
                            <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" value="1" />
115
                        [% END %]
116
                    </li>
117
                    <li>
118
                        <label for="can_be_sold">Can be sold? </label>
119
                        [% IF debit_type.can_be_sold %]
120
                            <input type="checkbox" name="can_be_sold" id="can_be_sold" checked="checked" value="1" />
121
                        [% ELSE %]
122
                            <input type="checkbox" name="can_be_sold" id="can_be_sold" value="1" />
123
                        [% END %]
124
                    </li>
125
                    <li>
126
                        <label for="restricts_checkouts">Included in noissuescharge? </label>
127
                        [% IF debit_type.restricts_checkouts %]
128
                            <input type="checkbox" name="restricts_checkouts" id="restricts_checkouts" checked="checked" value="1" />
129
                        [% ELSE %]
130
                            <input type="checkbox" name="restricts_checkouts" id="restricts_checkouts" value="1" />
131
                        [% END %]
132
                    </li>
133
                    <li>
134
                        <label for="branches">Libraries limitation: </label>
135
                        <select id="branches" name="branches" multiple size="10">
136
                            <option value="">All libraries</option>
137
                            [% FOREACH branch IN branches_loop %]
138
                                [% IF ( branch.selected ) %]
139
                                    <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
140
                                [% ELSE %]
141
                                    <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
142
                                [% END %]
143
                            [% END %]
144
                        </select>
145
                        <div class="hint">Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.</div>
146
                    </li>
147
                </ol>
148
            </fieldset>
149
            [% IF additional_fields.size %]
150
                [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %]
151
            [% END %]
152
            <fieldset class="action">
153
                <button id="save_debit_type" class="btn btn-primary">Save</button>
154
                <a class="cancel" href="/cgi-bin/koha/admin/debit_types.pl">Cancel</a>
155
            </fieldset>
156
        </form>
157
    [% END %]
157
158
158
                [% IF op == 'list' %]
159
    [% IF op == 'list' %]
159
                    <div id="toolbar" class="btn-toolbar">
160
        <div id="toolbar" class="btn-toolbar">
160
                        <a class="btn btn-default" id="newdebittype" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form"><i class="fa fa-plus"></i> New debit type</a>
161
            <a class="btn btn-default" id="newdebittype" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form"><i class="fa fa-plus"></i> New debit type</a>
161
                    </div>
162
        </div>
162
163
163
                    <h1>Debit types</h1>
164
        <h1>Debit types</h1>
164
                    [% IF debit_types.count %]
165
        [% IF debit_types.count %]
165
                        <div class="page-section">
166
            <div class="page-section">
166
                            <table id="table_debit_types">
167
                <table id="table_debit_types">
167
                                <thead>
168
                    <thead>
168
                                    <th>Archived</th>
169
                        <th>Archived</th>
169
                                    <th>System</th>
170
                        <th>System</th>
170
                                    <th>Code</th>
171
                        <th>Code</th>
171
                                    <th>Description</th>
172
                        <th>Description</th>
172
                                    <th>Default amount</th>
173
                        [% IF additional_fields.size %]
173
                                    <th>Available for</th>
174
                            <th>Additional fields</th>
174
                                    <th>Library limitations</th>
175
                        [% END %]
175
                                    <th>Blocks checkouts?</th>
176
                        <th>Default amount</th>
176
                                    <th class="noExport">Actions</th>
177
                        <th>Available for</th>
177
                                </thead>
178
                        <th>Library limitations</th>
178
                                <tbody>
179
                        <th>Blocks checkouts?</th>
179
                                    [% FOREACH debit_type IN debit_types %]
180
                        <th class="noExport">Actions</th>
180
                                    <tr>
181
                    </thead>
181
                                        <td>[% debit_type.archived | html %]</td>
182
                    <tbody>
182
                                        <td>[% debit_type.is_system | html %]</td>
183
                        [% FOREACH debit_type IN debit_types %]
183
                                        <td>[% debit_type.code | html %]</td>
184
                            <tr>
184
                                        <td>[%- PROCESS debit_type_description debit_type = debit_type -%]</td>
185
                                <td>[% debit_type.archived | html %]</td>
185
                                        <td>[% debit_type.default_amount | $Price %]</td>
186
                                <td>[% debit_type.is_system | html %]</td>
186
                                        <td>[% IF debit_type.can_be_invoiced && debit_type.can_be_sold %]
187
                                <td>[% debit_type.code | html %]</td>
187
                                            <i class="fa fa-id-card"></i> Invoicing, <i class="fa fa-shopping-cart"></i> Sale
188
                                <td>[%- PROCESS debit_type_description debit_type = debit_type -%]</td>
188
                                            [% ELSIF debit_type.can_be_invoiced %]
189
                                [% IF additional_fields.size %]
189
                                            <i class="fa fa-id-card"></i> Invoicing
190
                                    <td>
190
                                            [% ELSIF debit_type.can_be_sold %]
191
                                        [% IF debit_type.additional_field_values.count > 0 %]
191
                                            <i class="fa fa-shopping-cart"></i> Sale
192
                                            [% FOREACH additional_field IN debit_type.additional_field_values %]
193
                                                <div><span class="label">[% additional_field.field.name | html %]</span>: [% additional_field.value | html %]</div>
192
                                            [% END %]
194
                                            [% END %]
193
                                        </td>
195
                                        [% ELSE %]
194
                                        <td>
196
                                            <span>No additional fields</span>
195
                                            [% IF debit_type.library_limits.count > 0 %]
197
                                        [% END %]
196
                                                [% library_limits_str = "" %]
198
                                    </td>
197
                                                [% FOREACH library IN debit_type.library_limits %]
199
                                [% END %]
198
                                                    [%- IF loop.first -%]
200
                                <td>[% debit_type.default_amount | $Price %]</td>
199
                                                    [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
201
                                <td
200
                                                    [% ELSE %]
202
                                    >[% IF debit_type.can_be_invoiced && debit_type.can_be_sold %]
201
                                                    [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
203
                                        <i class="fa fa-id-card"></i> Invoicing, <i class="fa fa-shopping-cart"></i> Sale
202
                                                    [% END %]
204
                                    [% ELSIF debit_type.can_be_invoiced %]
203
                                                [% END %]
205
                                        <i class="fa fa-id-card"></i> Invoicing
204
                                                <span class="library_limitation" title="[% library_limits_str | html %]">
206
                                    [% ELSIF debit_type.can_be_sold %]
205
                                                    [% IF debit_type.library_limits.count > 1 %]
207
                                        <i class="fa fa-shopping-cart"></i> Sale
206
                                                        <span>[% debit_type.library_limits.count | html %] library limitations</span>
208
                                    [% END %]
207
                                                    [% ELSE %]
209
                                </td>
208
                                                        <span>[% debit_type.library_limits.count | html %] library limitation</span>
210
                                <td>
209
                                                    [% END %]
211
                                    [% IF debit_type.library_limits.count > 0 %]
212
                                        [% library_limits_str = "" %]
213
                                        [% FOREACH library IN debit_type.library_limits %]
214
                                            [%- IF loop.first -%]
215
                                                [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
210
                                            [% ELSE %]
216
                                            [% ELSE %]
211
                                                <span>No limitation</span>
217
                                                [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
212
                                            [% END %]
218
                                            [% END %]
213
                                        </td>
219
                                        [% END %]
214
                                        <td>
220
                                        <span class="library_limitation" title="[% library_limits_str | html %]">
215
                                            [% IF debit_type.restricts_checkouts %]
221
                                            [% IF debit_type.library_limits.count > 1 %]
216
                                                <span>Yes</span>
222
                                                <span>[% debit_type.library_limits.count | html %] library limitations</span>
217
                                            [% ELSE %]
223
                                            [% ELSE %]
218
                                                <span>No</span>
224
                                                <span>[% debit_type.library_limits.count | html %] library limitation</span>
219
                                            [% END %]
220
                                        </td>
221
                                        <td class="actions">
222
                                            [% IF !debit_type.archived %]
223
                                                <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&amp;code=[% debit_type.code | uri %]&type=debit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
224
                                                [% IF !debit_type.is_system %]
225
                                                    <form id="archive_[% debit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/debit_types.pl">
226
                                                        [% INCLUDE 'csrf-token.inc' %]
227
                                                        <input type="hidden" name="op" value="cud-archive" />
228
                                                        <input type="hidden" name="code" value="[% debit_type.code | html %]" />
229
                                                        <button type="submit" class="btn btn-default btn-xs archive_button" href="#" data-code="[% debit_type.code | html %]"><i class="fa fa-archive"></i> Archive</button>
230
                                                    </form>
231
                                                [% END %]
232
                                            [% ELSIF debit_type.archived %]
233
                                                <form id="unarchive_[% debit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/debit_types.pl">
234
                                                    [% INCLUDE 'csrf-token.inc' %]
235
                                                    <input type="hidden" name="op" value="cud-unarchive" />
236
                                                    <input type="hidden" name="code" value="[% debit_type.code | html %]" />
237
                                                    <button type="submit" class="btn btn-default btn-xs unarchive_button" href="#" data-code="[% debit_type.code | html %]"><i class="fa fa-undo"></i> Restore</button>
238
                                                </form>
239
                                            [% END %]
225
                                            [% END %]
240
                                        </td>
226
                                        </span>
241
                                    </tr>
227
                                    [% ELSE %]
228
                                        <span>No limitation</span>
242
                                    [% END %]
229
                                    [% END %]
243
                                </tbody>
230
                                </td>
244
                            </table>
231
                                <td>
245
                        </div><!-- /.page-section -->
232
                                    [% IF debit_type.restricts_checkouts %]
246
                    [% ELSE %]
233
                                        <span>Yes</span>
247
                        <div class="alert alert-info">
234
                                    [% ELSE %]
248
                            There are no account debit types defined. <a href="/cgi-bin/koha/admin/debit_types.pl?op=add_form">Create new debit type</a>
235
                                        <span>No</span>
249
                        </div>
236
                                    [% END %]
250
                    [% END %]
237
                                </td>
251
                [% END %]
238
                                <td class="actions">
239
                                    [% IF !debit_type.archived %]
240
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&amp;code=[% debit_type.code | uri %]&type=debit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
241
                                        [% IF !debit_type.is_system %]
242
                                            <form id="archive_[% debit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/debit_types.pl">
243
                                                [% INCLUDE 'csrf-token.inc' %]
244
                                                <input type="hidden" name="op" value="cud-archive" />
245
                                                <input type="hidden" name="code" value="[% debit_type.code | html %]" />
246
                                                <button type="submit" class="btn btn-default btn-xs archive_button" href="#" data-code="[% debit_type.code | html %]"><i class="fa fa-archive"></i> Archive</button>
247
                                            </form>
248
                                        [% END %]
249
                                    [% ELSIF debit_type.archived %]
250
                                        <form id="unarchive_[% debit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/debit_types.pl">
251
                                            [% INCLUDE 'csrf-token.inc' %]
252
                                            <input type="hidden" name="op" value="cud-unarchive" />
253
                                            <input type="hidden" name="code" value="[% debit_type.code | html %]" />
254
                                            <button type="submit" class="btn btn-default btn-xs unarchive_button" href="#" data-code="[% debit_type.code | html %]"><i class="fa fa-undo"></i> Restore</button>
255
                                        </form>
256
                                    [% END %]
257
                                </td>
258
                            </tr>
259
                        [% END %]
260
                    </tbody>
261
                </table> </div
262
            ><!-- /.page-section -->
263
        [% ELSE %]
264
            <div class="alert alert-info"> There are no account debit types defined. <a href="/cgi-bin/koha/admin/debit_types.pl?op=add_form">Create new debit type</a> </div>
265
        [% END %]
266
    [% END %]
252
[% END %]
267
[% END %]
253
268
254
[% MACRO jsinclude BLOCK %]
269
[% MACRO jsinclude BLOCK %]
255
    [% Asset.js("js/admin-menu.js") | $raw %]
270
    [% Asset.js("js/admin-menu.js") | $raw %]
256
    [% Asset.js("js/additional-fields-entry.js") | $raw %]
271
    [% Asset.js("js/additional-fields-entry.js") | $raw %]
257
    [% INCLUDE 'datatables.inc' %]
272
    [% INCLUDE 'datatables.inc' %]
258
259
    <script>
273
    <script>
260
        $(document).ready(function() {
274
        $(document).ready(function () {
261
            var txtActivefilter = _("Filter system debit types");
275
            var txtActivefilter = _("Filter system debit types");
262
            var txtInactivefilter = _("Show all debit types");
276
            var txtInactivefilter = _("Show all debit types");
263
            var table_debit_types = $("#table_debit_types").kohaTable({
277
            var table_debit_types = $("#table_debit_types").kohaTable({
Lines 276-295 Link Here
276
            $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>");
290
            $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>");
277
            $("#filter_system").click(function (e) {
291
            $("#filter_system").click(function (e) {
278
                e.preventDefault();
292
                e.preventDefault();
279
                if ($(this).hasClass('filtered')) {
293
                if ($(this).hasClass("filtered")) {
280
                    var filteredValue = '';
294
                    var filteredValue = "";
281
                    $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
295
                    $(this).html('<i class="fa fa-filter"></i> ' + txtActivefilter);
282
                } else { // Not filtered. Let's do it!
296
                } else {
283
                    var filteredValue = '0';
297
                    // Not filtered. Let's do it!
284
                    $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
298
                    var filteredValue = "0";
299
                    $(this).html('<i class="fa fa-filter"></i> ' + txtInactivefilter);
285
                }
300
                }
286
                table_debit_types.DataTable().columns(1).search(filteredValue, false, false).draw();
301
                table_debit_types.DataTable().columns(1).search(filteredValue, false, false).draw();
287
                $(this).toggleClass('filtered');
302
                $(this).toggleClass("filtered");
288
            });
303
            });
289
304
290
            //Start filtered
305
            //Start filtered
291
            $('#filter_system').click();
306
            $("#filter_system").click();
292
293
        });
307
        });
294
    </script>
308
    </script>
295
[% END %]
309
[% END %]
296
- 

Return to bug 38457