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