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