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