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