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 id="doc3" class="yui-t2">
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 error" 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">
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>
67 <fieldset class="rows">
68 <legend>Use a file</legend>
70 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
73 <fieldset class="rows">
74 <legend>Or enter a list of record numbers</legend>
77 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
78 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
82 <fieldset class="action">
83 <input type="hidden" name="op" value="list" />
84 <input type="submit" value="Continue" class="button" />
85 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
88 [% ELSIF op == 'list' %]
90 [% IF recordtype == 'biblio' %]
92 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
93 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
94 | <a id="selectwithoutitems" href="#">Select without items</a>
95 | <a id="selectnotreserved" href="#">Select without holds</a>
97 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
98 <table id="biblios" class="records">
102 <th>Biblionumber</th>
110 [% FOR biblio IN records %]
112 <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>
113 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
114 <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>
115 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | html %]">[% biblio.itemnumbers.size | html %]</a></td>
116 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | html %]">[% biblio.holds_count | html %]</a></td>
117 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | html %]">[% biblio.issues_count | html %]</a></td>
122 <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>
125 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
126 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
127 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
129 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
130 <table id="authorities" class="records">
140 [% FOR authority IN records %]
142 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
143 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | html %]">[% authority.authid | html %]</a></td>
144 <td>[% PROCESS authresult summary=authority.summary %]</td>
145 <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&op=do_search&idx=an,phr&q=[% authority.authid | html %]">[% authority.count_usage | html %] record(s)</a></td>
150 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
152 <fieldset class="action">
153 <input type="hidden" name="op" value="delete" />
154 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
155 <input type="submit" value="Delete selected records" class="button" />
156 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
160 There are no record ids defined.
162 [% ELSIF op == 'report' %]
163 [% IF report.total_records == report.total_success %]
164 All records have been deleted successfully!
165 [% ELSIF report.total_success == 0 %]
166 No record has been deleted. An error occurred.
168 [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred.
170 <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
172 No action defined for the template.
177 [% INCLUDE 'tools-menu.inc' %]
181 [% MACRO jsinclude BLOCK %]
182 [% Asset.js("js/tools-menu.js") | $raw %]
183 [% INCLUDE 'datatables.inc' %]
184 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
185 <script type="text/javascript">
186 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
187 $(document).ready(function() {
188 $("#selectall").click(function(e){
190 $(".records").checkCheckboxes(":input[type='checkbox']:not(:disabled)");
192 $("#clearall").click(function(e){
194 $(".records").unCheckCheckboxes(":input[type='checkbox']:not(:disabled)");
196 $("#selectwithoutitems").click(function(e){
198 $("#biblios").checkCheckboxes(":input[data-items='0']:not(:disabled)");
200 $("#selectnotreserved").click(function(e){
202 $("#biblios").checkCheckboxes(":input[data-reserves='0']:not(:disabled)");
205 $("#clearlinkedtobiblio").click(function(e){
207 $("#authorities").unCheckCheckboxes(":not(input[data-usage='0'])");
209 $("#selectall").click();
211 [% IF recordtype == 'biblio' %]
212 $(".records input:checkbox[data-issues!='0']").each(function(){
213 $(this).attr('title', MSG_CANNOT_BE_DELETED)
214 $(this).prop('disabled', true);
215 $(this).prop('checked', false);
216 $(this).parents('tr').find('td').css('background-color', '#ffff99');
220 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
222 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
223 { "aTargets": [ 3, 4 ], "sType": "num-html" }
230 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
232 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
233 { "aTargets": [ 3 ], "sType": "num-html" }
240 $("#selectrecords").on("submit",function(){
241 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
242 if (nb_checked == 0){
243 alert(_("No records have been selected."));
248 $("#selectauths").on("submit",function(){
249 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
251 alert(_("No authorities have been selected."));
259 [% INCLUDE 'intranet-bottom.inc' %]