4 [% PROCESS 'authorities-search-results.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Batch record modification › Tools › Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/humanmsg.css") | $raw %]
11 <body id="tools_batch_record_modification" class="tools">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
15 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
18 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
21 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
24 <a href="#" aria-current="page">Batch record modification</a>
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
34 <h1>Batch record modification</h1>
37 <div class="dialog message">
39 [% FOREACH message IN messages %]
40 [% IF message.type == 'success' %]
41 <div><i class="fa fa-check success"></i>
42 [% ELSIF message.type == 'warning' %]
43 <div><i class="fa fa-warning warn"></i>
44 [% ELSIF message.type == 'error' %]
45 <div><i class="fa fa-exclamation error"></i>
47 [% IF message.code == 'no_action_defined_for_the_template' %]
48 <span>The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.</span>
49 [% ELSIF message.code == 'biblio_not_exists' %]
50 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
51 [% ELSIF message.code == 'authority_not_exists' %]
52 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
53 [% ELSIF message.code == 'cannot_enqueue_job' %]
54 <span>Cannot enqueue this job.</span>
56 [% IF message.error %]
57 <span>(The error was: [% message.error | html %]. See the Koha logfile for more information).</span>
62 </div> <!-- /.dialog.message -->
65 [% IF view == 'form' %]
66 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="record_ids_selection">
67 <fieldset class="rows">
68 <legend>Record type</legend>
70 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
71 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
77 <div id="batch_mod_form" class="toptabs" style="clear:both">
78 <ul class="nav nav-tabs" role="tablist">
79 <li role="presentation" class="active">
80 <a href="#uploadfile_tab" aria-controls="uploadfile_tab" role="tab" data-toggle="tab">Upload a file</a>
83 <li id="show_list_option">
84 <a href="#shelves_tab" aria-controls="shelves_tab" role="tab" data-toggle="tab">Select a list of records</a>
87 <li role="presentation">
88 <a href="#enterlist_tab" aria-controls="enterlist_tab" role="tab" data-toggle="tab">Enter a list of record numbers</a>
92 <div class="tab-content">
93 <div id="uploadfile_tab" role="tabpanel" class="tab-pane active">
94 <fieldset class="rows">
96 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
103 <div id="shelves_tab" role="tabpanel" class="tab-pane">
104 <fieldset class="rows">
107 <label for="shelf_number">List: </label>
108 <select name="shelf_number" id="shelf_number">
109 <option value="">Select a list</option>
110 [% FOREACH list IN lists %]
111 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
122 <div id="enterlist_tab" role="tabpanel" class="tab-pane">
123 <fieldset class="rows">
126 <label for="recordnumber_list">Record numbers: </label>
127 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
128 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
134 </div> <!-- /.tab-content -->
135 </div> <!-- /#batch_mod_form -->
137 <fieldset class="rows">
138 <legend>MARC modification template</legend>
141 <label for="marc_modification_template_id" class="required">Template: </label>
142 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
143 <option value="">Select a template</option>
144 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
145 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
151 <fieldset class="action">
152 <input type="hidden" name="op" value="list" />
153 <input type="submit" value="Continue" class="button" />
154 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
156 </form> <!-- /#record_ids_selection -->
157 [% ELSIF view == 'list' %]
159 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
160 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
161 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
162 <option value="">Select a template</option>
163 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
164 [% IF mmt.selected %]
165 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
167 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
171 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
172 <div class="modal-dialog">
173 <div class="modal-content">
174 <div class="modal-header">
175 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
176 <h3 id="marcPreviewLabel">MARC preview</h3>
178 <div class="modal-body">
179 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
181 <div class="modal-footer">
182 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
187 [% IF recordtype == 'biblio' %]
189 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
190 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
192 <table id="biblios" class="records">
196 <th>Biblionumber</th>
202 [% FOR biblio IN records %]
204 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
205 <td>[% biblio.biblionumber | html %]</td>
206 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
208 <a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber | uri %]&mmtid=[% mmtid | uri %]&overlay_context=batchmod" class="previewMARC btn btn-default btn-xs" data-record_type="biblio" data-record_id="[% biblio.biblionumber | html %]" data-mmtid="[% mmtid | html %]" title="Preview MARC"><i class="fa fa-eye"></i> Show MARC</a>
213 </table> <!-- /#biblios -->
214 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
217 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
218 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
220 <table id="authorities" class="records">
230 [% FOR authority IN records %]
232 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
233 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
234 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
235 <td class="actions"><a href="/cgi-bin/koha/svc/records/preview?record_type=authority&record_id=[% authority.authid | uri %]&mmtid=[% mmtid | uri %]&overlay_context=batchmod" data-record_type="authority" data-record_id="[% authority.authid | html %]" data-mmtid="[% mmtid | html %]" class="previewMARC btn btn-default btn-xs"><i class='fa fa-eye'></i> Show MARC</a>
239 </table> <!-- /#authorities -->
240 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
242 <fieldset class="action">
243 <input type="hidden" name="op" value="modify" />
244 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
245 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
247 </form> <!-- /#process -->
249 <div class="dialog message">
250 No records were modified. [% IF recordtype != 'biblio' %]<a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>[% END %]
253 [% ELSIF view == 'errors' %]
254 [% FOR error IN errors %]
255 [% IF error == 'no_template_defined' %]
256 <div class="dialog alert">
257 No MARC modification template is defined. You have <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">to create</a> at least one template for using this tool.
261 [% ELSIF view == 'enqueued' %]
262 <div class="dialog message">
263 <p>The job has been enqueued! It will be processed as soon as possible.</p>
264 <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a>
265 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
268 <div class="dialog alert">
269 No action defined for the template.
273 </div> <!-- /.col-sm-10.col-sm-push-2 -->
274 <div class="col-sm-2 col-sm-pull-10">
276 [% INCLUDE 'tools-menu.inc' %]
278 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
279 </div> <!-- /.row -->
281 [% MACRO jsinclude BLOCK %]
282 [% Asset.js("js/tools-menu.js") | $raw %]
283 [% INCLUDE 'datatables.inc' %]
284 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
286 $(document).ready(function() {
288 $("input[type='radio']").click(function() {
289 if ($(this).attr('id') == 'authority_type') {
290 $("#show_list_option").hide();
291 } else if ($(this).attr('id') == 'biblio_type') {
292 $("#show_list_option").show();
296 $("#selectall").click(function(e){
298 $(".records input[type='checkbox']").each(function(){
299 $(this).prop("checked", true);
303 $("#clearall").click(function(e){
305 $(".records input[type='checkbox']").each(function(){
306 $(this).prop("checked", false);
310 $("#selectall").click();
312 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
314 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
315 { "aTargets": [1], "sType": "num-html" }
322 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
324 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
325 { "aTargets": [1], "sType": "num-html" }
332 $("#mainformsubmit").click(function() {
333 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
334 alert(_("Please select at least one record to process"));
337 if ($("#marc_modification_template_id").val() <= 0) {
338 alert(_("Please select a modification template."));
344 $("#record_ids_selection").on("submit", function(e) {
345 var tab = $(this).find('#batch_mod_form li.active:first a').attr('href');
346 if (tab == '#uploadfile_tab') {
347 $("#shelf_number").empty('');
348 $("#recordnumber_list").val('');
349 } else if (tab == '#shelves_tab') {
350 $("#uploadfile").val('')
351 $("#recordnumber_list").val('');
352 } else { // enterlist
353 $("#uploadfile").val('')
354 $("#shelf_number").empty('');
358 $("#marc_modification_template_id").change(function() {
359 var url = "/cgi-bin/koha/svc/records/preview?"
360 var mmtid = $(this).val();
361 $("a.previewMARC").each(function() {
362 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
366 $("body").on("click", ".previewMARC", function(e) {
368 var ltitle = $(this).text();
369 var page = $(this).attr("href");
370 $("#marcPreviewLabel").text(ltitle);
371 $("#marcPreview .modal-body").load(page + " div");
372 $('#marcPreview').modal({ show: true });
374 $("#marcPreview").on("hidden.bs.modal", function() {
375 $("#marcPreviewLabel").html("");
376 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
382 [% INCLUDE 'intranet-bottom.inc' %]