Bug 8612: Use CSV profile for exporting basket
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basket.tt
1 [% BLOCK csv_export %]
2     <div class="btn-group">
3         <a id="exportbutton" class="btn btn-default btn-sm" href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]"><i class="fa fa-download"></i> Export as CSV</a>
4       <a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
5       <ul class="dropdown-menu" id="export-csv-menu">
6           <li><a href="#">Default</a></li>
7           [% IF csv_profiles %]
8               [% FOR csv IN csv_profiles %]
9                 <li><a href="#" data-value="[% csv.export_format_id %]">[% csv.profile %]</a></li>
10               [% END %]
11           [% END %]
12        </ul>
13     </div>
14 [% END %]
15 [% USE KohaDates %]
16 [% USE Branches %]
17 [% USE Price %]
18 [% USE AuthorisedValues %]
19
20 [% INCLUDE 'doc-head-open.inc' %]
21 <title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
22 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
23 [% INCLUDE 'doc-head-close.inc' %]
24 [% INCLUDE 'datatables.inc' %]
25 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
26 <script type="text/javascript">
27 //<![CDATA[
28     function updateColumnsVisibility(visible) {
29         if ( visible ) {
30             $("table .tax_excluded, .tax_included").show();
31         } else {
32             [% IF ( listincgst ) %]
33                 $("table .tax_excluded").hide();
34             [% ELSE %]
35                 $("table .tax_included").hide();
36             [% END %]
37         }
38     }
39
40     $(document).ready(function() {
41         $('#toolbar').fixFloat();
42         $("#show_all_details").click(function(){
43             updateColumnsVisibility($(this).is(":checked"));
44         });
45
46         $("#show_all_details").prop('checked', false);
47         updateColumnsVisibility(false);
48         [% UNLESS ( closedate ) %]
49             $('#addtoBasket').on('show', function () {
50                $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML);
51             });
52         [% END %]
53
54         $("body").on("click", ".del_user", function(e){
55             e.preventDefault();
56             del_user( $(this).data("borrowernumber") );
57         });
58
59         $("#add_user").on("click",function(e){
60             e.preventDefault();
61             UserSearchPopup();
62         });
63
64         $(".transfer_order").on("click",function(e){
65             e.preventDefault();
66             transfer_order_popup( $(this).data("ordernumber"));
67         });
68     });
69 //]]>
70 </script>
71
72 [% UNLESS ( closedate ) %]
73 <script type="text/javascript">
74 //<![CDATA[
75
76             function transfer_order_popup(ordernumber) {
77                 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
78                     + "ordernumber=" + ordernumber
79                 window.open(url, 'TransferOrder','width=600,height=400,toolbar=false,scrollbars=yes');
80             }
81
82             function confirm_ediorder() {
83                 var is_confirmed = confirm(_("Are you sure you want to close this basket and generate an EDIFACT order?"));
84                 if (is_confirmed) {
85                     window.location = "/cgi-bin/koha/acqui/basket.pl?op=edi_confirm&basketno=[% basketno %]";
86                 }
87             }
88
89 //]]>
90 </script>
91 [% ELSE %]
92 <script type="text/javascript">
93 //<![CDATA[
94     $(document).ready(function(){
95         $("#basketgroupid").change(function(){
96             if($(this).val() == "new"){
97                 location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid %]";
98             }
99         });
100     });
101 //]]>
102 </script>
103 [% UNLESS ( grouped ) %]
104 <script type="text/javascript">
105 //<![CDATA[
106             function confirm_reopen() {
107                 var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %];
108                 var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?"));
109                 if (is_confirmed) {
110                     window.location = "/cgi-bin/koha/acqui/basket.pl?op=reopen&basketno=[% basketno %]";
111                 }
112             }
113 //]]>
114 </script>
115 [% END %]
116 [% END %]
117 <script type="text/javascript">
118 //<![CDATA[
119     $(document).ready(function() {
120         var orderst = $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, {
121             "sPaginationType": "four_button",
122             [% IF ( active ) %]
123                 "aoColumnDefs": [
124                     [% UNLESS ( closedate ) %]
125                         { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
126                     [% END %]
127                     { "sType": "anti-the", "aTargets": [ "anti-the" ] }
128                 ],
129             [% END %]
130         } ) );
131         var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
132             "sPaginationType": "four_button"
133         } ) );
134         $("#reopenbutton").on("click",function(e){
135             e.preventDefault();
136             confirm_reopen();
137         });
138         // Generates a dynamic link for exporting the selections data as CSV
139         $("#exportbutton, #export-csv-menu a").click(function() {
140             // Building the url from currently checked boxes
141             var url = '/cgi-bin/koha/acqui/basket.pl';
142             url += $('#exportbutton').attr('href');
143             if($(this).attr("data-value")) {
144                 url += '&amp;csv_profile=' + $(this).attr("data-value");
145             }
146             // And redirecting to the CSV page
147             location.href = url;
148             return false;
149         });
150     });
151
152     function UserSearchPopup(f) {
153         window.open(
154             "/cgi-bin/koha/acqui/add_user_search.pl",
155             'UserSearchPopup',
156             'width=840, height=500, scrollbars=yes, toolbar=no,'
157          );
158     }
159
160     function add_user(borrowernumber, borrowername) {
161         var ids = $("#users_ids").val();
162         if(ids.length > 0) {
163             ids = ids.split(':');
164         } else {
165             ids = new Array;
166         }
167         if (ids.indexOf(borrowernumber) < 0) {
168             ids.push(borrowernumber);
169             $("#users_ids").val(ids.join(':'));
170             var li = '<li id="user_'+borrowernumber+'">'+borrowername
171             + ' <a href="#" data-borrowernumber="'+borrowernumber+'" class="del_user"><i class="fa fa-trash"></i> '
172                 + _("Delete user") + '</a></li>';
173             $("#users_names").append(li);
174             return 0;
175         }
176         return -1;
177     }
178
179     function del_user(borrowernumber) {
180       $("#user_"+borrowernumber).remove();
181       var ids = $("#users_ids").val().split(':');
182       ids.splice(ids.indexOf(borrowernumber.toString()), 1);
183       $("#users_ids").val(ids.join(':'));
184     }
185 //]]>
186 </script>
187 <style type="text/css">
188 .sortmsg {font-size: 80%;}
189 </style>
190 </head>
191 <body id="acq_basket" class="acq">
192 [% INCLUDE 'header.inc' %]
193 [% INCLUDE 'acquisitions-search.inc' %]
194
195
196 <div id="breadcrumbs">
197     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
198     <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
199     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a> &rsaquo;
200     [% UNLESS ( basketno ) %][% IF ( delete_confirmed ) %]Deleted [% ELSE %]New [% END %][% END %]Basket [% basketname|html %] [% IF ( basketno ) %]([% basketno %])[% END %] for [% name|html %]
201 </div>
202
203 <div id="doc3" class="yui-t2">
204
205 <div id="bd">
206     <div id="yui-main">
207     [% IF (cannot_manage_basket) %]
208         <div class="yui-b">
209             <p class="error">You are not authorised to manage this basket.</p>
210         </div>
211     [% ELSE %]
212     <div class="yui-b">
213         [% IF !confirm_close && !edi_confirm %]
214         [% UNLESS ( selectbasketg ) %]
215             [% UNLESS ( closedate ) %]
216             [% UNLESS ( delete_confirmed ) %]
217                 <div id="toolbar" class="btn-toolbar">
218                     [% IF active %]
219                         <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-default btn-sm" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a></div>
220                     [% END %]
221                     <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="btn btn-default btn-sm" id="basketheadbutton"><i class="fa fa-pencil"></i> Edit basket</a></div>
222                     [%# FIXME This action should not be available for everyone %]
223                     <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-default btn-sm" data-toggle="modal" id="delbasketbutton"><i class="fa fa-trash"></i> Delete this basket</a></div>
224                    [% IF ( unclosable ) %]
225                     [% ELSIF ( uncertainprices ) %]
226                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="btn btn-default btn-sm" id="uncertpricesbutton"><i class="fa fa-usd"></i> Uncertain prices</a></div>
227                     [% ELSE %]
228                         <div class="btn-group">
229                             <a href="/cgi-bin/koha/acqui/basket.pl?op=close&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="closebutton"><i class="fa fa-times-circle"></i> Close this basket</a>
230                         </div>
231                     [% END %]
232
233                     [% PROCESS csv_export %]
234
235                         [% IF ediaccount %]
236                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/edi_ean.pl?op=ediorder&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="ediorderbutton"><i class="fa fa-download"></i> Create EDIFACT order</a></div>
237                         [% END %]
238
239                         [% IF ( active && books_loop ) %]
240                             <div class="btn-group">
241                                 <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
242                                     <input type="hidden" name="op" value="email" />
243                                     <input type="hidden" name="basketno" value="[% basketno %]" />
244                                     <button type="submit" class="btn btn-default btn-sm" id="emailvendorbutton"><i class="fa fa-envelope"></i> E-mail order</button>
245                                 </form>
246                             </div>
247                         [% END %]
248                 </div>
249             [% END %]
250
251             <!-- Modal for confirm deletion box-->
252                 <div class="modal" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
253                     <div class="modal-dialog">
254                     <div class="modal-content">
255                     <div class="modal-header">
256                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
257                         <h3>Confirm deletion</h3>
258                     </div>
259                     [% UNLESS book_foot_loop %]
260                         <div class="modal-body">
261                            <p>Are you sure you want to delete this basket?</p>
262                         </div>
263                         <div class="modal-footer">
264                             <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
265                             <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
266                                 <input type="hidden" name="op" value="delete_confirm" />
267                                 <input type="hidden" name="basketno" value="[% basketno %]" />
268                                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
269                                 <input type="hidden" name="delbiblio" value="0" />
270                                 <button type="submit" class="btn btn-default btn-default">Delete basket</button>
271                             </form>
272                         </div>
273                     [% ELSE %]
274                         <div class="modal-body">
275                            <p>Are you sure you want to delete this basket?</p>
276                            <p>Warning:</p>
277                            <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
278                            <p>If items have been created when ordering or receiving, they will be deleted.</p>
279                            <p>You can choose to delete bibliographic records if possible (bibliographic records that have other items or that are used in a subscription or another order will not be deleted).</p>
280                         </div>
281                         <div class="modal-footer">
282                             <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
283                             <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
284                                 <input type="hidden" name="op" value="delete_confirm" />
285                                 <input type="hidden" name="basketno" value="[% basketno %]" />
286                                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
287                                 <input type="hidden" name="delbiblio" value="0" />
288                                 <button type="submit" class="btn btn-default btn-default">Delete basket and orders</button>
289                             </form>
290
291                             <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
292                                 <input type="hidden" name="op" value="delete_confirm" />
293                                 <input type="hidden" name="basketno" value="[% basketno %]" />
294                                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
295                                 <input type="hidden" name="delbiblio" value="1" />
296                                 <button type="submit" class="btn btn-default btn-default">Delete basket, orders, and records</button>
297                             </form>
298
299                         </div>
300                     [% END %]
301                     </div>
302                     </div>
303                 </div>
304 <!-- End of Modal-->
305             [% ELSE %]
306                 [% UNLESS ( grouped ) %]
307                 <div id="toolbar" class="btn-toolbar">
308
309                     <div class="btn-group"><a href="#" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-refresh"></i> Reopen this basket</a></div>
310
311                     [% PROCESS csv_export %]
312
313                 </div>
314                 [% END %]
315             [% END %]
316             [% END %]
317
318     [% IF ( NO_BOOKSELLER ) %]
319     <h2>Vendor not found</h2>
320     [% ELSE %]
321         [% IF ( delete_confirmed ) %]
322             <div class="dialog message">
323                 <h3>Basket deleted</h3>
324             </div>
325             [% IF (cannotdelbiblios) %]
326                 <div class="dialog alert">
327                     <p><strong>Warning:</strong></p>
328                     <p><strong>The following records could not be deleted:</strong></p>
329                     <ul>
330                     [% FOREACH cannotdelbiblio IN cannotdelbiblios %]
331                         <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cannotdelbiblio.biblionumber %]">[% cannotdelbiblio.title |html %]</a> by [% cannotdelbiblio.author %]:
332                             <ul>
333                             [% IF (cannotdelbiblio.itemcount) %]<li>[% cannotdelbiblio.itemcount %] item(s) attached.</li>[% END %]
334                             [% IF (cannotdelbiblio.subscriptions) %]<li>[% cannotdelbiblio.subscriptions %] subscription(s) attached.</li>[% END %]
335                             [% IF (cannotdelbiblio.countbiblio) %]<li>[% cannotdelbiblio.countbiblio %] order(s) attached.</li>[% END %]
336                             [% IF (cannotdelbiblio.othererror) %]<li>Unknown error.</li>[% END %]
337                             </ul>
338                         </li>
339                     [% END %]
340                     </ul>
341                 </div>
342                 <a href="booksellers.pl">Click here to go back to booksellers page</a>
343             [% ELSE %]
344                 <a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid %]" class="btn btn-default btn-sm">Show baskets for vendor [% name | html %]</a> <a href="/cgi-bin/koha/acqui/booksellers.pl" class="btn btn-default btn-sm">Show all active baskets</a>
345             [% END %]
346         [% ELSE %]
347
348         [% FOR m IN messages %]
349             <div class="dialog [% m.type %]">
350                 [% SWITCH m.code %]
351                 [% CASE 'no_email' %]
352                     This vendor has no contact selected for sending orders to or is missing an e-mail address.
353                 [% CASE 'no_basketno' %]
354                     No basket given.
355                 [% CASE 'no_letter' %]
356                     There is no notice template with code ACQORDER defined.
357                 [% CASE 'email_sent' %]
358                     Order e-mail was sent to the vendor.
359                 [% CASE %]
360                     ERROR! - [% m.code %]
361                 [% END %]
362             </div>
363         [% END %]
364         <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
365         [% IF ( basketno ) %]
366             <div id="acqui_basket_summary" class="yui-g">
367                 <div class="rows">
368                 <div class="yui-u first">
369                 <ol>
370                 [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote %]</li>[% END %]
371                 [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote %]</li>[% END %]
372                 [% IF ( basketcontractno ) %]
373                     <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
374                 [% END %]
375                 [% IF deliveryplace %]<li><span class="label">Delivery place:</span> [% Branches.GetName( deliveryplace ) %]</li>[% END %]
376                 [% IF billingplace %]<li><span class="label">Billing place:</span> [% Branches.GetName( billingplace ) %]</li>[% END %]
377                 [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
378                 <li id="managedby">
379                     <form action="" method="post">
380                         <span class="label">Managed by:</span>
381                         <div style="float:left">
382                             <ul id="users_names" style="padding-left:0">
383                               [% FOREACH user IN users %]
384                                 <li id="user_[% user.borrowernumber %]">
385                                     [% user.firstname %] [% user.surname %]
386                                     <a href="#" data-borrowernumber="[% user.borrowernumber %]" class="del_user"><i class="fa fa-trash"></i> Delete user</a>
387                                 </li>
388                               [% END %]
389                             </ul>
390                             <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
391                             <input type="hidden" id="users_ids" name="users_ids" value="[% users_ids %]" />
392                             <input type="hidden" id="op" name="op" value="mod_users" />
393                             <input type="button" id="add_user" value="Add user" />
394                             <input type="submit" value="Save changes" />
395                         </div>
396                     </form>
397                 </li>
398                 <li id="branch">
399                     <span class="label">Library:</span>
400                     [% IF basketbranchcode %]
401                         [% Branches.GetName( basketbranchcode ) %]
402                     [% ELSE %]
403                         No library
404                     [% END %]
405                     [% IF branches_loop.size %]
406                         <form action="" method="post">
407                             <select id="branch" name="branch">
408                                 <option value="">(no library)</option>
409                                 [% FOREACH branch IN branches_loop %]
410                                     [% IF (branch.selected) %]
411                                         <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
412                                     [% ELSE %]
413                                         <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
414                                     [% END %]
415                                 [% END %]
416                             </select>
417                             <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
418                             <input type="hidden" id="op" name="op" value="mod_branch" />
419                             <input type="submit" value="Change" />
420                         </form>
421                     [% END %]
422                 </li>
423                 [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
424                 [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
425                 [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
426                 [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
427                 <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
428
429
430                 </ol>
431                 </div>
432                 [% IF ( closedate ) %]
433                 <div class="yui-u">
434                     [% IF ( CAN_user_acquisition_group_manage ) %]
435                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
436                     [% END %]
437                         <ol>
438                         <li>
439                           <span class="label">Basket group:</span>
440                           [% IF basketgroup.id and not basketgroup.name %]
441                             [% SET basketgroup.name = "Basket group no. " _ basketgroup.id %]
442                           [% END %]
443                           [% IF basketgroup.closed %]
444                               [% IF ( CAN_user_acquisition_group_manage ) %]
445                                   <a href="basketgroup.pl?op=add&booksellerid=[% booksellerid %]&basketgroupid=[% basketgroup.id %]" title="basketgroup">[% basketgroup.name %] (closed)</a>
446                               [% ELSE %]
447                                   [% basketgroup.name %] (closed)
448                               [% END %]
449                           [% ELSIF ( ! CAN_user_acquisition_group_manage ) %]
450                             [%- IF basketgroup.id -%]
451                                 [% basketgroup.name %]
452                             [%- ELSE -%]
453                                 No group
454                             [%- END -%]
455                           [% ELSE %]
456                             <select id="basketgroupid" name="basketgroupid">
457                               <option value="">No group</option>
458                               [% FOREACH bg IN basketgroups %]
459                                 [% IF ( bg.default ) %]
460                                     <option value="[% bg.id %]" selected="selected">[% bg.name %]</option>
461                                 [% ELSE %]
462                                   [% UNLESS bg.closed %]
463                                     <option value="[% bg.id %]">[% bg.name %]</option>
464                                   [% ELSE %]
465                                     <option value="[% bg.id %]" disabled="disabled">[% bg.name %] (closed)</option>
466                                   [% END %]
467                                 [% END %]
468                               [% END %]
469                               <option value="new">Add new group</option>
470                             </select>
471                             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
472                             <input type="hidden" value="mod_basket" name="op" />
473                             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
474                             <input type="submit" value="Change basket group" />
475                           [% END %]
476                         </li>
477                     [% IF basketgroup.deliveryplace %]<li><span class="label">Basket group delivery placename:</span> [% Branches.GetName( basketgroup.deliveryplace ) %]</li>[% END %]
478                     [% IF basketgroup.billingplace %]<li><span class="label">Basket group billing place:</span> [% Branches.GetName( basketgroup.billingplace ) %]</li>[% END %]
479                         </ol>
480                     [% IF ( CAN_user_acquisition_group_manage ) %]
481                     </form>
482                     [% END %]
483                 </div>
484                 [% END %]
485             </div>
486             </div>
487         [% END %]
488         [% IF ( duplinbatch ) %]<div class="dialog alert">
489         <h4>Duplicate warning</h4>
490         <p>Some records have not been automatically added because they match an existing record in your catalog:<a href="/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=[% duplinbatch %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" title="Open in new window" target="_blank" class="popup" style="margin-left:10px">Display them</a></p>
491         </div>[% END %]
492
493         <div id="acqui_basket_content" class="yui-g">
494         [% IF ( books_loop ) %]
495         <h2>Orders</h2>
496         <label for="show_all_details">
497             <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
498             Show all details
499         </label>
500             <table id="orders">
501                 <thead>
502                     <tr>
503                         <th>No.</th>
504                         <th class="anti-the">Order</th>
505                         <th class="tax_excluded">RRP tax exc.</th>
506                         <th class="tax_excluded">ecost tax exc.</th>
507                         <th class="tax_included">RRP tax inc.</th>
508                         <th class="tax_included">ecost tax inc.</th>
509                         <th>Qty.</th>
510                         <th class="tax_excluded">Total tax exc. ([% currency %])</th>
511                         <th class="tax_included">Total tax inc. ([% currency %])</th>
512                         <th>GST %</th>
513                         <th>GST</th>
514                         <th>Fund</th>
515                         <th>Supplier report</th>
516                         [% IF ( active ) %]
517                             [% UNLESS ( closedate ) %]
518                                 <th>Modify</th>
519                                 <th>Cancel order</th>
520                             [% END %]
521                         [% END %]
522                     </tr>
523                 </thead>
524                 <tfoot>
525                 [% FOREACH foot_loo IN book_foot_loop %]
526                     <tr>
527                         <th></th>
528                         <th>Total (GST [% foot_loo.tax_rate * 100 %])</th>
529                         <th class="tax_excluded">&nbsp;</th>
530                         <th class="tax_excluded">&nbsp;</th>
531                         <th class="tax_included">&nbsp;</th>
532                         <th class="tax_included">&nbsp;</th>
533                         <th>[% foot_loo.quantity %]</th>
534                         <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
535                         <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
536                         <th>&nbsp;</th>
537                         <th>[% foot_loo.tax_value | $Price %]</th>
538                         <th>&nbsp;</th>
539                         <th>&nbsp;</th>
540                         [% IF ( active ) %]
541                             [% UNLESS ( closedate ) %]
542                                 <th>&nbsp;</th>
543                                 <th>&nbsp;</th>
544                             [% END %]
545                         [% END %]
546                     </tr>
547                 [% END %]
548                 <tr>
549                     <th></th>
550                     <th>Total ([% currency %])</th>
551                     <th class="tax_excluded">&nbsp;</th>
552                     <th class="tax_excluded">&nbsp;</th>
553                     <th class="tax_included">&nbsp;</th>
554                     <th class="tax_included">&nbsp;</th>
555                     <th>[% total_quantity %]</th>
556                     <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
557                     <th class="tax_included">[% total_tax_included | $Price %]</th>
558                     <th>&nbsp;</th>
559                     <th>[% total_tax_value | $Price %]</th>
560                     <th>&nbsp;</th>
561                     <th>&nbsp;</th>
562                     [% IF ( active ) %]
563                         [% UNLESS ( closedate ) %]
564                             <th>&nbsp;</th>
565                             <th>&nbsp;</th>
566                         [% END %]
567                     [% END %]
568                 </tr>
569                 </tfoot>
570                 <tbody>
571                 [% FOREACH books_loo IN books_loop %]
572                     [% IF ( books_loo.order_received ) %]
573                         <tr class="disabled">
574                     [% ELSE %]
575                         <tr>
576                     [% END %]
577                         <td>
578                             [% books_loo.ordernumber %]
579                         </td>
580                         <td>
581                             <p>
582                                 [% IF ( books_loo.order_received ) %] (rcvd)[% END %]
583                                 [% IF books_loo.title %]
584                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber %]">[% books_loo.title |html %]</a>[% IF books_loo.author %] by [% books_loo.author %][% END %]
585                                 [% ELSE %]
586                                     <em>Deleted bibliographic record, can't find title</em><br />
587                                 [% END %]
588                                 <br />
589                                 [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %]
590                                 [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %]
591                                 [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %]
592                                 [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear %]
593                                 [% ELSIF ( books_loo.copyrightdate ) %] [% books_loo.copyrightdate %][% END %]
594                                 [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
595                                 [% IF ( books_loo.suggestionid ) %]
596                                     <br/>
597                                     Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
598                                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&amp;op=show">suggestion #[% books_loo.suggestionid %]</a>)
599                                 [% END %]
600                             </p>
601                                 [% IF ( books_loo.order_internalnote ) %]
602                                     <p class="ordernote"><strong>Internal note: </strong>[% books_loo.order_internalnote|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=internal">Change internal note</a>]</p>
603                                 [% ELSE %]
604                                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=internal">Add internal note</a>]
605                                 [% END %]
606                                 [% IF ( books_loo.order_vendornote ) %]
607                                     <p class="ordernote"><strong>Vendor note: </strong>[% books_loo.order_vendornote|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=vendor">Change vendor note</a>]</p>
608                                 [% ELSE %]
609                                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=vendor">Add vendor note</a>]
610                                 [% END %]
611                             [% IF (books_loo.transferred_from) %]
612                               [% basket = books_loo.transferred_from.basket %]
613                               [% bookseller = books_loo.transferred_from.bookseller %]
614                               [% timestamp = books_loo.transferred_from.timestamp %]
615                               <p>Transferred from basket:
616                                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"> [% basket.basketname %]</a>
617                                 (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a>)
618                                 on <span title="[% timestamp | $KohaDates with_hours = 1 %]">
619                                   [% timestamp | $KohaDates %]
620                                 </span>
621                               </p>
622                             [% END %]
623                         </td>
624                         [% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
625                         [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
626                         <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
627                         <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
628                         <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
629                         <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
630                         <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
631                         <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
632                         <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
633                         <td class="number">[% books_loo.tax_rate * 100 %]</td>
634                         <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
635                         <td>[% books_loo.budget_name %]</td>
636                         <td>[% books_loo.suppliers_report %]</td>
637                         [% IF ( active ) %]
638                             [% UNLESS ( closedate ) %]
639                             <td>
640                                 <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber %]&amp;booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Modify</a>
641                                 [% UNLESS (books_loo.order_received) %]
642                                     <br />
643                                     <a href="#" class="transfer_order" data-ordernumber="[% books_loo.ordernumber %]">Transfer</a>
644                                 [% END %]
645                             </td>
646                             <td>
647                             [% IF ( books_loo.left_holds_on_order ) %]
648                             <span class="button" title="Can't cancel order, ([% books_loo.holds_on_order %]) holds are linked with this order cancel holds first">Can't cancel order</span><br>
649                             [% ELSE %]
650                             <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber %]&biblionumber=[% books_loo.biblionumber %]&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno %]" class="button">Cancel order</a><br>
651                             [% END %]
652                             [% IF ( books_loo.can_del_bib ) %]
653                             <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber %]&biblionumber=[% books_loo.biblionumber %]&del_biblio=1&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno %]" class="button">Cancel order and delete catalog record</a><br>
654                             [% ELSE %]
655                             <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
656                             [% END %]
657                             [% IF ( books_loo.left_item ) %]
658                             <b title="Can't delete catalog record, because of [% books_loo.items %] existing hold(s)" >[% books_loo.items %] item(s) left</b><br>
659                             [% END %]
660                             [% IF ( books_loo.left_biblio ) %]
661                             <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios %] order(s) left</b><br>
662                             [% END %]
663                             [% IF ( books_loo.left_subscription ) %]
664                             <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions %] subscription(s) left</b><br>
665                             [% END %]
666                             [% IF ( books_loo.left_holds ) %]
667                             <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds %] hold(s) left</b>
668                             [% END %]
669                             </td>
670                             [% END %]
671                         [% END %]
672                     </tr>
673                 [% END %]
674                 </tbody>
675             </table>
676         [% END %]
677         [% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
678         [% END %]
679         </div>
680         [% IF (cancelledorders_loop) %]
681           <div id="cancelledorders">
682             <h2>Cancelled orders</h2>
683             <table id="cancelledorderst">
684               <thead>
685                 <tr>
686                   <th>No.</th>
687                   <th>Order</th>
688                   <th class="tax_excluded">RRP tax exc.</th>
689                   <th class="tax_excluded">ecost tax exc.</th>
690                   <th class="tax_included">RRP tax inc.</th>
691                   <th class="tax_included">ecost tax inc.</th>
692                   <th>Qty.</th>
693                   <th class="tax_excluded">Total tax exc. ([% currency %])</th>
694                   <th class="tax_included">Total tax inc. ([% currency %])</th>
695                   <th>GST %</th>
696                   <th>GST</th>
697                   <th>Fund</th>
698                 </tr>
699               </thead>
700               <tbody>
701                 [% FOREACH order IN cancelledorders_loop %]
702                   <tr style="color:grey">
703                     <td>
704                         [% order.ordernumber %]
705                     </td>
706                     <td>
707                       <p>
708                         [% IF ( order.order_received ) %] (rcvd)[% END %]
709                         [% IF (order.title) %]
710                           [% order.title |html %][% IF order.author %] by [% order.author %][% END %]
711                         [% ELSE %]
712                           <em>Deleted bibliographic record, can't find title</em>
713                         [% END %]
714                         <br />
715                         [% IF ( order.order_internalnote ) %] [% order.order_internalnote %][% END %]
716                         [% IF ( order.isbn ) %] - [% order.isbn %][% END %]
717                         [% IF ( order.issn ) %] - [% order.issn %][% END %]
718                         [% IF ( order.publishercode ) %], [% order.publishercode %][% END %]
719                         [% IF ( order.publicationyear ) %], [% order.publicationyear %]
720                         [% ELSIF ( order.copyrightdate ) %] [% order.copyrightdate %][% END %]
721                         [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
722                         [% IF ( order.cancellationreason ) %]
723                           <br />
724                           Cancellation reason: [% AuthorisedValues.GetByCode( 'ORDER_CANCELLATION_REASON', order.cancellationreason ) %]
725                         [% END %]
726                       </p>
727                       [% IF order.transferred_to %]
728                         [% basket = order.transferred_to.basket %]
729                         [% bookseller = order.transferred_to.bookseller %]
730                         [% timestamp = order.transferred_to.timestamp %]
731                         <p>Transferred to basket:
732                           <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"> [% basket.basketname %]</a>
733                           (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a>)
734                           on <span title="[% timestamp | $KohaDates with_hours = 1%]">
735                             [% timestamp | $KohaDates %]
736                           </span>
737                         </p>
738                       [% END %]
739                     </td>
740                     <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
741                     <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
742                     <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
743                     <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
744                     <td class="number">[% order.quantity %]</td>
745                     <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
746                     <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
747                     <td class="number">[% order.tax_rate * 100 %]</td>
748                     <td class="number">[% order.tax_value | $Price %]</td>
749                     <td>[% order.budget_name %]
750                   </tr>
751                 [% END %]
752               </tbody>
753             </table>
754           </div>
755         [% END %]
756         <br />
757         [% UNLESS ( closedate ) %]
758
759     <!-- Modal -->
760     <div id="addtoBasket" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel" aria-hidden="true">
761         <div class="modal-dialog">
762         <div class="modal-content">
763         <div class="modal-body">
764         [% IF active %]
765             [% INCLUDE 'acquisitions-add-to-basket.inc' %]
766         [% END %]
767         </div>
768         <div class="modal-footer">
769             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
770         </div>
771         </div>
772         </div>
773     </div>
774
775         [% END %]
776
777 [% END %]
778 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
779     [% END %]
780 [% IF ( confirm_close ) %]
781         <div id="closebasket_needsconfirmation" class="dialog alert">
782
783         <form action="/cgi-bin/koha/acqui/basket.pl">
784             <h1>Are you sure you want to close basket [% basketname|html %]?</h1>
785             [% IF ( CAN_user_acquisition_group_manage ) %]
786             <p>
787             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
788             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
789             </p>
790             [% END %]
791             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
792             <input type="hidden" value="close" name="op" />
793             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
794             <input type="hidden" name="confirm" value="1" />
795             <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" />
796             <button type="submit" class="approve" accesskey="y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
797         </form>
798         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
799             <input type="hidden" name="basketno" value="[% basketno %]" />
800             <button type="submit" class="deny" accesskey="n"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
801         </form>
802         </div>
803     [% END %]
804 [% IF edi_confirm %]
805         <div id="closebasket_needsconfirmation" class="dialog alert">
806
807         <form action="/cgi-bin/koha/acqui/basket.pl">
808             <h1>Are you sure you want to generate an EDIFACT order and close basket [% basketname|html %]?</h1>
809             [% IF CAN_user_acquisition_group_manage %]
810             <p>
811             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
812             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
813             </p>
814             [% END %]
815             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
816             <input type="hidden" value="ediorder" name="op" />
817             <input type="hidden" name="ean" value="[% ean %]" />
818             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
819             <input type="hidden" name="confirm" value="1" />
820             <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" />
821             <button type="submit" class="approve" accesskey="Y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
822         </form>
823         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
824             <input type="hidden" name="basketno" value="[% basketno %]" />
825             <button type="submit" class="deny" accesskey="N"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
826         </form>
827         </div>
828     [% END %]
829 </div>
830 [% END %][%# IF (cannot_manage_basket) %]
831 </div>
832 <div class="yui-b">
833 [% INCLUDE 'acquisitions-menu.inc' %]
834 </div>
835 </div>
836 [% INCLUDE 'intranet-bottom.inc' %]