Bug 28158: Remove additional backgroundjob related code
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Tools &rsaquo; Batch item modification</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
8 [% Asset.js("js/cataloging.js") | $raw %]
9 [% INCLUDE 'datatables.inc' %]
10 [% Asset.js("js/pages/batchMod.js") | $raw %]
11 <script>
12 //<![CDATA[
13
14 // Prepare array of all column headers, incrementing each index by
15 // two to accommodate control and title columns
16 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
17 for( x=0; x<allColumns.length; x++ ){
18   allColumns[x] = Number(allColumns[x]) + 2;
19 }
20 $(document).ready(function(){
21
22   $("input[name='disable_input']").click(function() {
23       var row = $(this).attr("id");
24       row = row.replace("row","hint");
25       var todisable = $(this).parent().find("[name='field_value'],[name='tag'],[name='subfield'],[name='mandatory']");
26       var regex_link = $(this).parent().find("[name='field_regex']");
27       if ($(this).is(":checked")) {
28           $(todisable).prop('disabled', true);
29           $("#"+row).html(_("This subfield will be deleted"));
30           $(regex_link).hide();
31       } else {
32           $(todisable).prop('disabled', false);
33           $("#"+row).html("");
34           $(regex_link).show();
35       }
36   });
37     $('a[name="field_regex"]').click(function() {
38         var id = $(this).attr('id');
39         var editor = $(this).parent().find("[name='field_value']");
40         var regex = $(this).parent().find("[name='regex_fields']");
41         var disable_input = $(this).parent().find("[name='disable_input']");
42         if ($(this).html() == 'RegEx') {
43             $(editor).hide();
44             $(regex).show();
45             $(this).html('Text');
46             $(disable_input).prop('disabled', true);
47         } else {
48             $(editor).show();
49             $(regex).hide();
50             $(this).html('RegEx');
51             $(disable_input).prop('disabled', false);
52         }
53         return false;
54     });
55 });
56 //]]>
57 </script>
58 <!--[if IE]>
59 <style>#selections { display: none; }</style>
60 <![endif]-->
61 <style>input[type=checkbox]{ margin : 0 .5em; }</style>
62 [% Asset.css("css/addbiblio.css") | $raw %]
63 [% Asset.css("css/humanmsg.css") | $raw %]
64 [% INCLUDE 'select2.inc' %]
65
66 </head>
67 <body id="tools_batchMod-edit" class="tools">
68 [% INCLUDE 'header.inc' %]
69 [% INCLUDE 'cat-search.inc' %]
70
71 <div id="breadcrumbs">
72   <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
73   <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
74   <a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a>
75 </div>
76
77 <div class="main container-fluid">
78
79             [% IF ( show ) %]
80               <h1>Batch item modification</h1>
81             [% ELSE %]
82               <h1>Batch item modification results</h1>
83               <div class="dialog message">
84                 [% IF (modified_items) %]
85                   [% modified_items | html %] item(s) modified (with [% modified_fields | html %] field(s) modified).
86                 [% ELSE %]
87                   No items modified.
88                 [% END %]
89               <fieldset class="action">
90                   [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
91                       [% IF searchid %]
92                           <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
93                       [% ELSE %]
94                           <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
95                       [% END %]
96                   [% ELSIF src %]
97                       <a href="[% src | url %]">Return to where you were</a>
98                   [% ELSE %]
99                       <a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a>
100                   [% END %]
101               </fieldset>
102               </div>
103             [% END %]
104 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
105 [% IF ( no_next_barcode ) %]<div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
106
107     [% IF ( notfoundbarcodes.size ) %]
108         <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div>
109         <table style="margin:auto;">
110             <thead>
111                 <tr><th>Barcodes not found</th></tr>
112             </thead>
113             <tbody>
114                 [% FOREACH notfoundbarcode IN notfoundbarcodes %]
115                     <tr><td>[% notfoundbarcode |html %]</td></td>
116                 [% END %]
117             </tbody>
118         </table>
119         [% IF ( item_loop ) %]
120             [% UNLESS ( too_many_items_display ) %]
121                 <h4>The following barcodes were found: </h4>
122             [% END %]
123         [% END %]
124     [% END %] <!-- /notfoundbarcodes -->
125     [% IF ( notfounditemnumbers.size ) %]
126         <div class="dialog alert"><p>Warning, the following itemnumbers were not found:</p></div>
127         <table style="margin:auto;">
128             <thead>
129                 <tr><th>Itemnumbers not found</th></tr>
130             </thead>
131             <tbody>
132                 [% FOREACH notfounditemnumber IN notfounditemnumbers %]
133                     <tr><td>[% notfounditemnumber |html %]</td></td>
134                 [% END %]
135             </tbody>
136         </table>
137         [% IF ( item_loop ) %]
138             [% UNLESS ( too_many_items_display ) %]
139                 <h4>The following itemnumbers were found: </h4>
140             [% END %]
141         [% END %]
142     [% END %] <!-- /notfounditemnumbers -->
143
144
145 <form name="f" action="batchMod.pl" method="post">
146      <input type="hidden" name="op" value="[% op | html %]" />
147      <input type="hidden" name="searchid" value="[% searchid | html %]" />
148      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
149      <input type="hidden" name="src" id="src" value="[% src | html %]" />
150      [% IF biblionumber %]
151         <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
152      [% END %]
153
154 [% IF ( item_loop ) %]
155   [% IF show %]
156     <div id="toolbar">
157       <a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-remove"></i> Clear all</a> | <a id="clearonloanbutton" href="#">Clear on loan</a>
158     </div>
159   [% END %]
160 <div id="cataloguing_additem_itemlist">
161
162 <p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
163         [% FOREACH item_header_loo IN item_header_loop %]
164         <span class="selected"><input id="checkheader[% loop.count | html %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</label> </span>
165         [% END %]
166 </p>
167         <table id="itemst">
168       <thead>
169     <tr>
170         <th>&nbsp;</th>
171         <th class="anti-the">Title</th>
172         <th class="holds_count" title="Item holds / Total holds">Holds</th>
173         [% FOREACH item_header_loo IN item_header_loop %]
174         <th> [% item_header_loo.header_value | html %] </th>
175         [% END %] 
176     </tr>
177       </thead>
178       <tbody>
179             [% FOREACH item_loo IN item_loop %]
180               <tr>
181                 [% IF show %]
182                   [% IF item_loo.nomod %]
183                     <td class="error">Cannot edit</td>
184                   [% ELSE %]
185                     <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" data-is-onloan="[% item_loo.onloan | html %]" /></td>
186                   [% END %]
187                 [% ELSE %]
188                   <td>&nbsp;</td>
189                 [% END %]
190                 <td>
191                     <label for="row[% item_loo.itemnumber | html %]">
192                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">
193                             [% item_loo.title | html %]
194                         </a>
195                         [% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]
196                     </label>
197                 </td>
198                 <td class="holds_count">
199                     [% IF item_loo.holds %]
200                         [% IF item_loo.item_holds %]
201                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this item: [% item_loo.item_holds | html %] / Total holds on this record: [% item_loo.holds | html -%]" >
202                         [% ELSE %]
203                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this item / Total holds on this record: [% item_loo.holds | html -%]" >
204                         [% END %]
205                     [% ELSE %]
206                         [% IF item_loo.holds %]
207                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this record: [% item_loo.holds | html -%]" >
208                         [% ELSE %]
209                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this record" >
210                         [% END %]
211                     [% END %]
212                                 [% IF item_loo.holds %]
213                                     [% item_loo.item_holds | html %]/[% item_loo.holds | html %]
214                                 [% ELSE %]
215                                     [% item_loo.holds | html %]
216                                 [% END %]
217                             </a>
218                 </td>
219                 [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field | html %]</td>
220         [% END %] </tr>
221             [% END %]
222       </tbody>
223         </table>
224 </div>
225 [% END %]<!-- /item_loop -->
226
227 [% IF ( simple_items_display || job_completed ) %]
228     [% IF ( too_many_items_display ) %]
229         <p>Too many items ([% too_many_items_display | html %]): You have edited more than [% Koha.Preference('MaxItemsToDisplayForBatchMod') | html %] items in a batch, items will not be shown.</p>
230     [% ELSE %]
231         <p>The following items were modified:</p>
232         <ul>
233         [% FOREACH simple_items_displa IN simple_items_display %]
234       <li>
235           [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% simple_items_displa.biblionumber | uri %]&amp;itemnumber=[% simple_items_displa.itemnumber | uri %]">[% simple_items_displa.barcode | html %]</a>[% ELSE %][% simple_items_displa.barcode | html %][% END %]
236       </li>
237         [% END %]
238         </ul>
239     [% END %]
240 [% END %]<!-- /simple_items_display -->
241
242 [% IF ( show ) %]
243
244 [% IF ( too_many_items_process ) %]
245     <p>Too many items ([% too_many_items_process | html %]): You are not allowed to edit more than [% Koha.Preference('MaxItemsToProcessForBatchMod') | html %] items in a batch.</p>
246 [% ELSIF ( too_many_items_display ) %]
247     <p>Too many items ([% too_many_items_display | html %]): You are editing more than [% Koha.Preference('MaxItemsToDisplayForBatchMod') | html %] items in a batch, items will not be shown.</p>
248     [% FOREACH itemnumber IN itemnumbers_array %]
249   <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
250     [% END %]
251 [% END %]<!-- /too_many_items -->
252
253 [% UNLESS (too_many_items_process) %]
254 <div id="cataloguing_additem_newitem">
255         <h2>Edit items</h2>
256         <div class="hint">Checking the box right next to the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div>
257   <fieldset class="rows">
258   <ol>
259         [% FOREACH ite IN item %]
260           <li>
261             <div class="subfield_line" style="[% ite.visibility | html %]" id="subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]">
262               [% SET mv = ite.marc_value %]
263               [% IF ( ite.mandatory ) %]
264                 <label class="required" for="[%- mv.id | html -%]">
265               [% ELSE %]
266                 <label for="[%- mv.id | html -%]">
267               [% END %]
268                 [% ite.subfield | html %] - [% ite.marc_lib | $raw %]
269               </label>
270
271               [% IF ( mv.type == 'select' ) -%]
272                 <select name="[%- mv.name | html -%]" id="[%- mv.id | html -%]" size="1" tabindex="1" class="input_marceditor select2">
273                   [%- FOREACH aval IN mv.values %]
274               [% ite.subfield | html %] -
275                     [% IF aval == mv.default %]
276                       <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
277                     [% ELSE %]
278                       <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
279                     [% END %]
280                   [%- END -%]
281                 </select>
282               [% ELSIF ( mv.type == 'text1' ) %]
283                 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
284                 <a href="#" class="buttonDot" onclick="Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=[%- mv.authtypecode | uri -%]&index=[%- mv.id | uri -%]','[%- mv.id | uri -%]'); return false;" title="Tag editor">...</a>
285               [% ELSIF ( mv.type == 'text2' ) %]
286                 <input type="text" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
287                 [% IF mv.noclick %]
288                   <a href="#" class="buttonDot disabled" title="No popup">...</a>
289                 [% ELSE %]
290                   <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot" title="Tag editor">...</a>
291                 [% END %]
292                 [% mv.javascript | $raw %]
293               [% ELSIF ( mv.type == 'text' ) %]
294                 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
295               [% ELSIF ( mv.type == 'hidden' ) %]
296                 <input type="hidden" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
297               [% ELSIF ( mv.type == 'textarea' ) %]
298                 <textarea tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255">[%- mv.value | html -%]"</textarea>
299               [%- END -%]
300
301               <span name="regex_fields" style="display: none;">
302                   s/<input type="text" id="[% mv.id | html %]" name="regex_search" placeholder="regex pattern" />/
303                   <input type="text" id="[% mv.id | html %]" name="regex_replace" placeholder="regex replacement" />/
304                   <input type="text" id="[% mv.id | html %]" name="regex_modifiers" placeholder="ig" size="3" />
305               </span>
306
307               [% UNLESS ( ite.mandatory ) %]
308                 <input type="checkbox" id="row[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]" title="Check to delete subfield [% ite.subfield | html %]" name="disable_input" value="[% ite.subfield | html %]" />
309               [% ELSE %]
310                 <span class="required">Required</span>
311               [% END %]
312
313               [% IF (mv.type == 'text' || mv.type == 'textarea' ) %]
314                   <a href="#" name="field_regex" id="[% ite.id | html %]" >RegEx</a>
315               [% END %]
316
317               <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
318               <input type="hidden" name="subfield"       value="[% ite.subfield | html %]" />
319               <input type="hidden" name="mandatory"       value="[% ite.mandatory | html %]" />
320               [% IF ( ite.repeatable ) %]
321                 <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode.parentNode); return false;">
322                   <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
323                 </a>
324               [% END %]
325               <span class="hint" id="hint[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]"></span>
326             </div>
327           </li>
328         [% END %]
329     </ol>
330     </fieldset>
331     <fieldset class="rows">
332       <legend>Other attributes</legend>
333       <ol>
334         <li>
335           <div class="subfield_line">
336           <label for="exclude_from_local_holds_priority">Exclude from local holds priority:</label>
337             <select id="exclude_from_local_holds_priority" name="exclude_from_local_holds_priority" class="input_marceditor select2" style="width: 50px">
338                 <option selected></option>
339                 <option value="1">Yes</option>
340                 <option value="0">No</option>
341             </select>
342           </div>
343         </li>
344       </ol>
345     </fieldset>
346     <fieldset class="action">    
347    <input type="submit" id="mainformsubmit" value="Save" />
348          <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a>
349     </fieldset>
350 </div>
351 [% ELSE %]
352     <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
353 [% END %]
354 [% ELSE %] <!-- // show -->
355 <fieldset class="action">
356 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
357     [% IF searchid %]
358         <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
359     [% ELSE %]
360         <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
361     [% END %]
362 [% ELSIF src %]
363    <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
364 [% ELSE %]
365    <a class="btn btn-default" href="/cgi-bin/koha/tools/batchMod.pl"><i class="fa fa-check-square-o"></i> Return to batch item modification</a>
366 [% END %]
367 </fieldset>
368
369 [% END %]
370
371 [% INCLUDE 'intranet-bottom.inc' %]