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