4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Automatic item modifications by age</title>
6 [% INCLUDE 'doc-head-close.inc' %]
9 <body id="tools_automatic_item_modification_by_age" class="tools">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
12 <div id="breadcrumbs">
13 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
14 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
15 [% IF ( op == 'edit_form' ) %]
16 <a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a> ›
19 Automatic item modifications by age
23 <div class="main container-fluid">
25 <div class="col-sm-10 col-sm-push-2">
28 [% IF ( op == 'edit_form' ) %]
29 <form method="post" id="rules_form" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">
30 <h3>Rules for automatic item modifications by age</h3>
31 <div id="toolbar" class="btn-toolbar">
32 <div class="btn-group">
33 <button class="btn btn-default add_rule"><i class="fa fa-plus"></i> Add rule</button>
35 <div class="btn-group">
36 <button type="submit" id="save_rules" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
38 <div class="btn-group">
39 <a class="btn btn-default" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa fa-remove"></i> Cancel</a>
43 <h3>Automatic item modifications by age</h3>
45 <div id="toolbar" class="btn-toolbar">
46 <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>
49 <div id="toolbar" class="btn-toolbar">
50 <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>
55 [% FOR message IN messages %]
56 [% IF message.type == "error" %]
57 <div class="dialog alert">
59 [% IF message.code == "unable_to_load_configuration" %]
60 An error occurs: Unable to load the configuration.
65 [% IF op == 'edit_form' %]
68 [% FOR rule IN rules %]
69 [% SET id = loop.count %]
70 <fieldset class="rule">
71 <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>
72 <input type="hidden" name="unique_id" value="[% loop.count | html %]" /> <!-- FIXME on update, the unique_id should be filled -->
75 <input class="age" type="number" value="[% rule.age | html %]" name="age_[% id | html %]" />
79 [% FOR condition IN rule.conditions %]
81 <select name="condition_field_[% id | html %]">
82 <option value="">Choose a field name</option>
83 [% FOR field IN condition_fields %]
84 [% IF condition.field == field %]
85 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
87 <option value="[% field | html %]">[% field | html %]</option>
92 <input type="text" value="[% condition.value | html %]" name="condition_value_[% id | html %]" />
93 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
94 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
99 <h5>Substitutions</h5>
100 [% FOR substitution IN rule.substitutions %]
102 <select class="required" required="required" name="substitution_field_[% id | html %]">
103 <option value="">Choose a field name</option>
104 [% FOR field IN substitution_fields %]
105 [% IF substitution.field == field %]
106 <option value="[% field | html %]" selected="selected">[% field | html %]</option>
108 <option value="[% field | html %]">[% field | html %]</option>
113 <input type="text" value="[% substitution.value | html %]" name="substitution_value_[% id | html %]" />
114 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
115 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
116 <span class="required">A field name is required</span>
123 <input type="hidden" name="op" value="update" />
127 <div id="norules" class="dialog message">
128 There are no rules defined.
131 <fieldset id="new_rule">
132 <legend>Rule <span class="rulecount"></span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend>
133 <input type="hidden" name="unique_id" />
136 <input class="age" type="number" value="" name="age" />
141 <select name="condition_field">
142 <option value="">Choose a field name</option>
143 [% FOR field IN condition_fields %]
144 <option value="[% field | html %]">[% field | html %]</option>
148 <input type="text" value="" name="condition_value" />
149 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
150 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
154 <h5>Substitutions</h5>
156 <select required="required" class="required" name="substitution_field">
157 <option value="">Choose a field name</option>
158 [% FOR field IN substitution_fields %]
159 <option value="[% field | html %]">[% field | html %]</option>
163 <input type="text" value="" name="substitution_value" />
164 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
165 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
166 <span class="required">A field name is required</span>
172 <h4>List of rules</h4>
178 <th>Substitutions</th>
182 [% FOR rule IN rules %]
185 [% IF rule.age.defined and rule.age.length > 0 %]
186 [% rule.age | html %] days
188 There is no age for this rule.
192 [% FOR condition IN rule.conditions %]
193 [% IF condition.field %]
195 [% condition.field | html %] = [% condition.value | html %]
198 There is no condition for this rule.
203 [% FOR substitution IN rule.substitutions %]
205 [% substitution.field | html %] = [% substitution.value | html %]
215 <div class="dialog message">
216 There are no rules defined.
221 </div> <!-- /.col-sm-10.col-sm-push-2 -->
223 <div class="col-sm-2 col-sm-pull-10">
225 [% INCLUDE 'tools-menu.inc' %]
227 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
228 </div> <!-- /.row -->
230 [% MACRO jsinclude BLOCK %]
231 [% Asset.js("js/tools-menu.js") | $raw %]
232 [% Asset.js("lib/hc-sticky.js") | $raw %]
233 [% Asset.js("js/automatic_item_modification_by_age.js") | $raw %]
234 [% IF op == 'edit_form' %]
237 $(document).ready(function() {
238 [% IF ( op == 'edit_form' ) %]
239 Sticky = $("#toolbar");
242 stickyClass: "floating"
245 [% IF rules.size > 0 %]
246 $("#norules").hide();
255 [% INCLUDE 'intranet-bottom.inc' %]