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 id="doc3" class="yui-t2">
25 <h1>Batch record modification</h1>
28 <div class="dialog message">
30 [% FOREACH message IN messages %]
31 [% IF message.type == 'success' %]
32 <div><i class="fa fa-check success"></i>
33 [% ELSIF message.type == 'warning' %]
34 <div><i class="fa fa-warning warn"></i>
35 [% ELSIF message.type == 'error' %]
36 <div><i class="fa fa-exclamation error"></i>
38 [% IF message.code == 'no_action_defined_for_the_template' %]
39 The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.
40 [% ELSIF message.code == 'biblio_not_exists' %]
41 Bibliographic record [% message.biblionumber | html %] does not exist in the database.
42 [% ELSIF message.code == 'authority_not_exists' %]
43 Authority record [% message.authid | html %] does not exist in the database.
44 [% ELSIF message.code == 'biblio_not_modified' %]
45 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.
46 [% ELSIF message.code == 'authority_not_modified' %]
47 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.
48 [% ELSIF message.code == 'biblio_modified' %]
49 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber | uri %]">[% message.biblionumber | html %]</a> has successfully been modified.
50 [% ELSIF message.code == 'authority_modified' %]
51 Bibliographic record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid | uri %]">[% message.authid | html %]</a> has successfully been modified.
53 [% IF message.error %]
54 (The error was: [% message.error | html %]. See the Koha logfile for more information).
62 [% IF view == 'form' %]
63 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
64 <fieldset class="rows">
65 <legend>Record type</legend>
67 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
68 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
71 <fieldset class="rows">
72 <legend>Use a file</legend>
74 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
77 <fieldset class="rows">
78 <legend>Or enter a list of record numbers</legend>
81 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
82 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
86 <fieldset class="rows">
87 <legend>Use MARC Modification Template:</legend>
90 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
91 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
92 <option value="">Select a template</option>
93 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
94 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
100 <fieldset class="action">
101 <input type="hidden" name="op" value="list" />
102 <input type="submit" value="Continue" class="button" />
103 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
106 [% ELSIF view == 'list' %]
108 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
109 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
110 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
111 <option value="">Select a template</option>
112 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
113 [% IF mmt.selected %]
114 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
116 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
120 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
121 <div class="modal-dialog">
122 <div class="modal-content">
123 <div class="modal-header">
124 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
125 <h3 id="marcPreviewLabel">MARC preview</h3>
127 <div class="modal-body">
128 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
130 <div class="modal-footer">
131 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
136 [% IF recordtype == 'biblio' %]
138 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
139 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
141 <table id="biblios" class="records">
145 <th>Biblionumber</th>
151 [% FOR biblio IN records %]
153 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
154 <td>[% biblio.biblionumber | html %]</td>
155 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
157 <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>
163 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
166 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
167 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
169 <table id="authorities" class="records">
179 [% FOR authority IN records %]
181 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
182 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
183 <td>[% PROCESS authresult summary=authority.summary %]</td>
184 <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>
189 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
191 <fieldset class="action">
192 <input type="hidden" name="op" value="modify" />
193 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
194 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
195 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
196 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
197 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
200 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
201 <div id="jobfailed"></div>
205 <div class="dialog message">
206 No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
209 [% ELSIF view == 'report' %]
210 [% IF report.total_records == report.total_success %]
211 <div class="dialog message">
212 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>
215 <div class="dialog message">
216 [% 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>
219 [% ELSIF view == 'errors' %]
220 [% FOR error IN errors %]
221 [% IF error == 'no_template_defined' %]
222 <div class="dialog alert">
223 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.
228 <div class="dialog alert">
229 No action defined for the template.
235 [% INCLUDE 'tools-menu.inc' %]
239 [% MACRO jsinclude BLOCK %]
240 [% Asset.js("js/tools-menu.js") | $raw %]
241 [% INCLUDE 'datatables.inc' %]
242 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
243 [% Asset.js("js/background-job-progressbar.js") | $raw %]
244 <script type="text/javascript">
245 $(document).ready(function() {
246 $("#selectall").click(function(e){
248 $(".records").checkCheckboxes();
250 $("#clearall").click(function(e){
252 $(".records").unCheckCheckboxes();
254 $("#selectall").click();
256 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
258 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
259 { "aTargets": [ 1 ], "sType": "num-html" }
266 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
268 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
269 { "aTargets": [ 1 ], "sType": "num-html" }
276 $("#mainformsubmit").click(function(){
277 if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
278 alert(_("Please select at least one record to process"));
281 if ( $("#marc_modification_template_id").val() <= 0 ) {
282 alert(_("Please select a modification template."));
285 return submitBackgroundJob(document.getElementById("process"));
288 $("#marc_modification_template_id").change(function(){
289 var url = "/cgi-bin/koha/svc/records/preview?"
290 var mmtid = $(this).val();
291 $("a.previewMARC").each(function(){
292 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
296 $("body").on("click",".previewMARC", function(e){
298 var ltitle = $(this).text();
299 var page = $(this).attr("href");
300 $("#marcPreviewLabel").text(ltitle);
301 $("#marcPreview .modal-body").load(page + " div");
302 $('#marcPreview').modal({show:true});
304 $("#marcPreview").on("hidden.bs.modal", function(){
305 $("#marcPreviewLabel").html("");
306 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
313 [% INCLUDE 'intranet-bottom.inc' %]