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