4 [% PROCESS 'authorities-search-results.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Batch record deletion › Cataloging › 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 [% WRAPPER breadcrumbs %]
17 [% WRAPPER breadcrumb_item %]
18 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
20 [% WRAPPER breadcrumb_item bc_active= 1 %]
21 <span>Batch record deletion</span>
23 [% END #/ WRAPPER breadcrumbs %]
24 [% END #/ WRAPPER sub-header.inc %]
26 <div class="main container-fluid">
28 <div class="col-sm-10 col-sm-push-2">
31 <h1>Batch record deletion</h1>
32 [% FOREACH message IN messages %]
33 [% IF message.type == 'success' %]
34 <div class="dialog message">
35 [% ELSIF message.type == 'warning' %]
36 <div class="dialog alert">
37 [% ELSIF message.type == 'error' %]
38 <div class="dialog alert" style="margin:auto;">
40 [% IF message.code == 'biblio_not_exists' %]
41 <span>The biblionumber [% message.biblionumber | html %] does not exist in the database.</span>
42 [% ELSIF message.code == 'authority_not_exists' %]
43 <span>The authority ID [% message.authid | html %] does not exist in the database.</span>
44 [% ELSIF message.code == 'cannot_enqueue_job' %]
45 <span>Cannot enqueue this job.</span>
46 [% ELSIF message.code == 'biblio_not_exists' %]
47 <span>Bibliographic record [% message.biblionumber | html %] does not exist in the database.</span>
48 [% ELSIF message.code == 'authority_not_exists' %]
49 <span>Authority record [% message.authid | html %] does not exist in the database.</span>
52 [% IF message.error %]
53 <span>(The error was: [% message.error | html %], see the Koha log file for more information).</span>
58 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="record_ids_selection">
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>
67 [% WRAPPER tabs id= "batch_del_form" %]
68 [% WRAPPER tabs_nav %]
69 [% WRAPPER tab_item tabname= "uploadfile_tab" bt_active= 1 %] <span>Upload a file</span> [% END %]
71 [% WRAPPER tab_item tabname= "shelves_tab" %] <span>Select a list of records</span> [% END %]
73 [% WRAPPER tab_item tabname= "enterlist_tab" %] <span>Enter a list of record numbers</span> [% END %]
74 [% END # /WRAPPER tabs_nav %]
76 [% WRAPPER tab_panels %]
77 [% WRAPPER tab_panel tabname="uploadfile_tab" bt_active= 1 %]
78 <fieldset class="rows">
80 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
83 [% END # /WRAPPER tab_panel %]
86 [% WRAPPER tab_panel tabname="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>
100 [% END # /WRAPPER tab_panel %]
101 [% END # /IF lists.count %]
103 [% WRAPPER tab_panel tabname="enterlist_tab" %]
104 <fieldset class="rows">
107 <label for="recordnumber_list">IDs: </label>
108 <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
109 <div class="hint">Enter a list of biblionumbers or authority IDs, one per line.</div>
113 [% END # /WRAPPER tab_panel %]
114 [% END # /WRAPPER tab_panels %]
115 [% END # /WRAPPER tabs %]
117 <fieldset class="action">
118 <input type="hidden" name="op" value="list" />
119 <input type="submit" class="btn btn-primary" value="Continue" />
120 <a class="cancel" href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cancel</a>
123 [% ELSIF op == 'list' %]
125 [% IF recordtype == 'biblio' %]
126 <div class="btn-toolbar selections-toolbar">
127 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
128 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
129 | <a id="selectwithoutitems" href="#">Select without items</a>
130 | <a id="selectnotreserved" href="#">Select without holds</a>
131 | <a id="selectwithoutsubscriptions" href="#">Select without subscriptions</a>
133 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectrecords">
134 <table id="biblios" class="records">
138 <th>Biblionumber</th>
143 <th>Subscriptions</th>
147 [% FOR biblio IN records %]
149 <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>
150 <td><label for="record_id_[% biblio.biblionumber | html %]">[% biblio.biblionumber | html %]</label></td>
151 <td>[% INCLUDE 'biblio-title.inc' link = 1 %]</td>
152 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.itemnumbers.size | html %]</a></td>
153 <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.holds_count | html %]</a></td>
154 <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.issues_count | html %]</a></td>
155 <td><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio.biblionumber | uri %]">[% biblio.subscriptions_count | html %]</a></td>
160 <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>
162 <div class="btn-toolbar selections-toolbar">
163 <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
164 | <a id="clearall" href="#"><i class="fa fa-times"></i> Clear all</a>
165 | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
167 <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post" id="selectauths">
168 <table id="authorities" class="records">
178 [% FOR authority IN records %]
180 <td><input type="checkbox" name="record_id" value="[% authority.authid | html %]" data-usage="[% authority.count_usage | html %]" /></td>
181 <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid | uri %]">[% authority.authid | html %]</a></td>
182 <td>[% PROCESS authresult summary=authority.summary authid=authority.authid %]</td>
183 <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>
188 <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
190 <fieldset class="action">
191 <input type="hidden" name="op" value="delete" />
192 <input type="hidden" name="recordtype" value="[% recordtype | html %]" />
193 <input type="submit" class="btn btn-primary" value="Delete selected records" />
194 <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
198 There are no record IDs defined.
200 [% ELSIF op == 'enqueued' %]
201 <div class="dialog message">
202 <p>The job has been enqueued! It will be processed as soon as possible.</p>
203 <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>
204 | <a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
207 No action defined for the template.
211 </div> <!-- /.col-sm-10.col-sm-push-2 -->
213 <div class="col-sm-2 col-sm-pull-10">
215 [% INCLUDE 'cat-menu.inc' %]
217 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
218 </div> <!-- /.row -->
220 [% MACRO jsinclude BLOCK %]
221 [% INCLUDE 'datatables.inc' %]
223 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
224 $(document).ready(function() {
226 $("input[type='radio']").click(function() {
227 if ($(this).attr('id') == 'authority_type') {
228 $("a[href='#shelves_tab_panel']").parent().hide();
229 } else if ($(this).attr('id') == 'biblio_type') {
230 $("a[href='#shelves_tab_panel']").parent().show();
234 $("#selectall").click(function(e){
236 $(".records input[type='checkbox']:not(:disabled)").each(function(){
237 $(this).prop("checked", true);
241 $("#clearall").click(function(e){
243 $(".records input[type='checkbox']:not(:disabled)").each(function(){
244 $(this).prop("checked", false);
248 $("#selectwithoutitems").click(function(e){
250 $(".records input[type='checkbox']:not(:disabled)").each(function(){
251 if( $(this).data("items") == 0 ){
252 $(this).prop("checked", true );
254 $(this).prop("checked", false );
259 $("#selectnotreserved").click(function(e){
261 $(".records input[type='checkbox']:not(:disabled)").each(function(){
262 if( $(this).data("reserves") == 0 ){
263 $(this).prop("checked", true );
265 $(this).prop("checked", false );
270 $("#selectwithoutsubscriptions").click(function(e){
272 $(".records input[type='checkbox']:not(:disabled)").each(function(){
273 if( $(this).data("subscriptions") == 0 ){
274 $(this).prop("checked", true );
276 $(this).prop("checked", false );
281 $("#clearlinkedtobiblio").click(function(e){
283 $(".records input[type='checkbox']:not(:disabled)").each(function(){
284 if( $(this).data("usage") == 0 ){
285 $(this).prop("checked", true );
287 $(this).prop("checked", false );
292 $("#selectall").click();
294 //Show a red cross if a biblio cannot be deleted
295 [% IF recordtype == 'biblio' %]
296 $(".records input:checkbox[data-issues!='0']").each(function(){
297 $(this).parents('tr').find('td').css('background-color', '#ffff99')
298 $(this).replaceWith("<span class='error'><i class='fa fa-times fa-lg'></i></span>")
299 $(".records i").attr('title', MSG_CANNOT_BE_DELETED)
303 $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
305 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
306 { "aTargets": [ 3, 4 ], "sType": "num-html" }
313 $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
315 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
316 { "aTargets": [ 3 ], "sType": "num-html" }
323 $("#selectrecords").on("submit",function(){
324 var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();
325 if (nb_checked == 0){
326 alert(_("No records have been selected."));
331 $("#selectauths").on("submit",function(){
332 var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size();
334 alert(_("No authorities have been selected."));
339 $("#record_ids_selection").on("submit", function(e){
340 var tab = $(this).find('#batch_del_form:active:first a').attr('href');
341 if ( tab == '#uploadfile_tab' ) {
342 $("#shelf_number").empty('');
343 $("#recordnumber_list").val('');
344 } else if ( tab == '#shelves_tab' ) {
345 $("#uploadfile").val('')
346 $("#recordnumber_list").val('');
347 } else { // enterlist
348 $("#uploadfile").val('')
349 $("#shelf_number").empty('');
357 [% INCLUDE 'intranet-bottom.inc' %]