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