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 [% WRAPPER 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
15 [% WRAPPER 'sub-header.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
22 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25 <a href="#" aria-current="page">Batch record deletion</a>
31 <div class="main container-fluid">
33 <div class="col-sm-10 col-sm-push-2">
36 <h1>Batch record deletion</h1>
37 [% FOREACH message IN messages %]
38 [% IF message.type == 'success' %]
39 <div class="dialog message">
40 [% ELSIF message.type == 'warning' %]
41 <div class="dialog alert">
42 [% ELSIF message.type == 'error' %]
43 <div class="dialog alert" style="margin:auto;">
45 [% IF message.code == 'biblio_not_exists' %]
46 <span>The biblionumber [% message.biblionumber | html %] does not exist in the database.</span>
47 [% ELSIF message.code == 'authority_not_exists' %]
48 <span>The authority id [% message.authid | html %] does not exist in the database.</span>
49 [% ELSIF message.code == 'cannot_enqueue_job' %]
50 <span>Cannot enqueue this job.</span>
51 [% ELSIF message.code == 'biblio_not_exists' %]
52 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
53 [% ELSIF message.code == 'authority_not_exists' %]
54 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
57 [% IF message.error %]
58 <span>(The error was: [% message.error | html %], see the Koha log file for more information).</span>
63 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
64 <fieldset class="rows">
65 <legend>Record type</legend>
67 <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
68 <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
72 <div id="batch_del_form" class="toptabs">
73 <ul class="nav nav-tabs" role="tablist">
74 <li role="presentation" class="active">
75 <a href="#uploadfile_tab" aria-controls="uploadfile_tab" role="tab" data-toggle="tab">Upload a file</a>
78 <li id="show_list_option" role="presentation">
79 <a href="#shelves_tab" aria-controls="shelves_tab" role="tab" data-toggle="tab">Select a list of records</a>
82 <li role="presentation">
83 <a href="#enterlist_tab" aria-controls="enterlist_tab" role="tab" data-toggle="tab">Enter a list of record numbers</a>
87 <div class="tab-content">
88 <div id="uploadfile_tab" role="tabpanel" class="tab-pane active">
89 <fieldset class="rows">
91 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
98 <div id="shelves_tab" role="tabpanel" class="tab-pane">
99 <fieldset class="rows">
102 <label for="shelf_number">List: </label>
103 <select name="shelf_number" id="shelf_number">
104 <option value="">Select a list</option>
105 [% FOREACH list IN lists %]
106 <option value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
116 <div id="enterlist_tab" role="tabpanel" class="tab-pane">
117 <fieldset class="rows">
120 <label for="recordnumber_list">IDs: </label>
121 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
122 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
129 </div> <!-- /.tab-content -->
132 <fieldset class="action">
133 <input type="hidden" name="op" value="list" />
134 <input type="submit" value="Continue" class="button" />
135 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
138 [% ELSIF op == 'list' %]
140 [% IF recordtype == 'biblio' %]
142 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
143 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
144 | <a id="selectwithoutitems" href="#">Select without items</a>
145 | <a id="selectnotreserved" href="#">Select without holds</a>
146 | <a id="selectwithoutsubscriptions" href="#">Select without subscriptions</a>
148 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
149 <table id="biblios" class="records">
153 <th>Biblionumber</th>
158 <th>Subscriptions</th>
162 [% FOR biblio IN records %]
164 <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>
165 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
166 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
167 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
168 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
169 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
170 <td><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio.biblionumber | uri %]">[% biblio.subscriptions_count | html %]</a></td>
175 <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>
178 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
179 | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
180 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
182 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
183 <table id="authorities" class="records">
193 [% FOR authority IN records %]
195 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
196 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
197 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
198 <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>
203 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
205 <fieldset class="action">
206 <input type="hidden" name="op" value="delete" />
207 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
208 <input type="submit" value="Delete selected records" class="button" />
209 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
213 There are no record IDs defined.
215 [% ELSIF op == 'enqueued' %]
216 <div class="dialog message">
217 <p>The job has been enqueued! It will be processed as soon as possible.</p>
218 <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>
219 | <a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
222 No action defined for the template.
226 </div> <!-- /.col-sm-10.col-sm-push-2 -->
228 <div class="col-sm-2 col-sm-pull-10">
230 [% INCLUDE 'tools-menu.inc' %]
232 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
233 </div> <!-- /.row -->
235 [% MACRO jsinclude BLOCK %]
236 [% Asset.js("js/tools-menu.js") | $raw %]
237 [% INCLUDE 'datatables.inc' %]
239 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
240 $(document).ready(function() {
242 $("input[type='radio']").click(function(){
243 if ($(this).attr('id') == 'authority_type') {
244 $("#show_list_option").hide();
245 } else if ($(this).attr('id') == 'biblio_type') {
246 $("#show_list_option").show();
249 $("#selectall").click(function(e){
251 $(".records input[type='checkbox']:not(:disabled)").each(function(){
252 $(this).prop("checked", true);
256 $("#clearall").click(function(e){
258 $(".records input[type='checkbox']:not(:disabled)").each(function(){
259 $(this).prop("checked", false);
263 $("#selectwithoutitems").click(function(e){
265 $(".records input[type='checkbox']:not(:disabled)").each(function(){
266 if( $(this).data("items") == 0 ){
267 $(this).prop("checked", true );
269 $(this).prop("checked", false );
274 $("#selectnotreserved").click(function(e){
276 $(".records input[type='checkbox']:not(:disabled)").each(function(){
277 if( $(this).data("reserves") == 0 ){
278 $(this).prop("checked", true );
280 $(this).prop("checked", false );
285 $("#selectwithoutsubscriptions").click(function(e){
287 $(".records input[type='checkbox']:not(:disabled)").each(function(){
288 if( $(this).data("subscriptions") == 0 ){
289 $(this).prop("checked", true );
291 $(this).prop("checked", false );
296 $("#clearlinkedtobiblio").click(function(e){
298 $(".records input[type='checkbox']:not(:disabled)").each(function(){
299 if( $(this).data("usage") == 0 ){
300 $(this).prop("checked", true );
302 $(this).prop("checked", false );
307 $("#selectall").click();
309 [% IF recordtype == 'biblio' %]
310 $(".records input:checkbox[data-issues!='0']").each(function(){
311 $(this).attr('title', MSG_CANNOT_BE_DELETED)
312 $(this).prop('disabled', true);
313 $(this).prop('checked', false);
314 $(this).parents('tr').find('td').css('background-color', '#ffff99');
318 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
320 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
321 { "aTargets": [ 3, 4 ], "sType": "num-html" }
328 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
330 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
331 { "aTargets": [ 3 ], "sType": "num-html" }
338 $("#selectrecords").on("submit",function(){
339 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
340 if (nb_checked == 0){
341 alert(_("No records have been selected."));
346 $("#selectauths").on("submit",function(){
347 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
349 alert(_("No authorities have been selected."));
354 $("#record_ids_selection").on("submit", function(e){
355 var tab = $(this).find('.ui-tabs-active:first a').attr('href');
356 if ( tab == '#uploadfile_tab' ) {
357 $("#shelf_number").empty('');
358 $("#recordnumber_list").val('');
359 } else if ( tab == '#shelves_tab' ) {
360 $("#uploadfile").val('')
361 $("#recordnumber_list").val('');
362 } else { // enterlist
363 $("#uploadfile").val('')
364 $("#shelf_number").empty('');
372 [% INCLUDE 'intranet-bottom.inc' %]