5 [% PROCESS 'accounts.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
8 [% IF op =='add_form' %]
10 [% IF credit_type.code %]
17 [% END %] › Administration › Koha
19 [% INCLUDE 'doc-head-close.inc' %]
22 <body id="admin_credit_types" class="admin">
23 [% WRAPPER 'header.inc' %]
24 [% INCLUDE 'prefs-admin-search.inc' %]
27 [% WRAPPER 'sub-header.inc' %]
28 [% WRAPPER breadcrumbs %]
29 [% WRAPPER breadcrumb_item %]
30 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
33 [% IF op == 'add_form' %]
34 [% WRAPPER breadcrumb_item %]
35 <a href="/cgi-bin/koha/admin/credit_types.pl">Credit types</a>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
38 [% IF credit_type.code %]
39 <span>Modify credit type</span>
41 <span>New credit type</span>
46 [% WRAPPER breadcrumb_item bc_active= 1 %]
47 <span>Credit types</span>
50 [% END #/ WRAPPER breadcrumbs %]
51 [% END #/ WRAPPER sub-header.inc %]
53 <div class="main container-fluid">
55 <div class="col-sm-10 col-sm-push-2">
58 [% FOREACH m IN messages %]
59 <div class="dialog [% m.type | html %]">
61 [% CASE 'success_on_saving' %]
62 <span>Credit type saved successfully</span>
63 [% CASE 'error_on_saving' %]
64 <span>An error occurred when saving this credit type</span>
65 [% CASE 'success_on_archive' %]
66 <span>Credit type archived successfully</span>
67 [% CASE 'success_on_restore' %]
68 <span>Credit type restored successfully</span>
70 <span>[% m.code | html %]</span>
75 [% IF op == 'add_form' %]
77 <h1>Modify a credit type</h1>
79 <h1>New credit type</h1>
82 <form action="/cgi-bin/koha/admin/credit_types.pl" name="Aform" method="post" class="validated">
83 <input type="hidden" name="op" value="add_validate" />
84 <fieldset class="rows">
87 <label for="code" class="required">Credit type code: </label>
89 <strong>[% credit_type.code | html %]</strong>
90 <input type="hidden" name="code" value="[% code | html %]" />
92 <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>
96 <label for="description" class="required">Description: </label>
97 [% IF credit_type && credit_type.is_system %]
98 <span>[%- PROCESS credit_type_description credit_type = credit_type -%]</span>
100 <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% credit_type.description | html %]" /> <span class="required">Required</span>
104 <label for="can_be_added_manually">Can be manually added ? </label>
105 [% IF credit_type && credit_type.is_system %]
106 [% IF credit_type.can_be_added_manually %]<span>Yes</span>[% ELSE %]<span>No</span>[% END %]
107 [% ELSIF credit_type.can_be_added_manually %]
108 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
110 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
114 <label for="credit_number_enabled">Enable credit number</label>
115 [% IF credit_type.credit_number_enabled %]
116 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" checked="checked" value="1" />
118 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" value="1" />
120 <span class="hint">Enable automatic generation of credit number (see <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreditNumber">AutoCreditNumber</a>)</span>
123 <label for="branches">Libraries limitation: </label>
124 [% IF credit_type && credit_type.is_system %]
125 <span>No library limitation</span>
127 <select id="branches" name="branches" multiple size="10">
128 <option value="">All libraries</option>
129 [% FOREACH branch IN branches_loop %]
130 [% IF ( branch.selected ) %]
131 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
133 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
137 <div class="hint">Select 'All libraries' if this credit type should be available at all libraries. Otherwise select libraries you want to associate credit type with.</div>
143 <fieldset class="action">
144 <button id="save_credit_type" class="btn btn-primary">Save</button>
145 <a class="cancel" href="/cgi-bin/koha/admin/credit_types.pl">Cancel</a>
150 [% IF op == 'list' %]
151 <div id="toolbar" class="btn-toolbar">
152 <a class="btn btn-default" id="newcredittype" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form"><i class="fa fa-plus"></i> New credit type</a>
155 <h1>Account credit types</h1>
156 [% IF credit_types.count %]
157 <div class="page-section">
158 <table id="table_credit_types">
164 <th>Available for</th>
165 <th>Credit number enabled</th>
166 <th>Library limitations</th>
167 <th class="noExport">Actions</th>
170 [% FOREACH credit_type IN credit_types %]
172 <td>[% credit_type.archived | html %]</td>
173 <td>[% credit_type.is_system | html %]</td>
174 <td>[% credit_type.code | html %]</td>
175 <td>[%- PROCESS credit_type_description credit_type = credit_type -%]</td>
176 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
177 <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
179 [% IF credit_type.library_limits.count > 0 %]
180 [% library_limits_str = "" %]
181 [% FOREACH library IN credit_type.library_limits %]
182 [%- IF loop.first -%]
183 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
185 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
188 <span class="library_limitation" title="[% library_limits_str | html %]">
189 [% limits_count = credit_type.library_limits.count %]
190 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
192 <span>No library limitation</span>
196 [% IF !credit_type.archived %]
197 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form&code=[% credit_type.code | uri %]&type=credit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
199 [% IF !credit_type.is_system && !credit_type.archived %]
200 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=archive&code=[% credit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
203 [% IF !credit_type.is_system && credit_type.archived %]
204 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=unarchive&code=[% credit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a>
211 </div><!-- /.page-section -->
213 <div class="dialog message">
214 There are no account credit types defined.
215 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
220 </div> <!-- /.col-sm-10.col-sm-push-2 -->
222 <div class="col-sm-2 col-sm-pull-10">
224 [% INCLUDE 'admin-menu.inc' %]
226 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
227 </div> <!-- /.row -->
229 [% MACRO jsinclude BLOCK %]
230 [% Asset.js("js/admin-menu.js") | $raw %]
231 [% INCLUDE 'datatables.inc' %]
234 $(document).ready(function() {
235 var txtActivefilter = _("Filter system credit types");
236 var txtInactivefilter = _("Show all credit types");
237 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
239 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
240 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
242 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
243 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
244 "iDisplayLength": 20,
245 "sPaginationType": "full_numbers"
247 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
248 $('#filter_system').click(function(e) {
250 if ($(this).hasClass('filtered')) {
251 var filteredValue = '';
252 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
253 } else { //Not filtered. Let's do it!
254 var filteredValue = '0';
255 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
257 table_credit_types.fnFilter(filteredValue, 1, false, false);
258 $(this).toggleClass('filtered');
262 $('#filter_system').click();
267 [% INCLUDE 'intranet-bottom.inc' %]