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