1 [% PROCESS 'authorities-search-results.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Tools › Batch record modification</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
9 <script type="text/javascript">
11 $(document).ready(function() {
12 $("#selectall").click(function(e){
14 $(".records").checkCheckboxes();
16 $("#clearall").click(function(e){
18 $(".records").unCheckCheckboxes();
20 $("#selectall").click();
22 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
24 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
25 { "aTargets": [ 1 ], "sType": "num-html" }
32 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
34 { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
35 { "aTargets": [ 1 ], "sType": "num-html" }
42 $("#mainformsubmit").click(function(){
43 if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
44 alert(_("Please select at least one record to process"));
47 if ( $("#marc_modification_template_id").val() <= 0 ) {
48 alert(_("Please select a modification template."));
51 return submitBackgroundJob(document.getElementById("process"));
54 $("#marc_modification_template_id").change(function(){
55 var url = "/cgi-bin/koha/svc/records/preview?"
56 var mmtid = $(this).val();
57 $("a.previewMARC").each(function(){
58 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
62 $("body").on("click",".previewMARC", function(e){
64 var ltitle = $(this).text();
65 var page = $(this).attr("href");
66 $("#marcPreviewLabel").text(ltitle);
67 $("#marcPreview .modal-body").load(page + " div");
68 $('#marcPreview').modal({show:true});
70 $("#marcPreview").on("hidden", function(){
71 $("#marcPreviewLabel").html("");
72 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
79 <body id="tools_batch_record_modification" class="tools">
80 [% INCLUDE 'header.inc' %]
81 [% INCLUDE 'cat-search.inc' %]
83 <div id="breadcrumbs">
84 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
85 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
86 <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
89 <div id="doc3" class="yui-t2">
93 <h1>Batch record modification</h1>
96 <div class="dialog message">
98 [% FOREACH message IN messages %]
99 [% IF message.type == 'success' %]
100 <div><i class="fa fa-check success"></i>
101 [% ELSIF message.type == 'warning' %]
102 <div><i class="fa fa-warning warn"></i>
103 [% ELSIF message.type == 'error' %]
104 <div><i class="fa fa-exclamation error"></i>
106 [% IF message.code == 'no_action_defined_for_the_template' %]
107 The selected template (id=[% message.mmtid%]) does not exist or no action is defined.
108 [% ELSIF message.code == 'biblio_not_exists' %]
109 Bibliographic record [% message.biblionumber %] does not exist in the database.
110 [% ELSIF message.code == 'authority_not_exists' %]
111 Authority record [% message.authid %] does not exist in the database.
112 [% ELSIF message.code == 'biblio_not_modified' %]
113 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.
114 [% ELSIF message.code == 'authority_not_modified' %]
115 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.
116 [% ELSIF message.code == 'biblio_modified' %]
117 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has successfully been modified.
118 [% ELSIF message.code == 'authority_modified' %]
119 Bibliographic record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has successfully been modified.
121 [% IF message.error %]
122 (The error was: [% message.error%]. See the Koha logfile for more information).
130 [% IF view == 'form' %]
131 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
132 <fieldset class="rows">
133 <legend>Record type</legend>
135 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
136 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
139 <fieldset class="rows">
140 <legend>Use a file</legend>
142 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
145 <fieldset class="rows">
146 <legend>Or enter a list of record numbers</legend>
149 <label for="recordnumber_list">Record number list (one per line): </label>
150 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
154 <fieldset class="rows">
155 <legend>Use MARC Modification Template:</legend>
158 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
159 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
160 <option value="">Select a template</option>
161 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
162 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
168 <fieldset class="action">
169 <input type="hidden" name="op" value="list" />
170 <input type="submit" value="Continue" class="button" />
171 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
174 [% ELSIF view == 'list' %]
176 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
177 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
178 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
179 <option value="">Select a template</option>
180 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
181 [% IF mmt.selected %]
182 <option value="[% mmt.template_id %]" selected="selected">[% mmt.name %]</option>
184 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
188 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
189 <div class="modal-dialog">
190 <div class="modal-content">
191 <div class="modal-header">
192 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
193 <h3 id="marcPreviewLabel">MARC preview</h3>
195 <div class="modal-body">
196 <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
198 <div class="modal-footer">
199 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
204 [% IF recordtype == 'biblio' %]
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="biblios" class="records">
213 <th>Biblionumber</th>
219 [% FOR biblio IN records %]
221 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber %]" data-items="[% biblio.itemnumbers.size %]" data-issues="[% biblio.issues_count %]" data-reserves="[% biblio.reserves.size %]" /></td>
222 <td>[% biblio.biblionumber %]</td>
223 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
225 <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>
231 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
234 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
235 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
237 <table id="authorities" class="records">
247 [% FOR authority IN records %]
249 <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
250 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
251 <td>[% PROCESS authresult summary=authority.summary %]</td>
252 <td><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">Preview MARC</a>
257 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
259 <fieldset class="action">
260 <input type="hidden" name="op" value="modify" />
261 <input type="hidden" name="recordtype" value="[% recordtype %]" />
262 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
263 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
264 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
265 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
268 <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
269 <div id="jobfailed"></div>
273 <div class="dialog message">
274 No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
277 [% ELSIF view == 'report' %]
278 [% IF report.total_records == report.total_success %]
279 <div class="dialog message">
280 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>
283 <div class="dialog message">
284 [% 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>
287 [% ELSIF view == 'errors' %]
288 [% FOR error IN errors %]
289 [% IF error == 'no_template_defined' %]
290 <div class="dialog alert">
291 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.
296 <div class="dialog alert">
297 No action defined for the template.
303 [% INCLUDE 'tools-menu.inc' %]
306 [% INCLUDE 'intranet-bottom.inc' %]