Bug 15685: Allow creation of items (AcqCreateItem) to be customizable per-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 |html %]) for [% booksellername|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 |html %]";
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 |html %]";
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 %]">[% booksellername|html %]</a> &rsaquo;
200     [% UNLESS ( basketno ) %][% IF ( delete_confirmed ) %]Deleted [% ELSE %]New [% END %][% END %]Basket [% basketname|html %] [% IF ( basketno ) %]([% basketno |html %])[% END %] for [% booksellername|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 [% booksellername | 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 |html %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% booksellername|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 |html %]</li>[% END %]
371                 [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote |html %]</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                 <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
427
428                 [% IF basket.create_items %]
429                     <li>
430                         <span class="label">Create items when:</span>
431                         [% SWITCH basket.create_items %]
432                             [% CASE 'receiving' %]Receiving items
433                             [% CASE 'cataloguing' %]Cataloguing items
434                             [% CASE %]Placing orders
435                         [% END %]
436                     </li>
437                 [% END %]
438
439                 </ol>
440                 </div>
441                 [% IF ( closedate ) %]
442                 <div class="yui-u">
443                     [% IF ( CAN_user_acquisition_group_manage ) %]
444                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
445                     [% END %]
446                         <ol>
447                         <li>
448                           <span class="label">Basket group:</span>
449                           [% IF basketgroup.id and not basketgroup.name %]
450                             [% SET basketgroup.name = "Basket group no. " _ basketgroup.id %]
451                           [% END %]
452                           [% IF basketgroup.closed %]
453                               [% IF ( CAN_user_acquisition_group_manage ) %]
454                                   <a href="basketgroup.pl?op=add&booksellerid=[% booksellerid %]&basketgroupid=[% basketgroup.id %]" title="basketgroup">[% basketgroup.name %] (closed)</a>
455                               [% ELSE %]
456                                   [% basketgroup.name %] (closed)
457                               [% END %]
458                           [% ELSIF ( ! CAN_user_acquisition_group_manage ) %]
459                             [%- IF basketgroup.id -%]
460                                 [% basketgroup.name %]
461                             [%- ELSE -%]
462                                 No group
463                             [%- END -%]
464                           [% ELSE %]
465                             <select id="basketgroupid" name="basketgroupid">
466                               <option value="">No group</option>
467                               [% FOREACH bg IN basketgroups %]
468                                 [% IF ( bg.default ) %]
469                                     <option value="[% bg.id %]" selected="selected">[% bg.name %]</option>
470                                 [% ELSE %]
471                                   [% UNLESS bg.closed %]
472                                     <option value="[% bg.id %]">[% bg.name %]</option>
473                                   [% ELSE %]
474                                     <option value="[% bg.id %]" disabled="disabled">[% bg.name %] (closed)</option>
475                                   [% END %]
476                                 [% END %]
477                               [% END %]
478                               <option value="new">Add new group</option>
479                             </select>
480                             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
481                             <input type="hidden" value="mod_basket" name="op" />
482                             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
483                             <input type="submit" value="Change basket group" />
484                           [% END %]
485                         </li>
486                     [% IF basketgroup.deliveryplace %]<li><span class="label">Basket group delivery placename:</span> [% Branches.GetName( basketgroup.deliveryplace ) %]</li>[% END %]
487                     [% IF basketgroup.billingplace %]<li><span class="label">Basket group billing place:</span> [% Branches.GetName( basketgroup.billingplace ) %]</li>[% END %]
488                         </ol>
489                     [% IF ( CAN_user_acquisition_group_manage ) %]
490                     </form>
491                     [% END %]
492                 </div>
493                 [% END %]
494             </div>
495             </div>
496         [% END %]
497         [% IF ( duplinbatch ) %]<div class="dialog alert">
498         <h4>Duplicate warning</h4>
499         <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>
500         </div>[% END %]
501
502         <div id="acqui_basket_content" class="yui-g">
503         [% IF ( books_loop ) %]
504         <h2>Orders</h2>
505         <label for="show_all_details">
506             <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
507             Show all details
508         </label>
509             <table id="orders">
510                 <thead>
511                     <tr>
512                         <th>No.</th>
513                         <th class="anti-the">Order</th>
514                         <th class="tax_excluded">RRP tax exc.</th>
515                         <th class="tax_excluded">ecost tax exc.</th>
516                         <th class="tax_included">RRP tax inc.</th>
517                         <th class="tax_included">ecost tax inc.</th>
518                         <th>Qty.</th>
519                         <th class="tax_excluded">Total tax exc. ([% currency %])</th>
520                         <th class="tax_included">Total tax inc. ([% currency %])</th>
521                         <th>GST %</th>
522                         <th>GST</th>
523                         <th>Fund</th>
524                         <th>Supplier report</th>
525                         [% IF ( active ) %]
526                             [% UNLESS ( closedate ) %]
527                                 <th>Modify</th>
528                                 <th>Cancel order</th>
529                             [% END %]
530                         [% END %]
531                     </tr>
532                 </thead>
533                 <tfoot>
534                 [% FOREACH foot_loo IN book_foot_loop %]
535                     <tr>
536                         <th></th>
537                         <th>Total (GST [% foot_loo.tax_rate * 100 %])</th>
538                         <th class="tax_excluded">&nbsp;</th>
539                         <th class="tax_excluded">&nbsp;</th>
540                         <th class="tax_included">&nbsp;</th>
541                         <th class="tax_included">&nbsp;</th>
542                         <th>[% foot_loo.quantity %]</th>
543                         <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
544                         <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
545                         <th>&nbsp;</th>
546                         <th>[% foot_loo.tax_value | $Price %]</th>
547                         <th>&nbsp;</th>
548                         <th>&nbsp;</th>
549                         [% IF ( active ) %]
550                             [% UNLESS ( closedate ) %]
551                                 <th>&nbsp;</th>
552                                 <th>&nbsp;</th>
553                             [% END %]
554                         [% END %]
555                     </tr>
556                 [% END %]
557                 <tr>
558                     <th></th>
559                     <th>Total ([% currency %])</th>
560                     <th class="tax_excluded">&nbsp;</th>
561                     <th class="tax_excluded">&nbsp;</th>
562                     <th class="tax_included">&nbsp;</th>
563                     <th class="tax_included">&nbsp;</th>
564                     <th>[% total_quantity %]</th>
565                     <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
566                     <th class="tax_included">[% total_tax_included | $Price %]</th>
567                     <th>&nbsp;</th>
568                     <th>[% total_tax_value | $Price %]</th>
569                     <th>&nbsp;</th>
570                     <th>&nbsp;</th>
571                     [% IF ( active ) %]
572                         [% UNLESS ( closedate ) %]
573                             <th>&nbsp;</th>
574                             <th>&nbsp;</th>
575                         [% END %]
576                     [% END %]
577                 </tr>
578                 </tfoot>
579                 <tbody>
580                 [% FOREACH books_loo IN books_loop %]
581                     [% IF ( books_loo.order_received ) %]
582                         <tr class="disabled">
583                     [% ELSE %]
584                         <tr>
585                     [% END %]
586                         <td>
587                             [% books_loo.ordernumber %]
588                         </td>
589                         <td>
590                             <p>
591                                 [% IF ( books_loo.order_received ) %] (rcvd)[% END %]
592                                 [% IF books_loo.title %]
593                                     <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 %]
594                                 [% ELSE %]
595                                     <em>Deleted bibliographic record, can't find title</em><br />
596                                 [% END %]
597                                 <br />
598                                 [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %]
599                                 [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %]
600                                 [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %]
601                                 [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear %]
602                                 [% ELSIF ( books_loo.copyrightdate ) %] [% books_loo.copyrightdate %][% END %]
603                                 [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
604                                 [% IF ( books_loo.suggestionid ) %]
605                                     <br/>
606                                     Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
607                                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&amp;op=show">suggestion #[% books_loo.suggestionid %]</a>)
608                                 [% END %]
609                             </p>
610                                 [% IF ( books_loo.order_internalnote ) %]
611                                     <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>
612                                 [% ELSE %]
613                                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=internal">Add internal note</a>]
614                                 [% END %]
615                                 [% IF ( books_loo.order_vendornote ) %]
616                                     <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>
617                                 [% ELSE %]
618                                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=vendor">Add vendor note</a>]
619                                 [% END %]
620                             [% IF (books_loo.transferred_from) %]
621                               [% basket = books_loo.transferred_from.basket %]
622                               [% bookseller = books_loo.transferred_from.bookseller %]
623                               [% timestamp = books_loo.transferred_from.timestamp %]
624                               <p>Transferred from basket:
625                                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"> [% basket.basketname %]</a>
626                                 (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a>)
627                                 on <span title="[% timestamp | $KohaDates with_hours = 1 %]">
628                                   [% timestamp | $KohaDates %]
629                                 </span>
630                               </p>
631                             [% END %]
632                         </td>
633                         [% 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 ... %]
634                         [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
635                         <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
636                         <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
637                         <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
638                         <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
639                         <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
640                         <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
641                         <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
642                         <td class="number">[% books_loo.tax_rate * 100 %]</td>
643                         <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
644                         <td>[% books_loo.budget_name %]</td>
645                         <td>[% books_loo.suppliers_report %]</td>
646                         [% IF ( active ) %]
647                             [% UNLESS ( closedate ) %]
648                             <td>
649                                 <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber %]&amp;booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Modify</a>
650                                 [% UNLESS (books_loo.order_received) %]
651                                     <br />
652                                     <a href="#" class="transfer_order" data-ordernumber="[% books_loo.ordernumber %]">Transfer</a>
653                                 [% END %]
654                             </td>
655                             <td>
656                             [% IF ( books_loo.left_holds_on_order ) %]
657                             <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>
658                             [% ELSE %]
659                             <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber %]&biblionumber=[% books_loo.biblionumber %]&basketno=[% basketno %]&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno %]" class="button">Cancel order</a><br>
660                             [% END %]
661                             [% IF ( books_loo.can_del_bib ) %]
662                             <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber %]&biblionumber=[% books_loo.biblionumber %]&basketno=[% basketno %]&del_biblio=1&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno %]" class="button">Cancel order and delete catalog record</a><br>
663                             [% ELSE %]
664                             <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
665                             [% END %]
666                             [% IF ( books_loo.left_item ) %]
667                             <b title="Can't delete catalog record, because of [% books_loo.items %] existing hold(s)" >[% books_loo.items %] item(s) left</b><br>
668                             [% END %]
669                             [% IF ( books_loo.left_biblio ) %]
670                             <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios %] order(s) left</b><br>
671                             [% END %]
672                             [% IF ( books_loo.left_subscription ) %]
673                             <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions %] subscription(s) left</b><br>
674                             [% END %]
675                             [% IF ( books_loo.left_holds ) %]
676                             <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds %] hold(s) left</b>
677                             [% END %]
678                             </td>
679                             [% END %]
680                         [% END %]
681                     </tr>
682                 [% END %]
683                 </tbody>
684             </table>
685         [% END %]
686         [% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
687         [% END %]
688         </div>
689         [% IF (cancelledorders_loop) %]
690           <div id="cancelledorders">
691             <h2>Cancelled orders</h2>
692             <table id="cancelledorderst">
693               <thead>
694                 <tr>
695                   <th>No.</th>
696                   <th>Order</th>
697                   <th class="tax_excluded">RRP tax exc.</th>
698                   <th class="tax_excluded">ecost tax exc.</th>
699                   <th class="tax_included">RRP tax inc.</th>
700                   <th class="tax_included">ecost tax inc.</th>
701                   <th>Qty.</th>
702                   <th class="tax_excluded">Total tax exc. ([% currency %])</th>
703                   <th class="tax_included">Total tax inc. ([% currency %])</th>
704                   <th>GST %</th>
705                   <th>GST</th>
706                   <th>Fund</th>
707                 </tr>
708               </thead>
709               <tbody>
710                 [% FOREACH order IN cancelledorders_loop %]
711                   <tr style="color:grey">
712                     <td>
713                         [% order.ordernumber %]
714                     </td>
715                     <td>
716                       <p>
717                         [% IF ( order.order_received ) %] (rcvd)[% END %]
718                         [% IF (order.title) %]
719                           [% order.title |html %][% IF order.author %] by [% order.author %][% END %]
720                         [% ELSE %]
721                           <em>Deleted bibliographic record, can't find title</em>
722                         [% END %]
723                         <br />
724                         [% IF ( order.order_internalnote ) %] [% order.order_internalnote %][% END %]
725                         [% IF ( order.isbn ) %] - [% order.isbn %][% END %]
726                         [% IF ( order.issn ) %] - [% order.issn %][% END %]
727                         [% IF ( order.publishercode ) %], [% order.publishercode %][% END %]
728                         [% IF ( order.publicationyear ) %], [% order.publicationyear %]
729                         [% ELSIF ( order.copyrightdate ) %] [% order.copyrightdate %][% END %]
730                         [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
731                         [% IF ( order.cancellationreason ) %]
732                           <br />
733                           Cancellation reason: [% AuthorisedValues.GetByCode( 'ORDER_CANCELLATION_REASON', order.cancellationreason ) %]
734                         [% END %]
735                       </p>
736                       [% IF order.transferred_to %]
737                         [% basket = order.transferred_to.basket %]
738                         [% bookseller = order.transferred_to.bookseller %]
739                         [% timestamp = order.transferred_to.timestamp %]
740                         <p>Transferred to basket:
741                           <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"> [% basket.basketname %]</a>
742                           (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a>)
743                           on <span title="[% timestamp | $KohaDates with_hours = 1%]">
744                             [% timestamp | $KohaDates %]
745                           </span>
746                         </p>
747                       [% END %]
748                     </td>
749                     <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
750                     <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
751                     <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
752                     <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
753                     <td class="number">[% order.quantity %]</td>
754                     <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
755                     <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
756                     <td class="number">[% order.tax_rate * 100 %]</td>
757                     <td class="number">[% order.tax_value | $Price %]</td>
758                     <td>[% order.budget_name %]
759                   </tr>
760                 [% END %]
761               </tbody>
762             </table>
763           </div>
764         [% END %]
765         <br />
766         [% UNLESS ( closedate ) %]
767
768     <!-- Modal -->
769     <div id="addtoBasket" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel" aria-hidden="true">
770         <div class="modal-dialog">
771         <div class="modal-content">
772         <div class="modal-body">
773         [% IF active %]
774             [% INCLUDE 'acquisitions-add-to-basket.inc' %]
775         [% END %]
776         </div>
777         <div class="modal-footer">
778             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
779         </div>
780         </div>
781         </div>
782     </div>
783
784         [% END %]
785
786 [% END %]
787 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
788     [% END %]
789 [% IF ( confirm_close ) %]
790         <div id="closebasket_needsconfirmation" class="dialog alert">
791
792         <form action="/cgi-bin/koha/acqui/basket.pl">
793             <h1>Are you sure you want to close basket [% basketname|html %]?</h1>
794             [% IF ( CAN_user_acquisition_group_manage ) %]
795             <p>
796             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
797             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
798             </p>
799             [% END %]
800             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
801             <input type="hidden" value="close" name="op" />
802             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
803             <input type="hidden" name="confirm" value="1" />
804             <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" />
805             <button type="submit" class="approve" accesskey="y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
806         </form>
807         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
808             <input type="hidden" name="basketno" value="[% basketno %]" />
809             <button type="submit" class="deny" accesskey="n"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
810         </form>
811         </div>
812     [% END %]
813 [% IF edi_confirm %]
814         <div id="closebasket_needsconfirmation" class="dialog alert">
815
816         <form action="/cgi-bin/koha/acqui/basket.pl">
817             <h1>Are you sure you want to generate an EDIFACT order and close basket [% basketname|html %]?</h1>
818             [% IF CAN_user_acquisition_group_manage %]
819             <p>
820             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
821             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
822             </p>
823             [% END %]
824             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
825             <input type="hidden" value="ediorder" name="op" />
826             <input type="hidden" name="ean" value="[% ean %]" />
827             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
828             <input type="hidden" name="confirm" value="1" />
829             <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" />
830             <button type="submit" class="approve" accesskey="Y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
831         </form>
832         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
833             <input type="hidden" name="basketno" value="[% basketno %]" />
834             <button type="submit" class="deny" accesskey="N"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
835         </form>
836         </div>
837     [% END %]
838 </div>
839 [% END %][%# IF (cannot_manage_basket) %]
840 </div>
841 <div class="yui-b">
842 [% INCLUDE 'acquisitions-menu.inc' %]
843 </div>
844 </div>
845 [% INCLUDE 'intranet-bottom.inc' %]