3 [% PROCESS 'authorities-search-results.inc' %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Batch record deletion</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.css("css/datatables.css") %]
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 id="doc3" class="yui-t2">
24 <h1>Batch record deletion</h1>
25 [% FOREACH message IN messages %]
26 [% IF message.type == 'success' %]
27 <div class="dialog message">
28 [% ELSIF message.type == 'warning' %]
29 <div class="dialog alert">
30 [% ELSIF message.type == 'error' %]
31 <div class="dialog error" style="margin:auto;">
33 [% IF message.code == 'biblio_not_exists' %]
34 The biblionumber [% message.biblionumber |html %] does not exist in the database.
35 [% ELSIF message.code == 'authority_not_exists' %]
36 The authority id [% message.authid |html %] does not exist in the database.
37 [% ELSIF message.code == 'item_issued' %]
38 At least one item is checked out on bibliographic record [% message.biblionumber %].
39 [% ELSIF message.code == 'reserve_not_cancelled' %]
40 Bibliographic record [% message.biblionumber %] was not deleted. A hold could not be canceled (reserve_id [% message.reserve_id %]).
41 [% ELSIF message.code == 'item_not_deleted' %]
42 The bibliographic record [% message.biblionumber %] was not deleted. An error was encountered when deleting an item (itemnumber [% message.itemnumber %]).
43 [% ELSIF message.code == 'biblio_not_deleted' %]
44 Bibliographic record [% message.biblionumber %] was not deleted. An error occurred.
45 [% ELSIF message.code == 'authority_not_deleted' %]
46 Authority record [% message.authid %] was not deleted. An error occurred.
47 [% ELSIF message.code == 'biblio_deleted' %]
48 Bibliographic record [% message.biblionumber %] has been deleted successfully.
49 [% ELSIF message.code == 'authority_deleted' %]
50 Authority [% message.authid %] has been deleted successfully.
52 [% IF message.error %]
53 (The error was: [% message.error%], see the Koha log file for more information).
58 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl">
59 <fieldset class="rows">
60 <legend>Record type</legend>
62 <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
63 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
66 <fieldset class="rows">
67 <legend>Use a file</legend>
69 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
72 <fieldset class="rows">
73 <legend>Or enter a list of record numbers</legend>
76 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
77 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
81 <fieldset class="action">
82 <input type="hidden" name="op" value="list" />
83 <input type="submit" value="Continue" class="button" />
84 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
87 [% ELSIF op == 'list' %]
89 [% IF recordtype == 'biblio' %]
91 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
92 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
93 | <a id="selectwithoutitems" href="#">Select without items</a>
94 | <a id="selectnotreserved" href="#">Select without holds</a>
96 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
97 <table id="biblios" class="records">
101 <th>Biblionumber</th>
109 [% FOR biblio IN records %]
111 <td><input type="checkbox" name="record_id" id="record_id_[% biblio.biblionumber %]" value="[% biblio.biblionumber %]" data-items="[% biblio.itemnumbers.size %]" data-issues="[% biblio.issues_count %]" data-reserves="[% biblio.holds_count %]" /></td>
112 <td><label for="record_id_[% biblio.biblionumber %]">[% biblio.biblionumber %]</label></td>
113 <td>[% INCLUDE 'biblio-default-view.inc' biblionumber=biblio.biblionumber %][% biblio.title %][% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle %] [% subtitle.subfield |html %][% END %][% END %]</a></td>
114 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.itemnumbers.size %]</a></td>
115 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.holds_count %]</a></td>
116 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.issues_count %]</a></td>
121 <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>
124 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
125 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
126 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
128 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
129 <table id="authorities" class="records">
139 [% FOR authority IN records %]
141 <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
142 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
143 <td>[% PROCESS authresult summary=authority.summary %]</td>
144 <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&op=do_search&idx=an,phr&q=[% authority.authid %]">[% authority.count_usage %] record(s)</a></td>
149 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
151 <fieldset class="action">
152 <input type="hidden" name="op" value="delete" />
153 <input type="hidden" name="recordtype" value="[% recordtype %]" />
154 <input type="submit" value="Delete selected records" class="button" />
155 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
159 There are no record ids defined.
161 [% ELSIF op == 'report' %]
162 [% IF report.total_records == report.total_success %]
163 All records have been deleted successfully!
164 [% ELSIF report.total_success == 0 %]
165 No record has been deleted. An error occurred.
167 [% report.total_success %] / [% report.total_records %] records have been deleted successfully but some errors occurred.
169 <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
171 No action defined for the template.
176 [% INCLUDE 'tools-menu.inc' %]
180 [% MACRO jsinclude BLOCK %]
181 [% Asset.js("js/tools-menu.js") %]
182 [% INCLUDE 'datatables.inc' %]
183 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
184 <script type="text/javascript">
185 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
186 $(document).ready(function() {
187 $("#selectall").click(function(e){
189 $(".records").checkCheckboxes(":input[type='checkbox']:not(:disabled)");
191 $("#clearall").click(function(e){
193 $(".records").unCheckCheckboxes(":input[type='checkbox']:not(:disabled)");
195 $("#selectwithoutitems").click(function(e){
197 $("#biblios").checkCheckboxes(":input[data-items='0']:not(:disabled)");
199 $("#selectnotreserved").click(function(e){
201 $("#biblios").checkCheckboxes(":input[data-reserves='0']:not(:disabled)");
204 $("#clearlinkedtobiblio").click(function(e){
206 $("#authorities").unCheckCheckboxes(":not(input[data-usage='0'])");
208 $("#selectall").click();
210 [% IF recordtype == 'biblio' %]
211 $(".records input:checkbox[data-issues!='0']").each(function(){
212 $(this).attr('title', MSG_CANNOT_BE_DELETED)
213 $(this).prop('disabled', true);
214 $(this).prop('checked', false);
215 $(this).parents('tr').find('td').css('background-color', '#ffff99');
219 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
221 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
222 { "aTargets": [ 3, 4 ], "sType": "num-html" }
229 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
231 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
232 { "aTargets": [ 3 ], "sType": "num-html" }
239 $("#selectrecords").on("submit",function(){
240 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
241 if (nb_checked == 0){
242 alert(_("No records have been selected."));
247 $("#selectauths").on("submit",function(){
248 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
250 alert(_("No authorities have been selected."));
258 [% INCLUDE 'intranet-bottom.inc' %]