Main Koha release repository
https://koha-community.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
255 lines
12 KiB
255 lines
12 KiB
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Automatic item modifications by age</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="tools_automatic_item_modification_by_age" class="tools">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
|
|
[% IF ( op == 'edit_form' ) %]
|
|
<a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a> ›
|
|
Rules
|
|
[% ELSE %]
|
|
Automatic item modifications by age
|
|
[% END %]
|
|
</div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% IF ( op == 'edit_form' ) %]
|
|
<form method="post" id="rules_form" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">
|
|
<h3>Rules for automatic item modifications by age</h3>
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<div class="btn-group">
|
|
<button class="btn btn-default add_rule"><i class="fa fa-plus"></i> Add rule</button>
|
|
</div>
|
|
<div class="btn-group">
|
|
<button type="submit" id="save_rules" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
|
|
</div>
|
|
<div class="btn-group">
|
|
<a class="btn btn-default" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa fa-remove"></i> Cancel</a>
|
|
</div>
|
|
</div>
|
|
[% ELSE %]
|
|
<h3>Automatic item modifications by age</h3>
|
|
[% IF ( rules ) %]
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<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>
|
|
</div>
|
|
[% ELSE %]
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<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>
|
|
</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% FOR message IN messages %]
|
|
[% IF message.type == "error" %]
|
|
<div class="dialog alert">
|
|
[% END %]
|
|
[% IF message.code == "unable_to_load_configuration" %]
|
|
An error occurs: Unable to load the configuration.
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'edit_form' %]
|
|
<div id="edit_rules">
|
|
<div id="rules">
|
|
[% FOR rule IN rules %]
|
|
[% SET id = loop.count %]
|
|
<fieldset class="rule">
|
|
<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>
|
|
<input type="hidden" name="unique_id" value="[% loop.count | html %]" /> <!-- FIXME on update, the unique_id should be filled -->
|
|
<div class="age">
|
|
<h5>Age in days</h5>
|
|
<input class="age" type="number" value="[% rule.age | html %]" name="age_[% id | html %]" />
|
|
</div>
|
|
<div class="blocks">
|
|
<h5>Conditions</h5>
|
|
[% FOR condition IN rule.conditions %]
|
|
<div class="block">
|
|
<select name="condition_field_[% id | html %]">
|
|
<option value="">Choose a field name</option>
|
|
[% FOR field IN condition_fields %]
|
|
[% IF condition.field == field %]
|
|
<option value="[% field | html %]" selected="selected">[% field | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% field | html %]">[% field | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
=
|
|
<input type="text" value="[% condition.value | html %]" name="condition_value_[% id | html %]" />
|
|
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
|
|
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
<div class="blocks">
|
|
<h5>Substitutions</h5>
|
|
[% FOR substitution IN rule.substitutions %]
|
|
<div class="block">
|
|
<select class="required" required="required" name="substitution_field_[% id | html %]">
|
|
<option value="">Choose a field name</option>
|
|
[% FOR field IN substitution_fields %]
|
|
[% IF substitution.field == field %]
|
|
<option value="[% field | html %]" selected="selected">[% field | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% field | html %]">[% field | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
=
|
|
<input type="text" value="[% substitution.value | html %]" name="substitution_value_[% id | html %]" />
|
|
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
|
|
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
|
|
<span class="required">A field name is required</span>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
</fieldset>
|
|
[% END %]
|
|
</div>
|
|
<input type="hidden" name="op" value="update" />
|
|
</div>
|
|
</form>
|
|
|
|
<div id="norules" class="dialog message">
|
|
There are no rules defined.
|
|
</div>
|
|
|
|
<fieldset id="new_rule">
|
|
<legend>Rule <span class="rulecount"></span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend>
|
|
<input type="hidden" name="unique_id" />
|
|
<div class="age">
|
|
<h5>Age in days</h5>
|
|
<input class="age" type="number" value="" name="age" />
|
|
</div>
|
|
<div class="blocks">
|
|
<h5>Conditions</h5>
|
|
<div class="block">
|
|
<select name="condition_field">
|
|
<option value="">Choose a field name</option>
|
|
[% FOR field IN condition_fields %]
|
|
<option value="[% field | html %]">[% field | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
=
|
|
<input type="text" value="" name="condition_value" />
|
|
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a>
|
|
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a>
|
|
</div>
|
|
</div>
|
|
<div class="blocks">
|
|
<h5>Substitutions</h5>
|
|
<div class="block">
|
|
<select required="required" class="required" name="substitution_field">
|
|
<option value="">Choose a field name</option>
|
|
[% FOR field IN substitution_fields %]
|
|
<option value="[% field | html %]">[% field | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
=
|
|
<input type="text" value="" name="substitution_value" />
|
|
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
|
|
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
|
|
<span class="required">A field name is required</span>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
[% ELSIF rules %]
|
|
<div>
|
|
<h4>List of rules</h4>
|
|
<table id="rulest">
|
|
<thead>
|
|
<tr>
|
|
<th>Age</th>
|
|
<th>Conditions</th>
|
|
<th>Substitutions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOR rule IN rules %]
|
|
<tr>
|
|
<td>
|
|
[% IF rule.age.defined and rule.age.length > 0 %]
|
|
[% rule.age | html %] days
|
|
[% ELSE %]
|
|
There is no age for this rule.
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% FOR condition IN rule.conditions %]
|
|
[% IF condition.field %]
|
|
<div class="block">
|
|
[% condition.field | html %] = [% condition.value | html %]
|
|
</div>
|
|
[% ELSE %]
|
|
There is no condition for this rule.
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% FOR substitution IN rule.substitutions %]
|
|
<div class="block">
|
|
[% substitution.field | html %] = [% substitution.value | html %]
|
|
</div>
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
There are no rules defined.
|
|
</div>
|
|
[% END %]
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/tools-menu.js") | $raw %]
|
|
[% Asset.js("lib/hc-sticky.js") | $raw %]
|
|
[% Asset.js("js/automatic_item_modification_by_age.js") | $raw %]
|
|
[% IF op == 'edit_form' %]
|
|
<script>
|
|
var Sticky;
|
|
$(document).ready(function() {
|
|
[% IF ( op == 'edit_form' ) %]
|
|
Sticky = $("#toolbar");
|
|
Sticky.hcSticky({
|
|
stickTo: "main",
|
|
stickyClass: "floating"
|
|
});
|
|
[% END %]
|
|
[% IF rules.size > 0 %]
|
|
$("#norules").hide();
|
|
[% ELSE %]
|
|
$("#rules").show();
|
|
[% END %]
|
|
});
|
|
</script>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|
|
|