3 [% PROCESS 'authorities-search-results.inc' %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Batch record modification</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.css("css/datatables.css") %]
10 <body id="tools_batch_record_modification" class="tools">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
14 <div id="breadcrumbs">
15 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
16 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
17 <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
20 <div id="doc3" class="yui-t2">
24 <h1>Batch record modification</h1>
27 <div class="dialog message">
29 [% FOREACH message IN messages %]
30 [% IF message.type == 'success' %]
31 <div><i class="fa fa-check success"></i>
32 [% ELSIF message.type == 'warning' %]
33 <div><i class="fa fa-warning warn"></i>
34 [% ELSIF message.type == 'error' %]
35 <div><i class="fa fa-exclamation error"></i>
37 [% IF message.code == 'no_action_defined_for_the_template' %]
38 The selected template (id=[% message.mmtid%]) does not exist or no action is defined.
39 [% ELSIF message.code == 'biblio_not_exists' %]
40 Bibliographic record [% message.biblionumber %] does not exist in the database.
41 [% ELSIF message.code == 'authority_not_exists' %]
42 Authority record [% message.authid %] does not exist in the database.
43 [% ELSIF message.code == 'biblio_not_modified' %]
44 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.
45 [% ELSIF message.code == 'authority_not_modified' %]
46 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.
47 [% ELSIF message.code == 'biblio_modified' %]
48 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has successfully been modified.
49 [% ELSIF message.code == 'authority_modified' %]
50 Bibliographic record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has successfully been modified.
52 [% IF message.error %]
53 (The error was: [% message.error%]. See the Koha logfile for more information).
61 [% IF view == 'form' %]
62 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
63 <fieldset class="rows">
64 <legend>Record type</legend>
66 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
67 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
70 <fieldset class="rows">
71 <legend>Use a file</legend>
73 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
76 <fieldset class="rows">
77 <legend>Or enter a list of record numbers</legend>
80 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
81 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
85 <fieldset class="rows">
86 <legend>Use MARC Modification Template:</legend>
89 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
90 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
91 <option value="">Select a template</option>
92 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
93 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
99 <fieldset class="action">
100 <input type="hidden" name="op" value="list" />
101 <input type="submit" value="Continue" class="button" />
102 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
105 [% ELSIF view == 'list' %]
107 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
108 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
109 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
110 <option value="">Select a template</option>
111 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
112 [% IF mmt.selected %]
113 <option value="[% mmt.template_id %]" selected="selected">[% mmt.name %]</option>
115 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
119 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
120 <div class="modal-dialog">
121 <div class="modal-content">
122 <div class="modal-header">
123 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
124 <h3 id="marcPreviewLabel">MARC preview</h3>
126 <div class="modal-body">
127 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
129 <div class="modal-footer">
130 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
135 [% IF recordtype == 'biblio' %]
137 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
138 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
140 <table id="biblios" class="records">
144 <th>Biblionumber</th>
150 [% FOR biblio IN records %]
152 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber %]" /></td>
153 <td>[% biblio.biblionumber %]</td>
154 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
156 <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>
162 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
165 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
166 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
168 <table id="authorities" class="records">
178 [% FOR authority IN records %]
180 <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
181 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
182 <td>[% PROCESS authresult summary=authority.summary %]</td>
183 <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>
188 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
190 <fieldset class="action">
191 <input type="hidden" name="op" value="modify" />
192 <input type="hidden" name="recordtype" value="[% recordtype %]" />
193 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
194 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
195 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
196 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
199 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
200 <div id="jobfailed"></div>
204 <div class="dialog message">
205 No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
208 [% ELSIF view == 'report' %]
209 [% IF report.total_records == report.total_success %]
210 <div class="dialog message">
211 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>
214 <div class="dialog message">
215 [% 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>
218 [% ELSIF view == 'errors' %]
219 [% FOR error IN errors %]
220 [% IF error == 'no_template_defined' %]
221 <div class="dialog alert">
222 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.
227 <div class="dialog alert">
228 No action defined for the template.
234 [% INCLUDE 'tools-menu.inc' %]
238 [% MACRO jsinclude BLOCK %]
239 [% Asset.js("js/tools-menu.js") %]
240 [% INCLUDE 'datatables.inc' %]
241 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
242 [% Asset.js("js/background-job-progressbar.js") %]
243 <script type="text/javascript">
244 $(document).ready(function() {
245 $("#selectall").click(function(e){
247 $(".records").checkCheckboxes();
249 $("#clearall").click(function(e){
251 $(".records").unCheckCheckboxes();
253 $("#selectall").click();
255 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
257 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
258 { "aTargets": [ 1 ], "sType": "num-html" }
265 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
267 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
268 { "aTargets": [ 1 ], "sType": "num-html" }
275 $("#mainformsubmit").click(function(){
276 if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
277 alert(_("Please select at least one record to process"));
280 if ( $("#marc_modification_template_id").val() <= 0 ) {
281 alert(_("Please select a modification template."));
284 return submitBackgroundJob(document.getElementById("process"));
287 $("#marc_modification_template_id").change(function(){
288 var url = "/cgi-bin/koha/svc/records/preview?"
289 var mmtid = $(this).val();
290 $("a.previewMARC").each(function(){
291 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
295 $("body").on("click",".previewMARC", function(e){
297 var ltitle = $(this).text();
298 var page = $(this).attr("href");
299 $("#marcPreviewLabel").text(ltitle);
300 $("#marcPreview .modal-body").load(page + " div");
301 $('#marcPreview').modal({show:true});
303 $("#marcPreview").on("hidden", function(){
304 $("#marcPreviewLabel").html("");
305 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
312 [% INCLUDE 'intranet-bottom.inc' %]