2 [% PROCESS 'authorities-search-results.inc' %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Tools › Batch record modification</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
9 <body id="tools_batch_record_modification" class="tools">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
13 <div id="breadcrumbs">
14 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
15 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
16 <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
19 <div id="doc3" class="yui-t2">
23 <h1>Batch record modification</h1>
26 <div class="dialog message">
28 [% FOREACH message IN messages %]
29 [% IF message.type == 'success' %]
30 <div><i class="fa fa-check success"></i>
31 [% ELSIF message.type == 'warning' %]
32 <div><i class="fa fa-warning warn"></i>
33 [% ELSIF message.type == 'error' %]
34 <div><i class="fa fa-exclamation error"></i>
36 [% IF message.code == 'no_action_defined_for_the_template' %]
37 The selected template (id=[% message.mmtid%]) does not exist or no action is defined.
38 [% ELSIF message.code == 'biblio_not_exists' %]
39 Bibliographic record [% message.biblionumber %] does not exist in the database.
40 [% ELSIF message.code == 'authority_not_exists' %]
41 Authority record [% message.authid %] does not exist in the database.
42 [% ELSIF message.code == 'biblio_not_modified' %]
43 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has not been modified. An error occurred on modifying it.
44 [% ELSIF message.code == 'authority_not_modified' %]
45 Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has not been modified. An error occurred on modifying it.
46 [% ELSIF message.code == 'biblio_modified' %]
47 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has successfully been modified.
48 [% ELSIF message.code == 'authority_modified' %]
49 Bibliographic record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has successfully been modified.
51 [% IF message.error %]
52 (The error was: [% message.error%]. See the Koha logfile for more information).
60 [% IF view == 'form' %]
61 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
62 <fieldset class="rows">
63 <legend>Record type</legend>
65 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
66 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
69 <fieldset class="rows">
70 <legend>Use a file</legend>
72 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
75 <fieldset class="rows">
76 <legend>Or enter a list of record numbers</legend>
79 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
80 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
84 <fieldset class="rows">
85 <legend>Use MARC Modification Template:</legend>
88 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
89 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
90 <option value="">Select a template</option>
91 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
92 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
98 <fieldset class="action">
99 <input type="hidden" name="op" value="list" />
100 <input type="submit" value="Continue" class="button" />
101 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
104 [% ELSIF view == 'list' %]
106 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
107 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
108 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
109 <option value="">Select a template</option>
110 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
111 [% IF mmt.selected %]
112 <option value="[% mmt.template_id %]" selected="selected">[% mmt.name %]</option>
114 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
118 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
119 <div class="modal-dialog">
120 <div class="modal-content">
121 <div class="modal-header">
122 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
123 <h3 id="marcPreviewLabel">MARC preview</h3>
125 <div class="modal-body">
126 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
128 <div class="modal-footer">
129 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
134 [% IF recordtype == 'biblio' %]
136 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
137 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
139 <table id="biblios" class="records">
143 <th>Biblionumber</th>
149 [% FOR biblio IN records %]
151 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber %]" /></td>
152 <td>[% biblio.biblionumber %]</td>
153 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
155 <a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber %]&mmtid=[% mmtid %]" class="previewMARC btn btn-default btn-xs" data-record_type="biblio" data-record_id="[% biblio.biblionumber %]" data-mmtid="[% mmtid %]" title="Preview MARC"><i class="fa fa-eye"></i> Show MARC</a>
161 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
164 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
165 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
167 <table id="authorities" class="records">
177 [% FOR authority IN records %]
179 <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
180 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
181 <td>[% PROCESS authresult summary=authority.summary %]</td>
182 <td class="actions"><a href="/cgi-bin/koha/svc/records/preview?record_type=authority&record_id=[% authority.authid %]&mmtid=[% mmtid %]" data-record_type="authority" data-record_id="[% authority.authid %]" data-mmtid="[% mmtid %]" class="previewMARC btn btn-default btn-xs"><i class='fa fa-eye'></i> Show MARC</a>
187 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
189 <fieldset class="action">
190 <input type="hidden" name="op" value="modify" />
191 <input type="hidden" name="recordtype" value="[% recordtype %]" />
192 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
193 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
194 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
195 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
198 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
199 <div id="jobfailed"></div>
203 <div class="dialog message">
204 No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
207 [% ELSIF view == 'report' %]
208 [% IF report.total_records == report.total_success %]
209 <div class="dialog message">
210 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>
213 <div class="dialog message">
214 [% report.total_success %] / [% report.total_records %] 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>
217 [% ELSIF view == 'errors' %]
218 [% FOR error IN errors %]
219 [% IF error == 'no_template_defined' %]
220 <div class="dialog alert">
221 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.
226 <div class="dialog alert">
227 No action defined for the template.
233 [% INCLUDE 'tools-menu.inc' %]
237 [% MACRO jsinclude BLOCK %]
238 <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu_[% KOHA_VERSION %].js"></script>
239 [% INCLUDE 'datatables.inc' %]
240 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min_[% KOHA_VERSION %].js"></script>
241 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar_[% KOHA_VERSION %].js"></script>
242 <script type="text/javascript">
243 $(document).ready(function() {
244 $("#selectall").click(function(e){
246 $(".records").checkCheckboxes();
248 $("#clearall").click(function(e){
250 $(".records").unCheckCheckboxes();
252 $("#selectall").click();
254 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
256 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
257 { "aTargets": [ 1 ], "sType": "num-html" }
264 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
266 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
267 { "aTargets": [ 1 ], "sType": "num-html" }
274 $("#mainformsubmit").click(function(){
275 if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
276 alert(_("Please select at least one record to process"));
279 if ( $("#marc_modification_template_id").val() <= 0 ) {
280 alert(_("Please select a modification template."));
283 return submitBackgroundJob(document.getElementById("process"));
286 $("#marc_modification_template_id").change(function(){
287 var url = "/cgi-bin/koha/svc/records/preview?"
288 var mmtid = $(this).val();
289 $("a.previewMARC").each(function(){
290 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
294 $("body").on("click",".previewMARC", function(e){
296 var ltitle = $(this).text();
297 var page = $(this).attr("href");
298 $("#marcPreviewLabel").text(ltitle);
299 $("#marcPreview .modal-body").load(page + " div");
300 $('#marcPreview').modal({show:true});
302 $("#marcPreview").on("hidden", function(){
303 $("#marcPreviewLabel").html("");
304 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
311 [% INCLUDE 'intranet-bottom.inc' %]