Bug 28066: Remove select tag's size attribute where it is 1
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-del.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Batch item deletion</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <!--[if IE]>
9 <style>#selections { display: none; }</style>
10 <![endif]-->
11 </head>
12 <body id="tools_batchMod-del" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
15
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18         <li>
19             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23         </li>
24         <li>
25             <a href="#" aria-current="page">Batch item deletion</a>
26         </li>
27     </ol>
28 </nav>
29
30 <div class="main container-fluid">
31
32                 [% IF ( show ) %]<h1>Batch item deletion</h1>[% ELSE %]<h1>Batch item deletion results</h1>[% END %]
33         [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
34         [% IF ( no_next_barcode ) %]<div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
35         [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
36         [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot delete</strong>: item has a waiting hold.</div>[% END %]
37
38     [% UNLESS ( action ) %]
39
40     [% IF ( notfoundbarcodes.size ) %]
41         <div class="dialog alert">
42             [% IF ( itemresults ) %]<p>Warning, the following barcodes were not found:</p>[% ELSE %]<p>Warning: no barcodes were found</p>[% END %]
43         </div>
44         <table style="margin:auto;">
45             <thead>
46                 <tr><th>Barcodes not found</th></tr>
47             </thead>
48             <tbody>
49                 [% FOREACH notfoundbarcode IN notfoundbarcodes %]
50                     <tr><td>[% notfoundbarcode |html %]</td></td>
51                 [% END %]
52             </tbody>
53         </table>
54         [% UNLESS ( too_many_items_display ) %]
55             [% IF ( item_loop ) %]
56                     <h4>The following barcodes were found: </h4>
57             [% END %]
58         [% END %]
59     [% END %] <!-- /notfoundbarcodes -->
60     [% IF ( notfounditemnumbers.size ) %]
61         <div class="dialog alert">
62             [% IF ( itemresults ) %]<p>Warning, the following itemnumbers were not found:</p>[% ELSE %]<p>Warning: no itemnumbers were found</p>[% END %]
63         </div>
64         <table style="margin:auto;">
65             <thead>
66                 <tr><th>Itemnumbers not found</th></tr>
67             </thead>
68             <tbody>
69                 [% FOREACH notfounditemnumber IN notfounditemnumbers %]
70                     <tr><td>[% notfounditemnumber |html %]</td></td>
71                 [% END %]
72             </tbody>
73         </table>
74         [% UNLESS ( too_many_items_display ) %]
75             [% IF ( item_loop ) %]
76                     <h4>The following itemnumbers were found: </h4>
77             [% END %]
78         [% END %]
79     [% END %] <!-- /notfounditemnumbers -->
80
81
82
83
84 <form name="f" action="batchMod.pl" method="post">
85      <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
86      <input type="hidden" name="op" value="[% op | html %]" />
87      <input type="hidden" name="searchid" value="[% searchid | html %]" />
88      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
89      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
90      <input type="hidden" name="src" id="src" value="[% src | html %]" />
91      [% IF biblionumber %]
92         <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
93      [% END %]
94
95 [% IF ( item_loop ) %]
96     [% IF ( show ) %]<div id="toolbar"><a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-remove"></i> Clear all</a></div>[% END %]
97     <div id="cataloguing_additem_itemlist">
98
99     <p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span>
100         [% FOREACH item_header_loo IN item_header_loop %]
101         <span class="selected"><input id="checkheader[% loop.count | html %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</label> </span>
102         [% END %]
103     </p>
104
105         <table id="itemst">
106             <thead>
107             <tr>
108                 [% IF ( show ) %]<th>&nbsp;</th>[% END %]
109                 <th class="anti-the">Title</th>
110                 <th class="holds_count" title="Item holds / Total holds">Holds</th>
111                 [% FOREACH item_header_loo IN item_header_loop %]
112                 <th> [% item_header_loo.header_value | html %] </th>
113                 [% END %]
114             </tr>
115             </thead>
116             <tbody>
117             [% FOREACH item_loo IN item_loop %]
118               <tr>
119                 [% IF show %]
120                   [% IF item_loo.nomod %]
121                     <td class="error">Cannot delete</td>
122                 [% ELSE %]
123                     [% SET can_be_deleted = item_loo.item.safe_to_delete %]
124                     [% IF can_be_deleted == 1 %]
125                         <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" /></td>
126                     [% ELSE %]
127                         [% SWITCH can_be_deleted %]
128                         [% CASE "book_on_loan" %][% SET cannot_delete_reason = t("Item is checked out") %]
129                         [% CASE "not_same_branch" %][% SET cannot_delete_reason = t("Item does not belong to your library") %]
130                         [% CASE "book_reserved" %][% SET cannot_delete_reason = t("Item has a waiting hold") %]
131                         [% CASE "linked_analytics" %][% SET cannot_delete_reason = t("Item has linked analytics") %]
132                         [% CASE "last_item_for_hold" %][% SET cannot_delete_reason = t("Last item for bibliographic record with biblio-level hold on it") %]
133                         [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ can_be_deleted _ ')' %]
134                         [% END %]
135
136                         <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" disabled="disabled" title="[% cannot_delete_reason | html %]"/></td>
137                     [% END %]
138                   [% END %]
139                 [% ELSE %]
140                   <td>&nbsp;</td>
141                 [% END %]
142                 <td>
143                     <label for="row[% item_loo.itemnumber | html %]">
144                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">
145                             [% item_loo.title | html %]
146                         </a>
147                         [% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]
148                     </label>
149                 </td>
150                 <td class="holds_count">
151                     [% IF item_loo.holds %]
152                         [% IF item_loo.item_holds %]
153                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this item: [% item_loo.item_holds | html %] / Total holds on this record: [% item_loo.holds | html -%]" >
154                         [% ELSE %]
155                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this item / Total holds on this record: [% item_loo.holds | html -%]" >
156                         [% END %]
157                     [% ELSE %]
158                         [% IF item_loo.holds %]
159                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this record: [% item_loo.holds | html -%]" >
160                         [% ELSE %]
161                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this record" >
162                         [% END %]
163                     [% END %]
164                                 [% IF item_loo.holds %]
165                                     [% item_loo.item_holds | html %]/[% item_loo.holds | html %]
166                                 [% ELSE %]
167                                     [% item_loo.holds | html %]
168                                 [% END %]
169                             </a>
170                 </td>
171             [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field | html %]</td>
172                     [% END %] </tr>
173             [% END %]
174             </tbody>
175         </table>
176     </div>
177 [% END %]
178
179 [% IF ( simple_items_display ) %]
180     <ul>
181     [% FOREACH simple_items_displa IN simple_items_display %]
182         <li>
183             <a href="[% simple_items_displa.itemnumber | url %]">[% simple_items_displa.barcode | html %]</a>
184         </li>
185     [% END %]
186     </ul>
187 [% END %]
188
189
190 [% IF ( show ) %]
191
192 [% IF ( too_many_items_display ) %]
193     <p>Too many items ([% too_many_items_display | html %]) to display individually.</p>
194     [% FOREACH itemnumber IN itemnumbers_array %]
195         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
196     [% END %]
197 [% END %]
198
199 [% IF ( itemresults ) %]
200         <div id="cataloguing_additem_newitem">
201          <input type="hidden" name="op" value="[% op | html %]" />
202          <p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p>
203          <input type="hidden" name="del" value="1" />
204          <fieldset class="action">
205         <input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label>
206         [% IF too_many_items_display %]
207             <input type="submit" name="mainformsubmit" value="Delete ALL submitted items" />
208         [% ELSE %]
209             <input type="submit" name="mainformsubmit" value="Delete selected items" />
210         [% END %]
211
212         <a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a>
213         </fieldset>
214     </div>
215     [% ELSE %]
216     <p><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a></p>
217     [% END %]
218     [% END %]
219     </form>
220     [% END %]
221
222 [% IF ( action ) %]
223     [% IF deletion_failed %]
224         <div class="dialog alert">
225             At least one item blocked the deletion. The operation rolled back and nothing happened!
226         </div>
227     [% ELSE %]
228         <div class="dialog message">
229             <p>[% deleted_items | html %] item(s) deleted.</p>
230             [% IF delete_records %] <p>[% deleted_records | html %] record(s) deleted.</p> [% END %]
231             [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
232                 [% IF biblio_deleted %]
233                     [% IF searchid %]
234                         <div id="previous_search_link"></div>
235                     [% END %]
236                     <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Return to the cataloging module</a>
237                 [% ELSE %]
238                     [% IF searchid %]
239                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
240                     [% ELSE %]
241                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
242                     [% END %]
243                 [% END %]
244             [% ELSIF src %]
245                 <a href="[% src | url %]">Return to where you were</a>
246             [% ELSE %]
247                 <a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a>
248             [% END %]
249         </div>
250     [% END %]
251     [% IF ( not_deleted_items ) %]
252     <div style="width:55%;margin:auto;">
253         <p>[% not_deleted_items | html %] item(s) could not be deleted: [% FOREACH not_deleted_itemnumber IN not_deleted_itemnumbers %][% not_deleted_itemnumber.itemnumber | html %][% END %]</p>
254     [% IF ( not_deleted_loop ) %]
255     <table id="itemst">
256         <thead>
257             <tr>
258             <th>Itemnumber</th>
259             <th>Barcode</th>
260             <th>Reason</th>
261             </tr>
262         </thead>
263         <tbody>
264             [% FOREACH not_deleted_loo IN not_deleted_loop %]
265             <tr>
266                 <td>[% not_deleted_loo.itemnumber | html %]</td>
267                 <td>[% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% not_deleted_loo.biblionumber | uri %]&amp;itemnumber=[% not_deleted_loo.itemnumber | uri %]">[% not_deleted_loo.barcode | html %]</a>[% ELSE %][% not_deleted_loo.barcode | html %][% END %]</td>
268                 <td>
269                     [% SWITCH not_deleted_loo.reason %]
270                     [% CASE "book_on_loan" %][% SET cannot_delete_reason = t("Item is checked out") %]
271                     [% CASE "not_same_branch" %][% SET cannot_delete_reason = t("Item does not belong to your library") %]
272                     [% CASE "book_reserved" %][% SET cannot_delete_reason = t("Item has a waiting hold") %]
273                     [% CASE "linked_analytics" %][% SET cannot_delete_reason = t("Item has linked analytics") %]
274                     [% CASE "last_item_for_hold" %][% SET cannot_delete_reason = t("Last item for bibliographic record with biblio-level hold on it") %]
275                     [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ can_be_deleted _ ')' %]
276                     [% END %]
277                     [% cannot_delete_reason | html %]
278                 </td>
279             </tr>
280             [% END %]
281         </tbody>
282         </table>
283     [% END %]
284     </div>
285     [% END %]
286
287     <p>
288         [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
289             [% IF biblio_deleted %]
290                 <a class="btn btn-default" href="/cgi-bin/koha/cataloguing/addbooks.pl"><i class="fa fa-check-square-o"></i> Return to the cataloging module</a>
291             [% ELSIF searchid %]
292                <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
293             [% ELSE %]
294                <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
295             [% END %]
296         [% ELSIF src %]
297            <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
298         [% ELSE %]
299            <a class="btn btn-default" href="/cgi-bin/koha/tools/batchMod.pl?del=1"><i class="fa fa-check-square-o"></i> Return to batch item deletion</a>
300         [% END %]
301     </p>
302 [% END %]
303     </div>
304
305 [% MACRO jsinclude BLOCK %]
306     [% Asset.js("js/tools-menu.js") | $raw %]
307     [% INCLUDE 'datatables.inc' %]
308     [% Asset.js("js/pages/batchMod.js") | $raw %]
309     [% Asset.js("js/browser.js") | $raw %]
310     <script>
311         // Prepare array of all column headers, incrementing each index by
312         // two to accommodate control and title columns
313         var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
314         for( x=0; x<allColumns.length; x++ ){
315           allColumns[x] = Number(allColumns[x]) + 2;
316         }
317         $(document).ready(function(){
318             $("#mainformsubmit").on("click",function(){
319                 return submitBackgroundJob(this.form);
320             });
321         });
322
323         [% IF searchid %]
324             browser = KOHA.browser('[% searchid | html %]');
325             browser.show_back_link();
326         [% END %]
327     </script>
328 [% END %]
329
330 [% INCLUDE 'intranet-bottom.inc' %]