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/datatables.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 == 'biblio_not_modified' %]
46 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber | uri %]">[% message.biblionumber | html %]</a> has not been modified. An error occurred on modifying it.
47 [% ELSIF message.code == 'authority_not_modified' %]
48 Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid | uri %]">[% message.authid | html %]</a> has not been modified. An error occurred on modifying it.
49 [% ELSIF message.code == 'biblio_modified' %]
50 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber | uri %]">[% message.biblionumber | html %]</a> has successfully been modified.
51 [% ELSIF message.code == 'authority_modified' %]
52 Bibliographic record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid | uri %]">[% message.authid | html %]</a> has successfully been modified.
54 [% IF message.error %]
55 (The error was: [% message.error | html %]. See the Koha logfile for more information).
63 [% IF view == 'form' %]
64 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
65 <fieldset class="rows">
66 <legend>Record type</legend>
68 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
69 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
75 <div id="batch_mod_form" class="toptabs">
77 <li><a href="#uploadfile">Upload a file</a></li>
78 [% IF lists.count %]<li id="show_list_option"><a href="#shelves">Select a list of records</a></li>[% END %]
79 <li><a href="#enterlist">Enter a list of record numbers</a></li>
83 <fieldset class="rows">
84 <legend>Use a file</legend>
86 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
93 <fieldset class="rows">
94 <legend>Or select a list of records</legend>
97 <label for="shelf_number">Use records from the following list: </label>
98 <select name="shelf_number" id="shelf_number">
99 <option value="">Select a list</option>
100 [% FOREACH list IN lists %]
101 <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
112 <fieldset class="rows">
113 <legend>Or enter a list of record numbers</legend>
116 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
117 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
126 <fieldset class="rows">
127 <legend>Use MARC Modification Template:</legend>
130 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
131 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
132 <option value="">Select a template</option>
133 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
134 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
140 <fieldset class="action">
141 <input type="hidden" name="op" value="list" />
142 <input type="submit" value="Continue" class="button" />
143 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
146 [% ELSIF view == 'list' %]
148 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
149 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
150 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
151 <option value="">Select a template</option>
152 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
153 [% IF mmt.selected %]
154 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
156 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
160 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
161 <div class="modal-dialog">
162 <div class="modal-content">
163 <div class="modal-header">
164 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
165 <h3 id="marcPreviewLabel">MARC preview</h3>
167 <div class="modal-body">
168 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
170 <div class="modal-footer">
171 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
176 [% IF recordtype == 'biblio' %]
178 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
179 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
181 <table id="biblios" class="records">
185 <th>Biblionumber</th>
191 [% FOR biblio IN records %]
193 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
194 <td>[% biblio.biblionumber | html %]</td>
195 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
197 <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>
203 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
206 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
207 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
209 <table id="authorities" class="records">
219 [% FOR authority IN records %]
221 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
222 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
223 <td>[% PROCESS authresult summary=authority.summary %]</td>
224 <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>
229 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
231 <fieldset class="action">
232 <input type="hidden" name="op" value="modify" />
233 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
234 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
235 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
236 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
237 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
240 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
241 <div id="jobfailed"></div>
245 <div class="dialog message">
246 No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
249 [% ELSIF view == 'report' %]
250 [% IF report.total_records == report.total_success %]
251 <div class="dialog message">
252 All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
255 <div class="dialog message">
256 [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
259 [% ELSIF view == 'errors' %]
260 [% FOR error IN errors %]
261 [% IF error == 'no_template_defined' %]
262 <div class="dialog alert">
263 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.
268 <div class="dialog alert">
269 No action defined for the template.
273 </div> <!-- /.col-sm-10.col-sm-push-2 -->
275 <div class="col-sm-2 col-sm-pull-10">
277 [% INCLUDE 'tools-menu.inc' %]
279 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
280 </div> <!-- /.row -->
282 [% MACRO jsinclude BLOCK %]
283 [% Asset.js("js/tools-menu.js") | $raw %]
284 [% INCLUDE 'datatables.inc' %]
285 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
286 [% Asset.js("js/background-job-progressbar.js") | $raw %]
288 $(document).ready(function() {
290 $("#batch_mod_form").tabs();
292 $("input[type='radio']").click(function(){
293 if ($(this).attr('id') == 'authority_type') {
294 $("#show_list_option").hide();
295 } else if ($(this).attr('id') == 'biblio_type') {
296 $("#show_list_option").show();
299 $("#selectall").click(function(e){
301 $(".records").checkCheckboxes();
303 $("#clearall").click(function(e){
305 $(".records").unCheckCheckboxes();
307 $("#selectall").click();
309 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
311 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
312 { "aTargets": [ 1 ], "sType": "num-html" }
319 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
321 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
322 { "aTargets": [ 1 ], "sType": "num-html" }
329 $("#mainformsubmit").click(function(){
330 if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
331 alert(_("Please select at least one record to process"));
334 if ( $("#marc_modification_template_id").val() <= 0 ) {
335 alert(_("Please select a modification template."));
338 return submitBackgroundJob(document.getElementById("process"));
341 $("#marc_modification_template_id").change(function(){
342 var url = "/cgi-bin/koha/svc/records/preview?"
343 var mmtid = $(this).val();
344 $("a.previewMARC").each(function(){
345 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
349 $("body").on("click",".previewMARC", function(e){
351 var ltitle = $(this).text();
352 var page = $(this).attr("href");
353 $("#marcPreviewLabel").text(ltitle);
354 $("#marcPreview .modal-body").load(page + " div");
355 $('#marcPreview').modal({show:true});
357 $("#marcPreview").on("hidden.bs.modal", function(){
358 $("#marcPreviewLabel").html("");
359 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
366 [% INCLUDE 'intranet-bottom.inc' %]