Bug 7162: Factorize code for order cancellation
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basket.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
4 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript">
8 //<![CDATA[
9     function updateColumnsVisibility(visible) {
10         if ( visible ) {
11             $("table .gste, .gsti").show();
12         } else {
13             [% IF ( listincgst ) %]
14                 $("table .gste").hide();
15             [% ELSE %]
16                 $("table .gsti").hide();
17             [% END %]
18         }
19     }
20
21     $(document).ready(function() {
22         $("#show_all_details").click(function(){
23             updateColumnsVisibility($(this+":checked").val());
24         });
25
26         $("#show_all_details").attr('checked', false);
27         updateColumnsVisibility(false);
28         [% UNLESS ( closedate ) %]
29             $('#addtoBasket').on('show', function () {
30                $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML);
31             });
32         [% END %]
33     });
34 //]]>
35 </script>
36
37 [% UNLESS ( closedate ) %]
38 <script type="text/javascript">
39 //<![CDATA[
40             function confirm_close() {
41                 var is_confirmed = confirm(_("Are you sure you want to close this basket?"));
42                 if (is_confirmed) {
43                     window.location = "[% script_name %]?op=close&basketno=[% basketno %]";
44                 }
45             }
46
47             function delete_basket(basketno,booksellerid,delbiblio) {
48                 window.location = "[% script_name %]?op=delete_confirm&delbiblio="+delbiblio+"&basketno="+basketno+"&booksellerid="+booksellerid;
49             }
50
51             function transfer_order_popup(ordernumber) {
52                 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
53                     + "ordernumber=" + ordernumber
54                 window.open(url, 'TransferOrder','width=600,height=400,toolbar=false,scrollbars=yes');
55             }
56
57 //]]>
58 </script>
59 [% ELSE %]
60 <script type="text/javascript">
61 //<![CDATA[
62     $(document).ready(function(){
63         $("#basketgroupid").change(function(){
64             if($(this).val() == "new"){
65                 location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid %]";
66             }
67         });
68     });
69 //]]>
70 </script>
71 [% UNLESS ( grouped ) %]
72 <script type="text/javascript">
73 //<![CDATA[
74             function confirm_reopen() {
75                 var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %];
76                 var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?"));
77                 if (is_confirmed) {
78                     window.location = "[% script_name %]?op=reopen&basketno=[% basketno %]";
79                 }
80             }
81 //]]>
82 </script>
83 [% END %]
84 [% END %]
85 <script type="text/javascript">
86 //<![CDATA[
87     $(document).ready(function() {
88         var orderst = $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, {
89             "sPaginationType": "four_button",
90             [% IF ( active ) %]
91               [% UNLESS ( closedate ) %]
92                 "aoColumnDefs": [
93                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
94                 ],
95               [% END %]
96             [% END %]
97         } ) );
98         var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
99             "sPaginationType": "four_button"
100         } ) );
101         $("#reopenbutton").on("click",function(e){
102             e.preventDefault();
103             confirm_reopen();
104         });
105     });
106
107     function basketUserSearchPopup(f) {
108         window.open(
109             "/cgi-bin/koha/acqui/aqbasketuser_search.pl",
110             'BasketUserSearchPopup',
111             'width=740,height=450,toolbar=no,'
112          );
113     }
114
115     function add_basket_user(borrowernumber, borrowername) {
116         var ids = $("#basketusers_ids").val();
117         if(ids.length > 0) {
118             ids = ids.split(':');
119         } else {
120             ids = new Array;
121         }
122         if (ids.indexOf(borrowernumber) < 0) {
123             ids.push(borrowernumber);
124             $("#basketusers_ids").val(ids.join(':'));
125             var li = '<li id="user_'+borrowernumber+'">'+borrowername
126                 + ' [<a style="cursor:pointer" onclick="del_basket_user('+borrowernumber+');">'
127                 + _("Delete user") + '</a>]</li>';
128             $("#basketusers_names").append(li);
129             return 0;
130         }
131         return -1;
132     }
133
134     function del_basket_user(borrowernumber) {
135       $("#user_"+borrowernumber).remove();
136       var ids = $("#basketusers_ids").val().split(':');
137       ids.splice(ids.indexOf(borrowernumber.toString()), 1);
138       $("#basketusers_ids").val(ids.join(':'));
139     }
140 //]]>
141 </script>
142 <style type="text/css">
143 .sortmsg {font-size: 80%;}
144 </style>
145 </head>
146 <body id="acq_basket" class="acq">
147 [% INCLUDE 'header.inc' %]
148 [% INCLUDE 'acquisitions-search.inc' %]
149
150
151 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a> &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</div>
152
153 <div id="doc3" class="yui-t2">
154
155 <div id="bd">
156     <div id="yui-main">
157     [% IF (cannot_manage_basket) %]
158         <div class="yui-b">
159             <p class="error">You are not authorised to manage this basket.</p>
160         </div>
161     [% ELSE %]
162     <div class="yui-b">
163         [% UNLESS ( confirm_close ) %]
164         [% UNLESS ( selectbasketg ) %]
165             [% UNLESS ( closedate ) %]
166                 <div id="toolbar" class="btn-toolbar">
167                     <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-plus"></i> Add to basket</a></div>
168                     <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="btn btn-small" id="basketheadbutton"><i class="icon-pencil"></i> Edit basket</a></div>
169                     <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-small" data-toggle="modal" id="delbasketbutton"><i class="icon-remove"></i> Delete this basket</a></div>
170                    [% IF ( unclosable ) %]
171                     [% ELSIF ( uncertainprices ) %]
172                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="btn btn-small" id="uncertpricesbutton">Uncertain prices</a></div>
173                     [% ELSE %]
174                         <div class="btn-group">
175                             <a href="[% script_name %]?op=close&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="closebutton"><i class="icon-remove-sign"></i> Close this basket</a>
176                         </div>
177                     [% END %]
178                         <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
179                 </div>
180 <!-- Modal for confirm deletion box-->
181                 <div class="modal hide" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
182                     <div class="modal-header">
183                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
184                         <h3>Confirm deletion</h3>
185                     </div>
186                     [% UNLESS book_foot_loop.size > 0 %]
187                         <div class="modal-body">
188                            <p>Are you sure you want to delete this basket?</p>
189                         </div>
190                         <div class="modal-footer">
191                             <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
192                             <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket</button>
193                         </div>
194                     [% ELSE %]
195                         <div class="modal-body">
196                            <p>Are you sure you want to delete this basket?</p>
197                            <p>Warning:</p>
198                            <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
199                            <p>If items have been created when ordering or receiving, they will be deleted.</p>
200                            <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>
201                         </div>
202                         <div class="modal-footer">
203                             <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
204                             <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;">Delete basket and orders</button>
205                             <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and bibs</button>
206                         </div>
207                     [% END %]
208                 </div>
209 <!-- End of Modal-->
210             [% ELSE %]
211                 [% UNLESS ( grouped ) %]
212                 <div id="toolbar" class="btn-toolbar">
213                     <div class="btn-group"><a href="#" class="btn btn-small" id="reopenbutton"><i class="icon-refresh"></i> Reopen this basket</a></div>
214                     <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
215                 </div>
216                 [% END %]
217             [% END %]
218             [% END %]
219
220     [% IF ( NO_BOOKSELLER ) %]
221     <h2>Vendor not found</h2>
222     [% ELSE %]
223         [% IF ( delete_confirmed ) %]
224             <h3>Basket deleted</h3>
225             [% IF (cannotdelbiblios) %]
226                 <div class="dialog alert">
227                     <p><strong>Warning:</strong></p>
228                     <p><strong>The following records could not be deleted:</strong></p>
229                     <ul>
230                     [% FOREACH cannotdelbiblio IN cannotdelbiblios %]
231                         <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cannotdelbiblio.biblionumber %]">[% cannotdelbiblio.title |html %]</a> by [% cannotdelbiblio.author %]:
232                             <ul>
233                             [% IF (cannotdelbiblio.itemcount) %]<li>[% cannotdelbiblio.itemcount %] item(s) attached.</li>[% END %]
234                             [% IF (cannotdelbiblio.subscriptions) %]<li>[% cannotdelbiblio.subscriptions %] subscription(s) attached.</li>[% END %]
235                             [% IF (cannotdelbiblio.countbiblio) %]<li>[% cannotdelbiblio.countbiblio %] order(s) attached.</li>[% END %]
236                             [% IF (cannotdelbiblio.othererror) %]<li>Unknown error.</li>[% END %]
237                             </ul>
238                         </li>
239                     [% END %]
240                     </ul>
241                 </div>
242                 <a href="booksellers.pl">Click here to go back to booksellers page</a>
243             [% ELSE %]
244             <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
245             [% END %]
246         [% ELSE %]
247         <h1>[% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
248         [% IF ( delete_confirm ) %]
249             <h2>
250             <span class="yui-button yui-link-button">
251             <em class="first-child">
252                 <a href="[% script_name %]?op=delete_confirm&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="yui-link-button">Yes, delete this basket!</a>
253             </em>
254             </span>
255             <span class="yui-button yui-link-button">
256             <em class="first-child">
257                 <a href="[% script_name %]?basketno=[% basketno %]" class="yui-link-button">Cancel</a>
258             </em>
259             </span>
260             </h2>
261         [% END %]
262         [% IF ( basketno ) %]
263             <div id="acqui_basket_summary" class="yui-g">
264                 <div class="rows">
265                 <div class="yui-u first">
266                 <ol>
267                 [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote %]</li>[% END %]
268                 [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote %]</li>[% END %]
269                 [% IF ( basketcontractno ) %]
270                     <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
271                 [% END %]
272                 [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
273                 [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
274                 [% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span>  [% authorisedbyname %]</li>[% END %]
275                 <li id="managedby">
276                     <form action="" method="post">
277                         <span class="label">Managed by:</span>
278                         <div style="float:left">
279                             <ul id="basketusers_names" style="padding-left:0">
280                               [% FOREACH user IN basketusers %]
281                                 <li id="user_[% user.borrowernumber %]">
282                                     [% user.firstname %] [% user.surname %]
283                                     [<a onclick="del_basket_user([% user.borrowernumber %]);" style="cursor:pointer">Delete user</a>]
284                                 </li>
285                               [% END %]
286                             </ul>
287                             <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
288                             <input type="hidden" id="basketusers_ids" name="basketusers_ids" value="[% basketusers_ids %]" />
289                             <input type="hidden" id="op" name="op" value="mod_users" />
290                             <input type="button" id="add_user" onclick="basketUserSearchPopup();" value="Add user" />
291                             <input type="submit" value="Save changes" />
292                         </div>
293                     </form>
294                 </li>
295                 <li id="branch">
296                     <span class="label">Branch:</span>
297                     [% IF basketbranchname %]
298                         [% basketbranchname %]
299                     [% ELSE %]
300                         No branch
301                     [% END %]
302                     [% IF branches_loop.size %]
303                         <form action="" method="post">
304                             <select id="branch" name="branch">
305                                 <option value="">(no branch)</option>
306                                 [% FOREACH branch IN branches_loop %]
307                                     [% IF (branch.selected) %]
308                                         <option selected="selected" value="[% branch.branchcode %]"> [% branch.branchname %]</option>
309                                     [% ELSE %]
310                                         <option value="[% branch.branchcode %]"> [% branch.branchname %]</option>
311                                     [% END %]
312                                 [% END %]
313                             </select>
314                             <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" />
315                             <input type="hidden" id="op" name="op" value="mod_branch" />
316                             <input type="submit" value="Change" />
317                         </form>
318                     [% END %]
319                 </li>
320                 [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
321                 [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
322                 [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
323
324                 </ol>
325                 </div>
326                 [% IF ( closedate ) %]
327                 <div class="yui-u">
328                     [% IF ( CAN_user_acquisition_group_manage ) %]
329                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
330                     [% END %]
331                         <ol>
332                         <li>
333                           <span class="label">Basket group:</span>
334                           [% IF basketgroup.id and not basketgroup.name %]
335                             [% SET basketgroup.name = "Basket group no. " _ basketgroup.id %]
336                           [% END %]
337                           [% IF basketgroup.closed %]
338                               [% IF ( CAN_user_acquisition_group_manage ) %]
339                                   <a href="basketgroup.pl?op=add&booksellerid=[% booksellerid %]&basketgroupid=[% basketgroup.id %]" title="basketgroup">[% basketgroup.name %] (closed)</a>
340                               [% ELSE %]
341                                   [% basketgroup.name %] (closed)
342                               [% END %]
343                           [% ELSIF ( ! CAN_user_acquisition_group_manage ) %]
344                             [%- IF basketgroup.id -%]
345                                 [% basketgroup.name %]
346                             [%- ELSE -%]
347                                 No group
348                             [%- END -%]
349                           [% ELSE %]
350                             <select id="basketgroupid" name="basketgroupid">
351                               <option value="">No group</option>
352                               [% FOREACH bg IN basketgroups %]
353                                 [% IF ( bg.default ) %]
354                                     <option value="[% bg.id %]" selected="selected">[% bg.name %]</option>
355                                 [% ELSE %]
356                                   [% UNLESS bg.closed %]
357                                     <option value="[% bg.id %]">[% bg.name %]</option>
358                                   [% ELSE %]
359                                     <option value="[% bg.id %]" disabled="disabled">[% bg.name %] (closed)</option>
360                                   [% END %]
361                                 [% END %]
362                               [% END %]
363                               <option value="new">Add new group</option>
364                             </select>
365                             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
366                             <input type="hidden" value="mod_basket" name="op" />
367                             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
368                             <input type="submit" value="Change basket group" />
369                           [% END %]
370                         </li>
371                     [% IF ( basketgroup.deliveryplacename ) %]<li><span class="label">Basket group delivery placename:</span> [% basketgroup.deliveryplacename %]</li>[% END %]
372                     [% IF ( basketgroup.billingplacename ) %]<li><span class="label">Basket group billing place:</span> [% basketgroup.billingplacename %]</li>[% END %]
373                         </ol>
374                     [% IF ( CAN_user_acquisition_group_manage ) %]
375                     </form>
376                     [% END %]
377                 </div>
378                 [% END %]
379             </div>
380             </div>
381         [% END %]
382
383         [% UNLESS ( delete_confirm ) %]
384         <div id="acqui_basket_content" class="yui-g">
385         [% IF ( books_loop ) %]
386         <h2>Orders</h2>
387         <label for="show_all_details">
388             <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
389             Show all details
390         </label>
391             <table id="orders">
392                 <thead>
393                     <tr>
394                         <th>No.</th>
395                         <th>Order</th>
396                         <th class="gste">RRP tax exc.</th>
397                         <th class="gste">ecost tax exc.</th>
398                         <th class="gsti">RRP tax inc.</th>
399                         <th class="gsti">ecost tax inc.</th>
400                         <th>Qty.</th>
401                         <th class="gste">Total tax exc. ([% currency %])</th>
402                         <th class="gsti">Total tax inc. ([% currency %])</th>
403                         <th>GST %</th>
404                         <th>GST</th>
405                         <th>Fund</th>
406                         [% IF ( active ) %]
407                             [% UNLESS ( closedate ) %]
408                                 <th>Modify</th>
409                                 <th>Delete</th>
410                             [% END %]
411                         [% END %]
412                     </tr>
413                 </thead>
414                 <tfoot>
415                 [% FOREACH foot_loo IN book_foot_loop %]
416                     <tr>
417                         <th></th>
418                         <th>Total (GST [% foot_loo.gstgsti %])</th>
419                         <th class="gste">&nbsp;</th>
420                         <th class="gste">&nbsp;</th>
421                         <th class="gsti">&nbsp;</th>
422                         <th class="gsti">&nbsp;</th>
423                         <th>[% foot_loo.quantity %]</th>
424                         <th class="gste">[% foot_loo.totalgste %]</th>
425                         <th class="gsti">[% foot_loo.totalgsti %]</th>
426                         <th>&nbsp;</th>
427                         <th>[% foot_loo.gstvalue %]</th>
428                         <th>&nbsp;</th>
429                         [% IF ( active ) %]
430                             [% UNLESS ( closedate ) %]
431                                 <th>&nbsp;</th>
432                                 <th>&nbsp;</th>
433                             [% END %]
434                         [% END %]
435                     </tr>
436                 [% END %]
437                 <tr>
438                     <th></th>
439                     <th>Total ([% currency %])</th>
440                     <th class="gste">&nbsp;</th>
441                     <th class="gste">&nbsp;</th>
442                     <th class="gsti">&nbsp;</th>
443                     <th class="gsti">&nbsp;</th>
444                     <th>[% total_quantity %]</th>
445                     <th class="gste">[% total_gste %]</th>
446                     <th class="gsti">[% total_gsti %]</th>
447                     <th>&nbsp;</th>
448                     <th>[% total_gstvalue %]</th>
449                     <th>&nbsp;</th>
450                     [% IF ( active ) %]
451                         [% UNLESS ( closedate ) %]
452                             <th>&nbsp;</th>
453                             <th>&nbsp;</th>
454                         [% END %]
455                     [% END %]
456                 </tr>
457                 </tfoot>
458                 <tbody>
459                 [% FOREACH books_loo IN books_loop %]
460                     [% IF ( books_loo.order_received ) %]<tr class="disabled">[% ELSE %][% IF ( books_loo.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %][% END %]
461                         <td>
462                             [% books_loo.ordernumber %]
463                         </td>
464                         <td>
465                             <p>
466                                 [% IF ( books_loo.order_received ) %] (rcvd)[% END %]
467                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber %]">[% books_loo.title |html %]</a> by [% books_loo.author %]
468                                 <br />
469                                 [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %]
470                                 [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %]
471                                 [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %]
472                                 [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear %][% END %]
473                                 [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
474                                 [% IF ( books_loo.suggestionid ) %]
475                                     <br/>
476                                     Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
477                                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&amp;op=show">suggestion #[% books_loo.suggestionid %]</a>)
478                                 [% END %]
479                             </p>
480                                 [% IF ( books_loo.order_internalnote ) %]
481                                     <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>
482                                 [% ELSE %]
483                                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=internal">Add internal note</a>]
484                                 [% END %]
485                                 [% IF ( books_loo.order_vendornote ) %]
486                                     <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>
487                                 [% ELSE %]
488                                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]&type=vendor">Add vendor note</a>]
489                                 [% END %]
490                             [% IF (books_loo.transferred_from) %]
491                               [% basket = books_loo.transferred_from.basket %]
492                               [% bookseller = books_loo.transferred_from.bookseller %]
493                               [% timestamp = books_loo.transferred_from.timestamp %]
494                               <p>Transferred from
495                                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">basket: [% basket.basketname %]</a>
496                                 (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a>)
497                                 on <span title="[% timestamp | $KohaDates with_hours = 1 %]">
498                                   [% timestamp | $KohaDates %]
499                                 </span>
500                               </p>
501                             [% END %]
502                         </td>
503                         [% 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 ... %]
504                         [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
505                         <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste %]</td>
506                         <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste %]</td>
507                         <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti %]</td>
508                         <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti %]</td>
509                         <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
510                         <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste %]</td>
511                         <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti %]</td>
512                         <td class="number [% IF books_loo.gstgsti.search(zero_regex) %]error[% END %]">[% books_loo.gstgsti %]</td>
513                         <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue %]</td>
514                         <td>[% books_loo.budget_name %]</td>
515                         [% IF ( active ) %]
516                             [% UNLESS ( closedate ) %]
517                             <td>
518                                 <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber %]&amp;booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Modify</a>
519                                 [% UNLESS (books_loo.order_received) %]
520                                     <br />
521                                     <a href="#" onclick="transfer_order_popup([% books_loo.ordernumber %]); return false;">Transfer</a>
522                                 [% END %]
523                             </td>
524                             <td>
525                             [% IF ( books_loo.left_holds_on_order ) %]
526                             <span class="button" title="Can't delete order, ([% books_loo.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br>
527                             [% ELSE %]
528                             <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">Delete order</a><br>
529                             [% END %]
530                             [% IF ( books_loo.can_del_bib ) %]
531                             <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">Delete order and catalog record</a><br>
532                             [% ELSE %]
533                             <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br>
534                             [% END %]
535                             [% IF ( books_loo.left_item ) %]
536                             <b title="Can't delete catalog record, because of [% books_loo.items %] existing hold(s)" >[% books_loo.items %] item(s) left</b><br>
537                             [% END %]
538                             [% IF ( books_loo.left_biblio ) %]
539                             <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios %] order(s) left</b><br>
540                             [% END %]
541                             [% IF ( books_loo.left_subscription ) %]
542                             <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions %] subscription(s) left</b><br>
543                             [% END %]
544                             [% IF ( books_loo.left_holds ) %]
545                             <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds %] hold(s) left</b>
546                             [% END %]
547                             </td>
548                             [% END %]
549                         [% END %]
550                     </tr>
551                 [% END %]
552                 </tbody>
553             </table>
554         [% END %]
555         [% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
556         [% END %]
557         </div>
558         [% IF (cancelledorders_loop) %]
559           <div id="cancelledorders">
560             <h2>Cancelled orders</h2>
561             <table id="cancelledorderst">
562               <thead>
563                 <tr>
564                   <th>No.</th>
565                   <th>Order</th>
566                   <th class="gste">RRP tax exc.</th>
567                   <th class="gste">ecost tax exc.</th>
568                   <th class="gsti">RRP tax inc.</th>
569                   <th class="gsti">ecost tax inc.</th>
570                   <th>Qty.</th>
571                   <th class="gste">Total tax exc. ([% currency %])</th>
572                   <th class="gsti">Total tax inc. ([% currency %])</th>
573                   <th>GST %</th>
574                   <th>GST</th>
575                   <th>Fund</th>
576                 </tr>
577               </thead>
578               <tbody>
579                 [% FOREACH order IN cancelledorders_loop %]
580                   <tr style="color:grey">
581                     <td>
582                         [% order.ordernumber %]
583                     </td>
584                     <td>
585                       <p>
586                         [% IF ( order.order_received ) %] (rcvd)[% END %]
587                         [% IF (order.title) %]
588                           [% order.title |html %] by [% order.author %]<br />
589                         [% ELSE %]
590                           <em>Deleted bibliographic record, can't find title</em><br />
591                         [% END %]
592                         [% IF ( order.order_internalnote ) %] [% order.order_internalnote %][% END %]
593                         [% IF ( order.isbn ) %] - [% order.isbn %][% END %]
594                         [% IF ( order.issn ) %] - [% order.issn %][% END %]
595                         [% IF ( order.publishercode ) %], [% order.publishercode %][% END %]
596                         [% IF ( order.publicationyear ) %], [% order.publicationyear %][% END %]
597                         [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
598                       </p>
599                       [% IF order.transferred_to %]
600                         [% basket = order.transferred_to.basket %]
601                         [% bookseller = order.transferred_to.bookseller %]
602                         [% timestamp = order.transferred_to.timestamp %]
603                         <p>Transferred to
604                           <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">basket: [% basket.basketname %]</a>
605                           (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a>)
606                           on <span title="[% timestamp | $KohaDates with_hours = 1%]">
607                             [% timestamp | $KohaDates %]
608                           </span>
609                         </p>
610                       [% END %]
611                     </td>
612                     <td class="number gste">[% order.rrpgste %]</td>
613                     <td class="number gste">[% order.ecostgste %]</td>
614                     <td class="number gsti">[% order.rrpgsti %]</td>
615                     <td class="number gsti">[% order.ecostgsti %]</td>
616                     <td class="number">[% order.quantity %]</td>
617                     <td class="number gste">[% order.totalgste %]</td>
618                     <td class="number gsti">[% order.totalgsti %]</td>
619                     <td class="number">[% order.gstgsti %]</td>
620                     <td class="number">[% order.gstvalue %]</td>
621                     <td>[% order.budget_name %]
622                   </tr>
623                 [% END %]
624               </tbody>
625             </table>
626           </div>
627         [% END %]
628         <br />
629         [% UNLESS ( closedate ) %]
630
631     <!-- Modal -->
632     <div id="addtoBasket" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel" aria-hidden="true">
633         <div class="modal-body"></div>
634         <div class="modal-footer">
635             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
636         </div>
637     </div>
638
639         [% INCLUDE 'acquisitions-add-to-basket.inc' %]
640         [% END %]
641         [% END %]
642 [% END %]
643 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
644     [% END %]
645 [% IF ( confirm_close ) %]
646         <div id="closebasket_needsconfirmation" class="dialog alert">
647
648         <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm">
649             <h1>Are you sure you want to close basket [% basketname|html %]?</h1>
650             [% IF ( CAN_user_acquisition_group_manage ) %]
651             <p>
652             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
653             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
654             </p>
655             [% END %]
656             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
657             <input type="hidden" value="close" name="op" />
658             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
659             <input type="hidden" name="confirm" value="1" />
660             <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" />
661             <input type="submit" class="approve" value="Yes, close (Y)" accesskey="y" />
662             <input type="submit" class="deny" value="No, don't close (N)" accesskey="n" onclick="javascript:window.location='/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]';return false;" />
663         </form>
664         </div>
665     [% END %]
666 </div>
667 [% END %][%# IF (cannot_manage_basket) %]
668 </div>
669 <div class="yui-b">
670 [% INCLUDE 'acquisitions-menu.inc' %]
671 </div>
672 </div>
673 [% INCLUDE 'intranet-bottom.inc' %]