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 IDs</a></li>
76 <div id="uploadfile_tab">
77 <fieldset class="rows">
79 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
86 <div id="shelves_tab">
87 <fieldset class="rows">
90 <label for="shelf_number">List: </label>
91 <select name="shelf_number" id="shelf_number">
92 <option value="">Select a list</option>
93 [% FOREACH list IN lists %]
94 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
105 <div id="enterlist_tab">
106 <fieldset class="rows">
109 <label for="recordnumber_list">IDs: </label>
110 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
111 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
120 <fieldset class="action">
121 <input type="hidden" name="op" value="list" />
122 <input type="submit" value="Continue" class="button" />
123 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
126 [% ELSIF op == 'list' %]
128 [% IF recordtype == 'biblio' %]
130 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
131 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
132 | <a id="selectwithoutitems" href="#">Select without items</a>
133 | <a id="selectnotreserved" href="#">Select without holds</a>
134 | <a id="selectwithoutsubscriptions" href="#">Select without subscriptions</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>
146 <th>Subscriptions</th>
150 [% FOR biblio IN records %]
152 <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>
153 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
154 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
155 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
156 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
157 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
158 <td><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio.biblionumber | uri %]">[% biblio.subscriptions_count | html %]</a></td>
163 <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>
166 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
167 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
168 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
170 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
171 <table id="authorities" class="records">
181 [% FOR authority IN records %]
183 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
184 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
185 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
186 <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>
191 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
193 <fieldset class="action">
194 <input type="hidden" name="op" value="delete" />
195 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
196 <input type="submit" value="Delete selected records" class="button" />
197 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
201 There are no record IDs defined.
203 [% ELSIF op == 'enqueued' %]
204 <div class="dialog message">
205 <p>The job has been enqueued! It will be processed as soon as possible.</p>
206 <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>
207 | <a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
210 No action defined for the template.
214 </div> <!-- /.col-sm-10.col-sm-push-2 -->
216 <div class="col-sm-2 col-sm-pull-10">
218 [% INCLUDE 'tools-menu.inc' %]
220 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
221 </div> <!-- /.row -->
223 [% MACRO jsinclude BLOCK %]
224 [% Asset.js("js/tools-menu.js") | $raw %]
225 [% INCLUDE 'datatables.inc' %]
227 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
228 $(document).ready(function() {
230 $("#batch_del_form").tabs();
232 $("input[type='radio']").click(function(){
233 if ($(this).attr('id') == 'authority_type') {
234 $("#show_list_option").hide();
235 } else if ($(this).attr('id') == 'biblio_type') {
236 $("#show_list_option").show();
239 $("#selectall").click(function(e){
241 $(".records input[type='checkbox']:not(:disabled)").each(function(){
242 $(this).prop("checked", true);
246 $("#clearall").click(function(e){
248 $(".records input[type='checkbox']:not(:disabled)").each(function(){
249 $(this).prop("checked", false);
253 $("#selectwithoutitems").click(function(e){
255 $(".records input[type='checkbox']:not(:disabled)").each(function(){
256 if( $(this).data("items") == 0 ){
257 $(this).prop("checked", true );
259 $(this).prop("checked", false );
264 $("#selectnotreserved").click(function(e){
266 $(".records input[type='checkbox']:not(:disabled)").each(function(){
267 if( $(this).data("reserves") == 0 ){
268 $(this).prop("checked", true );
270 $(this).prop("checked", false );
275 $("#selectwithoutsubscriptions").click(function(e){
277 $(".records input[type='checkbox']:not(:disabled)").each(function(){
278 if( $(this).data("subscriptions") == 0 ){
279 $(this).prop("checked", true );
281 $(this).prop("checked", false );
286 $("#clearlinkedtobiblio").click(function(e){
288 $(".records input[type='checkbox']:not(:disabled)").each(function(){
289 if( $(this).data("usage") == 0 ){
290 $(this).prop("checked", true );
292 $(this).prop("checked", false );
297 $("#selectall").click();
299 [% IF recordtype == 'biblio' %]
300 $(".records input:checkbox[data-issues!='0']").each(function(){
301 $(this).attr('title', MSG_CANNOT_BE_DELETED)
302 $(this).prop('disabled', true);
303 $(this).prop('checked', false);
304 $(this).parents('tr').find('td').css('background-color', '#ffff99');
308 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
310 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
311 { "aTargets": [ 3, 4 ], "sType": "num-html" }
318 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
320 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
321 { "aTargets": [ 3 ], "sType": "num-html" }
328 $("#selectrecords").on("submit",function(){
329 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
330 if (nb_checked == 0){
331 alert(_("No records have been selected."));
336 $("#selectauths").on("submit",function(){
337 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
339 alert(_("No authorities have been selected."));
344 $("#record_ids_selection").on("submit", function(e){
345 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
346 if ( tab == '#uploadfile_tab' ) {
347 $("#shelf_number").empty('');
348 $("#recordnumber_list").val('');
349 } else if ( tab == '#shelves_tab' ) {
350 $("#uploadfile").val('')
351 $("#recordnumber_list").val('');
352 } else { // enterlist
353 $("#uploadfile").val('')
354 $("#shelf_number").empty('');
362 [% INCLUDE 'intranet-bottom.inc' %]