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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23 <a href="#" aria-current="page">Batch record deletion</a>
28 <div class="main container-fluid">
30 <div class="col-sm-10 col-sm-push-2">
33 <h1>Batch record deletion</h1>
34 [% FOREACH message IN messages %]
35 [% IF message.type == 'success' %]
36 <div class="dialog message">
37 [% ELSIF message.type == 'warning' %]
38 <div class="dialog alert">
39 [% ELSIF message.type == 'error' %]
40 <div class="dialog alert" style="margin:auto;">
42 [% IF message.code == 'biblio_not_exists' %]
43 The biblionumber [% message.biblionumber | html %] does not exist in the database.
44 [% ELSIF message.code == 'authority_not_exists' %]
45 The authority id [% message.authid | html %] does not exist in the database.
46 [% ELSIF message.code == 'item_issued' %]
47 At least one item is checked out on bibliographic record [% message.biblionumber | html %].
48 [% ELSIF message.code == 'reserve_not_cancelled' %]
49 Bibliographic record [% message.biblionumber | html %] was not deleted. A hold could not be canceled (reserve_id [% message.reserve_id | html %]).
50 [% ELSIF message.code == 'item_not_deleted' %]
51 The bibliographic record [% message.biblionumber | html %] was not deleted. An error was encountered when deleting an item (itemnumber [% message.itemnumber | html %]).
52 [% ELSIF message.code == 'biblio_not_deleted' %]
53 Bibliographic record [% message.biblionumber | html %] was not deleted. An error occurred.
54 [% ELSIF message.code == 'authority_not_deleted' %]
55 Authority record [% message.authid | html %] was not deleted. An error occurred.
56 [% ELSIF message.code == 'biblio_deleted' %]
57 Bibliographic record [% message.biblionumber | html %] has been deleted successfully.
58 [% ELSIF message.code == 'authority_deleted' %]
59 Authority [% message.authid | html %] has been deleted successfully.
61 [% IF message.error %]
62 (The error was: [% message.error | html %], see the Koha log file for more information).
67 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
68 <fieldset class="rows">
69 <legend>Record type</legend>
71 <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
72 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
76 <div id="batch_del_form" class="toptabs" style="clear:both">
78 <li><a href="#uploadfile_tab">Upload a file</a></li>
79 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
80 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
83 <div id="uploadfile_tab">
84 <fieldset class="rows">
85 <legend>Use a file</legend>
87 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
94 <div id="shelves_tab">
95 <fieldset class="rows">
96 <legend>Or select a list of records</legend>
99 <label for="shelf_number">Use records from the following list: </label>
100 <select name="shelf_number" id="shelf_number">
101 <option value="">Select a list</option>
102 [% FOREACH list IN lists %]
103 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
114 <div id="enterlist_tab">
115 <fieldset class="rows">
116 <legend>Or enter a list of record numbers</legend>
119 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
120 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
129 <fieldset class="action">
130 <input type="hidden" name="op" value="list" />
131 <input type="submit" value="Continue" class="button" />
132 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
135 [% ELSIF op == 'list' %]
137 [% IF recordtype == 'biblio' %]
139 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
140 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
141 | <a id="selectwithoutitems" href="#">Select without items</a>
142 | <a id="selectnotreserved" href="#">Select without holds</a>
144 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
145 <table id="biblios" class="records">
149 <th>Biblionumber</th>
157 [% FOR biblio IN records %]
159 <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>
160 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
161 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
162 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
163 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
164 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
169 <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>
172 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
173 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
174 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
176 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
177 <table id="authorities" class="records">
187 [% FOR authority IN records %]
189 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
190 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
191 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
192 <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>
197 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
199 <fieldset class="action">
200 <input type="hidden" name="op" value="delete" />
201 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
202 <input type="submit" value="Delete selected records" class="button" />
203 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
207 There are no record ids defined.
209 [% ELSIF op == 'report' %]
210 [% IF report.total_records == report.total_success %]
211 All records have been deleted successfully!
212 [% ELSIF report.total_success == 0 %]
213 No record has been deleted. An error occurred.
215 [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred.
217 <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
219 No action defined for the template.
223 </div> <!-- /.col-sm-10.col-sm-push-2 -->
225 <div class="col-sm-2 col-sm-pull-10">
227 [% INCLUDE 'tools-menu.inc' %]
229 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
230 </div> <!-- /.row -->
232 [% MACRO jsinclude BLOCK %]
233 [% Asset.js("js/tools-menu.js") | $raw %]
234 [% INCLUDE 'datatables.inc' %]
236 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
237 $(document).ready(function() {
239 $("#batch_del_form").tabs();
241 $("input[type='radio']").click(function(){
242 if ($(this).attr('id') == 'authority_type') {
243 $("#show_list_option").hide();
244 } else if ($(this).attr('id') == 'biblio_type') {
245 $("#show_list_option").show();
248 $("#selectall").click(function(e){
250 $(".records input[type='checkbox']:not(:disabled)").each(function(){
251 $(this).prop("checked", true);
255 $("#clearall").click(function(e){
257 $(".records input[type='checkbox']:not(:disabled)").each(function(){
258 $(this).prop("checked", false);
262 $("#selectwithoutitems").click(function(e){
264 $(".records input[type='checkbox']:not(:disabled)").each(function(){
265 if( $(this).data("items") == 0 ){
266 $(this).prop("checked", true );
268 $(this).prop("checked", false );
273 $("#selectnotreserved").click(function(e){
275 $(".records input[type='checkbox']:not(:disabled)").each(function(){
276 if( $(this).data("reserves") == 0 ){
277 $(this).prop("checked", true );
279 $(this).prop("checked", false );
284 $("#clearlinkedtobiblio").click(function(e){
286 $(".records input[type='checkbox']:not(:disabled)").each(function(){
287 if( $(this).data("usage") == 0 ){
288 $(this).prop("checked", true );
290 $(this).prop("checked", false );
295 $("#selectall").click();
297 [% IF recordtype == 'biblio' %]
298 $(".records input:checkbox[data-issues!='0']").each(function(){
299 $(this).attr('title', MSG_CANNOT_BE_DELETED)
300 $(this).prop('disabled', true);
301 $(this).prop('checked', false);
302 $(this).parents('tr').find('td').css('background-color', '#ffff99');
306 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
308 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
309 { "aTargets": [ 3, 4 ], "sType": "num-html" }
316 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
318 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
319 { "aTargets": [ 3 ], "sType": "num-html" }
326 $("#selectrecords").on("submit",function(){
327 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
328 if (nb_checked == 0){
329 alert(_("No records have been selected."));
334 $("#selectauths").on("submit",function(){
335 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
337 alert(_("No authorities have been selected."));
342 $("#record_ids_selection").on("submit", function(e){
343 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
344 if ( tab == '#uploadfile_tab' ) {
345 $("#shelf_number").empty('');
346 $("#recordnumber_list").val('');
347 } else if ( tab == '#shelves_tab' ) {
348 $("#uploadfile").val('')
349 $("#recordnumber_list").val('');
350 } else { // enterlist
351 $("#uploadfile").val('')
352 $("#shelf_number").empty('');
360 [% INCLUDE 'intranet-bottom.inc' %]