5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › Batch item modification</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style>input[type=checkbox]{ margin : 0 .5em; }</style>
9 [% Asset.css("css/addbiblio.css") | $raw %]
10 [% Asset.css("css/humanmsg.css") | $raw %]
13 <body id="tools_batchMod-edit" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
17 <div id="breadcrumbs">
18 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
19 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
20 <a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a>
23 <div class="main container-fluid">
26 <h1>Batch item modification</h1>
28 <h1>Batch item modification results</h1>
29 <div class="dialog message">
30 [% IF (modified_items) %]
31 [% modified_items | html %] item(s) modified (with [% modified_fields | html %] field(s) modified).
35 <fieldset class="action">
36 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
38 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
40 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
43 <a href="[% src | url %]">Return to where you were</a>
45 <a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a>
48 </div> <!-- /.dialog.message -->
51 [% IF ( barcode_not_unique ) %]
52 <div class="dialog alert">
53 <strong>Error saving item</strong>: Barcode must be unique.
56 [% IF ( no_next_barcode ) %]
57 <div class="dialog alert">
58 <strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.
62 [% IF ( notfoundbarcodes.size ) %]
63 <div class="dialog alert">
64 <p>Warning, the following barcodes were not found:</p>
67 <table style="margin:auto;">
69 <tr><th>Barcodes not found</th></tr>
72 [% FOREACH notfoundbarcode IN notfoundbarcodes %]
73 <tr><td>[% notfoundbarcode |html %]</td></td>
78 [% IF ( item_loop ) %]
79 [% UNLESS ( too_many_items_display ) %]
80 <h4>The following barcodes were found: </h4>
83 [% END # /IF notfoundbarcodes.size %]
85 [% IF ( notfounditemnumbers.size ) %]
86 <div class="dialog alert">
87 <p>Warning, the following itemnumbers were not found:</p>
90 <table style="margin:auto;">
92 <tr><th>Itemnumbers not found</th></tr>
95 [% FOREACH notfounditemnumber IN notfounditemnumbers %]
96 <tr><td>[% notfounditemnumber |html %]</td></td>
100 [% IF ( item_loop ) %]
101 [% UNLESS ( too_many_items_display ) %]
102 <h4>The following itemnumbers were found: </h4>
105 [% END # /IF notfounditemnumbers.size %]
108 <form name="f" action="batchMod.pl" method="post">
109 <input type="hidden" name="op" value="[% op | html %]" />
110 <input type="hidden" name="searchid" value="[% searchid | html %]" />
111 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
112 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
113 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
114 <input type="hidden" name="src" id="src" value="[% src | html %]" />
115 [% IF biblionumber %]
116 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
119 [% IF ( item_loop ) %]
122 <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>
126 <div id="cataloguing_additem_itemlist">
129 <strong>Show/hide columns:</strong>
130 <span class="selected">
131 <input type="checkbox" checked="checked" id="showall" />
132 <label for="showall">Show all columns</label>
135 <input type="checkbox" id="hideall" />
136 <label for="hideall">Hide all columns</label>
139 [% FOREACH item_header_loo IN item_header_loop %]
140 <span class="selected">
141 <input id="checkheader[% loop.count | html %]" type="checkbox" checked="checked" />
142 <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</label>
145 </p> <!-- /#selections -->
151 <th class="anti-the">Title</th>
152 <th class="holds_count" title="Item holds / Total holds">Holds</th>
153 [% FOREACH item_header_loo IN item_header_loop %]
154 <th> [% item_header_loo.header_value | html %] </th>
159 [% FOREACH item_loo IN item_loop %]
162 [% IF item_loo.nomod %]
163 <td class="error">Cannot edit</td>
166 <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 %]" />
173 <label for="row[% item_loo.itemnumber | html %]">
174 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">
175 [% item_loo.title | html %]
177 [% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]
180 <td class="holds_count">
181 [% IF item_loo.holds %]
182 [% IF item_loo.item_holds %]
183 <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 -%]" >
185 <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 -%]" >
188 [% IF item_loo.holds %]
189 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this record: [% item_loo.holds | html -%]" >
191 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this record" >
193 [% END # /IF item_loo.holds %]
194 [% IF item_loo.holds %]
195 [% item_loo.item_holds | html %]/[% item_loo.holds | html %]
197 [% item_loo.holds | html %]
201 [% FOREACH item_valu IN item_loo.item_value %]
203 [% item_valu.field | html %]
207 [% END # /FOREACH item_loo %]
209 </table> <!-- /#itemst -->
210 </div> <!-- /#cataloguing_additem_itemlist -->
211 [% END # /IF item_loop %]
213 [% IF ( simple_items_display || job_completed ) %]
214 [% IF ( too_many_items_display ) %]
215 <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 <p>The following items were modified:</p>
219 [% FOREACH simple_items_displa IN simple_items_display %]
221 [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% simple_items_displa.biblionumber | uri %]&itemnumber=[% simple_items_displa.itemnumber | uri %]">[% simple_items_displa.barcode | html %]</a>[% ELSE %][% simple_items_displa.barcode | html %][% END %]
225 [% END # /IF too_many_items_display %]
226 [% END # /IF simple_items_display %]
230 [% IF ( too_many_items_process ) %]
231 <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>
232 [% ELSIF ( too_many_items_display ) %]
233 <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>
234 [% FOREACH itemnumber IN itemnumbers_array %]
235 <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
237 [% END # /IF too_many_items_process %]
239 [% UNLESS (too_many_items_process) %]
240 <div id="cataloguing_additem_newitem">
242 <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>
243 <fieldset class="rows">
245 [% FOREACH ite IN item %]
247 <div class="subfield_line" style="[% ite.visibility | html %]" id="subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]">
248 [% SET mv = ite.marc_value %]
249 [% IF ( ite.mandatory ) %]
250 <label class="required" for="[%- mv.id | html -%]">
252 <label for="[%- mv.id | html -%]">
254 [% ite.subfield | html %] - [% ite.marc_lib | $raw %]
257 [% IF ( mv.type == 'select' ) -%]
258 <select name="[%- mv.name | html -%]" id="[%- mv.id | html -%]" size="1" tabindex="1" class="input_marceditor select2">
259 [%- FOREACH aval IN mv.values %]
260 [% ite.subfield | html %] -
261 [% IF aval == mv.default %]
262 <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
264 <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
268 [% ELSIF ( mv.type == 'text1' ) %]
269 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
270 <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>
271 [% ELSIF ( mv.type == 'text2' ) %]
272 <input type="text" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
274 <a href="#" class="buttonDot disabled" title="No popup">...</a>
276 <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot" title="Tag editor">...</a>
278 [% ELSIF ( mv.type == 'text' ) %]
279 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
280 [% ELSIF ( mv.type == 'hidden' ) %]
281 <input type="hidden" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
282 [% ELSIF ( mv.type == 'textarea' ) %]
283 <textarea tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255">[%- mv.value | html -%]"</textarea>
284 [%- END # /IF mv.type == ... -%]
286 <span name="regex_fields" style="display: none;">
287 s/<input type="text" id="[% mv.id | html %]" name="regex_search" placeholder="regex pattern" />/
288 <input type="text" id="[% mv.id | html %]" name="regex_replace" placeholder="regex replacement" />/
289 <input type="text" id="[% mv.id | html %]" name="regex_modifiers" placeholder="ig" size="3" />
292 [% UNLESS ( ite.mandatory ) %]
293 <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 %]" />
295 <span class="required">Required</span>
298 [% IF (mv.type == 'text' || mv.type == 'textarea' ) %]
299 <a href="#" name="field_regex" id="[% ite.id | html %]" >RegEx</a>
302 <input type="hidden" name="tag" value="[% ite.tag | html %]" />
303 <input type="hidden" name="subfield" value="[% ite.subfield | html %]" />
304 <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
305 [% IF ( ite.repeatable ) %]
306 <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode.parentNode); return false;">
307 <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
310 <span class="hint" id="hint[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]"></span>
311 </div> <!-- /.subfield_line -->
313 [% END # /FOREACH ite %]
317 <fieldset class="rows">
318 <legend>Other attributes</legend>
321 <div class="subfield_line">
322 <label for="exclude_from_local_holds_priority">Exclude from local holds priority:</label>
323 <select id="exclude_from_local_holds_priority" name="exclude_from_local_holds_priority" class="input_marceditor select2" style="width: 50px">
324 <option selected></option>
325 <option value="1">Yes</option>
326 <option value="0">No</option>
333 <fieldset class="action">
335 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
336 <div id="jobfailed"></div>
338 <input type="submit" id="mainformsubmit" value="Save" />
339 <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a>
341 </div> <!-- /#cataloguing_additem_newitem -->
343 <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
344 [% END # /UNLESS too_many_items_process %]
346 <fieldset class="action">
347 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
349 <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>
351 <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>
354 <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
356 <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>
358 </fieldset> <!-- /.action -->
362 [% MACRO jsinclude BLOCK %]
363 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
364 [% Asset.js("js/background-job-progressbar.js") | $raw %]
365 [% Asset.js("js/cataloging.js") | $raw %]
366 [% INCLUDE 'datatables.inc' %]
367 [% Asset.js("js/pages/batchMod.js") | $raw %]
368 [% INCLUDE 'select2.inc' %]
370 // Prepare array of all column headers, incrementing each index by
371 // two to accommodate control and title columns
372 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
373 for( x=0; x<allColumns.length; x++ ){
374 allColumns[x] = Number(allColumns[x]) + 2;
377 $(document).ready(function(){
378 $("input[name='disable_input']").click(function() {
379 var row = $(this).attr("id");
380 row = row.replace("row","hint");
381 var todisable = $(this).parent().find("[name='field_value'],[name='tag'],[name='subfield'],[name='mandatory']");
382 var regex_link = $(this).parent().find("[name='field_regex']");
383 if ($(this).is(":checked")) {
384 $(todisable).prop('disabled', true);
385 $("#"+row).html(_("This subfield will be deleted"));
386 $(regex_link).hide();
388 $(todisable).prop('disabled', false);
390 $(regex_link).show();
393 $("#mainformsubmit").on("click",function(){
394 return submitBackgroundJob(this.form);
396 $('a[name="field_regex"]').click(function() {
397 var id = $(this).attr('id');
398 var editor = $(this).parent().find("[name='field_value']");
399 var regex = $(this).parent().find("[name='regex_fields']");
400 var disable_input = $(this).parent().find("[name='disable_input']");
401 if ($(this).html() == 'RegEx') {
404 $(this).html('Text');
405 $(disable_input).prop('disabled', true);
409 $(this).html('RegEx');
410 $(disable_input).prop('disabled', false);
417 [%- # Loop over fields which may have plugin JavaScript -%]
418 [%- UNLESS (too_many_items_process) -%]
419 [%- FOREACH ite IN item -%]
420 [% SET mv = ite.marc_value %]
421 [%- IF ( mv.type == 'text2' ) -%]
422 <!-- subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %] -->
423 [% mv.javascript | $raw %]
430 [% INCLUDE 'intranet-bottom.inc' %]