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>
68 <div id="batch_del_form" class="toptabs" style="clear:both">
70 <li><a href="#uploadfile_tab">Upload a file</a></li>
71 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
72 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
75 <div id="uploadfile_tab">
76 <fieldset class="rows">
77 <legend>Use a file</legend>
79 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
86 <div id="shelves_tab">
87 <fieldset class="rows">
88 <legend>Or select a list of records</legend>
91 <label for="shelf_number">Use records from the following list: </label>
92 <select name="shelf_number" id="shelf_number">
93 <option value="">Select a list</option>
94 [% FOREACH list IN lists %]
95 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
106 <div id="enterlist_tab">
107 <fieldset class="rows">
108 <legend>Or enter a list of record numbers</legend>
111 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
112 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
121 <fieldset class="action">
122 <input type="hidden" name="op" value="list" />
123 <input type="submit" value="Continue" class="button" />
124 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
127 [% ELSIF op == 'list' %]
129 [% IF recordtype == 'biblio' %]
131 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
132 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
133 | <a id="selectwithoutitems" href="#">Select without items</a>
134 | <a id="selectnotreserved" href="#">Select without holds</a>
136 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
137 <table id="biblios" class="records">
141 <th>Biblionumber</th>
149 [% FOR biblio IN records %]
151 <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>
152 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
153 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
154 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
155 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
156 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
161 <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>
164 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
165 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
166 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
168 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
169 <table id="authorities" class="records">
179 [% FOR authority IN records %]
181 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
182 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
183 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
184 <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>
189 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
191 <fieldset class="action">
192 <input type="hidden" name="op" value="delete" />
193 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
194 <input type="submit" value="Delete selected records" class="button" />
195 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
199 There are no record ids defined.
201 [% ELSIF op == 'report' %]
202 [% IF report.total_records == report.total_success %]
203 All records have been deleted successfully!
204 [% ELSIF report.total_success == 0 %]
205 No record has been deleted. An error occurred.
207 [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred.
209 <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
211 No action defined for the template.
215 </div> <!-- /.col-sm-10.col-sm-push-2 -->
217 <div class="col-sm-2 col-sm-pull-10">
219 [% INCLUDE 'tools-menu.inc' %]
221 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
222 </div> <!-- /.row -->
224 [% MACRO jsinclude BLOCK %]
225 [% Asset.js("js/tools-menu.js") | $raw %]
226 [% INCLUDE 'datatables.inc' %]
228 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
229 $(document).ready(function() {
231 $("#batch_del_form").tabs();
233 $("input[type='radio']").click(function(){
234 if ($(this).attr('id') == 'authority_type') {
235 $("#show_list_option").hide();
236 } else if ($(this).attr('id') == 'biblio_type') {
237 $("#show_list_option").show();
240 $("#selectall").click(function(e){
242 $(".records input[type='checkbox']:not(:disabled)").each(function(){
243 $(this).prop("checked", true);
247 $("#clearall").click(function(e){
249 $(".records input[type='checkbox']:not(:disabled)").each(function(){
250 $(this).prop("checked", false);
254 $("#selectwithoutitems").click(function(e){
256 $(".records input[type='checkbox']:not(:disabled)").each(function(){
257 if( $(this).data("items") == 0 ){
258 $(this).prop("checked", true );
260 $(this).prop("checked", false );
265 $("#selectnotreserved").click(function(e){
267 $(".records input[type='checkbox']:not(:disabled)").each(function(){
268 if( $(this).data("reserves") == 0 ){
269 $(this).prop("checked", true );
271 $(this).prop("checked", false );
276 $("#clearlinkedtobiblio").click(function(e){
278 $(".records input[type='checkbox']:not(:disabled)").each(function(){
279 if( $(this).data("usage") == 0 ){
280 $(this).prop("checked", true );
282 $(this).prop("checked", false );
287 $("#selectall").click();
289 [% IF recordtype == 'biblio' %]
290 $(".records input:checkbox[data-issues!='0']").each(function(){
291 $(this).attr('title', MSG_CANNOT_BE_DELETED)
292 $(this).prop('disabled', true);
293 $(this).prop('checked', false);
294 $(this).parents('tr').find('td').css('background-color', '#ffff99');
298 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
300 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
301 { "aTargets": [ 3, 4 ], "sType": "num-html" }
308 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
310 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
311 { "aTargets": [ 3 ], "sType": "num-html" }
318 $("#selectrecords").on("submit",function(){
319 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
320 if (nb_checked == 0){
321 alert(_("No records have been selected."));
326 $("#selectauths").on("submit",function(){
327 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
329 alert(_("No authorities have been selected."));
334 $("#record_ids_selection").on("submit", function(e){
335 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
336 if ( tab == '#uploadfile_tab' ) {
337 $("#shelf_number").empty('');
338 $("#recordnumber_list").val('');
339 } else if ( tab == '#shelves_tab' ) {
340 $("#uploadfile").val('')
341 $("#recordnumber_list").val('');
342 } else { // enterlist
343 $("#uploadfile").val('')
344 $("#shelf_number").empty('');
352 [% INCLUDE 'intranet-bottom.inc' %]