Bug 16238: Use .prop() instead of .attr() for 'disabled'
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batch_delete_records.tt
1 [% PROCESS 'authorities-search-results.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Tools &rsaquo; Batch record deletion</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8 <script type="text/javascript">
9 //<![CDATA[
10 var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out.");
11 $(document).ready(function() {
12   $("#selectall").click(function(e){
13     e.preventDefault();
14     $(".records").checkCheckboxes();
15   });
16   $("#clearall").click(function(e){
17     e.preventDefault();
18     $(".records").unCheckCheckboxes();
19   });
20   $("#selectwithoutitems").click(function(e){
21     e.preventDefault();
22     $("#biblios").checkCheckboxes(":input[data-items='0']:not(:disabled)");
23   });
24   $("#selectnotreserved").click(function(e){
25     e.preventDefault();
26     $("#biblios").checkCheckboxes(":input[data-reserves='0']:not(:disabled)");
27
28   });
29   $("#clearlinkedtobiblio").click(function(e){
30     e.preventDefault();
31     $("#authorities").unCheckCheckboxes(":not(input[data-usage='0'])");
32   });
33   $("#selectall").click();
34
35   [% IF recordtype == 'biblio' %]
36     $(".records input:checkbox[data-issues!='0']").each(function(){
37       $(this).attr('title', MSG_CANNOT_BE_DELETED)
38       $(this).prop('disabled', true);
39       $(this).prop('checked', false);
40       $(this).parents('tr').find('td').css('background-color', '#ffff99');
41     });
42   [% END %]
43
44   $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
45     "aoColumnDefs": [
46       { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
47       { "aTargets": [ 3, 4 ], "sType": "num-html" }
48     ],
49     "sDom": 't',
50     "aaSorting": [],
51     "bPaginate": false
52   }));
53
54   $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
55     "aoColumnDefs": [
56       { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
57       { "aTargets": [ 3 ], "sType": "num-html" }
58     ],
59     "sDom": 't',
60     "aaSorting": [],
61     "bPaginate": false
62   }));
63 });
64 //]]>
65 </script>
66 </head>
67 <body id="tools_batch_delete_records" class="tools">
68 [% INCLUDE 'header.inc' %]
69 [% INCLUDE 'cat-search.inc' %]
70
71 <div id="breadcrumbs">
72     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
73     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
74     <a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a>
75 </div>
76
77 <div id="doc3" class="yui-t2">
78 <div id="bd">
79 <div id="yui-main">
80 <div class="yui-b">
81   <h1>Batch record deletion</h1>
82   [% FOREACH message IN messages %]
83     [% IF message.type == 'success' %]
84       <div class="dialog message">
85     [% ELSIF message.type == 'warning' %]
86       <div class="dialog alert">
87     [% ELSIF message.type == 'error' %]
88       <div class="dialog error" style="margin:auto;">
89     [% END %]
90     [% IF message.code == 'biblio_not_exists' %]
91       The biblionumber [% message.biblionumber %] does not exist in the database.
92     [% ELSIF message.code == 'authority_not_exists' %]
93       The authority id [% message.authid %] does not exist in the database.
94     [% ELSIF message.code == 'item_issued' %]
95       At least one item is checked out on bibliographic record [% message.biblionumber %].
96     [% ELSIF message.code == 'reserve_not_cancelled' %]
97       Bibliographic record [% message.biblionumber %] was not deleted. A hold could not be canceled (reserve_id [% message.reserve_id %]).
98     [% ELSIF message.code == 'item_not_deleted' %]
99       The bibliographic record [% message.biblionumber %] was not deleted. An error was encountered when deleting an item (itemnumber [% message.itemnumber %]).
100     [% ELSIF message.code == 'biblio_not_deleted' %]
101       Bibliographic record [% message.biblionumber %] was not deleted. An error occurred.
102     [% ELSIF message.code == 'authority_not_deleted' %]
103       Authority record [% message.authid %] was not deleted. An error occurred.
104     [% ELSIF message.code == 'biblio_deleted' %]
105       Bibliographic record [% message.biblionumber %] has been deleted successfully.
106     [% ELSIF message.code == 'authority_deleted' %]
107       Authority [% message.authid %] has been deleted successfully.
108     [% END %]
109     [% IF message.error %]
110       (The error was: [% message.error%], see the Koha log file for more information).
111     [% END %]
112     </div>
113   [% END %]
114   [% IF op == 'form' %]
115     <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_delete_records.pl">
116       <fieldset class="rows">
117         <legend>Record type</legend>
118         <ol>
119           <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
120           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
121         </ol>
122       </fieldset>
123       <fieldset class="rows">
124         <legend>Use a file</legend>
125         <ol>
126           <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
127         </ol>
128       </fieldset>
129       <fieldset class="rows">
130         <legend>Or enter a list of record numbers</legend>
131         <ol>
132           <li>
133             <label for="recordnumber_list">Record number list (one per line): </label>
134             <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
135           </li>
136         </ol>
137       </fieldset>
138       <fieldset class="action">
139         <input type="hidden" name="op" value="list" />
140         <input type="submit" value="Continue" class="button" />
141         <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
142       </fieldset>
143     </form>
144   [% ELSIF op == 'list' %]
145     [% IF records %]
146       [% IF recordtype == 'biblio' %]
147         <div id="toolbar">
148           <a id="selectall" href="#">Select all</a>
149           | <a id="clearall" href="#">Clear all</a>
150           | <a id="selectwithoutitems" href="#">Select without items</a>
151           | <a id="selectnotreserved" href="#">Select without holds</a>
152         </div>
153         <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post">
154           <table id="biblios" class="records">
155             <thead>
156               <tr>
157                 <th></th>
158                 <th>Biblionumber</th>
159                 <th>Title</th>
160                 <th>Items</th>
161                 <th>Holds</th>
162                 <th>Checkouts</th>
163               </tr>
164             </thead>
165             <tbody>
166               [% FOR biblio IN records %]
167                 <tr>
168                   <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.reserves.size %]" /></td>
169                   <td><label for="record_id_[% biblio.biblionumber %]">[% biblio.biblionumber %]</label></td>
170                   <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>
171                   <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.itemnumbers.size %]</a></td>
172                   <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.reserves.size %]</a></td>
173                   <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.issues_count %]</a></td>
174                 </tr>
175               [% END %]
176             </tbody>
177           </table>
178           <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>
179       [% ELSE %]
180         <div id="toolbar">
181           <a id="selectall" href="#">Select all</a>
182           | <a id="clearall" href="#">Clear all</a>
183           | <a id="clearlinkedtobiblio" href="#">Clear used authorities</a>
184         </div>
185         <form action="/cgi-bin/koha/tools/batch_delete_records.pl" method="post">
186           <table id="authorities" class="records">
187             <thead>
188               <tr>
189                 <th></th>
190                 <th>Authid</th>
191                 <th>Summary</th>
192                 <th>Used in</th>
193               </tr>
194             </thead>
195             <tbody>
196               [% FOR authority IN records %]
197                 <tr>
198                   <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
199                   <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
200                   <td>[% PROCESS authresult summary=authority.summary %]</td>
201                   <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;idx=an,phr&amp;q=[% authority.authid %]">[% authority.count_usage %] record(s)</a></td>
202                 </tr>
203               [% END %]
204             </tbody>
205           </table>
206           <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will delete all selected authorities!</div>
207       [% END %]
208         <fieldset class="action">
209           <input type="hidden" name="op" value="delete" />
210           <input type="hidden" name="recordtype" value="[% recordtype %]" />
211           <input type="submit" value="Delete selected records" class="button" />
212           <a class="cancel" href="/cgi-bin/koha/tools/batch_delete_records.pl">Cancel</a>
213         </fieldset>
214       </form>
215     [% ELSE %]
216       There are no record ids defined.
217     [% END %]
218   [% ELSIF op == 'report' %]
219     [% IF report.total_records == report.total_success %]
220       All records have been deleted successfully!
221     [% ELSIF report.total_success == 0 %]
222       No record has been deleted. An error occurred.
223     [% ELSE %]
224       [% report.total_success %] / [% report.total_records %] records have been deleted successfully but some errors occurred.
225     [% END %]
226     <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
227   [% ELSE %]
228     No action defined for the template.
229   [% END %]
230 </div>
231 </div>
232 <div class="yui-b">
233   [% INCLUDE 'tools-menu.inc' %]
234 </div>
235 </div>
236 [% INCLUDE 'intranet-bottom.inc' %]