4 [% PROCESS 'authorities-search-results.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › Batch record modification</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 <div id="breadcrumbs">
16 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
17 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
18 <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
21 <div class="main container-fluid">
23 <div class="col-sm-10 col-sm-push-2">
26 <h1>Batch record modification</h1>
29 <div class="dialog message">
31 [% FOREACH message IN messages %]
32 [% IF message.type == 'success' %]
33 <div><i class="fa fa-check success"></i>
34 [% ELSIF message.type == 'warning' %]
35 <div><i class="fa fa-warning warn"></i>
36 [% ELSIF message.type == 'error' %]
37 <div><i class="fa fa-exclamation error"></i>
39 [% IF message.code == 'no_action_defined_for_the_template' %]
40 The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.
41 [% ELSIF message.code == 'biblio_not_exists' %]
42 Bibliographic record [% message.biblionumber | html %] does not exist in the database.
43 [% ELSIF message.code == 'authority_not_exists' %]
44 Authority record [% message.authid | html %] does not exist in the database.
45 [% ELSIF message.code == 'cannot_enqueue_job' %]
46 Cannot enqueue this job.
48 [% IF message.error %]
49 (The error was: [% message.error | html %]. See the Koha logfile for more information).
54 </div> <!-- /.dialog.message -->
57 [% IF view == 'form' %]
58 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="record_ids_selection">
59 <fieldset class="rows">
60 <legend>Record type</legend>
62 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
63 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
69 <div id="batch_mod_form" class="toptabs" style="clear:both">
71 <li><a href="#uploadfile_tab">Upload a file</a></li>
72 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
73 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
76 <div id="uploadfile_tab">
77 <fieldset class="rows">
78 <legend>Use a file</legend>
80 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
87 <div id="shelves_tab">
88 <fieldset class="rows">
89 <legend>Or select a list of records</legend>
92 <label for="shelf_number">Use records from the following list: </label>
93 <select name="shelf_number" id="shelf_number">
94 <option value="">Select a list</option>
95 [% FOREACH list IN lists %]
96 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
107 <div id="enterlist_tab">
108 <fieldset class="rows">
109 <legend>Or enter a list of record numbers</legend>
112 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
113 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
120 </div> <!-- /#batch_mod_form -->
122 <fieldset class="rows">
123 <legend>Use MARC Modification Template:</legend>
126 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
127 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
128 <option value="">Select a template</option>
129 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
130 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
136 <fieldset class="action">
137 <input type="hidden" name="op" value="list" />
138 <input type="submit" value="Continue" class="button" />
139 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
141 </form> <!-- /#record_ids_selection -->
142 [% ELSIF view == 'list' %]
144 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
145 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
146 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
147 <option value="">Select a template</option>
148 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
149 [% IF mmt.selected %]
150 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
152 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
156 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
157 <div class="modal-dialog">
158 <div class="modal-content">
159 <div class="modal-header">
160 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
161 <h3 id="marcPreviewLabel">MARC preview</h3>
163 <div class="modal-body">
164 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
166 <div class="modal-footer">
167 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
172 [% IF recordtype == 'biblio' %]
174 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
175 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
177 <table id="biblios" class="records">
181 <th>Biblionumber</th>
187 [% FOR biblio IN records %]
189 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
190 <td>[% biblio.biblionumber | html %]</td>
191 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
193 <a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber | uri %]&mmtid=[% mmtid | uri %]" 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>
198 </table> <!-- /#biblios -->
199 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
202 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
203 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
205 <table id="authorities" class="records">
215 [% FOR authority IN records %]
217 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
218 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
219 <td>[% PROCESS authresult summary=authority.summary %]</td>
220 <td class="actions"><a href="/cgi-bin/koha/svc/records/preview?record_type=authority&record_id=[% authority.authid | uri %]&mmtid=[% mmtid | uri %]" 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>
224 </table> <!-- /#authorities -->
225 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
227 <fieldset class="action">
228 <input type="hidden" name="op" value="modify" />
229 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
230 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
232 </form> <!-- /#process -->
234 <div class="dialog message">
235 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 %]
238 [% ELSIF view == 'errors' %]
239 [% FOR error IN errors %]
240 [% IF error == 'no_template_defined' %]
241 <div class="dialog alert">
242 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.
246 [% ELSIF view == 'enqueued' %]
247 <div class="dialog message">
248 <p>The job has been enqueued! It will be processed as soon as possible (FIXME - well, it could depend on a config?)</p>
249 <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>
250 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
253 <div class="dialog alert">
254 No action defined for the template.
258 </div> <!-- /.col-sm-10.col-sm-push-2 -->
259 <div class="col-sm-2 col-sm-pull-10">
261 [% INCLUDE 'tools-menu.inc' %]
263 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
264 </div> <!-- /.row -->
266 [% MACRO jsinclude BLOCK %]
267 [% Asset.js("js/tools-menu.js") | $raw %]
268 [% INCLUDE 'datatables.inc' %]
269 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
270 [% Asset.js("js/background-job-progressbar.js") | $raw %]
272 $(document).ready(function() {
274 $("#batch_mod_form").tabs();
276 $("input[type='radio']").click(function() {
277 if ($(this).attr('id') == 'authority_type') {
278 $("#show_list_option").hide();
279 } else if ($(this).attr('id') == 'biblio_type') {
280 $("#show_list_option").show();
284 $("#selectall").click(function(e){
286 $(".records input[type='checkbox']").each(function(){
287 $(this).prop("checked", true);
291 $("#clearall").click(function(e){
293 $(".records input[type='checkbox']").each(function(){
294 $(this).prop("checked", false);
298 $("#selectall").click();
300 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
302 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
303 { "aTargets": [1], "sType": "num-html" }
310 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
312 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
313 { "aTargets": [1], "sType": "num-html" }
320 $("#mainformsubmit").click(function() {
321 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
322 alert(_("Please select at least one record to process"));
325 if ($("#marc_modification_template_id").val() <= 0) {
326 alert(_("Please select a modification template."));
332 $("#record_ids_selection").on("submit", function(e) {
333 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
334 if (tab == '#uploadfile_tab') {
335 $("#shelf_number").empty('');
336 $("#recordnumber_list").val('');
337 } else if (tab == '#shelves_tab') {
338 $("#uploadfile").val('')
339 $("#recordnumber_list").val('');
340 } else { // enterlist
341 $("#uploadfile").val('')
342 $("#shelf_number").empty('');
346 $("#marc_modification_template_id").change(function() {
347 var url = "/cgi-bin/koha/svc/records/preview?"
348 var mmtid = $(this).val();
349 $("a.previewMARC").each(function() {
350 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
354 $("body").on("click", ".previewMARC", function(e) {
356 var ltitle = $(this).text();
357 var page = $(this).attr("href");
358 $("#marcPreviewLabel").text(ltitle);
359 $("#marcPreview .modal-body").load(page + " div");
360 $('#marcPreview').modal({ show: true });
362 $("#marcPreview").on("hidden.bs.modal", function() {
363 $("#marcPreviewLabel").html("");
364 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
370 [% INCLUDE 'intranet-bottom.inc' %]