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>
72 <fieldset class="rows">
73 <legend>Use a file</legend>
75 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
78 <fieldset class="rows" id="shelves">
79 <legend>Or select a list of records</legend>
82 <label for="shelf_number">Use records from the following list: </label>
83 <select name="shelf_number" id="shelf_number">
84 <option value="">Select a list</option>
85 [% FOREACH list IN lists %]
86 <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
93 <fieldset class="rows">
94 <legend>Or enter a list of record numbers</legend>
97 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
98 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
102 <fieldset class="rows">
103 <legend>Use MARC Modification Template:</legend>
106 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
107 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
108 <option value="">Select a template</option>
109 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
110 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
116 <fieldset class="action">
117 <input type="hidden" name="op" value="list" />
118 <input type="submit" value="Continue" class="button" />
119 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
122 [% ELSIF view == 'list' %]
124 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
125 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
126 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
127 <option value="">Select a template</option>
128 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
129 [% IF mmt.selected %]
130 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
132 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
136 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
137 <div class="modal-dialog">
138 <div class="modal-content">
139 <div class="modal-header">
140 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
141 <h3 id="marcPreviewLabel">MARC preview</h3>
143 <div class="modal-body">
144 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
146 <div class="modal-footer">
147 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
152 [% IF recordtype == 'biblio' %]
154 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
155 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
157 <table id="biblios" class="records">
161 <th>Biblionumber</th>
167 [% FOR biblio IN records %]
169 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
170 <td>[% biblio.biblionumber | html %]</td>
171 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
173 <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>
179 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
182 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
183 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
185 <table id="authorities" class="records">
195 [% FOR authority IN records %]
197 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
198 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
199 <td>[% PROCESS authresult summary=authority.summary %]</td>
200 <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>
205 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
207 <fieldset class="action">
208 <input type="hidden" name="op" value="modify" />
209 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
210 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
211 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
212 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
213 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
216 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
217 <div id="jobfailed"></div>
221 <div class="dialog message">
222 No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
225 [% ELSIF view == 'report' %]
226 [% IF report.total_records == report.total_success %]
227 <div class="dialog message">
228 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>
231 <div class="dialog message">
232 [% 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>
235 [% ELSIF view == 'errors' %]
236 [% FOR error IN errors %]
237 [% IF error == 'no_template_defined' %]
238 <div class="dialog alert">
239 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.
244 <div class="dialog alert">
245 No action defined for the template.
249 </div> <!-- /.col-sm-10.col-sm-push-2 -->
251 <div class="col-sm-2 col-sm-pull-10">
253 [% INCLUDE 'tools-menu.inc' %]
255 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
256 </div> <!-- /.row -->
258 [% MACRO jsinclude BLOCK %]
259 [% Asset.js("js/tools-menu.js") | $raw %]
260 [% INCLUDE 'datatables.inc' %]
261 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
262 [% Asset.js("js/background-job-progressbar.js") | $raw %]
264 $(document).ready(function() {
265 $("input[type='radio']").click(function(){
266 if ($(this).attr('id') == 'authority_type') {
267 $("#shelves").hide();
268 } else if ($(this).attr('id') == 'biblio_type') {
269 $("#shelves").show();
272 $("#selectall").click(function(e){
274 $(".records").checkCheckboxes();
276 $("#clearall").click(function(e){
278 $(".records").unCheckCheckboxes();
280 $("#selectall").click();
282 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
284 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
285 { "aTargets": [ 1 ], "sType": "num-html" }
292 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
294 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
295 { "aTargets": [ 1 ], "sType": "num-html" }
302 $("#mainformsubmit").click(function(){
303 if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
304 alert(_("Please select at least one record to process"));
307 if ( $("#marc_modification_template_id").val() <= 0 ) {
308 alert(_("Please select a modification template."));
311 return submitBackgroundJob(document.getElementById("process"));
314 $("#marc_modification_template_id").change(function(){
315 var url = "/cgi-bin/koha/svc/records/preview?"
316 var mmtid = $(this).val();
317 $("a.previewMARC").each(function(){
318 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
322 $("body").on("click",".previewMARC", function(e){
324 var ltitle = $(this).text();
325 var page = $(this).attr("href");
326 $("#marcPreviewLabel").text(ltitle);
327 $("#marcPreview .modal-body").load(page + " div");
328 $('#marcPreview').modal({show:true});
330 $("#marcPreview").on("hidden.bs.modal", function(){
331 $("#marcPreviewLabel").html("");
332 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
339 [% INCLUDE 'intranet-bottom.inc' %]