Bug 27936: Clarify AllowItemsOnHoldCheckoutSIP syspref help text
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / marc_modification_templates.tt
1 [% USE raw %]
2 [% USE JSON.Escape %]
3 [% USE Asset %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; MARC modification templates</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% FILTER collapse %]
9     <style>
10         #add_action {
11             display: none;
12         }
13
14         .action_line {
15             margin-bottom: 1em;
16         }
17     </style>
18 [% END %]
19 </head>
20
21 <body id="tools_marc_modification_templates" class="tools">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'cat-search.inc' %]
24
25 [% IF ( TemplatesLoop ) %]
26     [% FOREACH TemplatesLoo IN TemplatesLoop %]
27         [% IF ( TemplatesLoo.selected ) %]
28             [% SET template_name = TemplatesLoo.name %]
29         [% END %]
30     [% END %]
31 [% END %]
32
33 <div id="breadcrumbs">
34     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
35     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
36     [% IF ( template_name ) %]
37         <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a>
38         &rsaquo; [% template_name | html %]
39     [% ELSE %]
40         MARC modification templates
41     [% END %]
42 </div>
43
44 <div class="main container-fluid">
45     <div class="row">
46         <div class="col-sm-10 col-sm-push-2">
47             <main>
48
49             <div id="toolbar" class="btn-toolbar">
50                 <a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-default duplicate_template"><i class="fa fa-plus"></i> New template</a>
51                 [% IF ( template_id != '' ) %]
52                     <a href="#" id="new_action" class="btn btn-default"><i class="fa fa-plus"></i> New action</a>
53                 [% END %]
54             </div>
55
56             [% IF error %]
57                 [% IF error == 'no_from_field' %]
58                     <div class="dialog message">Error: no field value specified.</div>
59                 [% END %]
60             [% END %]
61
62             [% IF ( TemplatesLoop ) %]
63
64                 [% IF ( template_id == '' ) %]
65
66                     <h2>MARC modification templates [% template_id | html %]</h2>
67
68                     <table id="templatest">
69                         <thead>
70                             <tr>
71                                 <th>Template</th>
72                                 <th class="noExport">Actions</th>
73                             </tr>
74                         </thead>
75                         <tbody>
76                             [% FOREACH TemplatesLoo IN TemplatesLoop %]
77                                 <tr>
78                                     <td>[% TemplatesLoo.name | html %]</td>
79                                     <td class="actions">
80                                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id | html %]&amp;op=select_template" ><i class="fa fa-fw fa-pencil"></i> Edit actions</a>
81                                         <a class="btn btn-default btn-xs duplicate_template" href="#" data-toggle="modal" data-template_id="[% TemplatesLoo.template_id | html %]" data-target="#createTemplate"><i class="fa fa-fw fa-copy"></i> Duplicate</a>
82                                         <a class="btn btn-default btn-xs delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id | html %]&amp;op=delete_template"><i class="fa fa-fw fa-trash"></i> Delete</a>
83                                     </td>
84                                 </tr>
85                             [% END %]
86                         </tbody>
87                     </table>
88
89                 [% ELSE %]
90
91                     <h2>Actions for <i>[% template_name | html %]</i></h2>
92
93                     [% IF ( ActionsLoop ) %]
94
95                         <table id="template_actions" class="template_actions">
96                             <thead>
97                                 <tr>
98                                     <th>Change order</th>
99                                     <th>Rank</th>
100                                     <th>Action</th>
101                                     <th>Description</th>
102                                     <th>&nbsp;</th>
103                                     <th>&nbsp;</th>
104                                 </tr>
105                             </thead>
106                             <tbody>
107                                 [% FOREACH ActionsLoo IN ActionsLoop %]
108                                     <tr>
109                                         <td class="actions">
110                                             <a title="Move action up" href="marc_modification_templates.pl?op=move_action&amp;where=up&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
111                                                 <i class="fa fa-arrow-up fa-lg order-control"></i>
112                                             </a>
113
114                                             <a title="Move action to top" href="marc_modification_templates.pl?op=move_action&amp;where=top&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
115                                                 <i class="fa fa-arrow-up fa-lg overline order-control"></i>
116                                             </a>
117
118                                             <a title="Move action to bottom" href="marc_modification_templates.pl?op=move_action&amp;where=bottom&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
119                                                 <i class="fa fa-arrow-down fa-lg underline order-control"></i>
120                                             </a>
121
122                                             <a title="Move action down" href="marc_modification_templates.pl?op=move_action&amp;where=down&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
123                                                 <i class="fa fa-arrow-down fa-lg order-control"></i>
124                                             </a>
125                                         </td>
126
127                                         <td>[% ActionsLoo.ordering | html %]</td>
128                                         <td>
129                                             [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %]
130                                             [% IF ( ActionsLoo.action_add_field ) %] Add new [% END %]
131                                             [% IF ( ActionsLoo.action_update_field ) %] Update existing or add new [% END %]
132                                             [% IF ( ActionsLoo.action_move_field ) %] Move [% END %]
133                                             [% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %]
134                                             [% IF ( ActionsLoo.action_copy_and_replace_field ) %] Copy and replace [% END %]
135
136                                             [% UNLESS ( ActionsLoo.action_update_field ) %]
137                                                 [% IF ( ActionsLoo.field_number ) %]
138                                                     1st
139                                                 [% END %]
140                                             [% END %]
141
142                                             field
143
144                                             [% ActionsLoo.from_field | html %][% IF ( ActionsLoo.from_subfield.length ) %]$[% ActionsLoo.from_subfield | html %][% END %]
145
146                                             [% IF ( ActionsLoo.field_value ) %]
147                                                 with value <i>[% ActionsLoo.field_value | html %]</i>
148                                             [% END %]
149
150                                             [% IF ( ActionsLoo.to_field ) %]
151                                                 to [% ActionsLoo.to_field | html %][% IF ( ActionsLoo.to_subfield.length ) %]$[% ActionsLoo.to_subfield | html %][% END %]
152
153                                                 [% IF ( ActionsLoo.to_regex_search ) %]
154                                                      using RegEx s<strong>/[% ActionsLoo.to_regex_search | html %]/[% ActionsLoo.to_regex_replace | html %]/[% ActionsLoo.to_regex_modifiers | html %]</strong>
155                                                 [% END %]
156                                             [% END %]
157
158                                             [% IF ( ActionsLoo.conditional ) %]
159                                                 [% IF ( ActionsLoo.conditional_if ) %] if [% END %]
160                                                 [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %]
161
162                                                 [% ActionsLoo.conditional_field | html %][% IF ( ActionsLoo.conditional_subfield.length ) %]$[% ActionsLoo.conditional_subfield | html %][% END %]
163
164                                                 [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %]
165                                                 [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %]
166                                                 [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %]
167                                                 [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %]
168
169                                                 [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]<strong>[% ActionsLoo.conditional_value | html %]</strong>[% IF ( ActionsLoo.conditional_regex ) %]/[% END %]
170                                             [% END %]
171                                         </td>
172                                         <td>[% ActionsLoo.description | html %]</td>
173                                         <td>
174                                             <a class="btn btn-default btn-xs edit_action" href="#modaction" data-mmta_id="[% ActionsLoo.mmta_id | html %]"><i class="fa fa-pencil"></i> Edit</a>
175                                         </td>
176                                         <td>
177                                             <a class="btn btn-default btn-xs" href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id | html %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id | html %]" onclick="return confirmDeleteAction();"><i class="fa fa-trash"></i> Delete</a>
178                                         </td>
179                                     </tr>
180                                 [% END # /FOREACH ActionsLoo %]
181                             </tbody>
182                         </table>
183                     [% ELSE %]
184                         <div class="dialog message template_actions"><p>There are no defined actions for this template.</p></div>
185                     [% END # /IF ActionsLoop %]
186
187                     <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" >
188                         <a name="modaction"></a>
189                         <fieldset>
190                             <legend id="modaction_legend">Add a new action</legend>
191                             <div id="warning_multivalued" style="color:red; display:none;">You have chosen a condition on the same field as the original field. If your records contain multivalued fields it is highly recommended not to do that.</div>
192
193                             <div class="action_line">
194                                 <select name="action" id="action" onchange="onActionChange(this);">
195                                     <option value="delete_field">Delete</option>
196                                     <option value="add_field">Add new</option>
197                                     <option value="update_field">Update existing or add new</option>
198                                     <option value="move_field">Move</option>
199                                     <option value="copy_field">Copy</option>
200                                     <option value="copy_and_replace_field">Copy and replace</option>
201                                 </select>
202
203                                 <span id="field_number_block">
204                                     <select name="field_number" id="field_number">
205                                         <option value="0">All</option>
206                                         <option value="1">1st</option>
207                                     </select>
208                                 </span>
209
210                                 field(s) <input type="text" name="from_field" id="from_field" size="3" maxlength="3" /> <input type="text" name="from_subfield" id="from_subfield" size="1" maxlength="1" title="let blank for the entire field" />
211
212                                 <span name="with_value_block" id="with_value_block" style="display:none;">
213                                     with value <input type="text" name="field_value" id="field_value" />
214                                 </span>
215
216                                 <span name="to_field_block" id="to_field_block" style="display:none;">
217                                     to field <input type="text" name="to_field" id="to_field" size="3" maxlength="3" /> <input type="text" name="to_subfield" id="to_subfield" size="1" maxlength="1" title="let blank for the entire field" />
218
219                                     <span name="to_field_regex_block" id="to_field_regex_block">
220                                         <sup>
221                                             <label for="to_field_regex">RegEx</label>
222                                             <input type="checkbox" name="to_field_regex" id="to_field_regex" onchange="onToFieldRegexChange(this);" />
223
224                                             <span name="to_field_regex_value_block" id="to_field_regex_value_block" style="display:none;">
225                                                 s/<input type="text" name="to_regex_search" id="to_regex_search" placeholder="regex pattern" />/<input type="text" name="to_regex_replace" id="to_regex_replace" placeholder="regex replacement" />/<input type="text" name="to_regex_modifiers" id="to_regex_modifiers" placeholder="ig" size="3" />
226                                             </span>
227                                         </sup>
228                                     </span>
229                                 </span>
230                             </div>
231
232                             <div class="action_line">
233                                 <select name="conditional" id="conditional" onchange="onConditionalChange(this);">
234                                     <option value="" selected="selected" />
235                                     <option value="if">if</option>
236                                     <option value="unless">unless</option>
237                                 </select>
238
239                                 <span name="conditional_block" id="conditional_block" style="display:none;">
240                                     field <input type="text" name="conditional_field" id="conditional_field" size="3" maxlength="3" /> <input type="text" name="conditional_subfield" id="conditional_subfield" size="1" maxlength="1" />
241
242                                     <select name="conditional_comparison" id="conditional_comparison" onchange="onConditionalComparisonChange(this);">
243                                         <option value="" />
244                                         <option value="exists">exists</option>
245                                         <option value="not_exists">doesn't exist</option>
246                                         <option value="equals">matches</option>
247                                         <option value="not_equals">doesn't match</option>
248                                     </select>
249
250                                     <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;">
251
252                                         <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span>
253
254                                         <sup>
255                                             <label for="conditional_regex">RegEx</label>
256                                             <input type="checkbox" name="conditional_regex" id="conditional_regex" onchange="onConditionalRegexChange(this);" />
257                                         </sup>
258
259                                     </span>
260                                 </span>
261                             </div>
262
263                             <div class="action_line">
264                                 <label for="description">Description:</label>
265                                 <input type="text" name="description" id="description" size="60" />
266                             </div>
267
268                             <fieldset class="action">
269                                 <input type="hidden" name="template_id" value="[% template_id | html %]" />
270                                 <input type="hidden" name="mmta_id" id="mmta_id" />
271                                 <input type="hidden" name="op" value="add_action" />
272                                 <input id="action_submit" type="submit" value="Add action" />
273                                 <a href="#modaction" class="cancel" id="cancel_edit" onclick="cancelEditAction();">Cancel</a>
274                             </fieldset>
275
276                         </fieldset>
277                     </form>
278
279                 [% END %]
280
281             [% ELSE %]
282                 <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
283             [% END # /IF TemplatesLoop %]
284
285             <!-- Modal to create new template -->
286             <div class="modal" id="createTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelcreateTemplate" aria-hidden="true">
287                 <div class="modal-dialog">
288                 <div class="modal-content">
289                 <div class="modal-header">
290                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
291                     <h3 id="LabelcreateTemplate">Create a new template</h3>
292                 </div>
293                 <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated">
294                     <div class="modal-body">
295                         <fieldset>
296                             <p>
297                                 <label for="template_name" class="required">Name: </label>
298                                 <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
299                                 <span class="required">Required</span>
300                             </p>
301
302                             <input type="hidden" name="op" value="create_template" />
303
304                             <p>
305                                 <label for="duplicate_a_template">Duplicate a template:</label>
306                                 <select name="template_id" id="duplicate_a_template">
307                                     <option value=""> -- None --</option>
308                                     [% FOREACH TemplatesLoo IN TemplatesLoop %]
309                                         <option value="[% TemplatesLoo.template_id | html %]"> [% TemplatesLoo.name | html %]</option>
310                                     [% END %]
311                                 </select>
312                                 <input type="hidden" name="duplicate_current_template" id="duplicate_current_template" />
313                             </p>
314                         </fieldset>
315                     </div>
316                     <div class="modal-footer">
317                         <button type="submit" class="btn btn-default">Submit</button>
318                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
319                     </div>
320                 </form>
321                 </div>
322                 </div>
323             </div>
324
325             </main>
326         </div> <!-- /.col-sm-10.col-sm-push-2 -->
327
328         <div class="col-sm-2 col-sm-pull-10">
329             <aside>
330                 [% INCLUDE 'tools-menu.inc' %]
331             </aside>
332         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
333      </div> <!-- /.row -->
334
335 [% MACRO jsinclude BLOCK %]
336     [% Asset.js("js/tools-menu.js") | $raw %]
337     <script>
338         var MSG_MMT_SUBFIELDS_MATCH = _("Both subfield values should be filled or empty.");
339         var MSG_MMT_DESTINATION_REQUIRED = _("The destination should be filled.");
340         var MSG_MMT_CONTROL_FIELD_EMPTY = _("If the field is a control field, the subfield should be empty");
341         var MSG_MMT_CONTROL_FIELD = _("A control field cannot be used with a regular field.");
342         var MSG_MMT_SOURCE_SUBFIELD = _("The source subfield should be filled for update.");
343         var MSG_MMT_SOURCE_FIELD = _("The source field should be filled.");
344         var MSG_MMT_EVERY = _("Every");
345         var MSG_MMT_ALL = _("All");
346         var MSG_MMT_CONFIRM_DEL_TEMPLATE = _("Are you sure you wish to delete this template?");
347         var MSG_MMT_CONFIRM_DEL_TEMPLATE_ACTION = _("Are you sure you wish to delete this template action?");
348         var MSG_MMT_EDIT_ACTION = _("Edit action %s");
349         var MSG_MMT_UPDATE_ACTION = _("Update action");
350         var MSG_MMT_CONDITIONAL_FIELD_REQUIRED = _("The conditional field should be filled.");
351         var MSG_MMT_CONDITIONAL_COMPARISON_REQUIRED = _("The conditional comparison operator should be filled.");
352         var MSG_MMT_CONDITIONAL_VALUE_REQUIRED = _("The conditional value should be filled.");
353         var MSG_MMT_CONDITIONAL_VALUE_REGEX_REQUIRED = _("The conditional regular expression should be filled.");
354         var mmtas = [% ActionsLoop.json | $raw %]
355     </script>
356     [% Asset.js("js/marc_modification_templates.js") | $raw %]
357 [% END %]
358
359 [% INCLUDE 'intranet-bottom.inc' %]