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" class="btn btn-primary" value="Continue" />
166 <a class="cancel" href="/cgi-bin/koha/cataloguing/cataloging-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' %]
200 <div class="btn-toolbar selections-toolbar">
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 <div class="page-section">
205 <table id="biblios" class="records">
209 <th>Biblionumber</th>
215 [% FOR biblio IN records %]
217 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
218 <td>[% biblio.biblionumber | html %]</td>
219 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
221 <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>
226 </table> <!-- /#biblios -->
228 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
230 <div class="btn-toolbar selections-toolbar">
231 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
232 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
234 <div class="page-section">
235 <table id="authorities" class="records">
245 [% FOR authority IN records %]
247 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
248 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
249 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
250 <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>
254 </table> <!-- /#authorities -->
256 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
258 <fieldset class="action">
259 <input type="hidden" name="op" value="modify" />
260 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
261 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
263 </form> <!-- /#process -->
265 <div class="dialog message">
266 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 %]
269 [% ELSIF view == 'errors' %]
270 [% FOR error IN errors %]
271 [% IF error == 'no_template_defined' %]
272 <div class="dialog message">
273 <p>No MARC modification template is defined. You have to create at least one template in order to use this tool.</p>
274 [% IF ( CAN_user_tools_marc_modification_templates ) %]
275 <a class="btn btn-default" href="/cgi-bin/koha/tools/marc_modification_templates.pl"><i class="fa fa-plus"></i> Create a new MARC modification template</a>
280 [% ELSIF view == 'enqueued' %]
281 <div class="dialog message">
282 <p>The job has been enqueued! It will be processed as soon as possible.</p>
283 <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>
284 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
287 <div class="dialog alert">
288 No action defined for the template.
292 </div> <!-- /.col-sm-10.col-sm-push-2 -->
293 <div class="col-sm-2 col-sm-pull-10">
295 [% INCLUDE 'cat-menu.inc' %]
297 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
298 </div> <!-- /.row -->
300 [% MACRO jsinclude BLOCK %]
301 [% INCLUDE 'datatables.inc' %]
302 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
304 $(document).ready(function() {
306 $("input[type='radio']").click(function() {
307 if ($(this).attr('id') == 'authority_type') {
308 $("#show_list_option").hide();
309 } else if ($(this).attr('id') == 'biblio_type') {
310 $("#show_list_option").show();
314 $("#selectall").click(function(e){
316 $(".records input[type='checkbox']").each(function(){
317 $(this).prop("checked", true);
321 $("#clearall").click(function(e){
323 $(".records input[type='checkbox']").each(function(){
324 $(this).prop("checked", false);
328 $("#selectall").click();
330 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
332 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
333 { "aTargets": [1], "sType": "num-html" }
340 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
342 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
343 { "aTargets": [1], "sType": "num-html" }
350 $("#mainformsubmit").click(function() {
351 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
352 alert(_("Please select at least one record to process"));
355 if ($("#marc_modification_template_id").val() <= 0) {
356 alert(_("Please select a modification template."));
362 $("#record_ids_selection").on("submit", function(e) {
363 var tab = $(this).find('#batch_mod_form li.active:first a').attr('href');
364 if (tab == '#uploadfile_tab') {
365 $("#shelf_number").empty('');
366 $("#recordnumber_list").val('');
367 } else if (tab == '#shelves_tab') {
368 $("#uploadfile").val('')
369 $("#recordnumber_list").val('');
370 } else { // enterlist
371 $("#uploadfile").val('')
372 $("#shelf_number").empty('');
376 $("#marc_modification_template_id").change(function() {
377 var url = "/cgi-bin/koha/svc/records/preview?"
378 var mmtid = $(this).val();
379 $("a.previewMARC").each(function() {
380 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
384 $("body").on("click", ".previewMARC", function(e) {
386 var ltitle = $(this).text();
387 var page = $(this).attr("href");
388 $("#marcPreviewLabel").text(ltitle);
389 $("#marcPreview .modal-body").load(page + " div");
390 $('#marcPreview').modal({ show: true });
392 $("#marcPreview").on("hidden.bs.modal", function() {
393 $("#marcPreviewLabel").html("");
394 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
400 [% INCLUDE 'intranet-bottom.inc' %]