4 [% PROCESS 'authorities-search-results.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Batch record modification › Cataloging › 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 [% WRAPPER 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
16 [% WRAPPER 'sub-header.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
25 [% IF view == 'form' %]
27 <a href="#" aria-current="page">Batch record modification</a>
31 <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
34 <a href="#" aria-current="page">Results</a>
41 <div class="main container-fluid">
43 <div class="col-sm-10 col-sm-push-2">
46 <h1>Batch record modification</h1>
49 <div class="dialog message">
51 [% FOREACH message IN messages %]
52 [% IF message.type == 'success' %]
53 <div><i class="fa fa-check success"></i>
54 [% ELSIF message.type == 'warning' %]
55 <div><i class="fa fa-warning warn"></i>
56 [% ELSIF message.type == 'error' %]
57 <div><i class="fa fa-exclamation error"></i>
59 [% IF message.code == 'no_action_defined_for_the_template' %]
60 <span>The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.</span>
61 [% ELSIF message.code == 'biblio_not_exists' %]
62 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
63 [% ELSIF message.code == 'authority_not_exists' %]
64 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
65 [% ELSIF message.code == 'cannot_enqueue_job' %]
66 <span>Cannot enqueue this job.</span>
68 [% IF message.error %]
69 <span>(The error was: [% message.error | html %]. See the Koha logfile for more information).</span>
74 </div> <!-- /.dialog.message -->
77 [% IF view == 'form' %]
78 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="record_ids_selection">
79 <fieldset class="rows">
80 <legend>Record type</legend>
82 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
83 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
89 <div id="batch_mod_form" class="toptabs" style="clear:both">
90 <ul class="nav nav-tabs" role="tablist">
91 <li role="presentation" class="active">
92 <a href="#uploadfile_tab" aria-controls="uploadfile_tab" role="tab" data-toggle="tab">Upload a file</a>
95 <li id="show_list_option">
96 <a href="#shelves_tab" aria-controls="shelves_tab" role="tab" data-toggle="tab">Select a list of records</a>
99 <li role="presentation">
100 <a href="#enterlist_tab" aria-controls="enterlist_tab" role="tab" data-toggle="tab">Enter a list of record numbers</a>
104 <div class="tab-content">
105 <div id="uploadfile_tab" role="tabpanel" class="tab-pane active">
106 <fieldset class="rows">
108 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
115 <div id="shelves_tab" role="tabpanel" class="tab-pane">
116 <fieldset class="rows">
119 <label for="shelf_number">List: </label>
120 <select name="shelf_number" id="shelf_number">
121 <option value="">Select a list</option>
122 [% FOREACH list IN lists %]
123 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
134 <div id="enterlist_tab" role="tabpanel" class="tab-pane">
135 <fieldset class="rows">
138 <label for="recordnumber_list">Record numbers: </label>
139 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
140 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
146 </div> <!-- /.tab-content -->
147 </div> <!-- /#batch_mod_form -->
149 <fieldset class="rows">
150 <legend>MARC modification template</legend>
153 <label for="marc_modification_template_id" class="required">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 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
163 <fieldset class="action">
164 <input type="hidden" name="op" value="list" />
165 <input type="submit" value="Continue" class="button" />
166 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
168 </form> <!-- /#record_ids_selection -->
169 [% ELSIF view == 'list' %]
171 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
172 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
173 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
174 <option value="">Select a template</option>
175 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
176 [% IF mmt.selected %]
177 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
179 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
183 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
184 <div class="modal-dialog">
185 <div class="modal-content">
186 <div class="modal-header">
187 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
188 <h3 id="marcPreviewLabel">MARC preview</h3>
190 <div class="modal-body">
191 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
193 <div class="modal-footer">
194 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
199 [% IF recordtype == 'biblio' %]
201 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
202 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
204 <table id="biblios" class="records">
208 <th>Biblionumber</th>
214 [% FOR biblio IN records %]
216 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
217 <td>[% biblio.biblionumber | html %]</td>
218 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
220 <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>
225 </table> <!-- /#biblios -->
226 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
229 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
230 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
232 <table id="authorities" class="records">
242 [% FOR authority IN records %]
244 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
245 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
246 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
247 <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>
251 </table> <!-- /#authorities -->
252 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
254 <fieldset class="action">
255 <input type="hidden" name="op" value="modify" />
256 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
257 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
259 </form> <!-- /#process -->
261 <div class="dialog message">
262 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 %]
265 [% ELSIF view == 'errors' %]
266 [% FOR error IN errors %]
267 [% IF error == 'no_template_defined' %]
268 <div class="dialog alert">
269 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.
273 [% ELSIF view == 'enqueued' %]
274 <div class="dialog message">
275 <p>The job has been enqueued! It will be processed as soon as possible.</p>
276 <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>
277 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
280 <div class="dialog alert">
281 No action defined for the template.
285 </div> <!-- /.col-sm-10.col-sm-push-2 -->
286 <div class="col-sm-2 col-sm-pull-10">
288 [% INCLUDE 'cat-menu.inc' %]
290 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
291 </div> <!-- /.row -->
293 [% MACRO jsinclude BLOCK %]
294 [% INCLUDE 'datatables.inc' %]
295 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
296 [% Asset.js("js/background-job-progressbar.js") | $raw %]
298 $(document).ready(function() {
300 $("input[type='radio']").click(function() {
301 if ($(this).attr('id') == 'authority_type') {
302 $("#show_list_option").hide();
303 } else if ($(this).attr('id') == 'biblio_type') {
304 $("#show_list_option").show();
308 $("#selectall").click(function(e){
310 $(".records input[type='checkbox']").each(function(){
311 $(this).prop("checked", true);
315 $("#clearall").click(function(e){
317 $(".records input[type='checkbox']").each(function(){
318 $(this).prop("checked", false);
322 $("#selectall").click();
324 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
326 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
327 { "aTargets": [1], "sType": "num-html" }
334 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
336 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
337 { "aTargets": [1], "sType": "num-html" }
344 $("#mainformsubmit").click(function() {
345 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
346 alert(_("Please select at least one record to process"));
349 if ($("#marc_modification_template_id").val() <= 0) {
350 alert(_("Please select a modification template."));
356 $("#record_ids_selection").on("submit", function(e) {
357 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
358 if (tab == '#uploadfile_tab') {
359 $("#shelf_number").empty('');
360 $("#recordnumber_list").val('');
361 } else if (tab == '#shelves_tab') {
362 $("#uploadfile").val('')
363 $("#recordnumber_list").val('');
364 } else { // enterlist
365 $("#uploadfile").val('')
366 $("#shelf_number").empty('');
370 $("#marc_modification_template_id").change(function() {
371 var url = "/cgi-bin/koha/svc/records/preview?"
372 var mmtid = $(this).val();
373 $("a.previewMARC").each(function() {
374 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
378 $("body").on("click", ".previewMARC", function(e) {
380 var ltitle = $(this).text();
381 var page = $(this).attr("href");
382 $("#marcPreviewLabel").text(ltitle);
383 $("#marcPreview .modal-body").load(page + " div");
384 $('#marcPreview').modal({ show: true });
386 $("#marcPreview").on("hidden.bs.modal", function() {
387 $("#marcPreviewLabel").html("");
388 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
394 [% INCLUDE 'intranet-bottom.inc' %]