4 [% PROCESS 'authorities-search-results.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Batch record deletion › Tools › Koha</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 == 'cannot_enqueue_job' %]
47 Cannot enqueue this job.
48 [% ELSIF message.code == 'biblio_not_exists' %]
49 Bibliographic record [% message.biblionumber | html %] does not exist in the database.
50 [% ELSIF message.code == 'authority_not_exists' %]
51 Authority record [% message.authid | html %] does not exist in the database.
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>
69 <div id="batch_del_form" class="toptabs" style="clear:both">
71 <li><a href="#uploadfile_tab">Upload a file</a></li>
72 [% IF lists.count %]<li id="show_list_option"><a href="#shelves_tab">Select a list of records</a></li>[% END %]
73 <li><a href="#enterlist_tab">Enter a list of record numbers</a></li>
76 <div id="uploadfile_tab">
77 <fieldset class="rows">
78 <legend>Use a file</legend>
80 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
87 <div id="shelves_tab">
88 <fieldset class="rows">
89 <legend>Or select a list of records</legend>
92 <label for="shelf_number">Use records from the following list: </label>
93 <select name="shelf_number" id="shelf_number">
94 <option value="">Select a list</option>
95 [% FOREACH list IN lists %]
96 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
107 <div id="enterlist_tab">
108 <fieldset class="rows">
109 <legend>Or enter a list of record numbers</legend>
112 <label for="recordnumber_list">List of biblionumbers or authority ids (one per line): </label>
113 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
122 <fieldset class="action">
123 <input type="hidden" name="op" value="list" />
124 <input type="submit" value="Continue" class="button" />
125 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
128 [% ELSIF op == 'list' %]
130 [% IF recordtype == 'biblio' %]
132 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
133 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
134 | <a id="selectwithoutitems" href="#">Select without items</a>
135 | <a id="selectnotreserved" href="#">Select without holds</a>
136 | <a id="selectwithoutsubscriptions" href="#">Select without subscriptions</a>
138 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
139 <table id="biblios" class="records">
143 <th>Biblionumber</th>
148 <th>Subscriptions</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 %]" data-subscriptions="[% biblio.subscriptions_count | html %]" /></td>
155 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
156 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</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>
160 <td><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio.biblionumber | uri %]">[% biblio.subscriptions_count | html %]</a></td>
165 <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>
168 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
169 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
170 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
172 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
173 <table id="authorities" class="records">
183 [% FOR authority IN records %]
185 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
186 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
187 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
188 <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>
193 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
195 <fieldset class="action">
196 <input type="hidden" name="op" value="delete" />
197 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
198 <input type="submit" value="Delete selected records" class="button" />
199 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
203 There are no record ids defined.
205 [% ELSIF op == 'enqueued' %]
206 <div class="dialog message">
207 <p>The job has been enqueued! It will be processed as soon as possible.</p>
208 <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a>
209 | <a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
212 No action defined for the template.
216 </div> <!-- /.col-sm-10.col-sm-push-2 -->
218 <div class="col-sm-2 col-sm-pull-10">
220 [% INCLUDE 'tools-menu.inc' %]
222 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
223 </div> <!-- /.row -->
225 [% MACRO jsinclude BLOCK %]
226 [% Asset.js("js/tools-menu.js") | $raw %]
227 [% INCLUDE 'datatables.inc' %]
229 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
230 $(document).ready(function() {
232 $("#batch_del_form").tabs();
234 $("input[type='radio']").click(function(){
235 if ($(this).attr('id') == 'authority_type') {
236 $("#show_list_option").hide();
237 } else if ($(this).attr('id') == 'biblio_type') {
238 $("#show_list_option").show();
241 $("#selectall").click(function(e){
243 $(".records input[type='checkbox']:not(:disabled)").each(function(){
244 $(this).prop("checked", true);
248 $("#clearall").click(function(e){
250 $(".records input[type='checkbox']:not(:disabled)").each(function(){
251 $(this).prop("checked", false);
255 $("#selectwithoutitems").click(function(e){
257 $(".records input[type='checkbox']:not(:disabled)").each(function(){
258 if( $(this).data("items") == 0 ){
259 $(this).prop("checked", true );
261 $(this).prop("checked", false );
266 $("#selectnotreserved").click(function(e){
268 $(".records input[type='checkbox']:not(:disabled)").each(function(){
269 if( $(this).data("reserves") == 0 ){
270 $(this).prop("checked", true );
272 $(this).prop("checked", false );
277 $("#selectwithoutsubscriptions").click(function(e){
279 $(".records input[type='checkbox']:not(:disabled)").each(function(){
280 if( $(this).data("subscriptions") == 0 ){
281 $(this).prop("checked", true );
283 $(this).prop("checked", false );
288 $("#clearlinkedtobiblio").click(function(e){
290 $(".records input[type='checkbox']:not(:disabled)").each(function(){
291 if( $(this).data("usage") == 0 ){
292 $(this).prop("checked", true );
294 $(this).prop("checked", false );
299 $("#selectall").click();
301 [% IF recordtype == 'biblio' %]
302 $(".records input:checkbox[data-issues!='0']").each(function(){
303 $(this).attr('title', MSG_CANNOT_BE_DELETED)
304 $(this).prop('disabled', true);
305 $(this).prop('checked', false);
306 $(this).parents('tr').find('td').css('background-color', '#ffff99');
310 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
312 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
313 { "aTargets": [ 3, 4 ], "sType": "num-html" }
320 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
322 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
323 { "aTargets": [ 3 ], "sType": "num-html" }
330 $("#selectrecords").on("submit",function(){
331 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
332 if (nb_checked == 0){
333 alert(_("No records have been selected."));
338 $("#selectauths").on("submit",function(){
339 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
341 alert(_("No authorities have been selected."));
346 $("#record_ids_selection").on("submit", function(e){
347 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
348 if ( tab == '#uploadfile_tab' ) {
349 $("#shelf_number").empty('');
350 $("#recordnumber_list").val('');
351 } else if ( tab == '#shelves_tab' ) {
352 $("#uploadfile").val('')
353 $("#recordnumber_list").val('');
354 } else { // enterlist
355 $("#uploadfile").val('')
356 $("#shelf_number").empty('');
364 [% INCLUDE 'intranet-bottom.inc' %]