4 [% PROCESS 'authorities-search-results.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › Batch record deletion</title>
7 [% INCLUDE 'doc-head-close.inc' %]
10 <body id="tools_batch_delete_records" class="tools">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
14 <div id="breadcrumbs">
15 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
16 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
17 <a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a>
20 <div class="main container-fluid">
22 <div class="col-sm-10 col-sm-push-2">
25 <h1>Batch record deletion</h1>
26 [% FOREACH message IN messages %]
27 [% IF message.type == 'success' %]
28 <div class="dialog message">
29 [% ELSIF message.type == 'warning' %]
30 <div class="dialog alert">
31 [% ELSIF message.type == 'error' %]
32 <div class="dialog alert" style="margin:auto;">
34 [% IF message.code == 'biblio_not_exists' %]
35 The biblionumber [% message.biblionumber | html %] does not exist in the database.
36 [% ELSIF message.code == 'authority_not_exists' %]
37 The authority id [% message.authid | html %] does not exist in the database.
38 [% ELSIF message.code == 'item_issued' %]
39 At least one item is checked out on bibliographic record [% message.biblionumber | html %].
40 [% ELSIF message.code == 'reserve_not_cancelled' %]
41 Bibliographic record [% message.biblionumber | html %] was not deleted. A hold could not be canceled (reserve_id [% message.reserve_id | html %]).
42 [% ELSIF message.code == 'item_not_deleted' %]
43 The bibliographic record [% message.biblionumber | html %] was not deleted. An error was encountered when deleting an item (itemnumber [% message.itemnumber | html %]).
44 [% ELSIF message.code == 'biblio_not_deleted' %]
45 Bibliographic record [% message.biblionumber | html %] was not deleted. An error occurred.
46 [% ELSIF message.code == 'authority_not_deleted' %]
47 Authority record [% message.authid | html %] was not deleted. An error occurred.
48 [% ELSIF message.code == 'biblio_deleted' %]
49 Bibliographic record [% message.biblionumber | html %] has been deleted successfully.
50 [% ELSIF message.code == 'authority_deleted' %]
51 Authority [% message.authid | html %] has been deleted successfully.
53 [% IF message.error %]
54 (The error was: [% message.error | html %], see the Koha log file for more information).
59 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
60 <fieldset class="rows">
61 <legend>Record type</legend>
63 <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
64 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
70 <div id="batch_del_form" class="toptabs">
72 <li><a href="#uploadfile_tab">Upload a file</a></li>
73 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
74 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
77 <div id="uploadfile_tab">
78 <fieldset class="rows">
79 <legend>Use a file</legend>
81 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
88 <div id="shelves_tab">
89 <fieldset class="rows">
90 <legend>Or select a list of records</legend>
93 <label for="shelf_number">Use records from the following list: </label>
94 <select name="shelf_number" id="shelf_number">
95 <option value="">Select a list</option>
96 [% FOREACH list IN lists %]
97 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
108 <div id="enterlist_tab">
109 <fieldset class="rows">
110 <legend>Or enter a list of record numbers</legend>
113 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
114 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
123 <fieldset class="action">
124 <input type="hidden" name="op" value="list" />
125 <input type="submit" value="Continue" class="button" />
126 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
129 [% ELSIF op == 'list' %]
131 [% IF recordtype == 'biblio' %]
133 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
134 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
135 | <a id="selectwithoutitems" href="#">Select without items</a>
136 | <a id="selectnotreserved" href="#">Select without holds</a>
138 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
139 <table id="biblios" class="records">
143 <th>Biblionumber</th>
151 [% FOR biblio IN records %]
153 <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 %]" /></td>
154 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
155 <td>[% INCLUDE 'biblio-default-view.inc' biblionumber=biblio.biblionumber %][% INCLUDE 'biblio-title.inc' %]</a></td>
156 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
157 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
158 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
163 <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>
166 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
167 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
168 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
170 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
171 <table id="authorities" class="records">
181 [% FOR authority IN records %]
183 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
184 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
185 <td>[% PROCESS authresult summary=authority.summary %]</td>
186 <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>
191 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
193 <fieldset class="action">
194 <input type="hidden" name="op" value="delete" />
195 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
196 <input type="submit" value="Delete selected records" class="button" />
197 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
201 There are no record ids defined.
203 [% ELSIF op == 'report' %]
204 [% IF report.total_records == report.total_success %]
205 All records have been deleted successfully!
206 [% ELSIF report.total_success == 0 %]
207 No record has been deleted. An error occurred.
209 [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred.
211 <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
213 No action defined for the template.
217 </div> <!-- /.col-sm-10.col-sm-push-2 -->
219 <div class="col-sm-2 col-sm-pull-10">
221 [% INCLUDE 'tools-menu.inc' %]
223 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
224 </div> <!-- /.row -->
226 [% MACRO jsinclude BLOCK %]
227 [% Asset.js("js/tools-menu.js") | $raw %]
228 [% INCLUDE 'datatables.inc' %]
229 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
231 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
232 $(document).ready(function() {
234 $("#batch_del_form").tabs();
236 $("input[type='radio']").click(function(){
237 if ($(this).attr('id') == 'authority_type') {
238 $("#show_list_option").hide();
239 } else if ($(this).attr('id') == 'biblio_type') {
240 $("#show_list_option").show();
243 $("#selectall").click(function(e){
245 $(".records").checkCheckboxes(":input[type='checkbox']:not(:disabled)");
247 $("#clearall").click(function(e){
249 $(".records").unCheckCheckboxes(":input[type='checkbox']:not(:disabled)");
251 $("#selectwithoutitems").click(function(e){
253 $("#biblios").checkCheckboxes(":input[data-items='0']:not(:disabled)");
255 $("#selectnotreserved").click(function(e){
257 $("#biblios").checkCheckboxes(":input[data-reserves='0']:not(:disabled)");
260 $("#clearlinkedtobiblio").click(function(e){
262 $("#authorities").unCheckCheckboxes(":not(input[data-usage='0'])");
264 $("#selectall").click();
266 [% IF recordtype == 'biblio' %]
267 $(".records input:checkbox[data-issues!='0']").each(function(){
268 $(this).attr('title', MSG_CANNOT_BE_DELETED)
269 $(this).prop('disabled', true);
270 $(this).prop('checked', false);
271 $(this).parents('tr').find('td').css('background-color', '#ffff99');
275 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
277 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
278 { "aTargets": [ 3, 4 ], "sType": "num-html" }
285 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
287 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
288 { "aTargets": [ 3 ], "sType": "num-html" }
295 $("#selectrecords").on("submit",function(){
296 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
297 if (nb_checked == 0){
298 alert(_("No records have been selected."));
303 $("#selectauths").on("submit",function(){
304 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
306 alert(_("No authorities have been selected."));
311 $("#record_ids_selection").on("submit", function(e){
312 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
313 if ( tab == '#uploadfile_tab' ) {
314 $("#shelf_number").empty('');
315 $("#recordnumber_list").val('');
316 } else if ( tab == '#shelves_tab' ) {
317 $("#uploadfile").val('')
318 $("#recordnumber_list").val('');
319 } else { // enterlist
320 $("#uploadfile").val('')
321 $("#shelf_number").empty('');
329 [% INCLUDE 'intranet-bottom.inc' %]