5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Administration ›
7 [% IF op =='add_form' %]
9 [% IF credit_type.code %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="admin_credit_types" class="admin">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'prefs-admin-search.inc' %]
25 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
28 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
31 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
34 [% IF op == 'add_form' %]
36 <a href="/cgi-bin/koha/admin/credit_types.pl">Credit types</a>
39 <a href="#" aria-current="page">
40 [% IF credit_type.code %]
50 <a href="#" aria-current="page">
58 <div class="main container-fluid">
60 <div class="col-sm-10 col-sm-push-2">
63 [% FOREACH m IN messages %]
64 <div class="dialog [% m.type | html %]">
66 [% CASE 'success_on_saving' %]
67 Credit type saved successfully.
68 [% CASE 'error_on_saving' %]
69 An error occurred when saving this credit type.
70 [% CASE 'success_on_archive' %]
71 Credit type archived successfully.
72 [% CASE 'success_on_restore' %]
73 Credit type restored successfully.
80 [% IF op == 'add_form' %]
82 <h3>Modify a credit type</h3>
84 <h3>New credit type</h3>
87 <form action="/cgi-bin/koha/admin/credit_types.pl" name="Aform" method="post" class="validated">
88 <input type="hidden" name="op" value="add_validate" />
89 <fieldset class="rows">
92 <label for="code" class="required">Credit type code: </label>
94 <strong>[% credit_type.code | html %]</strong>
95 <input type="hidden" name="code" value="[% code | html %]" />
97 <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>
101 <label for="description" class="required">Description: </label>
102 [% IF credit_type && credit_type.is_system %]
103 <span>[% credit_type.description | html %]</span>
105 <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>
109 <label for="can_be_added_manually">Can be manually added ? </label>
110 [% IF credit_type && credit_type.is_system %]
111 [% IF credit_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]
112 [% ELSIF credit_type.can_be_added_manually %]
113 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
115 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
119 <label for="credit_number_enabled">Enable credit number</label>
120 [% IF credit_type.credit_number_enabled %]
121 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" checked="checked" value="1" />
123 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" value="1" />
125 <span>Enable automatic generation of credit number (see <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreditNumber">AutoCreditNumber</a>)</span>
128 <label for="branches">Libraries limitation: </label>
129 [% IF credit_type && credit_type.is_system %]
130 No library limitation
132 <select id="branches" name="branches" multiple size="10">
133 <option value="">All libraries</option>
134 [% FOREACH branch IN branches_loop %]
135 [% IF ( branch.selected ) %]
136 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
138 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
142 <span>Select 'All libraries' if this credit type should be available at all libraries. Otherwise select libraries you want to associate credit type with.</span>
148 <fieldset class="action">
149 <button id="save_credit_type" class="btn btn-default">Save</button>
150 <a class="cancel" href="/cgi-bin/koha/admin/credit_types.pl">Cancel</a>
155 [% IF op == 'list' %]
156 <div id="toolbar" class="btn-toolbar">
157 <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>
160 <h3>Account credit types</h3>
161 [% IF credit_types.count %]
162 <table id="table_credit_types">
168 <th>Available for</th>
169 <th>Credit number enabled</th>
170 <th>Library limitations</th>
171 <th class="noExport">Actions</th>
174 [% FOREACH credit_type IN credit_types %]
176 <td>[% credit_type.archived | html %]</td>
177 <td>[% credit_type.is_system | html %]</td>
178 <td>[% credit_type.code | html %]</td>
179 <td>[% credit_type.description | html %]</td>
180 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
181 <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
183 [% IF credit_type.library_limits.count > 0 %]
184 [% library_limits_str = "" %]
185 [% FOREACH library IN credit_type.library_limits %]
186 [%- IF loop.first -%]
187 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
189 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
192 <span class="library_limitation" title="[% library_limits_str | html %]">
193 [% limits_count = credit_type.library_limits.count %]
194 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
200 [% IF !credit_type.archived %]
201 <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 fa-pencil"></i> Edit</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=archive&code=[% credit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
207 [% IF !credit_type.is_system && credit_type.archived %]
208 <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>
216 <div class="dialog message">
217 There are no account credit types defined.
218 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
223 </div> <!-- /.col-sm-10.col-sm-push-2 -->
225 <div class="col-sm-2 col-sm-pull-10">
227 [% INCLUDE 'admin-menu.inc' %]
229 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
230 </div> <!-- /.row -->
232 [% MACRO jsinclude BLOCK %]
233 [% Asset.js("js/admin-menu.js") | $raw %]
234 [% INCLUDE 'datatables.inc' %]
237 $(document).ready(function() {
238 var txtActivefilter = _("Filter system credit types");
239 var txtInactivefilter = _("Show all credit types");
240 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
242 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
243 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
245 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
246 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
247 "iDisplayLength": 20,
248 "sPaginationType": "full_numbers"
250 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
251 $('#filter_system').click(function(e) {
253 if ($(this).hasClass('filtered')) {
254 var filteredValue = '';
255 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
256 } else { //Not filtered. Let's do it!
257 var filteredValue = '0';
258 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
260 table_credit_types.fnFilter(filteredValue, 1, false, false);
261 $(this).toggleClass('filtered');
265 $('#filter_system').click();
270 [% INCLUDE 'intranet-bottom.inc' %]