3 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7 [% IF ( op == 'edit_form' ) %]
8 [% t("Rules") | html %] ›
10 [% t("Automatic item modifications by age") | html %] ›
11 [% t("Cataloging") | html %] ›
12 [% t("Koha") | html %]
14 [% INCLUDE 'doc-head-close.inc' %]
17 <body id="tools_automatic_item_modification_by_age" class="tools">
18 [% WRAPPER 'header.inc' %]
19 [% INCLUDE 'cat-search.inc' %]
22 [% WRAPPER 'sub-header.inc' %]
23 [% WRAPPER breadcrumbs %]
24 [% WRAPPER breadcrumb_item %]
25 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
28 [% IF ( op == 'edit_form' ) %]
29 [% WRAPPER breadcrumb_item %]
30 <a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a>
32 [% WRAPPER breadcrumb_item bc_active= 1 %]
36 [% WRAPPER breadcrumb_item bc_active= 1 %]
37 <span>Automatic item modifications by age</span>
40 [% END #/ WRAPPER breadcrumbs %]
41 [% END #/ WRAPPER sub-header.inc %]
43 <div class="main container-fluid">
45 <div class="col-sm-10 col-sm-push-2">
48 [% IF ( op == 'edit_form' ) %]
49 <form method="post" id="rules_form" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">
50 <h1>Rules for automatic item modifications by age</h1>
51 <div id="toolbar" class="btn-toolbar">
52 <div class="btn-group">
53 <button class="btn btn-default add_rule"><i class="fa fa-plus"></i> Add rule</button>
55 <div class="btn-group">
56 <button type="submit" id="save_rules" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
58 <div class="btn-group">
59 <a class="btn btn-default" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa fa-times"></i> Cancel</a>
63 <h1>Automatic item modifications by age</h1>
65 <div id="toolbar" class="btn-toolbar">
66 <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit rules</a>
69 <div id="toolbar" class="btn-toolbar">
70 <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>
75 [% FOR message IN messages %]
76 [% IF message.type == "error" %]
77 <div class="dialog alert">
79 [% IF message.code == "unable_to_load_configuration" %]
80 An error occurs: Unable to load the configuration.
85 [% IF op == 'edit_form' %]
88 [% FOR rule IN rules %]
89 [% SET id = loop.count %]
90 <fieldset class="rule">
91 <legend>Rule <span class="rulecount">[% loop.count | html %]</span> <a href="#" class="remove_rule"><i class="fa fa-trash-can"></i> Remove this rule</a></legend>
92 <input type="hidden" name="unique_id" value="[% loop.count | html %]" /> <!-- FIXME on update, the unique_id should be filled -->
95 <input class="age" type="text" inputmode="numeric" pattern="[0-9]*" value="[% rule.age | html %]" name="age_[% id | html %]" />
98 <select name="agefield_[% id | html %]">
99 <option value="">Choose an age field</option>
100 [% FOR field IN agefields %]
101 [% IF rule.agefield == field %]
102 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
104 <option value="[% field | html %]">[% field | html %]</option>
108 <span class="hint">If not set then items.dateaccessioned will be used</span>
113 [% FOR condition IN rule.conditions %]
115 <select name="condition_field_[% id | html %]">
116 <option value="">Choose a field name</option>
117 [% FOR field IN condition_fields %]
118 [% IF condition.field == field %]
119 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
121 <option value="[% field | html %]">[% field | html %]</option>
126 <input type="text" value="[% condition.value | html %]" name="condition_value_[% id | html %]" />
127 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
128 <a class="remove_block" href="#"><i class="fa fa-trash-can"></i> Remove condition</a>
133 <h5>Substitutions</h5>
134 [% FOR substitution IN rule.substitutions %]
136 <select class="required" required="required" name="substitution_field_[% id | html %]">
137 <option value="">Choose a field name</option>
138 [% FOR field IN substitution_fields %]
139 [% IF substitution.field == field %]
140 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
142 <option value="[% field | html %]">[% field | html %]</option>
147 <input type="text" value="[% substitution.value | html %]" name="substitution_value_[% id | html %]" />
148 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
149 <a class="remove_block" href="#"><i class="fa fa-trash-can"></i> Remove substitution</a>
150 <span class="required">A field name is required</span>
157 <input type="hidden" name="op" value="update" />
161 <div id="norules" class="dialog message">
162 There are no rules defined.
165 <fieldset id="new_rule">
166 <legend>Rule <span class="rulecount"></span> <a href="#" class="remove_rule"><i class="fa fa-trash-can"></i> Remove this rule</a></legend>
167 <input type="hidden" name="unique_id" />
170 <input class="age" type="text" inputmode="numeric" pattern="[0-9]*" value="" name="age" />
173 <select name="agefield">
174 <option value="">Choose an age field</option>
175 [% FOR field IN agefields %]
176 <option value="[% field | html %]">[% field | html %]</option>
179 <span class="hint">If not set then items.dateaccessioned will be used</span>
185 <select name="condition_field">
186 <option value="">Choose a field name</option>
187 [% FOR field IN condition_fields %]
188 <option value="[% field | html %]">[% field | html %]</option>
192 <input type="text" value="" name="condition_value" />
193 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
194 <a class="remove_block" href="#"><i class="fa fa-trash-can"></i> Remove condition</a>
198 <h5>Substitutions</h5>
200 <select required="required" class="required" name="substitution_field">
201 <option value="">Choose a field name</option>
202 [% FOR field IN substitution_fields %]
203 <option value="[% field | html %]">[% field | html %]</option>
207 <input type="text" value="" name="substitution_value" />
208 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
209 <a class="remove_block" href="#"><i class="fa fa-trash-can"></i> Remove substitution</a>
210 <span class="required">A field name is required</span>
216 <h4>List of rules</h4>
218 <div class="page-section">
225 <th>Substitutions</th>
229 [% FOR rule IN rules %]
232 [% IF rule.age.defined and rule.age.length > 0 %]
233 <span>[% rule.age | html %] days</span>
235 <span>There is no age for this rule.</span>
239 [% IF rule.agefield %]
240 [% rule.agefield | html %]
242 <!-- In case old rules do not contain an agefield value display that items.dateaccessioned will be used -->
243 items.dateaccessioned
247 [% FOR condition IN rule.conditions %]
248 [% IF condition.field %]
250 [% condition.field | html %] = [% condition.value | html %]
253 There is no condition for this rule.
258 [% FOR substitution IN rule.substitutions %]
260 [% substitution.field | html %] = [% substitution.value | html %]
268 </div> <!-- /.page-section -->
271 <div class="dialog message">
272 There are no rules defined.
277 </div> <!-- /.col-sm-10.col-sm-push-2 -->
279 <div class="col-sm-2 col-sm-pull-10">
281 [% INCLUDE 'cat-menu.inc' %]
283 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
284 </div> <!-- /.row -->
286 [% MACRO jsinclude BLOCK %]
287 [% Asset.js("lib/hc-sticky.js") | $raw %]
288 [% Asset.js("js/automatic_item_modification_by_age.js") | $raw %]
289 [% IF op == 'edit_form' %]
292 $(document).ready(function() {
293 [% IF ( op == 'edit_form' ) %]
294 Sticky = $("#toolbar");
297 stickyClass: "floating"
300 [% IF rules.size > 0 %]
301 $("#norules").hide();
310 [% INCLUDE 'intranet-bottom.inc' %]