Bug 10904: Limit patron update request management by branch
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcel.tt
1 [% USE Koha %]
2 [% USE Price %]
3 [% USE currency = format('%.2f') -%]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
6             Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title>
7 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% INCLUDE 'datatables.inc' %]
10 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
11 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
12 [% INCLUDE 'greybox.inc' %]
13 <script type="text/javascript">
14 //<![CDATA[
15
16     dt_overwrite_html_sorting_localeCompare();
17
18     var sticky_filters = [% sticky_filters %];
19
20     $(document).ready(function(){
21       if ( $("#pendingt").length ) {
22         var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
23             "bStateSave": true,
24             "iCookieDuration": 60*60*24*1000, // 1000 days
25             "iDisplayLength": 10,
26             "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
27             "aoColumnDefs": [
28                 { "aTargets": [ 4, 9, 10 ], "bSortable": false, "bSearchable": false },
29             ],
30             "aoColumns": [
31                 { "sType": "html" },
32                 { "sType": "html" },
33                 { "sType": "num-html" },
34                 { "sType": "html" },
35                 null,
36                 null,
37                 null,
38                 null,
39                 null,
40                 null,
41                 null,
42             ],
43             'bAutoWidth': false,
44             "sPaginationType": "four_button"
45         } )
46         ).columnFilter({
47             sPlaceHolder: "head:after",
48             aoColumns: [
49                 { type: "text" },
50                 { type: "text" },
51                 { type: "text" },
52                 { type: "text" },
53                 null,
54                 { type: "text" },
55                 { type: "text" },
56                 { type: "text" },
57                 { type: "text" },
58                 null,
59                 null
60             ]
61         });
62       }
63
64       if ( $("#receivedt").length ) {
65         var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
66             "bStateSave": true,
67             "iCookieDuration": 60*60*24*1000, // 1000 days
68             "iDisplayLength": 10,
69             "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
70             "aoColumnDefs": [
71                 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
72             ],
73             "aoColumns": [
74                 { "sType": "html" },
75                 { "sType": "html" },
76                 { "sType": "html" },
77                 { "sType": "num-html" },
78                 null,
79                 null,
80                 null,
81                 null,
82                 null,
83                 null,
84                 null,
85                 null
86             ],
87             "sPaginationType": "four_button"
88         } ) );
89       }
90
91       // Keep filters from finishreceive.pl to parcel.pl
92       $.cookie("filter_parcel_summary", $("#summaryfilter").val());
93       $.cookie("filter_parcel_basketname", $("#basketfilter").val());
94       $.cookie("filter_parcel_orderno", $("#orderfilter").val());
95       $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
96       $.cookie("filter_parcel_ean", $("#eanfilter").val());
97
98       $("#filterform").on('submit', function(){
99         $.cookie("filter_parcel_summary", $("#summaryfilter").val());
100         $.cookie("filter_parcel_basketname", $("#basketfilter").val());
101         $.cookie("filter_parcel_orderno", $("#orderfilter").val());
102         $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
103         $.cookie("filter_parcel_ean", $("#eanfilter").val());
104       });
105
106     });
107
108      // Case-insensitive version of jquery's contains function
109      jQuery.extend(jQuery.expr[':'], {
110             icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
111      });
112
113      // Contains exactly function
114      jQuery.extend(jQuery.expr[':'], {
115           containsExactly: "$(a).text() == m[3]"
116      });
117
118 //]]>
119 </script>
120 <script type="text/javascript">
121 //<![CDATA[
122             function transfer_order_popup(ordernumber) {
123                 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
124                     + "ordernumber=" + ordernumber
125                 window.open(url, 'TransferOrder');
126             }
127
128 //]]>
129 </script>
130 </head>
131 <body id="acq_parcel" class="acq">
132 [% INCLUDE 'header.inc' %]
133 [% INCLUDE 'acquisitions-search.inc' %]
134
135 <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;
136     [% IF ( datereceived ) %]
137         Receipt summary for <i>[% name %]</i>
138         [% IF ( invoice ) %]
139             <i>[ [% invoice %] ]</i>
140         [% END %]
141         on <i>[% formatteddatereceived %]</i>
142     [% ELSE %]
143         Receive orders from [% name %]
144     [% END %]
145 </div>
146
147 <div id="doc3" class="yui-t2">
148
149    <div id="bd">
150         <div id="yui-main">
151         <div class="yui-b">
152         [% IF ( receive_error ) %]
153         <div class="dialog alert">
154         <h3>Error adding items:</h3>
155         <ul>
156         [% FOREACH error_loo IN error_loop %]
157                 <li>[% error_loo.error_param %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
158         [% END %]
159         </ul>
160         </div>
161         [% END %]
162     <h1>
163         [% IF ( datereceived ) %]
164             Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% formatteddatereceived %]</i>
165         [% ELSE %]
166             Receive orders from [% name %]
167         [% END %]
168     </h1>
169
170     [% IF ( success_delorder ) %]
171     <div class="dialog message">The order has been successfully canceled.</div>
172     [% ELSE %]
173         [% IF ( error_delitem ) %]
174             <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
175         [% END %]
176         [% IF ( error_delbiblio ) %]
177             <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
178         [% END %]
179     [% END %]
180
181     [% IF (error_cancelling_receipt) %]
182       <div class="dialog error">
183       Cannot cancel receipt. Possible reasons :
184       <ul>
185         <li>
186           The order line you trying to cancel was created from a partial receipt
187           of another order line which is already received. Try to cancel this
188           one first and retry.
189         </li>
190         <li>
191           The order line you trying to cancel was created from a partial receipt
192           of another order line which has been deleted. Cancellation is not
193           possible.
194         </li>
195       </ul>
196       </div>
197     [% END %]
198
199     [% IF error_invoice_not_known %]
200         <div class="dialog error">
201             The invoice referenced by this invoiceid does not exist.
202         </div>
203     [% END %]
204
205 [% UNLESS no_orders_to_display %]
206 <div id="acqui_receive_summary">
207 <p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p>
208 </div>
209 [% UNLESS (invoiceclosedate) %]
210   <div id="acqui_receive_search">
211     <h3>Pending orders</h3>
212
213     [% IF ( loop_orders ) %]
214       <table id="pendingt">
215         <thead>
216           <tr>
217             <th>Basket search</th>
218             <th>Basket group search</th>
219             <th>Order line search</th>
220             <th>Summary search</th>
221             <th>&nbsp;</th>
222             <th>Quantity search</th>
223             <th>Unit cost search</th>
224             <th>Order cost search</th>
225             <th>Fund search</th>
226             <th>&nbsp;</th>
227             <th>&nbsp;</th>
228           </tr>
229           <tr>
230             <th>Basket</th>
231             <th>Basket group</th>
232             <th>Order line</th>
233             <th>Summary</th>
234             <th>View record</th>
235             <th>Quantity</th>
236             <th>Unit cost</th>
237             <th>Order cost</th>
238             <th>Fund</th>
239             <th>&nbsp;</th>
240             <th>&nbsp;</th>
241           </tr>
242         </thead>
243         <tbody class="filterclass">
244         [% FOREACH loop_order IN loop_orders %]
245             <tr>
246                 <td class="basketfilterclass">[% loop_order.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a>)</td>
247                 <td>
248                   [% IF loop_order.basketgroupid %]
249                     [% loop_order.basketgroupname %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% loop_order.booksellerid %]">[% loop_order.basketgroupid %]</a>)
250                   [% ELSE %]
251                     No basket group
252                   [% END %]
253                 </td>
254                 <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&amp;booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td>
255                 <td class="summaryfilterclass">
256                   <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a>
257                 [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %]
258                 [% IF ( loop_order.isbn ) %] &ndash; [% loop_order.isbn %][% END %]
259                 [% IF ( loop_order.publishercode ) %]<br />Publisher:[% loop_order.publishercode %][% END %]
260                 [% IF ( loop_order.suggestionid ) %]
261                     <br/>
262                     Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %]
263                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&amp;op=show">suggestion #[% loop_order.suggestionid %]</a>)
264                 [% END %]
265                 <br />
266                 [% IF ( loop_order.order_internalnote ) %]
267                     <p class="ordernote"><strong>Internal note: </strong>[% loop_order.order_internalnote|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=internal">Change internal note</a>]</p>
268                 [% ELSE %]
269                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=internal">Add internal note</a>]
270                 [% END %]
271                 [% IF ( loop_order.order_vendornote ) %]
272                     <p class="ordernote"><strong>Vendor note: </strong>[% loop_order.order_vendornote|html %]</p>
273                 [% ELSE %]
274                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=vendor">Add vendor note</a>]
275                 [% END %]
276                 </td>
277                 <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>
278                 <td>[% loop_order.quantity %]</td>
279                 <td>[% loop_order.ecost | $Price %]</td>
280                 <td>[% loop_order.total | $Price %]</td>
281                 <td>[% loop_order.budget_name %]</td>
282                                 <td>
283                               <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;invoiceid=[% invoiceid %]">Receive</a>
284                     <br />
285                     <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber %]); return false;">Transfer</a>
286                                 </td>
287                                 <td>
288                         [% IF ( loop_order.left_holds_on_order ) %]
289                         <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>
290                         [% ELSE %]
291                         <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber %]&biblionumber=[% loop_order.biblionumber %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Delete order</a><br />
292                         [% END %]
293                         [% IF ( loop_order.can_del_bib ) %]
294                         <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber %]&biblionumber=[% loop_order.biblionumber %]&del_biblio=1&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Delete order and catalog record</a><br />
295                         [% ELSE %]
296                         <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br>
297                         [% END %]
298                         [% IF ( loop_order.left_item ) %]
299                         <b title="Can't delete catalog record, because of [% loop_order.items %] existing item(s)" >[% loop_order.items %] item(s) left</b><br>
300                         [% END %]
301                         [% IF ( loop_order.left_biblio ) %]
302                         <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios %] order(s) left</b><br>
303                         [% END %]
304                         [% IF ( loop_order.left_subscription ) %]
305                         <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions %] subscription(s) left</b><br>
306                         [% END %]
307                         [% IF ( loop_order.left_holds ) %]
308                         <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds %] hold(s) left</b>
309                         [% END %]
310                     </td>
311                 </tr>
312         [% END %]
313         </tbody>
314       </table>
315     [% ELSE %]There are no pending orders.[% END %]
316   </div>
317 [% ELSE %]
318     <p>
319         Invoice is closed, so you can't receive orders anymore.
320         <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Reopen it</a>.
321     </p>
322 [% END %]
323
324 <div id="acqui_receive_receivelist">
325     <h3>Already received</h3>
326
327    [% IF ( loop_received ) %]
328    <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
329     <table id="receivedt">
330       <thead>
331         <tr>
332           <th>Basket</th>
333           <th>Basket group</th>
334           <th>Order line</th>
335           <th>Holds</th>
336           <th>Summary</th>
337           <th>View record</th>
338           <th>Quantity</th>
339           <th>Fund</th>
340           <th>Est cost</th>
341           <th>Actual cost</th>
342           <th>TOTAL</th>
343           <th></th>
344         </tr>
345       </thead>
346     <tfoot>
347         [% FOREACH key IN subtotal_for_funds.keys.sort %]
348             <tr>
349                 [% IF invoiceincgst %]
350                     <td colspan="6" class="total">(Tax inc.)</td>
351                 [% ELSE %]
352                     <td colspan="6" class="total">(Tax exc.)</td>
353                 [% END %]
354                 <td colspan="2"><i>Subtotal for</i> [% funds.$key.budget_name %]</td>
355                 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
356                 <td>[% subtotal_for_funds.$key.unitprice | $Price  %]</td>
357                 <td>&nbsp;</td>
358                 <td>&nbsp;</td>
359             </tr>
360         [% END %]
361         <tr>
362             <th colspan="10" class="total">Total tax exc.</th>
363             <th>[% total_gste | $Price %]</th>
364             <th></th>
365         </tr>
366         [% FOREACH book_foot IN book_foot_loop %]
367             <tr>
368                 <th colspan="10">Total (GST [% book_foot.gstrate * 100 | $Price %]%)</th>
369                 <th>[% book_foot.gstvalue | $Price %]</th>
370                 <th></th>
371             </tr>
372         [% END %]
373         <tr>
374             <th colspan="10" class="total">Total tax inc.</th>
375             <th>[% total_gsti | $Price %]</th>
376             <th></th>
377         </tr>
378     </tfoot>
379     <tbody class="filterclass">
380         [% FOREACH order IN loop_received %]
381             <tr>
382                 <td>[% order.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td>
383                 <td>
384                   [% IF order.basketgroupid %]
385                     [% order.basketgroupname %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% order.booksellerid %]">[% order.basketgroupid %]</a>)
386                   [% ELSE %]
387                     No basket group
388                   [% END %]
389                 </td>
390                 <td>
391                   <a href="neworderempty.pl?ordernumber=[% order.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% order.ordernumber %]</a>
392                   [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
393                     (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber %]&amp;booksellerid=[% booksellerid %]" title="Original order line">[% order.parent_ordernumber %]</a>)
394                   [% END %]
395                 </td>
396                 <td>
397                   [% IF order.holds > 0 %]
398                     <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber %]">[% order.holds %]</a></span>
399                   [% ELSE %]
400                     0
401                   [% END %]
402                 </td>
403                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
404                 [% IF ( order.author ) %] / [% order.author %][% END %]
405                 [% IF ( order.isbn ) %] - [% order.isbn %][% END %]
406                 [% IF ( order.publishercode ) %]<br />Publisher :[% order.publishercode %][% END %]
407                 [% IF ( order.suggestionid ) %]
408                     <br/>
409                     Suggested by: [% order.surnamesuggestedby %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby %] [% END %]
410                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid %]&amp;op=show">suggestion #[% order.suggestionid %]</a>)
411                 [% END %]
412                 </td>
413                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
414                 <td>[% order.quantityreceived %]</td>
415                 <td>[% order.budget.budget_name %]</td>
416                 <td>[% order.ecost | $Price %]</td>
417                 <td>[% order.unitprice | $Price %]</td>
418                 <td>[% order.total | $Price %]</td>
419                 <td>
420                     [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
421                       [% IF loop_receive.cannot_cancel %]
422                         [% span_title = BLOCK %]
423                             Cannot cancel receipt of this order line because it
424                             was created from a partial receipt of order line no.
425                             [% order.parent_ordernumber %], which is
426                             already received. Try cancelling this one first and
427                             retry.
428                         [% END %]
429                       [% ELSE %]
430                         [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
431                         [%# Some additional checks should be added in the pl file %]
432                         [% span_title = BLOCK %]
433                           Cannot cancel receipt of this order line because at least one reservation exists on the records.
434                         [% END %]
435                       [% END %]
436                       <span title="[% span_title | collapse %]">
437                           Can't cancel receipt
438                       </span>
439                     [% ELSE %]
440                         <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]&op=cancelreceipt&ordernumber=[% order.ordernumber %]">Cancel receipt</a>
441                     [% END %]
442                 </td>
443             </tr>
444             [% END %]
445         </tbody>
446     </table>
447     </form>
448         [% ELSE %]There are no received orders.[% END %]
449 </div>
450
451 [% IF (invoiceclosedate) %]
452     <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">View invoice</a>
453 [% ELSE %]
454     <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
455         <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
456         <fieldset class="action">
457             <input type="submit" value="Finish receiving" />
458         </fieldset>
459     </form>
460 [% END %]
461
462 [% END %]
463
464 </div>
465 </div>
466
467
468 <div class="yui-b">
469 <form action="/cgi-bin/koha/acqui/parcel.pl" id="filterform" method="post">
470   <fieldset class="brief">
471     <h4>Filter</h4>
472     <ol>
473       <li>
474         <label for="summaryfilter">ISBN, author or title :</label>
475         <input type="text" name="summaryfilter" id="summaryfilter" value="[% summaryfilter %]"/>
476       </li>
477       <li>
478         <label for="basketfilter">Basket :</label>
479         <input type="text" name="basketfilter" id="basketfilter" value="[% basketfilter %]"/>
480       </li>
481       <li>
482           <label for="basketgroupnamefilter">Basket group name :</label>
483           <input type="text" name="basketgroupnamefilter" id="basketgroupnamefilter" value="[% basketgroupnamefilter %]" />
484       </li>
485       <li>
486         <label for="orderfilter">Order line :</label>
487         <input type="text" name="orderfilter" id="orderfilter" value="[% orderfilter %]"/>
488       </li>
489       [% IF (UNIMARC) %]
490         <li>
491           <label for="eanfilter">EAN :</label>
492           <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter %]"/>
493         </li>
494       [% END %]
495     </ol>
496     <fieldset class="action">
497       <input type="hidden" value="search" name="op" />
498       <input type="hidden" value="[% invoiceid %]" name="invoiceid" />
499       <input type="submit" value="Filter" />
500       <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Clear</a>
501     </fieldset>
502   </fieldset>
503 </form>
504 [% INCLUDE 'acquisitions-menu.inc' %]
505 </div>
506 </div>
507 [% INCLUDE 'intranet-bottom.inc' %]