4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Automatic item modifications by age › Cataloging › Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
9 <body id="tools_automatic_item_modification_by_age" class="tools">
10 [% WRAPPER 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
14 [% WRAPPER 'sub-header.inc' %]
15 [% WRAPPER breadcrumbs %]
16 [% WRAPPER breadcrumb_item %]
17 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
20 [% IF ( op == 'edit_form' ) %]
21 [% WRAPPER breadcrumb_item %]
22 <a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a>
24 [% WRAPPER breadcrumb_item bc_active= 1 %]
28 [% WRAPPER breadcrumb_item bc_active= 1 %]
29 <span>Automatic item modifications by age</span>
32 [% END #/ WRAPPER breadcrumbs %]
33 [% END #/ WRAPPER sub-header.inc %]
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
40 [% IF ( op == 'edit_form' ) %]
41 <form method="post" id="rules_form" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">
42 <h1>Rules for automatic item modifications by age</h1>
43 <div id="toolbar" class="btn-toolbar">
44 <div class="btn-group">
45 <button class="btn btn-default add_rule"><i class="fa fa-plus"></i> Add rule</button>
47 <div class="btn-group">
48 <button type="submit" id="save_rules" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
50 <div class="btn-group">
51 <a class="btn btn-default" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa fa-remove"></i> Cancel</a>
55 <h1>Automatic item modifications by age</h1>
57 <div id="toolbar" class="btn-toolbar">
58 <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-pencil"></i> Edit rules</a>
61 <div id="toolbar" class="btn-toolbar">
62 <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-plus"></i> Add rules</a>
67 [% FOR message IN messages %]
68 [% IF message.type == "error" %]
69 <div class="dialog alert">
71 [% IF message.code == "unable_to_load_configuration" %]
72 An error occurs: Unable to load the configuration.
77 [% IF op == 'edit_form' %]
80 [% FOR rule IN rules %]
81 [% SET id = loop.count %]
82 <fieldset class="rule">
83 <legend>Rule <span class="rulecount">[% loop.count | html %]</span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend>
84 <input type="hidden" name="unique_id" value="[% loop.count | html %]" /> <!-- FIXME on update, the unique_id should be filled -->
87 <input class="age" type="text" inputmode="numeric" pattern="[0-9]*" value="[% rule.age | html %]" name="age_[% id | html %]" />
90 <select name="agefield_[% id | html %]">
91 <option value="">Choose an age field</option>
92 [% FOR field IN agefields.sort %]
93 [% IF rule.agefield == field %]
94 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
96 <option value="[% field | html %]">[% field | html %]</option>
100 <span class="hint">If not set then items.dateaccessioned will be used</span>
105 [% FOR condition IN rule.conditions %]
107 <select name="condition_field_[% id | html %]">
108 <option value="">Choose a field name</option>
109 [% FOR field IN condition_fields.sort %]
110 [% IF condition.field == field %]
111 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
113 <option value="[% field | html %]">[% field | html %]</option>
118 <input type="text" value="[% condition.value | html %]" name="condition_value_[% id | html %]" />
119 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
120 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
125 <h5>Substitutions</h5>
126 [% FOR substitution IN rule.substitutions %]
128 <select class="required" required="required" name="substitution_field_[% id | html %]">
129 <option value="">Choose a field name</option>
130 [% FOR field IN substitution_fields.sort %]
131 [% IF substitution.field == field %]
132 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
134 <option value="[% field | html %]">[% field | html %]</option>
139 <input type="text" value="[% substitution.value | html %]" name="substitution_value_[% id | html %]" />
140 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
141 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
142 <span class="required">A field name is required</span>
149 <input type="hidden" name="op" value="update" />
153 <div id="norules" class="dialog message">
154 There are no rules defined.
157 <fieldset id="new_rule">
158 <legend>Rule <span class="rulecount"></span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend>
159 <input type="hidden" name="unique_id" />
162 <input class="age" type="text" inputmode="numeric" pattern="[0-9]*" value="" name="age" />
165 <select name="agefield">
166 <option value="">Choose an age field</option>
167 [% FOR field IN agefields.sort %]
168 <option value="[% field | html %]">[% field | html %]</option>
171 <span class="hint">If not set then items.dateaccessioned will be used</span>
177 <select name="condition_field">
178 <option value="">Choose a field name</option>
179 [% FOR field IN condition_fields.sort %]
180 <option value="[% field | html %]">[% field | html %]</option>
184 <input type="text" value="" name="condition_value" />
185 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
186 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
190 <h5>Substitutions</h5>
192 <select required="required" class="required" name="substitution_field">
193 <option value="">Choose a field name</option>
194 [% FOR field IN substitution_fields.sort %]
195 <option value="[% field | html %]">[% field | html %]</option>
199 <input type="text" value="" name="substitution_value" />
200 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
201 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
202 <span class="required">A field name is required</span>
208 <h4>List of rules</h4>
210 <div class="page-section">
217 <th>Substitutions</th>
221 [% FOR rule IN rules %]
224 [% IF rule.age.defined and rule.age.length > 0 %]
225 <span>[% rule.age | html %] days</span>
227 <span>There is no age for this rule.</span>
231 [% IF rule.agefield %]
232 [% rule.agefield | html %]
234 <!-- In case old rules do not contain an agefield value display that items.dateaccessioned will be used -->
235 items.dateaccessioned
239 [% FOR condition IN rule.conditions %]
240 [% IF condition.field %]
242 [% condition.field | html %] = [% condition.value | html %]
245 There is no condition for this rule.
250 [% FOR substitution IN rule.substitutions %]
252 [% substitution.field | html %] = [% substitution.value | html %]
260 </div> <!-- /.page-section -->
263 <div class="dialog message">
264 There are no rules defined.
269 </div> <!-- /.col-sm-10.col-sm-push-2 -->
271 <div class="col-sm-2 col-sm-pull-10">
273 [% INCLUDE 'cat-menu.inc' %]
275 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
276 </div> <!-- /.row -->
278 [% MACRO jsinclude BLOCK %]
279 [% Asset.js("lib/hc-sticky.js") | $raw %]
280 [% Asset.js("js/automatic_item_modification_by_age.js") | $raw %]
281 [% IF op == 'edit_form' %]
284 $(document).ready(function() {
285 [% IF ( op == 'edit_form' ) %]
286 Sticky = $("#toolbar");
289 stickyClass: "floating"
292 [% IF rules.size > 0 %]
293 $("#norules").hide();
302 [% INCLUDE 'intranet-bottom.inc' %]