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 The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.
49 [% ELSIF message.code == 'biblio_not_exists' %]
50 Bibliographic record [% message.biblionumber | html %] does not exist in the database.
51 [% ELSIF message.code == 'authority_not_exists' %]
52 Authority record [% message.authid | html %] does not exist in the database.
53 [% ELSIF message.code == 'cannot_enqueue_job' %]
54 Cannot enqueue this job.
56 [% IF message.error %]
57 (The error was: [% message.error | html %]. See the Koha logfile for more information).
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">
79 <li><a href="#uploadfile_tab">Upload a file</a></li>
80 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
81 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
84 <div id="uploadfile_tab">
85 <fieldset class="rows">
86 <legend>Use a file</legend>
88 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
95 <div id="shelves_tab">
96 <fieldset class="rows">
97 <legend>Or select a list of records</legend>
100 <label for="shelf_number">Use records from the following list: </label>
101 <select name="shelf_number" id="shelf_number">
102 <option value="">Select a list</option>
103 [% FOREACH list IN lists %]
104 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
115 <div id="enterlist_tab">
116 <fieldset class="rows">
117 <legend>Or enter a list of record numbers</legend>
120 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
121 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
128 </div> <!-- /#batch_mod_form -->
130 <fieldset class="rows">
131 <legend>Use MARC modification template:</legend>
134 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
135 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
136 <option value="">Select a template</option>
137 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
138 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
144 <fieldset class="action">
145 <input type="hidden" name="op" value="list" />
146 <input type="submit" value="Continue" class="button" />
147 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
149 </form> <!-- /#record_ids_selection -->
150 [% ELSIF view == 'list' %]
152 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
153 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
154 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
155 <option value="">Select a template</option>
156 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
157 [% IF mmt.selected %]
158 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
160 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
164 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
165 <div class="modal-dialog">
166 <div class="modal-content">
167 <div class="modal-header">
168 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
169 <h3 id="marcPreviewLabel">MARC preview</h3>
171 <div class="modal-body">
172 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
174 <div class="modal-footer">
175 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
180 [% IF recordtype == 'biblio' %]
182 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
183 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
185 <table id="biblios" class="records">
189 <th>Biblionumber</th>
195 [% FOR biblio IN records %]
197 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
198 <td>[% biblio.biblionumber | html %]</td>
199 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
201 <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>
206 </table> <!-- /#biblios -->
207 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
210 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
211 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
213 <table id="authorities" class="records">
223 [% FOR authority IN records %]
225 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
226 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
227 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
228 <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>
232 </table> <!-- /#authorities -->
233 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
235 <fieldset class="action">
236 <input type="hidden" name="op" value="modify" />
237 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
238 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
240 </form> <!-- /#process -->
242 <div class="dialog message">
243 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 %]
246 [% ELSIF view == 'errors' %]
247 [% FOR error IN errors %]
248 [% IF error == 'no_template_defined' %]
249 <div class="dialog alert">
250 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.
254 [% ELSIF view == 'enqueued' %]
255 <div class="dialog message">
256 <p>The job has been enqueued! It will be processed as soon as possible.</p>
257 <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>
258 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
261 <div class="dialog alert">
262 No action defined for the template.
266 </div> <!-- /.col-sm-10.col-sm-push-2 -->
267 <div class="col-sm-2 col-sm-pull-10">
269 [% INCLUDE 'tools-menu.inc' %]
271 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
272 </div> <!-- /.row -->
274 [% MACRO jsinclude BLOCK %]
275 [% Asset.js("js/tools-menu.js") | $raw %]
276 [% INCLUDE 'datatables.inc' %]
277 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
278 [% Asset.js("js/background-job-progressbar.js") | $raw %]
280 $(document).ready(function() {
282 $("#batch_mod_form").tabs();
284 $("input[type='radio']").click(function() {
285 if ($(this).attr('id') == 'authority_type') {
286 $("#show_list_option").hide();
287 } else if ($(this).attr('id') == 'biblio_type') {
288 $("#show_list_option").show();
292 $("#selectall").click(function(e){
294 $(".records input[type='checkbox']").each(function(){
295 $(this).prop("checked", true);
299 $("#clearall").click(function(e){
301 $(".records input[type='checkbox']").each(function(){
302 $(this).prop("checked", false);
306 $("#selectall").click();
308 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
310 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
311 { "aTargets": [1], "sType": "num-html" }
318 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
320 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
321 { "aTargets": [1], "sType": "num-html" }
328 $("#mainformsubmit").click(function() {
329 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
330 alert(_("Please select at least one record to process"));
333 if ($("#marc_modification_template_id").val() <= 0) {
334 alert(_("Please select a modification template."));
340 $("#record_ids_selection").on("submit", function(e) {
341 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
342 if (tab == '#uploadfile_tab') {
343 $("#shelf_number").empty('');
344 $("#recordnumber_list").val('');
345 } else if (tab == '#shelves_tab') {
346 $("#uploadfile").val('')
347 $("#recordnumber_list").val('');
348 } else { // enterlist
349 $("#uploadfile").val('')
350 $("#shelf_number").empty('');
354 $("#marc_modification_template_id").change(function() {
355 var url = "/cgi-bin/koha/svc/records/preview?"
356 var mmtid = $(this).val();
357 $("a.previewMARC").each(function() {
358 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
362 $("body").on("click", ".previewMARC", function(e) {
364 var ltitle = $(this).text();
365 var page = $(this).attr("href");
366 $("#marcPreviewLabel").text(ltitle);
367 $("#marcPreview .modal-body").load(page + " div");
368 $('#marcPreview').modal({ show: true });
370 $("#marcPreview").on("hidden.bs.modal", function() {
371 $("#marcPreviewLabel").html("");
372 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
378 [% INCLUDE 'intranet-bottom.inc' %]