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