3 [% PROCESS 'i18n.inc' %]
5 [% PROCESS 'authorities-search-results.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
8 [% IF view == 'list' %]
9 [% t("Confirm selection") | html %] ›
10 [% ELSIF view == 'enqueued' %]
11 [% t("Job enqueued") | html %] ›
13 [% t("Batch record modification") | html %] ›
14 [% t("Cataloging") | html %] ›
15 [% t("Koha") | html %]
17 [% INCLUDE 'doc-head-close.inc' %]
18 [% Asset.css("css/humanmsg.css") | $raw %]
21 <body id="tools_batch_record_modification" class="tools">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'cat-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 [% WRAPPER breadcrumbs %]
28 [% WRAPPER breadcrumb_item %]
29 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
31 [% IF view == 'form' %]
32 [% WRAPPER breadcrumb_item bc_active= 1 %]
33 <span>Batch record modification</span>
36 [% WRAPPER breadcrumb_item %]
37 <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
39 [% WRAPPER breadcrumb_item bc_active= 1 %]
40 [% IF view == 'list' %]
41 [% t("Confirm selection") | html %]
42 [% ELSIF view == 'enqueued' %]
43 [% t("Job enqueued") | html %]
47 [% END #/ WRAPPER breadcrumbs %]
48 [% END #/ WRAPPER sub-header.inc %]
50 <div class="main container-fluid">
52 <div class="col-sm-10 col-sm-push-2">
54 [% INCLUDE 'messages.inc' %]
56 <h1>Batch record modification</h1>
59 <div class="dialog message">
61 [% FOREACH message IN messages %]
62 [% IF message.type == 'success' %]
63 <div><i class="fa fa-check success"></i>
64 [% ELSIF message.type == 'warning' %]
65 <div><i class="fa-solid fa-triangle-exclamation warn"></i>
66 [% ELSIF message.type == 'error' %]
67 <div><i class="fa fa-exclamation error"></i>
69 [% IF message.code == 'no_action_defined_for_the_template' %]
70 <span>The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.</span>
71 [% ELSIF message.code == 'biblio_not_exists' %]
72 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
73 [% ELSIF message.code == 'authority_not_exists' %]
74 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
75 [% ELSIF message.code == 'cannot_enqueue_job' %]
76 <span>Cannot enqueue this job.</span>
78 [% IF message.error %]
79 <span>(The error was: [% message.error | html %]. See the Koha logfile for more information).</span>
84 </div> <!-- /.dialog.message -->
87 [% IF view == 'form' %]
88 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="record_ids_selection">
89 [% INCLUDE 'csrf-token.inc' %]
90 <fieldset class="rows">
91 <legend>Record type</legend>
93 <li><label for="biblio_type"><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /> Bibliographic records</label></li>
94 <li><label for="authority_type"><input type="radio" name="recordtype" value="authority" id="authority_type" /> Authority records</label></li>
100 [% WRAPPER tabs id= "batch_mod_form" %]
101 [% WRAPPER tabs_nav %]
102 [% WRAPPER tab_item tabname= "uploadfile_tab" bt_active= 1 %] <span>Upload a file</span> [% END %]
104 [% WRAPPER tab_item tabname= "shelves_tab" %] <span>Select a list of records</span> [% END %]
105 <!-- <li id="show_list_option"> -->
107 [% WRAPPER tab_item tabname= "enterlist_tab" %] <span>Enter a list of record numbers</span> [% END %]
108 [% END # /WRAPPER tabs_nav %]
109 [% WRAPPER tab_panels %]
110 [% WRAPPER tab_panel tabname="uploadfile_tab" bt_active= 1 %]
111 <fieldset class="rows">
113 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
116 [% END # /tab_panel %]
119 [% WRAPPER tab_panel tabname="shelves_tab" %]
120 <fieldset class="rows">
123 <label for="shelf_number">List: </label>
124 <select name="shelf_number" id="shelf_number">
125 <option value="">Select a list</option>
126 [% FOREACH list IN lists %]
127 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
133 [% END # /tab_panel %]
135 [% WRAPPER tab_panel tabname="enterlist_tab" %]
136 <fieldset class="rows">
139 <label for="recordnumber_list">Record numbers: </label>
140 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
141 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
145 [% END # /tab_panel %]
146 [% END # /WRAPPER tab_panels %]
147 [% END # /WRAPPER tabs %]
149 <fieldset class="rows">
150 <legend>MARC modification template</legend>
153 <label for="marc_modification_template_id" class="required">Template: </label>
154 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
155 <option value="">Select a template</option>
156 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
157 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
163 <fieldset class="action">
164 <input type="hidden" name="op" value="cud-list" />
165 <input type="submit" class="btn btn-primary" value="Continue" />
166 <a class="cancel" href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cancel</a>
168 </form> <!-- /#record_ids_selection -->
169 [% ELSIF view == 'list' %]
171 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
172 [% INCLUDE 'csrf-token.inc' %]
173 <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
174 <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
175 <option value="">Select a template</option>
176 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
177 [% IF mmt.selected %]
178 <option value="[% mmt.template_id | html %]" selected="selected">[% mmt.name | html %]</option>
180 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
184 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
185 <div class="modal-dialog">
186 <div class="modal-content">
187 <div class="modal-header">
188 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
189 <h3 id="marcPreviewLabel">MARC preview</h3>
191 <div class="modal-body">
192 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
194 <div class="modal-footer">
195 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
200 [% IF recordtype == 'biblio' %]
201 <div class="btn-toolbar selections-toolbar">
202 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
203 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
205 <div class="page-section">
206 <table id="biblios" class="records">
210 <th>Biblionumber</th>
216 [% FOR biblio IN records %]
218 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
219 <td>[% biblio.biblionumber | html %]</td>
220 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
222 <a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber | uri %]&mmtid=[% mmtid | uri %]&overlay_context=batchmod" 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-solid fa-eye"></i> Show MARC</a>
227 </table> <!-- /#biblios -->
229 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
231 <div class="btn-toolbar selections-toolbar">
232 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
233 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
235 <div class="page-section">
236 <table id="authorities" class="records">
246 [% FOR authority IN records %]
248 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
249 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
250 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
251 <td class="actions"><a href="/cgi-bin/koha/svc/records/preview?record_type=authority&record_id=[% authority.authid | uri %]&mmtid=[% mmtid | uri %]&overlay_context=batchmod" 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>
255 </table> <!-- /#authorities -->
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="cud-modify" />
261 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
262 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
264 </form> <!-- /#process -->
266 <div class="dialog message">
267 No records were modified. [% IF recordtype != 'biblio' %]<a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>[% END %]
270 [% ELSIF view == 'errors' %]
271 [% FOR error IN errors %]
272 [% IF error == 'no_template_defined' %]
273 <div class="dialog message">
274 <p>No MARC modification template is defined. You have to create at least one template in order to use this tool.</p>
275 [% IF ( CAN_user_tools_marc_modification_templates ) %]
276 <a class="btn btn-default" href="/cgi-bin/koha/tools/marc_modification_templates.pl"><i class="fa fa-plus"></i> Create a new MARC modification template</a>
281 [% ELSIF view == 'enqueued' %]
282 <div class="dialog message">
283 <h1>The job has been enqueued!</h1>
284 <p>It will be processed as soon as possible.</p>
285 <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a>
286 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
289 <div class="dialog alert">
290 No action defined for the template.
294 </div> <!-- /.col-sm-10.col-sm-push-2 -->
295 <div class="col-sm-2 col-sm-pull-10">
297 [% INCLUDE 'cat-menu.inc' %]
299 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
300 </div> <!-- /.row -->
302 [% MACRO jsinclude BLOCK %]
303 [% INCLUDE 'datatables.inc' %]
304 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
306 function update_tab_display(){
307 let selected_type = $('input[name="recordtype"]:checked').val();
308 if (selected_type == 'authority') {
309 $("a[href='#shelves_tab_panel']").parent().hide();
310 $("a[href='#uploadfile_tab_panel']").tab("show");
311 } else if (selected_type == 'biblio') {
312 $("a[href='#shelves_tab_panel']").parent().show();
313 $("a[href='#uploadfile_tab_panel']").tab("show");
316 $(document).ready(function() {
318 update_tab_display();
319 $("input[type='radio']").click(function() {
320 update_tab_display();
323 $("#selectall").click(function(e){
325 $(".records input[type='checkbox']").each(function(){
326 $(this).prop("checked", true);
330 $("#clearall").click(function(e){
332 $(".records input[type='checkbox']").each(function(){
333 $(this).prop("checked", false);
337 $("#selectall").click();
339 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
341 { "targets": [0, 3], "orderable": false, "searchable": false },
342 { "targets": [1], "type": "num-html" }
349 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
351 { "targets": [0, 3], "orderable": false, "searchable": false },
352 { "targets": [1], "type": "num-html" }
359 $("#mainformsubmit").click(function() {
360 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
361 alert(_("Please select at least one record to process"));
364 if ($("#marc_modification_template_id").val() <= 0) {
365 alert(_("Please select a modification template."));
371 $("#record_ids_selection").on("submit", function(e) {
372 var tab = $(this).find('#batch_mod_form li.active:first a').attr('href');
373 if (tab == '#uploadfile_tab_panel') {
374 $("#recordnumber_list, #shelf_number").val('');
375 } else if (tab == '#shelves_tab_panel') {
376 $("#recordnumber_list, #uploadfile").val('');
377 } else { // enterlist
378 $("#uploadfile, #shelf_number").val('')
382 $("#marc_modification_template_id").change(function() {
383 var url = "/cgi-bin/koha/svc/records/preview?"
384 var mmtid = $(this).val();
385 $("a.previewMARC").each(function() {
386 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
390 $("body").on("click", ".previewMARC", function(e) {
392 var ltitle = $(this).text();
393 var page = $(this).attr("href");
394 $("#marcPreviewLabel").text(ltitle);
395 $("#marcPreview .modal-body").load(page + " div");
396 $('#marcPreview').modal({ show: true });
398 $("#marcPreview").on("hidden.bs.modal", function() {
399 $("#marcPreviewLabel").html("");
400 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
406 [% INCLUDE 'intranet-bottom.inc' %]