Bug 23987: "return to cataloguing" if the record is deleted from bachMod-del
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-del.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Tools &rsaquo; Batch item deletion</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <!--[if IE]>
8 <style>#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         [% UNLESS ( too_many_items_display ) %]
46             [% IF ( item_loop ) %]
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         [% UNLESS ( too_many_items_display ) %]
66             [% IF ( item_loop ) %]
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 | html %]" />
77      <input type="hidden" name="op" value="[% op | html %]" />
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 | html %]" />
81      [% IF biblionumber %]
82         <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
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 | html %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</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                 <th class="holds_count" title="Item holds / Total holds">Holds</th>
101                 [% FOREACH item_header_loo IN item_header_loop %]
102                 <th> [% item_header_loo.header_value | html %] </th>
103                 [% END %]
104             </tr>
105             </thead>
106             <tbody>
107             [% FOREACH item_loo IN item_loop %]
108               <tr>
109                 [% IF show %]
110                   [% IF item_loo.nomod %]
111                     <td class="error">Cannot edit</td>
112                   [% ELSE %]
113                     <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" data-is-onloan="[% item_loo.onloan | html %]" /></td>
114                   [% END %]
115                 [% ELSE %]
116                   <td>&nbsp;</td>
117                 [% END %]
118                 <td>
119                     <label for="row[% item_loo.itemnumber | html %]">
120                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">
121                             [% item_loo.title | html %]
122                         </a>
123                         [% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]
124                     </label>
125                 </td>
126                 <td class="holds_count">
127                     [% IF item_loo.holds %]
128                         [% IF item_loo.item_holds %]
129                             <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 -%]" >
130                         [% ELSE %]
131                             <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 -%]" >
132                         [% END %]
133                     [% ELSE %]
134                         [% IF item_loo.holds %]
135                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="Holds on this record: [% item_loo.holds | html -%]" >
136                         [% ELSE %]
137                             <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]" title="No holds on this record" >
138                         [% END %]
139                     [% END %]
140                                 [% IF item_loo.holds %]
141                                     [% item_loo.item_holds | html %]/[% item_loo.holds | html %]
142                                 [% ELSE %]
143                                     [% item_loo.holds | html %]
144                                 [% END %]
145                             </a>
146                 </td>
147             [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field | html %]</td>
148                     [% END %] </tr>
149             [% END %]
150             </tbody>
151         </table>
152     </div>
153 [% END %]
154
155 [% IF ( simple_items_display ) %]
156     <ul>
157     [% FOREACH simple_items_displa IN simple_items_display %]
158         <li>
159             <a href="[% simple_items_displa.itemnumber | url %]">[% simple_items_displa.barcode | html %]</a>
160         </li>
161     [% END %]
162     </ul>
163 [% END %]
164
165
166 [% IF ( show ) %]
167
168 [% IF ( too_many_items_display ) %]
169     <p>Too many items ([% too_many_items_display | html %]) to display individually.</p>
170     [% FOREACH itemnumber IN itemnumbers_array %]
171         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
172     [% END %]
173 [% END %]
174
175 [% IF ( itemresults ) %]
176         <div id="cataloguing_additem_newitem">
177          <input type="hidden" name="op" value="[% op | html %]" />
178          <p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p>
179          <input type="hidden" name="del" value="1" />
180          <fieldset class="action">
181         <input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label>
182         [% IF too_many_items_display %]
183             <input type="submit" name="mainformsubmit" value="Delete ALL submitted items" />
184         [% ELSE %]
185             <input type="submit" name="mainformsubmit" value="Delete selected items" />
186         [% END %]
187
188         <a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a>
189         </fieldset>
190     </div>
191     [% ELSE %]
192     <p><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a></p>
193     [% END %]
194     [% END %]
195     </form>
196     [% END %]
197
198 [% IF ( action ) %]
199     <div class="dialog message">
200             <p>[% deleted_items | html %] item(s) deleted.</p>
201             [% IF delete_records %] <p>[% deleted_records | html %] record(s) deleted.</p> [% END %]
202             [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
203                 [% IF biblio_deleted %]
204                     <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Return to the cataloging module</a>
205                 [% ELSE %]
206                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
207                 [% END %]
208             [% ELSIF src %]
209                 <a href="[% src | url %]">Return to where you were</a>
210             [% ELSE %]
211                 <a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a>
212             [% END %]
213         </div>
214     [% IF ( not_deleted_items ) %]
215     <div style="width:55%;margin:auto;">
216         <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>
217     [% IF ( not_deleted_loop ) %]
218     <table id="itemst">
219         <thead>
220             <tr>
221             <th>Itemnumber</th>
222             <th>Barcode</th>
223             <th>Reason</th>
224             </tr>
225         </thead>
226         <tbody>
227             [% FOREACH not_deleted_loo IN not_deleted_loop %]
228             <tr>
229                 <td>[% not_deleted_loo.itemnumber | html %]</td>
230                 <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>
231                 <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>
232             </tr>
233             [% END %]
234         </tbody>
235         </table>
236     [% END %]
237     </div>
238     [% END %]
239
240     <p>
241         [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Delete items in a batch%]
242             [% IF biblio_deleted %]
243                 <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>
244             [% ELSE %]
245                <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>
246             [% END %]
247         [% ELSIF src %]
248            <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
249         [% ELSE %]
250            <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>
251         [% END %]
252     </p>
253 [% END %]
254     </div>
255
256 [% MACRO jsinclude BLOCK %]
257     [% Asset.js("js/tools-menu.js") | $raw %]
258     [% INCLUDE 'datatables.inc' %]
259     [% Asset.js("js/pages/batchMod.js") | $raw %]
260     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
261     <script type="text/javascript">
262         // Prepare array of all column headers, incrementing each index by
263         // two to accommodate control and title columns
264         var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
265         for( x=0; x<allColumns.length; x++ ){
266           allColumns[x] = Number(allColumns[x]) + 2;
267         }
268         $(document).ready(function(){
269             $("#mainformsubmit").on("click",function(){
270                 return submitBackgroundJob(this.form);
271             });
272         });
273     </script>
274 [% END %]
275
276 [% INCLUDE 'intranet-bottom.inc' %]