5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Batch item modification › Tools › Koha</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' %]
18 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
21 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
27 <a href="#" aria-current="page">Batch item modification</a>
32 <div class="main container-fluid">
35 <h1>Batch item modification</h1>
37 <h1>Batch item modification results</h1>
38 <div class="dialog message">
39 [% IF (modified_items) %]
40 [% modified_items | html %] item(s) modified (with [% modified_fields | html %] field(s) modified).
44 <fieldset class="action">
45 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
47 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
49 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
52 <a href="[% src | url %]">Return to where you were</a>
54 <a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a>
57 </div> <!-- /.dialog.message -->
60 [% IF ( barcode_not_unique ) %]
61 <div class="dialog alert">
62 <strong>Error saving item</strong>: Barcode must be unique.
65 [% IF ( no_next_barcode ) %]
66 <div class="dialog alert">
67 <strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.
71 [% IF ( notfoundbarcodes.size ) %]
72 <div class="dialog alert">
73 <p>Warning, the following barcodes were not found:</p>
76 <table style="margin:auto;">
78 <tr><th>Barcodes not found</th></tr>
81 [% FOREACH notfoundbarcode IN notfoundbarcodes %]
82 <tr><td>[% notfoundbarcode |html %]</td></td>
87 [% IF ( item_loop ) %]
88 [% UNLESS ( too_many_items_display ) %]
89 <h4>The following barcodes were found: </h4>
92 [% END # /IF notfoundbarcodes.size %]
94 [% IF ( notfounditemnumbers.size ) %]
95 <div class="dialog alert">
96 <p>Warning, the following itemnumbers were not found:</p>
99 <table style="margin:auto;">
101 <tr><th>Itemnumbers not found</th></tr>
104 [% FOREACH notfounditemnumber IN notfounditemnumbers %]
105 <tr><td>[% notfounditemnumber |html %]</td></td>
109 [% IF ( item_loop ) %]
110 [% UNLESS ( too_many_items_display ) %]
111 <h4>The following itemnumbers were found: </h4>
114 [% END # /IF notfounditemnumbers.size %]
117 <form name="f" action="batchMod.pl" method="post">
118 <input type="hidden" name="op" value="[% op | html %]" />
119 <input type="hidden" name="searchid" value="[% searchid | html %]" />
120 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
121 <input type="hidden" name="src" id="src" value="[% src | html %]" />
122 [% IF biblionumber %]
123 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
126 [% IF ( item_loop ) %]
129 <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>
133 <div id="cataloguing_additem_itemlist">
136 <strong>Show/hide columns:</strong>
137 <span class="selected">
138 <input type="checkbox" checked="checked" id="showall" />
139 <label for="showall">Show all columns</label>
142 <input type="checkbox" id="hideall" />
143 <label for="hideall">Hide all columns</label>
146 [% FOREACH item_header_loo IN item_header_loop %]
147 <span class="selected">
148 <input id="checkheader[% loop.count | html %]" type="checkbox" checked="checked" />
149 <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</label>
152 </p> <!-- /#selections -->
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>
166 [% FOREACH item_loo IN item_loop %]
169 [% IF item_loo.nomod %]
170 <td class="error">Cannot edit</td>
173 <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 %]" />
180 <label for="row[% item_loo.itemnumber | html %]">
181 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">
182 [% item_loo.title | html %]
184 [% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]
187 <td class="holds_count">
188 [% IF item_loo.holds %]
189 [% IF item_loo.item_holds %]
190 <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 -%]" >
192 <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 -%]" >
195 [% IF item_loo.holds %]
196 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this record: [% item_loo.holds | html -%]" >
198 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this record" >
200 [% END # /IF item_loo.holds %]
201 [% IF item_loo.holds %]
202 [% item_loo.item_holds | html %]/[% item_loo.holds | html %]
204 [% item_loo.holds | html %]
208 [% FOREACH item_valu IN item_loo.item_value %]
210 [% item_valu.field | html %]
214 [% END # /FOREACH item_loo %]
216 </table> <!-- /#itemst -->
217 </div> <!-- /#cataloguing_additem_itemlist -->
218 [% END # /IF item_loop %]
220 [% IF ( simple_items_display || job_completed ) %]
221 [% IF ( too_many_items_display ) %]
222 <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>
224 <p>The following items were modified:</p>
226 [% FOREACH simple_items_displa IN simple_items_display %]
228 [% 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 %]
232 [% END # /IF too_many_items_display %]
233 [% END # /IF simple_items_display %]
237 [% IF ( too_many_items_process ) %]
238 <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>
239 [% ELSIF ( too_many_items_display ) %]
240 <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>
241 [% FOREACH itemnumber IN itemnumbers_array %]
242 <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
244 [% END # /IF too_many_items_process %]
246 [% UNLESS (too_many_items_process) %]
247 <div id="cataloguing_additem_newitem">
249 <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>
250 <fieldset class="rows">
252 [% FOREACH ite IN item %]
254 <div class="subfield_line" style="[% ite.visibility | html %]" id="subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]">
255 [% SET mv = ite.marc_value %]
256 [% IF ( ite.mandatory ) %]
257 <label class="required" for="[%- mv.id | html -%]">
259 <label for="[%- mv.id | html -%]">
261 [% ite.subfield | html %] - [% ite.marc_lib | $raw %]
264 [% IF ( mv.type == 'select' ) -%]
265 <select name="[%- mv.name | html -%]" id="[%- mv.id | html -%]" tabindex="1" class="input_marceditor select2">
266 [%- FOREACH aval IN mv.values %]
267 [% ite.subfield | html %] -
268 [% IF aval == mv.default %]
269 <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
271 <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
275 [% ELSIF ( mv.type == 'text1' ) %]
276 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
277 <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>
278 [% ELSIF ( mv.type == 'text2' ) %]
279 <input type="text" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
281 <a href="#" class="buttonDot disabled" title="No popup">...</a>
283 <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot" title="Tag editor">...</a>
285 [% ELSIF ( mv.type == 'text' ) %]
286 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
287 [% ELSIF ( mv.type == 'hidden' ) %]
288 <input type="hidden" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
289 [% ELSIF ( mv.type == 'textarea' ) %]
290 <textarea tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255">[%- mv.value | html -%]"</textarea>
291 [%- END # /IF mv.type == ... -%]
293 <span name="regex_fields" style="display: none;">
294 s/<input type="text" id="[% mv.id | html %]" name="regex_search" placeholder="regex pattern" />/
295 <input type="text" id="[% mv.id | html %]" name="regex_replace" placeholder="regex replacement" />/
296 <input type="text" id="[% mv.id | html %]" name="regex_modifiers" placeholder="ig" size="3" />
299 [% UNLESS ( ite.mandatory ) %]
300 <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 %]" />
302 <span class="required">Required</span>
305 [% IF (mv.type == 'text' || mv.type == 'textarea' ) %]
306 <a href="#" name="field_regex" id="[% ite.id | html %]" >RegEx</a>
309 <input type="hidden" name="tag" value="[% ite.tag | html %]" />
310 <input type="hidden" name="subfield" value="[% ite.subfield | html %]" />
311 <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
312 [% IF ( ite.repeatable ) %]
313 <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode.parentNode); return false;">
314 <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
317 <span class="hint" id="hint[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]"></span>
318 </div> <!-- /.subfield_line -->
320 [% END # /FOREACH ite %]
324 <fieldset class="rows">
325 <legend>Other attributes</legend>
328 <div class="subfield_line">
329 <label for="exclude_from_local_holds_priority">Exclude from local holds priority:</label>
330 <select id="exclude_from_local_holds_priority" name="exclude_from_local_holds_priority" class="input_marceditor select2" style="width: 50px">
331 <option selected></option>
332 <option value="1">Yes</option>
333 <option value="0">No</option>
340 <fieldset class="action">
341 <input type="submit" id="mainformsubmit" value="Save" />
342 <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a>
344 </div> <!-- /#cataloguing_additem_newitem -->
346 <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
347 [% END # /UNLESS too_many_items_process %]
349 <fieldset class="action">
350 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
352 <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>
354 <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>
357 <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
359 <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>
361 </fieldset> <!-- /.action -->
365 [% MACRO jsinclude BLOCK %]
366 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
367 [% Asset.js("js/cataloging.js") | $raw %]
368 [% INCLUDE 'datatables.inc' %]
369 [% Asset.js("js/pages/batchMod.js") | $raw %]
370 [% INCLUDE 'select2.inc' %]
372 // Prepare array of all column headers, incrementing each index by
373 // two to accommodate control and title columns
374 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
375 for( x=0; x<allColumns.length; x++ ){
376 allColumns[x] = Number(allColumns[x]) + 2;
379 $(document).ready(function(){
380 $("input[name='disable_input']").click(function() {
381 var row = $(this).attr("id");
382 row = row.replace("row","hint");
383 var todisable = $(this).parent().find("[name='field_value'],[name='tag'],[name='subfield'],[name='mandatory']");
384 var regex_link = $(this).parent().find("[name='field_regex']");
385 if ($(this).is(":checked")) {
386 $(todisable).prop('disabled', true);
387 $("#"+row).html(_("This subfield will be deleted"));
388 $(regex_link).hide();
390 $(todisable).prop('disabled', false);
392 $(regex_link).show();
395 $('a[name="field_regex"]').click(function() {
396 var id = $(this).attr('id');
397 var editor = $(this).parent().find("[name='field_value']");
398 var regex = $(this).parent().find("[name='regex_fields']");
399 var disable_input = $(this).parent().find("[name='disable_input']");
400 if ($(this).html() == 'RegEx') {
403 $(this).html('Text');
404 $(disable_input).prop('disabled', true);
408 $(this).html('RegEx');
409 $(disable_input).prop('disabled', false);
416 [%- # Loop over fields which may have plugin JavaScript -%]
417 [%- UNLESS (too_many_items_process) -%]
418 [%- FOREACH ite IN item -%]
419 [% SET mv = ite.marc_value %]
420 [%- IF ( mv.type == 'text2' ) -%]
421 <!-- subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %] -->
422 [% mv.javascript | $raw %]
429 [% INCLUDE 'intranet-bottom.inc' %]