Bug 10317: improve display when order receiving page is given an invalid invoiceid
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcel.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
3             Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title>
4 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5 [% INCLUDE 'doc-head-close.inc' %]
6 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7 [% INCLUDE 'datatables-strings.inc' %]
8 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9 [% INCLUDE 'greybox.inc' %]
10 <script type="text/javascript" src="[% yuipath %]/json/json-min.js"></script>
11 <script type="text/javascript">
12 //<![CDATA[
13
14     dt_overwrite_html_sorting_localeCompare();
15
16     $(document).ready(function(){
17       if ( $("#pendingt").length ) {
18         var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
19             "bStateSave": true,
20             "iCookieDuration": 60*60*24*1000, // 1000 days
21             "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
22             "aoColumnDefs": [
23                 { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false },
24             ],
25             "aoColumns": [
26                 { "sType": "num-html" },
27                 { "sType": "num-html" },
28                 { "sType": "html" },
29                 null,
30                 null,
31                 null,
32                 null,
33                 null,
34                 null,
35                 null,
36             ],
37             "sPaginationType": "four_button"
38         } ) );
39       }
40       if ( $("#receivedt").length ) {
41         var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
42             "bStateSave": true,
43             "iCookieDuration": 60*60*24*1000, // 1000 days
44             "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
45             "aoColumnDefs": [
46                 { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
47             ],
48             "aoColumns": [
49                 { "sType": "num-html" },
50                 { "sType": "num-html" },
51                 { "sType": "html" },
52                 null,
53                 null,
54                 null,
55                 null,
56                 null,
57                 null
58             ],
59             "sPaginationType": "four_button"
60         } ) );
61       }
62
63     });
64
65      // Case-insensitive version of jquery's contains function
66      jQuery.extend(jQuery.expr[':'], {
67             icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
68      });
69
70      // Contains exactly function
71      jQuery.extend(jQuery.expr[':'], {
72           containsExactly: "$(a).text() == m[3]"
73      });
74
75 //]]>
76 </script>
77 <script type="text/javascript">
78 //<![CDATA[
79             function confirm_delete_item(ordernumber, basketno, biblionumber) {
80                 var is_confirmed = confirm(_("Are you sure you want to delete this order ?"));
81                 if (is_confirmed) {
82                     window.location = "addorder.pl?ordernumber="+ordernumber+"&basketno="+basketno+"&quantity=0&biblionumber="+biblionumber+"&invoiceid=[% invoiceid %]";
83                 }
84             }
85             
86             function confirm_delete_biblio(ordernumber, basketno, biblionumber) {
87                 var is_confirmed = confirm(_("Are you sure you want to delete this catalog record and order ?"));
88                 if (is_confirmed) {
89                     window.location = "addorder.pl?ordernumber="+ordernumber+"&basketno="+basketno+"&quantity=0&biblionumber="+biblionumber+"&delbiblio=1&invoiceid=[% invoiceid %]";
90                     }
91             }
92 //]]>
93 </script>
94 </head>
95 <body id="acq_parcel" class="acq">
96 [% INCLUDE 'header.inc' %]
97 [% INCLUDE 'acquisitions-search.inc' %]
98
99 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
100     [% IF ( datereceived ) %]
101         Receipt summary for <i>[% name %]</i>
102         [% IF ( invoice ) %]
103             <i>[ [% invoice %] ]</i>
104         [% END %]
105         on <i>[% formatteddatereceived %]</i>
106     [% ELSE %]
107         Receive orders from [% name %]
108     [% END %]
109 </div>
110
111 <div id="doc3" class="yui-t2">
112
113    <div id="bd">
114         <div id="yui-main">
115         <div class="yui-b">
116         [% IF ( receive_error ) %]
117         <div class="dialog alert">
118         <h3>Error adding items:</h3>
119         <ul>
120         [% FOREACH error_loo IN error_loop %]
121                 <li>[% error_loo.error_param %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
122         [% END %]
123         </ul>
124         </div>
125         [% END %]
126     <h1>
127         [% IF ( datereceived ) %]
128             Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% formatteddatereceived %]</i>
129         [% ELSE %]
130             Receive orders from [% name %]
131         [% END %]
132     </h1>
133
134     [% IF ( success_delorder ) %]
135     <div class="dialog message">The order has been successfully canceled.</div>
136     [% ELSE %]
137         [% IF ( error_delitem ) %]
138             <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
139         [% END %]
140         [% IF ( error_delbiblio ) %]
141             <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
142         [% END %]
143     [% END %]
144
145     [% IF (error_cancelling_receipt) %]
146       <div class="dialog error">
147       Cannot cancel receipt. Possible reasons :
148       <ul>
149         <li>
150           The order line you trying to cancel was created from a partial receipt
151           of another order line which is already received. Try to cancel this
152           one first and retry.
153         </li>
154         <li>
155           The order line you trying to cancel was created from a partial receipt
156           of another order line which has been deleted. Cancellation is not
157           possible.
158         </li>
159       </ul>
160       </div>
161     [% END %]
162
163     [% IF error_invoice_not_known %]
164         <div class="dialog error">
165             The invoice referenced by this invoiceid does not exist.
166         </div>
167     [% END %]
168
169 [% UNLESS no_orders_to_display %]
170 <div id="acqui_receive_summary">
171 <p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p>
172 </div>
173 [% UNLESS (invoiceclosedate) %]
174 <div id="acqui_receive_search">
175     <h3>Pending orders</h3>
176
177  [% IF ( loop_orders ) %]<table id="pendingt">
178     <thead>
179         <tr>
180             <th>Basket</th>
181             <th>Order line</th>
182             <th>Summary</th>
183             <th>View record</th>
184             <th>Quantity</th>
185             <th>Unit cost</th>
186             <th>Order cost</th>
187             <th>Fund</th>
188             <th>&nbsp;</th>
189             <th>&nbsp;</th>
190         </tr>
191     </thead>
192     <tbody class="filterclass">
193         [% FOREACH loop_order IN loop_orders %]
194             <tr>
195                 <td class="basketfilterclass"><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a></td>
196                 <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&amp;booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td>
197                 <td class="summaryfilterclass">
198                   <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a>
199                 [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %]
200                 [% IF ( loop_order.isbn ) %] &ndash; [% loop_order.isbn %][% END %]
201                 [% IF ( loop_order.publishercode ) %]<br />Publisher :[% loop_order.publishercode %][% END %]
202                 [% IF ( loop_order.suggestionid ) %]
203                     <br/>
204                     Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %]
205                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&amp;op=show">suggestion #[% loop_order.suggestionid %]</a>)
206                 [% END %]
207                 <br />
208                 [% IF ( loop_order.notes ) %]
209                     <p class="ordernote"><strong>Note: </strong>[% loop_order.notes|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Change note</a>]</p>
210                 [% ELSE %]
211                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Add note</a>]
212                 [% END %]
213                 </td>
214                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
215                 <td>[% loop_order.quantity %]</td>
216                 <td>[% loop_order.ecost %]</td>
217                 <td>[% loop_order.ordertotal %]</td>
218                 <td>[% loop_order.budget_name %]</td>
219                                 <td>
220                               <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;invoiceid=[% invoiceid %]">Receive</a>
221                                 </td>
222                                 <td>
223                         [% IF ( loop_order.left_holds_on_order ) %]
224                         <span class="button" title="Can't delete order, ([% loop_order.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br>
225                         [% ELSE %]
226                         <a href="javascript:confirm_delete_item([% loop_order.ordernumber %], [% loop_order.basketno %], [% loop_order.biblionumber %])" class="button">Delete order</a><br>
227                         [% END %]
228                         [% IF ( loop_order.can_del_bib ) %]
229                         <a href="javascript:confirm_delete_biblio([% loop_order.ordernumber %], [% loop_order.basketno %], [% loop_order.biblionumber %])" class="button">Delete order and catalog record</a><br>
230                         [% ELSE %]
231                         <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br>
232                         [% END %]
233                         [% IF ( loop_order.left_item ) %]
234                         <b title="Can't delete catalog record, because of [% loop_order.items %] existing item(s)" >[% loop_order.items %] item(s) left</b><br>
235                         [% END %]
236                         [% IF ( loop_order.left_biblio ) %]
237                         <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios %] order(s) left</b><br>
238                         [% END %]
239                         [% IF ( loop_order.left_subscription ) %]
240                         <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions %] subscription(s) left</b><br>
241                         [% END %]
242                         [% IF ( loop_order.left_holds ) %]
243                         <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds %] hold(s) left</b>
244                         [% END %]
245                     </td>
246                 </tr>
247             [% END %]
248         </tbody>
249         </table>
250         [% ELSE %]There are no pending orders.[% END %]
251     </div>
252 [% ELSE %]
253     <p>
254         Invoice is closed, so you can't receive orders anymore.
255         <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Reopen it</a>.
256     </p>
257 [% END %]
258
259 <div id="acqui_receive_receivelist">
260     <h3>Already received</h3>
261
262
263    [% IF ( loop_received ) %]
264    <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
265     <table id="receivedt">
266         <thead>
267             <tr>
268                 <th>Basket</th>
269         <th>Order line</th>
270                 <th>Summary</th>
271         <th>View record</th>
272                 <th>Quantity</th>  
273                 <th>Est cost</th>
274                 <th>Actual cost</th>
275                 <th>TOTAL</th>
276         <th></th>
277             </tr>
278     </thead>
279     <tfoot>
280         <tr>
281             <th colspan="7" class="total">Total tax exc.</th>
282             <th>[% total_gste %]</th>
283             <th></th>
284         </tr>
285         [% FOREACH book_foot IN book_foot_loop %]
286             <tr>
287                 <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
288                 <th>[% book_foot.value %]</th>
289                 <th></th>
290             </tr>
291         [% END %]
292         <tr>
293             <th colspan="7" class="total">Total tax inc.</th>
294             <th>[% total_gsti %]</th>
295             <th></th>
296         </tr>
297     </tfoot>
298         <tbody class="filterclass">
299             [% FOREACH loop_receive IN loop_received %]
300             <tr>
301                 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
302                 <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
303                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
304                 [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
305                 [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
306                 [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %]
307                 [% IF ( loop_receive.suggestionid ) %]
308                     <br/>
309                     Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %]
310                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&amp;op=show">suggestion #[% loop_receive.suggestionid %]</a>)
311                 [% END %]
312                 </td>
313                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
314                 <td>[% loop_receive.quantityreceived %]</td>
315                 <td>[% loop_receive.ecost %]</td>
316                 <td>[% loop_receive.unitprice %]</td>
317                 <td>[% loop_receive.total %]</td>
318                 <td>
319                     [% IF (loop_receive.cannot_cancel) %]
320                         [% span_title = BLOCK %]
321                             Cannot cancel receipt of this order line because it
322                             was created from a partial receipt of order line no.
323                             [% loop_receive.parent_ordernumber %], which is
324                             already received. Try cancelling this one first and
325                             retry.
326                         [% END %]
327                         <span title="[% span_title | collapse %]">
328                             Can't cancel receipt
329                         </span>
330                     [% ELSE %]
331                         <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]&op=cancelreceipt&ordernumber=[% loop_receive.ordernumber %]">Cancel receipt</a>
332                     [% END %]
333                 </td>
334             </tr>
335             [% END %]
336         </tbody>
337     </table>
338     </form>
339         [% ELSE %]There are no received orders.[% END %]
340 </div>
341
342 [% IF (invoiceclosedate) %]
343     <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">View invoice</a>
344 [% ELSE %]
345     <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
346         <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
347         <fieldset class="action">
348             <input type="submit" value="Finish receiving" />
349         </fieldset>
350     </form>
351 [% END %]
352
353 [% END %]
354
355 </div>
356 </div>
357
358
359 <div class="yui-b">
360 <form action="/cgi-bin/koha/acqui/parcel.pl" id="filterform" method="post">
361         <fieldset class="brief">
362
363             <h4>Filter</h4>
364
365             <ol>
366
367                 <li>
368                     <label for="summaryfilter">ISBN, author or title :</label>
369             <input type="text" name="summaryfilter" id="summaryfilter" value="[% summaryfilter %]"/>
370                 </li>
371
372                 <li>
373                     <label for="basketfilter">Basket :</label>
374             <input type="text" name="basketfilter" id="basketfilter" value="[% basketfilter %]"/>
375                 </li>
376
377                 <li>
378             <label for="orderfilter">Order line :</label>
379             <input type="text" name="orderfilter" id="orderfilter" value="[% orderfilter %]"/>
380                 </li>
381                 [% IF (UNIMARC) %]
382         <li>
383             <label for="eanfilter">EAN :</label>
384             <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter %]"/>
385         </li>
386                 [% END %]
387             </ol>
388                 <fieldset class="action">
389         <input type="hidden" value="search" name="op" />
390         <input type="hidden" value="[% invoiceid %]" name="invoiceid" />
391         <input type="submit" value="Filter" />
392         <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Clear</a>
393                 </fieldset>
394
395
396         </fieldset>
397     </form>
398 [% INCLUDE 'acquisitions-menu.inc' %]
399 </div>
400 </div>
401 [% INCLUDE 'intranet-bottom.inc' %]
402