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