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="[% themelang %]/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="[% themelang %]/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/loading-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>
94 [% FOREACH message IN messages %]
95 [% IF message.type == 'success' %]
96 <div class="dialog message">
97 [% ELSIF message.type == 'warning' %]
98 <div class="dialog alert">
99 [% ELSIF message.type == 'error' %]
100 <div class="dialog error" style="margin:auto;">
102 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
103 [% IF message.code == 'no_action_defined_for_the_template' %]
104 The selected template (id=[% message.mmtid%]) does not exist or no action is defined.
105 [% ELSIF message.code == 'biblio_not_exists' %]
106 The biblionumber [% message.biblionumber %] does not exist in the database.
107 [% ELSIF message.code == 'authority_not_exists' %]
108 The authority id [% message.authid %] does not exist in the database.
109 [% ELSIF message.code == 'biblio_not_modified' %]
110 The biblio <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has not been modified. An error occurred on modifying it.
111 [% ELSIF message.code == 'authority_not_modified' %]
112 The authority <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has not been modified. An error occurred on modifying it.
113 [% ELSIF message.code == 'biblio_modified' %]
114 The biblio <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has successfully been modified.
115 [% ELSIF message.code == 'authority_modified' %]
116 The authority <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has successfully been modified.
118 [% IF message.error %]
119 (The error was: [% message.error%], see the Koha logfile for more information).
123 [% IF view == 'form' %]
124 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
125 <fieldset class="rows">
126 <legend>Record type</legend>
128 <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
129 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
132 <fieldset class="rows">
133 <legend>Use a file</legend>
135 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
138 <fieldset class="rows">
139 <legend>Or enter a list of record numbers</legend>
142 <label for="recordnumber_list">Record number list (one per line): </label>
143 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
147 <fieldset class="rows">
148 <legend>Use MARC Modification Template:</legend>
151 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
152 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
153 <option value="">Select a template</option>
154 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
155 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
161 <fieldset class="action">
162 <input type="hidden" name="op" value="list" />
163 <input type="submit" value="Continue" class="button" />
164 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
167 [% ELSIF view == 'list' %]
169 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
170 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
171 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
172 <option value="">Select a template</option>
173 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
174 [% IF mmt.selected %]
175 <option value="[% mmt.template_id %]" selected="selected">[% mmt.name %]</option>
177 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
181 [% IF recordtype == 'biblio' %]
183 <a id="selectall" href="#">Select all</a>
184 | <a id="clearall" href="#">Clear all</a>
186 <table id="biblios" class="records">
190 <th>Biblionumber</th>
196 [% FOR biblio IN records %]
198 <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>
199 <td>[% biblio.biblionumber %]</td>
200 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
201 <td><a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber %]&mmtid=[% mmtid %]" class="previewMARC" data-record_type="biblio" data-record_id="[% biblio.biblionumber %]" data-mmtid="[% mmtid %]" title="Preview MARC" >Preview MARC</a>
206 <div class="note">Reminder: this action will modify all selected biblios!</div>
208 <div id="marcPreview" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
209 <div class="modal-header">
210 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
211 <h3 id="marcPreviewLabel">MARC preview</h3>
213 <div class="modal-body">
214 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
216 <div class="modal-footer">
217 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
223 <a id="selectall" href="#">Select all</a>
224 | <a id="clearall" href="#">Clear all</a>
226 <table id="authorities" class="records">
236 [% FOR authority IN records %]
238 <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
239 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
240 <td>[% PROCESS authresult summary=authority.summary %]</td>
241 <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>
246 <div class="note">Reminder: this action will modify all selected authorities!</div>
249 <div id="marcPreview" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
250 <div class="modal-header">
251 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
252 <h3 id="marcPreviewLabel">MARC preview</h3>
254 <div class="modal-body">
255 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
257 <div class="modal-footer">
258 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
262 <fieldset class="action">
263 <input type="hidden" name="op" value="modify" />
264 <input type="hidden" name="recordtype" value="[% recordtype %]" />
265 <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
266 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
267 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
268 <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
271 <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
272 <div id="jobfailed"></div>
276 There is no record ids defined.
278 [% ELSIF view == 'report' %]
279 [% IF report.total_records == report.total_success %]
280 All records have successfully been modified!
282 [% report.total_success %] / [% report.total_records %] records have successfully been modified.
283 Some errors occurred.
285 <p><a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
286 [% ELSIF view == 'errors' %]
287 [% FOR error IN errors %]
288 [% IF error == 'no_template_defined' %]
289 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.
293 No action defined for the template.
298 [% INCLUDE 'tools-menu.inc' %]
301 [% INCLUDE 'intranet-bottom.inc' %]