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