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