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' %]
8 [% Asset.css("css/datatables.css") | $raw %]
11 <body id="tools_batch_delete_records" class="tools">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
15 <div id="breadcrumbs">
16 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
17 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
18 <a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a>
21 <div class="main container-fluid">
23 <div class="col-sm-10 col-sm-push-2">
26 <h1>Batch record deletion</h1>
27 [% FOREACH message IN messages %]
28 [% IF message.type == 'success' %]
29 <div class="dialog message">
30 [% ELSIF message.type == 'warning' %]
31 <div class="dialog alert">
32 [% ELSIF message.type == 'error' %]
33 <div class="dialog alert" style="margin:auto;">
35 [% IF message.code == 'biblio_not_exists' %]
36 The biblionumber [% message.biblionumber | html %] does not exist in the database.
37 [% ELSIF message.code == 'authority_not_exists' %]
38 The authority id [% message.authid | html %] does not exist in the database.
39 [% ELSIF message.code == 'item_issued' %]
40 At least one item is checked out on bibliographic record [% message.biblionumber | html %].
41 [% ELSIF message.code == 'reserve_not_cancelled' %]
42 Bibliographic record [% message.biblionumber | html %] was not deleted. A hold could not be canceled (reserve_id [% message.reserve_id | html %]).
43 [% ELSIF message.code == 'item_not_deleted' %]
44 The bibliographic record [% message.biblionumber | html %] was not deleted. An error was encountered when deleting an item (itemnumber [% message.itemnumber | html %]).
45 [% ELSIF message.code == 'biblio_not_deleted' %]
46 Bibliographic record [% message.biblionumber | html %] was not deleted. An error occurred.
47 [% ELSIF message.code == 'authority_not_deleted' %]
48 Authority record [% message.authid | html %] was not deleted. An error occurred.
49 [% ELSIF message.code == 'biblio_deleted' %]
50 Bibliographic record [% message.biblionumber | html %] has been deleted successfully.
51 [% ELSIF message.code == 'authority_deleted' %]
52 Authority [% message.authid | html %] has been deleted successfully.
54 [% IF message.error %]
55 (The error was: [% message.error | html %], see the Koha log file for more information).
60 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
61 <fieldset class="rows">
62 <legend>Record type</legend>
64 <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
65 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
71 <div id="batch_del_form" class="toptabs">
73 <li><a href="#uploadfile_tab">Upload a file</a></li>
74 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
75 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
78 <div id="uploadfile_tab">
79 <fieldset class="rows">
80 <legend>Use a file</legend>
82 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
89 <div id="shelves_tab">
90 <fieldset class="rows">
91 <legend>Or select a list of records</legend>
94 <label for="shelf_number">Use records from the following list: </label>
95 <select name="shelf_number" id="shelf_number">
96 <option value="">Select a list</option>
97 [% FOREACH list IN lists %]
98 <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>
109 <div id="enterlist_tab">
110 <fieldset class="rows">
111 <legend>Or enter a list of record numbers</legend>
114 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
115 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
124 <fieldset class="action">
125 <input type="hidden" name="op" value="list" />
126 <input type="submit" value="Continue" class="button" />
127 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
130 [% ELSIF op == 'list' %]
132 [% IF recordtype == 'biblio' %]
134 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
135 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
136 | <a id="selectwithoutitems" href="#">Select without items</a>
137 | <a id="selectnotreserved" href="#">Select without holds</a>
139 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
140 <table id="biblios" class="records">
144 <th>Biblionumber</th>
152 [% FOR biblio IN records %]
154 <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>
155 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
156 <td>[% INCLUDE 'biblio-default-view.inc' biblionumber=biblio.biblionumber %][% biblio.title | html %][% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle %] [% subtitle.subfield | html %][% END %][% END %]</a></td>
157 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
158 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
159 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
164 <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>
167 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
168 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
169 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
171 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
172 <table id="authorities" class="records">
182 [% FOR authority IN records %]
184 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
185 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
186 <td>[% PROCESS authresult summary=authority.summary %]</td>
187 <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>
192 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
194 <fieldset class="action">
195 <input type="hidden" name="op" value="delete" />
196 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
197 <input type="submit" value="Delete selected records" class="button" />
198 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
202 There are no record ids defined.
204 [% ELSIF op == 'report' %]
205 [% IF report.total_records == report.total_success %]
206 All records have been deleted successfully!
207 [% ELSIF report.total_success == 0 %]
208 No record has been deleted. An error occurred.
210 [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred.
212 <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
214 No action defined for the template.
218 </div> <!-- /.col-sm-10.col-sm-push-2 -->
220 <div class="col-sm-2 col-sm-pull-10">
222 [% INCLUDE 'tools-menu.inc' %]
224 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
225 </div> <!-- /.row -->
227 [% MACRO jsinclude BLOCK %]
228 [% Asset.js("js/tools-menu.js") | $raw %]
229 [% INCLUDE 'datatables.inc' %]
230 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
232 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
233 $(document).ready(function() {
235 $("#batch_del_form").tabs();
237 $("input[type='radio']").click(function(){
238 if ($(this).attr('id') == 'authority_type') {
239 $("#show_list_option").hide();
240 } else if ($(this).attr('id') == 'biblio_type') {
241 $("#show_list_option").show();
244 $("#selectall").click(function(e){
246 $(".records").checkCheckboxes(":input[type='checkbox']:not(:disabled)");
248 $("#clearall").click(function(e){
250 $(".records").unCheckCheckboxes(":input[type='checkbox']:not(:disabled)");
252 $("#selectwithoutitems").click(function(e){
254 $("#biblios").checkCheckboxes(":input[data-items='0']:not(:disabled)");
256 $("#selectnotreserved").click(function(e){
258 $("#biblios").checkCheckboxes(":input[data-reserves='0']:not(:disabled)");
261 $("#clearlinkedtobiblio").click(function(e){
263 $("#authorities").unCheckCheckboxes(":not(input[data-usage='0'])");
265 $("#selectall").click();
267 [% IF recordtype == 'biblio' %]
268 $(".records input:checkbox[data-issues!='0']").each(function(){
269 $(this).attr('title', MSG_CANNOT_BE_DELETED)
270 $(this).prop('disabled', true);
271 $(this).prop('checked', false);
272 $(this).parents('tr').find('td').css('background-color', '#ffff99');
276 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
278 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
279 { "aTargets": [ 3, 4 ], "sType": "num-html" }
286 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
288 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
289 { "aTargets": [ 3 ], "sType": "num-html" }
296 $("#selectrecords").on("submit",function(){
297 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
298 if (nb_checked == 0){
299 alert(_("No records have been selected."));
304 $("#selectauths").on("submit",function(){
305 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
307 alert(_("No authorities have been selected."));
312 $("#record_ids_selection").on("submit", function(e){
313 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
314 if ( tab == '#uploadfile_tab' ) {
315 $("#shelf_number").empty('');
316 $("#recordnumber_list").val('');
317 } else if ( tab == '#shelves_tab' ) {
318 $("#uploadfile").val('')
319 $("#recordnumber_list").val('');
320 } else { // enterlist
321 $("#uploadfile").val('')
322 $("#shelf_number").empty('');
330 [% INCLUDE 'intranet-bottom.inc' %]