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