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="runinbackground" id="runinbackground" value="" />
122 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
123 <input type="hidden" name="src" id="src" value="[% src | html %]" />
124 [% IF biblionumber %]
125 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
128 [% IF ( item_loop ) %]
131 <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>
135 <div id="cataloguing_additem_itemlist">
138 <strong>Show/hide columns:</strong>
139 <span class="selected">
140 <input type="checkbox" checked="checked" id="showall" />
141 <label for="showall">Show all columns</label>
144 <input type="checkbox" id="hideall" />
145 <label for="hideall">Hide all columns</label>
148 [% FOREACH item_header_loo IN item_header_loop %]
149 <span class="selected">
150 <input id="checkheader[% loop.count | html %]" type="checkbox" checked="checked" />
151 <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</label>
154 </p> <!-- /#selections -->
160 <th class="anti-the">Title</th>
161 <th class="holds_count" title="Item holds / Total holds">Holds</th>
162 [% FOREACH item_header_loo IN item_header_loop %]
163 <th> [% item_header_loo.header_value | html %] </th>
168 [% FOREACH item_loo IN item_loop %]
171 [% IF item_loo.nomod %]
172 <td class="error">Cannot edit</td>
175 <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 %]" />
182 <label for="row[% item_loo.itemnumber | html %]">
183 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">
184 [% item_loo.title | html %]
186 [% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]
189 <td class="holds_count">
190 [% IF item_loo.holds %]
191 [% IF item_loo.item_holds %]
192 <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 -%]" >
194 <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 -%]" >
197 [% IF item_loo.holds %]
198 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this record: [% item_loo.holds | html -%]" >
200 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this record" >
202 [% END # /IF item_loo.holds %]
203 [% IF item_loo.holds %]
204 [% item_loo.item_holds | html %]/[% item_loo.holds | html %]
206 [% item_loo.holds | html %]
210 [% FOREACH item_valu IN item_loo.item_value %]
212 [% item_valu.field | html %]
216 [% END # /FOREACH item_loo %]
218 </table> <!-- /#itemst -->
219 </div> <!-- /#cataloguing_additem_itemlist -->
220 [% END # /IF item_loop %]
222 [% IF ( simple_items_display || job_completed ) %]
223 [% IF ( too_many_items_display ) %]
224 <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>
226 <p>The following items were modified:</p>
228 [% FOREACH simple_items_displa IN simple_items_display %]
230 [% 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 %]
234 [% END # /IF too_many_items_display %]
235 [% END # /IF simple_items_display %]
239 [% IF ( too_many_items_process ) %]
240 <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>
241 [% ELSIF ( too_many_items_display ) %]
242 <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>
243 [% FOREACH itemnumber IN itemnumbers_array %]
244 <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
246 [% END # /IF too_many_items_process %]
248 [% UNLESS (too_many_items_process) %]
249 <div id="cataloguing_additem_newitem">
251 <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>
252 <fieldset class="rows">
254 [% FOREACH ite IN item %]
256 <div class="subfield_line" style="[% ite.visibility | html %]" id="subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]">
257 [% SET mv = ite.marc_value %]
258 [% IF ( ite.mandatory ) %]
259 <label class="required" for="[%- mv.id | html -%]">
261 <label for="[%- mv.id | html -%]">
263 [% ite.subfield | html %] - [% ite.marc_lib | $raw %]
266 [% IF ( mv.type == 'select' ) -%]
267 <select name="[%- mv.name | html -%]" id="[%- mv.id | html -%]" tabindex="1" class="input_marceditor select2">
268 [%- FOREACH aval IN mv.values %]
269 [% ite.subfield | html %] -
270 [% IF aval == mv.default %]
271 <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
273 <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
277 [% ELSIF ( mv.type == 'text1' ) %]
278 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
279 <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>
280 [% ELSIF ( mv.type == 'text2' ) %]
281 <input type="text" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
283 <a href="#" class="buttonDot disabled" title="No popup">...</a>
285 <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot" title="Tag editor">...</a>
287 [% ELSIF ( mv.type == 'text' ) %]
288 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
289 [% ELSIF ( mv.type == 'hidden' ) %]
290 <input type="hidden" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
291 [% ELSIF ( mv.type == 'textarea' ) %]
292 <textarea tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255">[%- mv.value | html -%]"</textarea>
293 [%- END # /IF mv.type == ... -%]
295 <span name="regex_fields" style="display: none;">
296 s/<input type="text" id="[% mv.id | html %]" name="regex_search" placeholder="regex pattern" />/
297 <input type="text" id="[% mv.id | html %]" name="regex_replace" placeholder="regex replacement" />/
298 <input type="text" id="[% mv.id | html %]" name="regex_modifiers" placeholder="ig" size="3" />
301 [% UNLESS ( ite.mandatory ) %]
302 <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 %]" />
304 <span class="required">Required</span>
307 [% IF (mv.type == 'text' || mv.type == 'textarea' ) %]
308 <a href="#" name="field_regex" id="[% ite.id | html %]" >RegEx</a>
311 <input type="hidden" name="tag" value="[% ite.tag | html %]" />
312 <input type="hidden" name="subfield" value="[% ite.subfield | html %]" />
313 <input type="hidden" name="mandatory" value="[% ite.mandatory | html %]" />
314 [% IF ( ite.repeatable ) %]
315 <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode.parentNode); return false;">
316 <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
319 <span class="hint" id="hint[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]"></span>
320 </div> <!-- /.subfield_line -->
322 [% END # /FOREACH ite %]
326 <fieldset class="rows">
327 <legend>Other attributes</legend>
330 <div class="subfield_line">
331 <label for="exclude_from_local_holds_priority">Exclude from local holds priority:</label>
332 <select id="exclude_from_local_holds_priority" name="exclude_from_local_holds_priority" class="input_marceditor select2" style="width: 50px">
333 <option selected></option>
334 <option value="1">Yes</option>
335 <option value="0">No</option>
342 <fieldset class="action">
344 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
345 <div id="jobfailed"></div>
347 <input type="submit" id="mainformsubmit" value="Save" />
348 <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a>
350 </div> <!-- /#cataloguing_additem_newitem -->
352 <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
353 [% END # /UNLESS too_many_items_process %]
355 <fieldset class="action">
356 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
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>
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>
363 <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
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>
367 </fieldset> <!-- /.action -->
371 [% MACRO jsinclude BLOCK %]
372 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
373 [% Asset.js("js/background-job-progressbar.js") | $raw %]
374 [% Asset.js("js/cataloging.js") | $raw %]
375 [% INCLUDE 'datatables.inc' %]
376 [% Asset.js("js/pages/batchMod.js") | $raw %]
377 [% INCLUDE 'select2.inc' %]
379 // Prepare array of all column headers, incrementing each index by
380 // two to accommodate control and title columns
381 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
382 for( x=0; x<allColumns.length; x++ ){
383 allColumns[x] = Number(allColumns[x]) + 2;
386 $(document).ready(function(){
387 $("input[name='disable_input']").click(function() {
388 var row = $(this).attr("id");
389 row = row.replace("row","hint");
390 var todisable = $(this).parent().find("[name='field_value'],[name='tag'],[name='subfield'],[name='mandatory']");
391 var regex_link = $(this).parent().find("[name='field_regex']");
392 if ($(this).is(":checked")) {
393 $(todisable).prop('disabled', true);
394 $("#"+row).html(_("This subfield will be deleted"));
395 $(regex_link).hide();
397 $(todisable).prop('disabled', false);
399 $(regex_link).show();
402 $("#mainformsubmit").on("click",function(){
403 //return submitBackgroundJob(this.form);
405 $('a[name="field_regex"]').click(function() {
406 var id = $(this).attr('id');
407 var editor = $(this).parent().find("[name='field_value']");
408 var regex = $(this).parent().find("[name='regex_fields']");
409 var disable_input = $(this).parent().find("[name='disable_input']");
410 if ($(this).html() == 'RegEx') {
413 $(this).html('Text');
414 $(disable_input).prop('disabled', true);
418 $(this).html('RegEx');
419 $(disable_input).prop('disabled', false);
426 [%- # Loop over fields which may have plugin JavaScript -%]
427 [%- UNLESS (too_many_items_process) -%]
428 [%- FOREACH ite IN item -%]
429 [% SET mv = ite.marc_value %]
430 [%- IF ( mv.type == 'text2' ) -%]
431 <!-- subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %] -->
432 [% mv.javascript | $raw %]
439 [% INCLUDE 'intranet-bottom.inc' %]