Bug 21141: Handle non-existent itemnumbers in batch item modification/deletion
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-del.tt
1 [% USE Asset %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Tools &rsaquo; Batch item deletion</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% Asset.css("css/datatables.css") %]
7 <!--[if IE]>
8 <style type="text/css">#selections { display: none; }</style>
9 <![endif]-->
10 </head>
11 <body id="tools_batchMod-del" class="tools">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
14
15 <div id="breadcrumbs">
16     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
17     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
18     <a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a>
19 </div>
20
21 <div class="main container-fluid">
22
23                 [% IF ( show ) %]<h1>Batch item deletion</h1>[% ELSE %]<h1>Batch item deletion results</h1>[% END %]
24         [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
25         [% 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 %]
26         [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
27         [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot delete</strong>: item has a waiting hold.</div>[% END %]
28
29     [% UNLESS ( action ) %]
30
31     [% IF ( notfoundbarcodes.size ) %]
32         <div class="dialog alert">
33             [% IF ( itemresults ) %]<p>Warning, the following barcodes were not found:</p>[% ELSE %]<p>Warning: no barcodes were found</p>[% END %]
34         </div>
35         <table style="margin:auto;">
36             <thead>
37                 <tr><th>Barcodes not found</th></tr>
38             </thead>
39             <tbody>
40                 [% FOREACH notfoundbarcode IN notfoundbarcodes %]
41                     <tr><td>[% notfoundbarcode |html %]</td></td>
42                 [% END %]
43             </tbody>
44         </table>
45         [% IF ( item_loop ) %]
46             [% UNLESS ( too_many_items ) %]
47                 <h4>The following barcodes were found: </h4>
48             [% END %]
49         [% END %]
50     [% END %] <!-- /notfoundbarcodes -->
51     [% IF ( notfounditemnumbers.size ) %]
52         <div class="dialog alert">
53             [% IF ( itemresults ) %]<p>Warning, the following itemnumbers were not found:</p>[% ELSE %]<p>Warning: no itemnumbers were found</p>[% END %]
54         </div>
55         <table style="margin:auto;">
56             <thead>
57                 <tr><th>Itemnumbers not found</th></tr>
58             </thead>
59             <tbody>
60                 [% FOREACH notfounditemnumber IN notfounditemnumbers %]
61                     <tr><td>[% notfounditemnumber |html %]</td></td>
62                 [% END %]
63             </tbody>
64         </table>
65         [% IF ( item_loop ) %]
66             [% UNLESS ( too_many_items ) %]
67                 <h4>The following itemnumbers were found: </h4>
68             [% END %]
69         [% END %]
70     [% END %] <!-- /notfounditemnumbers -->
71
72
73
74
75 <form name="f" action="batchMod.pl" method="post">
76      <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]" />
77      <input type="hidden" name="op" value="[% op %]" />
78      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
79      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
80      <input type="hidden" name="src" id="src" value="[% src %]" />
81      [% IF biblionumber %]
82         <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]" />
83      [% END %]
84
85 [% IF ( item_loop ) %]
86     [% 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 %]
87     <div id="cataloguing_additem_itemlist">
88
89     <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>
90         [% FOREACH item_header_loo IN item_header_loop %]
91         <span class="selected"><input id="checkheader[% loop.count %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
92         [% END %]
93     </p>
94
95         <table id="itemst">
96             <thead>
97             <tr>
98                 [% IF ( show ) %]<th>&nbsp;</th>[% END %]
99                 <th class="anti-the">Title</th>
100                 [% FOREACH item_header_loo IN item_header_loop %]
101                 <th> [% item_header_loo.header_value %] </th>
102                 [% END %]
103             </tr>
104             </thead>
105             <tbody>
106             [% FOREACH item_loo IN item_loop %] <tr> [% IF ( show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% END %]
107             <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
108             [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td>
109                     [% END %] </tr>
110             [% END %]
111             </tbody>
112         </table>
113     </div>
114 [% END %]
115
116 [% IF ( simple_items_display ) %]
117     <ul>
118     [% FOREACH simple_items_displa IN simple_items_display %]
119         <li>
120             <a href="[% simple_items_displa.itemnumber %]">[% simple_items_displa.barcode %]</a>
121         </li>
122     [% END %]
123     </ul>
124 [% END %]
125
126
127 [% IF ( show ) %]
128
129 [% IF ( too_many_items ) %]
130     <p>Too many items ([% too_many_items %]) to display individually.</p>
131     [% FOREACH itemnumber IN itemnumbers_array %]
132         <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
133     [% END %]
134 [% END %]
135
136 [% IF ( itemresults ) %]
137         <div id="cataloguing_additem_newitem">
138          <input type="hidden" name="op" value="[% op %]" />
139          <p>This will delete [% IF ( too_many_items ) %]all the[% ELSE %]the selected[% END %] items.</p>
140          <input type="hidden" name="del" value="1" />
141          <fieldset class="action">
142         <input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label>
143         [% IF too_many_items %]
144             <input type="submit" name="mainformsubmit" value="Delete ALL submitted items" />
145         [% ELSE %]
146             <input type="submit" name="mainformsubmit" value="Delete selected items" />
147         [% END %]
148
149         <a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a>
150         </fieldset>
151     </div>
152     [% ELSE %]
153     <p><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a></p>
154     [% END %]
155     [% END %]
156     </form>
157     [% END %]
158
159 [% IF ( action ) %]
160     <div class="dialog message">
161             <p>[% deleted_items %] item(s) deleted.</p>
162             [% IF delete_records %] <p>[% deleted_records %] record(s) deleted.</p> [% END %]
163             [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
164                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">Return to the record</a>
165             [% ELSIF src %]
166                 <a href="[% src %]">Return to where you were</a>
167             [% ELSE %]
168                 <a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a>
169             [% END %]
170         </div>
171     [% IF ( not_deleted_items ) %]
172     <div style="width:55%;margin:auto;">
173         <p>[% not_deleted_items %] item(s) could not be deleted: [% FOREACH not_deleted_itemnumber IN not_deleted_itemnumbers %][% not_deleted_itemnumber.itemnumber %][% END %]</p>
174     [% IF ( not_deleted_loop ) %]
175     <table id="itemst">
176         <thead>
177             <tr>
178             <th>Itemnumber</th>
179             <th>Barcode</th>
180             <th>Reason</th>
181             </tr>
182         </thead>
183         <tbody>
184             [% FOREACH not_deleted_loo IN not_deleted_loop %]
185             <tr>
186                 <td>[% not_deleted_loo.itemnumber %]</td>
187                 <td>[% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% not_deleted_loo.biblionumber %]&amp;itemnumber=[% not_deleted_loo.itemnumber %]">[% not_deleted_loo.barcode %]</a>[% ELSE %][% not_deleted_loo.barcode %][% END %]</td>
188                 <td>[% IF ( not_deleted_loo.book_on_loan ) %]Item is checked out[% ELSIF ( not_deleted_loo.book_reserved ) %]Item has a waiting hold[% END %]</td>
189             </tr>
190             [% END %]
191         </tbody>
192         </table>
193     [% END %]
194     </div>
195     [% END %]
196
197     <p>
198         [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
199            <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
200         [% ELSIF src %]
201            <a class="btn btn-default" href="[% src %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
202         [% ELSE %]
203            <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>
204         [% END %]
205     </p>
206 [% END %]
207     </div>
208
209 [% MACRO jsinclude BLOCK %]
210     [% Asset.js("js/tools-menu.js") %]
211     [% INCLUDE 'datatables.inc' %]
212     [% Asset.js("js/pages/batchMod.js") %]
213     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
214     <script type="text/javascript">
215         // Prepare array of all column headers, incrementing each index by
216         // two to accommodate control and title columns
217         var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
218         for( x=0; x<allColumns.length; x++ ){
219           allColumns[x] = Number(allColumns[x]) + 2;
220         }
221         $(document).ready(function(){
222             $("#mainformsubmit").on("click",function(){
223                 return submitBackgroundJob(this.form);
224             });
225         });
226     </script>
227 [% END %]
228
229 [% INCLUDE 'intranet-bottom.inc' %]