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">
55 <h1>Batch record modification</h1>
58 <div class="dialog message">
60 [% FOREACH message IN messages %]
61 [% IF message.type == 'success' %]
62 <div><i class="fa fa-check success"></i>
63 [% ELSIF message.type == 'warning' %]
64 <div><i class="fa-solid fa-triangle-exclamation warn"></i>
65 [% ELSIF message.type == 'error' %]
66 <div><i class="fa fa-exclamation error"></i>
68 [% IF message.code == 'no_action_defined_for_the_template' %]
69 <span>The selected template (id=[% message.mmtid | html %]) does not exist or no action is defined.</span>
70 [% ELSIF message.code == 'biblio_not_exists' %]
71 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
72 [% ELSIF message.code == 'authority_not_exists' %]
73 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
74 [% ELSIF message.code == 'cannot_enqueue_job' %]
75 <span>Cannot enqueue this job.</span>
77 [% IF message.error %]
78 <span>(The error was: [% message.error | html %]. See the Koha logfile for more information).</span>
83 </div> <!-- /.dialog.message -->
86 [% IF view == 'form' %]
87 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="record_ids_selection">
88 <fieldset class="rows">
89 <legend>Record type</legend>
91 <li><label for="biblio_type"><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /> Bibliographic records</label></li>
92 <li><label for="authority_type"><input type="radio" name="recordtype" value="authority" id="authority_type" /> Authority records</label></li>
98 [% WRAPPER tabs id= "batch_mod_form" %]
99 [% WRAPPER tabs_nav %]
100 [% WRAPPER tab_item tabname= "uploadfile_tab" bt_active= 1 %] <span>Upload a file</span> [% END %]
102 [% WRAPPER tab_item tabname= "shelves_tab" %] <span>Select a list of records</span> [% END %]
103 <!-- <li id="show_list_option"> -->
105 [% WRAPPER tab_item tabname= "enterlist_tab" %] <span>Enter a list of record numbers</span> [% END %]
106 [% END # /WRAPPER tabs_nav %]
107 [% WRAPPER tab_panels %]
108 [% WRAPPER tab_panel tabname="uploadfile_tab" bt_active= 1 %]
109 <fieldset class="rows">
111 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
114 [% END # /tab_panel %]
117 [% WRAPPER tab_panel tabname="shelves_tab" %]
118 <fieldset class="rows">
121 <label for="shelf_number">List: </label>
122 <select name="shelf_number" id="shelf_number">
123 <option value="">Select a list</option>
124 [% FOREACH list IN lists %]
125 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
131 [% END # /tab_panel %]
133 [% WRAPPER tab_panel tabname="enterlist_tab" %]
134 <fieldset class="rows">
137 <label for="recordnumber_list">Record numbers: </label>
138 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
139 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
143 [% END # /tab_panel %]
144 [% END # /WRAPPER tab_panels %]
145 [% END # /WRAPPER tabs %]
147 <fieldset class="rows">
148 <legend>MARC modification template</legend>
151 <label for="marc_modification_template_id" class="required">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 | html %]">[% mmt.name | html %]</option>
161 <fieldset class="action">
162 <input type="hidden" name="op" value="list" />
163 <input type="submit" class="btn btn-primary" value="Continue" />
164 <a class="cancel" href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cancel</a>
166 </form> <!-- /#record_ids_selection -->
167 [% ELSIF view == 'list' %]
169 <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
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 | html %]" selected="selected">[% mmt.name | html %]</option>
177 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
181 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
182 <div class="modal-dialog">
183 <div class="modal-content">
184 <div class="modal-header">
185 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
186 <h3 id="marcPreviewLabel">MARC preview</h3>
188 <div class="modal-body">
189 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
191 <div class="modal-footer">
192 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
197 [% IF recordtype == 'biblio' %]
198 <div class="btn-toolbar selections-toolbar">
199 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
200 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
202 <div class="page-section">
203 <table id="biblios" class="records">
207 <th>Biblionumber</th>
213 [% FOR biblio IN records %]
215 <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber | html %]" /></td>
216 <td>[% biblio.biblionumber | html %]</td>
217 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a></td>
219 <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>
224 </table> <!-- /#biblios -->
226 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
228 <div class="btn-toolbar selections-toolbar">
229 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
230 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
232 <div class="page-section">
233 <table id="authorities" class="records">
243 [% FOR authority IN records %]
245 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
246 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
247 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
248 <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>
252 </table> <!-- /#authorities -->
254 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
256 <fieldset class="action">
257 <input type="hidden" name="op" value="modify" />
258 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
259 <input type="submit" id="mainformsubmit" value="Modify selected records" class="button" />
261 </form> <!-- /#process -->
263 <div class="dialog message">
264 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 %]
267 [% ELSIF view == 'errors' %]
268 [% FOR error IN errors %]
269 [% IF error == 'no_template_defined' %]
270 <div class="dialog message">
271 <p>No MARC modification template is defined. You have to create at least one template in order to use this tool.</p>
272 [% IF ( CAN_user_tools_marc_modification_templates ) %]
273 <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>
278 [% ELSIF view == 'enqueued' %]
279 <div class="dialog message">
280 <h1>The job has been enqueued!</h1>
281 <p>It will be processed as soon as possible.</p>
282 <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>
283 | <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a></p>
286 <div class="dialog alert">
287 No action defined for the template.
291 </div> <!-- /.col-sm-10.col-sm-push-2 -->
292 <div class="col-sm-2 col-sm-pull-10">
294 [% INCLUDE 'cat-menu.inc' %]
296 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
297 </div> <!-- /.row -->
299 [% MACRO jsinclude BLOCK %]
300 [% INCLUDE 'datatables.inc' %]
301 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
303 function update_tab_display(){
304 let selected_type = $('input[name="recordtype"]:checked').val();
305 if (selected_type == 'authority') {
306 $("a[href='#shelves_tab_panel']").parent().hide();
307 $("a[href='#uploadfile_tab_panel']").tab("show");
308 } else if (selected_type == 'biblio') {
309 $("a[href='#shelves_tab_panel']").parent().show();
310 $("a[href='#uploadfile_tab_panel']").tab("show");
313 $(document).ready(function() {
315 update_tab_display();
316 $("input[type='radio']").click(function() {
317 update_tab_display();
320 $("#selectall").click(function(e){
322 $(".records input[type='checkbox']").each(function(){
323 $(this).prop("checked", true);
327 $("#clearall").click(function(e){
329 $(".records input[type='checkbox']").each(function(){
330 $(this).prop("checked", false);
334 $("#selectall").click();
336 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
338 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
339 { "aTargets": [1], "sType": "num-html" }
346 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
348 { "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
349 { "aTargets": [1], "sType": "num-html" }
356 $("#mainformsubmit").click(function() {
357 if ($("input[type=checkbox][name='record_id']:checked").length == 0) {
358 alert(_("Please select at least one record to process"));
361 if ($("#marc_modification_template_id").val() <= 0) {
362 alert(_("Please select a modification template."));
368 $("#record_ids_selection").on("submit", function(e) {
369 var tab = $(this).find('#batch_mod_form li.active:first a').attr('href');
370 if (tab == '#uploadfile_tab_panel') {
371 $("#recordnumber_list, #shelf_number").val('');
372 } else if (tab == '#shelves_tab_panel') {
373 $("#recordnumber_list, #uploadfile").val('');
374 } else { // enterlist
375 $("#uploadfile, #shelf_number").val('')
379 $("#marc_modification_template_id").change(function() {
380 var url = "/cgi-bin/koha/svc/records/preview?"
381 var mmtid = $(this).val();
382 $("a.previewMARC").each(function() {
383 $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
387 $("body").on("click", ".previewMARC", function(e) {
389 var ltitle = $(this).text();
390 var page = $(this).attr("href");
391 $("#marcPreviewLabel").text(ltitle);
392 $("#marcPreview .modal-body").load(page + " div");
393 $('#marcPreview').modal({ show: true });
395 $("#marcPreview").on("hidden.bs.modal", function() {
396 $("#marcPreviewLabel").html("");
397 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
403 [% INCLUDE 'intranet-bottom.inc' %]