3 [% PROCESS 'i18n.inc' %]
5 [% PROCESS 'authorities-search-results.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
9 [% t("Confirm selection") | html %] ›
11 [% IF op == 'enqueued' %]
12 [% t("Job enqueued") | html %] ›
14 [% t("Batch record deletion") | html %] ›
15 [% t("Cataloging") | html %] ›
16 [% t("Koha") | html %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="tools_batch_delete_records" 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 op == 'list' || op == 'enqueued' %]
32 [% WRAPPER breadcrumb_item %]
33 <a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
38 [% t("Confirm selection") | html %]
40 [% ELSIF OP == 'enqueued' %]
41 [% WRAPPER breadcrumb_item bc_active= 1 %]
42 [% t("Job enqueued") | html %]
45 [% WRAPPER breadcrumb_item bc_active= 1 %]
46 <span>Batch record deletion</span>
49 [% END #/ WRAPPER breadcrumbs %]
50 [% END #/ WRAPPER sub-header.inc %]
52 <div class="main container-fluid">
54 <div class="col-sm-10 col-sm-push-2">
57 <h1>Batch record deletion</h1>
58 [% FOREACH message IN messages %]
59 [% IF message.type == 'success' %]
60 <div class="dialog message">
61 [% ELSIF message.type == 'warning' %]
62 <div class="dialog alert">
63 [% ELSIF message.type == 'error' %]
64 <div class="dialog alert" style="margin:auto;">
66 [% IF message.code == 'biblio_not_exists' %]
67 <span>The biblionumber [% message.biblionumber | html %] does not exist in the database.</span>
68 [% ELSIF message.code == 'authority_not_exists' %]
69 <span>The authority ID [% message.authid | html %] does not exist in the database.</span>
70 [% ELSIF message.code == 'cannot_enqueue_job' %]
71 <span>Cannot enqueue this job.</span>
72 [% ELSIF message.code == 'biblio_not_exists' %]
73 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
74 [% ELSIF message.code == 'authority_not_exists' %]
75 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
78 [% IF message.error %]
79 <span>(The error was: [% message.error | html %], see the Koha log file for more information).</span>
84 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
85 <fieldset class="rows">
86 <legend>Record type</legend>
88 <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
89 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
93 [% WRAPPER tabs id= "batch_del_form" %]
94 [% WRAPPER tabs_nav %]
95 [% WRAPPER tab_item tabname= "uploadfile_tab" bt_active= 1 %] <span>Upload a file</span> [% END %]
97 [% WRAPPER tab_item tabname= "shelves_tab" %] <span>Select a list of records</span> [% END %]
99 [% WRAPPER tab_item tabname= "enterlist_tab" %] <span>Enter a list of record numbers</span> [% END %]
100 [% END # /WRAPPER tabs_nav %]
102 [% WRAPPER tab_panels %]
103 [% WRAPPER tab_panel tabname="uploadfile_tab" bt_active= 1 %]
104 <fieldset class="rows">
106 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
109 [% END # /WRAPPER tab_panel %]
112 [% WRAPPER tab_panel tabname="shelves_tab" %]
113 <fieldset class="rows">
116 <label for="shelf_number">List: </label>
117 <select name="shelf_number" id="shelf_number">
118 <option value="">Select a list</option>
119 [% FOREACH list IN lists %]
120 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
126 [% END # /WRAPPER tab_panel %]
127 [% END # /IF lists.count %]
129 [% WRAPPER tab_panel tabname="enterlist_tab" %]
130 <fieldset class="rows">
133 <label for="recordnumber_list">IDs: </label>
134 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
135 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
139 [% END # /WRAPPER tab_panel %]
140 [% END # /WRAPPER tab_panels %]
141 [% END # /WRAPPER tabs %]
143 <fieldset class="action">
144 <input type="hidden" name="op" value="list" />
145 <input type="submit" class="btn btn-primary" value="Continue" />
146 <a class="cancel" href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cancel</a>
149 [% ELSIF op == 'list' %]
151 [% IF recordtype == 'biblio' %]
152 <div class="btn-toolbar selections-toolbar">
153 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
154 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
155 | <a id="selectwithoutitems" href="#">Select without items</a>
156 | <a id="selectnotreserved" href="#">Select without holds</a>
157 | <a id="selectwithoutsubscriptions" href="#">Select without subscriptions</a>
160 <div class="page-section">
161 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
162 <table id="biblios" class="records">
166 <th>Biblionumber</th>
171 <th>Subscriptions</th>
175 [% FOR biblio IN records %]
177 <td><input type="checkbox" name="record_id" id="record_id_[% biblio.biblionumber | html %]" value="[% biblio.biblionumber | html %]" data-items="[% biblio.itemnumbers.size | html %]" data-issues="[% biblio.issues_count | html %]" data-reserves="[% biblio.holds_count | html %]" data-subscriptions="[% biblio.subscriptions_count | html %]" /></td>
178 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
179 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
180 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
181 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
182 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
183 <td><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio.biblionumber | uri %]">[% biblio.subscriptions_count | html %]</a></td>
188 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected bibliographic records, attached subscriptions, existing holds, and attached items!</div>
190 <div class="btn-toolbar selections-toolbar">
191 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
192 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
193 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
195 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
196 <table id="authorities" class="records">
206 [% FOR authority IN records %]
208 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
209 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
210 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
211 <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&op=do_search&idx=an,phr&q=[% authority.authid | uri %]">[% authority.count_usage | html %] record(s)</a></td>
216 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
218 <fieldset class="action">
219 <input type="hidden" name="op" value="delete" />
220 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
221 <input type="submit" class="btn btn-primary" value="Delete selected records" />
222 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
227 There are no record IDs defined.
229 [% ELSIF op == 'enqueued' %]
230 <div class="dialog message">
231 <h1>The job has been enqueued!</h1>
232 <p>It will be processed as soon as possible.</p>
233 <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>
234 | <a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
237 No action defined for the template.
241 </div> <!-- /.col-sm-10.col-sm-push-2 -->
243 <div class="col-sm-2 col-sm-pull-10">
245 [% INCLUDE 'cat-menu.inc' %]
247 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
248 </div> <!-- /.row -->
250 [% MACRO jsinclude BLOCK %]
251 [% INCLUDE 'datatables.inc' %]
253 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
254 $(document).ready(function() {
256 $("input[type='radio']").click(function() {
257 if ($(this).attr('id') == 'authority_type') {
258 $("a[href='#shelves_tab_panel']").parent().hide();
259 } else if ($(this).attr('id') == 'biblio_type') {
260 $("a[href='#shelves_tab_panel']").parent().show();
264 $("#selectall").click(function(e){
266 $(".records input[type='checkbox']:not(:disabled)").each(function(){
267 $(this).prop("checked", true);
271 $("#clearall").click(function(e){
273 $(".records input[type='checkbox']:not(:disabled)").each(function(){
274 $(this).prop("checked", false);
278 $("#selectwithoutitems").click(function(e){
280 $(".records input[type='checkbox']:not(:disabled)").each(function(){
281 if( $(this).data("items") == 0 ){
282 $(this).prop("checked", true );
284 $(this).prop("checked", false );
289 $("#selectnotreserved").click(function(e){
291 $(".records input[type='checkbox']:not(:disabled)").each(function(){
292 if( $(this).data("reserves") == 0 ){
293 $(this).prop("checked", true );
295 $(this).prop("checked", false );
300 $("#selectwithoutsubscriptions").click(function(e){
302 $(".records input[type='checkbox']:not(:disabled)").each(function(){
303 if( $(this).data("subscriptions") == 0 ){
304 $(this).prop("checked", true );
306 $(this).prop("checked", false );
311 $("#clearlinkedtobiblio").click(function(e){
313 $(".records input[type='checkbox']:not(:disabled)").each(function(){
314 if( $(this).data("usage") == 0 ){
315 $(this).prop("checked", true );
317 $(this).prop("checked", false );
322 $("#selectall").click();
324 //Show a red cross if a biblio cannot be deleted
325 [% IF recordtype == 'biblio' %]
326 $(".records input:checkbox[data-issues!='0']").each(function(){
327 $(this).parents('tr').find('td').css('background-color', '#ffff99')
328 $(this).replaceWith("<span class='error'><i class='fa fa-times fa-lg'></i></span>")
329 $(".records i").attr('title', MSG_CANNOT_BE_DELETED)
333 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
335 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
336 { "aTargets": [ 3, 4 ], "sType": "num-html" }
343 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
345 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
346 { "aTargets": [ 3 ], "sType": "num-html" }
353 $("#selectrecords").on("submit",function(){
354 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
355 if (nb_checked == 0){
356 alert(_("No records have been selected."));
361 $("#selectauths").on("submit",function(){
362 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
364 alert(_("No authorities have been selected."));
369 $("#record_ids_selection").on("submit", function(e){
370 var tab = $(this).find('#batch_del_form:active:first a').attr('href');
371 if ( tab == '#uploadfile_tab' ) {
372 $("#shelf_number").empty('');
373 $("#recordnumber_list").val('');
374 } else if ( tab == '#shelves_tab' ) {
375 $("#uploadfile").val('')
376 $("#recordnumber_list").val('');
377 } else { // enterlist
378 $("#uploadfile").val('')
379 $("#shelf_number").empty('');
387 [% INCLUDE 'intranet-bottom.inc' %]