Bug 18639: Add replacementprice field to acquisitions workflow
[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 | html %]?op=export&amp;basketno=[% basketno | html %]&amp;booksellerid=[% booksellerid | html %]"><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 [% SET footerjs = 1 %]
22 [% INCLUDE 'doc-head-open.inc' %]
23 <title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %]Basket [% basketname | html %] ([% basketno | html %]) for [% booksellername | html %]</title>
24 [% Asset.css("css/datatables.css") | $raw %]
25 [% INCLUDE 'doc-head-close.inc' %]
26 <style type="text/css">
27     .sortmsg {font-size: 80%;}
28 </style>
29 </head>
30
31 <body id="acq_basket" class="acq">
32 [% INCLUDE 'header.inc' %]
33 [% INCLUDE 'acquisitions-search.inc' %]
34
35
36 <div id="breadcrumbs">
37     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
38     <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
39     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo;
40     [% UNLESS ( basketno ) %][% IF ( delete_confirmed ) %]Deleted [% ELSE %]New [% END %][% END %]Basket [% basketname | html %] [% IF ( basketno ) %]([% basketno | html %])[% END %] for [% booksellername | html %]
41 </div>
42
43 <div id="doc3" class="yui-t2">
44
45 <div id="bd">
46     <div id="yui-main">
47     [% IF (cannot_manage_basket) %]
48         <div class="yui-b">
49             <p class="error">You are not authorised to manage this basket.</p>
50         </div>
51     [% ELSE %]
52     <div class="yui-b">
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 | html %]&amp;basketno=[% basketno | html %]&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 | html %]&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 | html %]&amp;booksellerid=[% booksellerid | html %]" 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 | html %]&amp;booksellerid=[% booksellerid | html %]" 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 | html %]">[% 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 | html %]" 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 | html %]">[% booksellername | html %]</a></h1>
208         [% IF ( basketno ) %]
209             <div id="acqui_basket_summary" class="yui-g">
210                 <div class="rows">
211                 <div class="yui-u first">
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 | html %]&amp;booksellerid=[% booksellerid | html %]">[% 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="" 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                             </ul>
233                             <input type="hidden" id="basketno" name="basketno" value="[% basketno | html %]" />
234                             <input type="hidden" id="users_ids" name="users_ids" value="[% users_ids | html %]" />
235                             <input type="hidden" id="op" name="op" value="mod_users" />
236                             <input type="button" id="add_user" value="Add user" />
237                             <input type="submit" value="Save changes" />
238                         </div>
239                     </form>
240                 </li>
241                 <li id="branch">
242                     <span class="label">Library:</span>
243                     [% IF basketbranchcode %]
244                         [% Branches.GetName( basketbranchcode ) | html %]
245                     [% ELSE %]
246                         No library
247                     [% END %]
248                     [% IF branches_loop.size %]
249                         <form action="" method="post">
250                             <select id="branch" name="branch">
251                                 <option value="">(no library)</option>
252                                 [% FOREACH branch IN branches_loop %]
253                                     [% IF (branch.selected) %]
254                                         <option selected="selected" value="[% branch.branchcode | html %]"> [% branch.branchname | html %]</option>
255                                     [% ELSE %]
256                                         <option value="[% branch.branchcode | html %]"> [% branch.branchname | html %]</option>
257                                     [% END %]
258                                 [% END %]
259                             </select>
260                             <input type="hidden" id="basketno" name="basketno" value="[% basketno | html %]" />
261                             <input type="hidden" id="op" name="op" value="mod_branch" />
262                             <input type="submit" value="Change" />
263                         </form>
264                     [% END %]
265                 </li>
266                 [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
267                 [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
268                 [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates | html %]</li>[% END %]
269                 <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
270
271                 [% IF basket.create_items %]
272                     <li>
273                         <span class="label">Create items when:</span>
274                         [% SWITCH basket.create_items %]
275                             [% CASE 'receiving' %]Receiving items
276                             [% CASE 'cataloguing' %]Cataloguing items
277                             [% CASE %]Placing orders
278                         [% END %]
279                     </li>
280                 [% END %]
281
282                 </ol>
283                 </div>
284                 [% IF ( closedate ) %]
285                 <div class="yui-u">
286                     [% IF ( CAN_user_acquisition_group_manage ) %]
287                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
288                     [% END %]
289                         <ol>
290                         <li>
291                           <span class="label">Basket group:</span>
292                           [% IF basketgroup.id and not basketgroup.name %]
293                             [% SET basketgroup.name = "Basket group no. " _ basketgroup.id %]
294                           [% END %]
295                           [% IF basketgroup.closed %]
296                               [% IF ( CAN_user_acquisition_group_manage ) %]
297                                   <a href="basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]&basketgroupid=[% basketgroup.id | html %]" title="basketgroup">[% basketgroup.name | html %] (closed)</a>
298                               [% ELSE %]
299                                   [% basketgroup.name | html %] (closed)
300                               [% END %]
301                           [% ELSIF ( ! CAN_user_acquisition_group_manage ) %]
302                             [%- IF basketgroup.id -%]
303                                 [% basketgroup.name | html %]
304                             [%- ELSE -%]
305                                 No group
306                             [%- END -%]
307                           [% ELSE %]
308                             <select id="basketgroupid" name="basketgroupid">
309                               <option value="">No group</option>
310                               [% FOREACH bg IN basketgroups %]
311                                 [% IF ( bg.default ) %]
312                                     <option value="[% bg.id | html %]" selected="selected">[% bg.name | html %]</option>
313                                 [% ELSE %]
314                                   [% UNLESS bg.closed %]
315                                     <option value="[% bg.id | html %]">[% bg.name | html %]</option>
316                                   [% ELSE %]
317                                     <option value="[% bg.id | html %]" disabled="disabled">[% bg.name | html %] (closed)</option>
318                                   [% END %]
319                                 [% END %]
320                               [% END %]
321                               <option value="new">Add new group</option>
322                             </select>
323                             <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
324                             <input type="hidden" value="mod_basket" name="op" />
325                             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
326                             <input type="submit" value="Change basket group" />
327                           [% END %]
328                         </li>
329                     [% IF basketgroup.deliveryplace %]<li><span class="label">Basket group delivery placename:</span> [% Branches.GetName( basketgroup.deliveryplace ) | html %]</li>[% END %]
330                     [% IF basketgroup.billingplace %]<li><span class="label">Basket group billing place:</span> [% Branches.GetName( basketgroup.billingplace ) | html %]</li>[% END %]
331                         </ol>
332                     [% IF ( CAN_user_acquisition_group_manage ) %]
333                     </form>
334                     [% END %]
335                 </div>
336                 [% END %]
337             </div>
338             </div>
339         [% END %]
340         [% IF ( duplinbatch ) %]<div class="dialog alert">
341         <h4>Duplicate warning</h4>
342         <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 | html %]&amp;basketno=[% basketno | html %]&amp;booksellerid=[% booksellerid | html %]" title="Open in new window" target="_blank" class="popup" style="margin-left:10px">Display them</a></p>
343         </div>[% END %]
344
345         <div id="acqui_basket_content" class="yui-g">
346         [% IF ( books_loop ) %]
347         <h2>Orders</h2>
348         <label for="show_all_details">
349             <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
350             Show all details
351         </label>
352             <table id="orders">
353                 <thead>
354                     <tr>
355                         <th>No.</th>
356                         <th class="anti-the">Order</th>
357                         <th class="tax_excluded">RRP tax exc.</th>
358                         <th class="tax_excluded">ecost tax exc.</th>
359                         <th class="tax_included">RRP tax inc.</th>
360                         <th class="tax_included">ecost tax inc.</th>
361                         <th class="replacementprice">Replacement price</th>
362                         <th>Qty.</th>
363                         <th class="tax_excluded">Total tax exc. ([% currency | html %])</th>
364                         <th class="tax_included">Total tax inc. ([% currency | html %])</th>
365                         <th>GST %</th>
366                         <th>GST</th>
367                         <th>Fund</th>
368                         <th>Supplier report</th>
369                         [% IF ( active ) %]
370                             [% UNLESS ( closedate ) %]
371                                 <th>Modify</th>
372                                 <th>Cancel order</th>
373                             [% END %]
374                         [% END %]
375                     </tr>
376                 </thead>
377                 <tfoot>
378                 [% FOREACH foot_loo IN book_foot_loop %]
379                     <tr>
380                         <th></th>
381                         <th>Total (GST [% foot_loo.tax_rate * 100 | html %])</th>
382                         <th class="tax_excluded">&nbsp;</th>
383                         <th class="tax_excluded">&nbsp;</th>
384                         <th class="tax_included">&nbsp;</th>
385                         <th class="tax_included">&nbsp;</th>
386                         <th class="replacementprice">&nbsp;</th>
387                         <th>[% foot_loo.quantity | html %]</th>
388                         <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price | html %]</th>
389                         <th class="tax_included">[% foot_loo.total_tax_included | $Price | html %]</th>
390                         <th>&nbsp;</th>
391                         <th>[% foot_loo.tax_value | $Price | html %]</th>
392                         <th>&nbsp;</th>
393                         <th>&nbsp;</th>
394                         [% IF ( active ) %]
395                             [% UNLESS ( closedate ) %]
396                                 <th>&nbsp;</th>
397                                 <th>&nbsp;</th>
398                             [% END %]
399                         [% END %]
400                     </tr>
401                 [% END %]
402                 <tr>
403                     <th></th>
404                     <th>Total ([% currency | html %])</th>
405                     <th class="tax_excluded">&nbsp;</th>
406                     <th class="tax_excluded">&nbsp;</th>
407                     <th class="tax_included">&nbsp;</th>
408                     <th class="tax_included">&nbsp;</th>
409                     <th class="replacementprice">&nbsp;</th>
410                     <th>[% total_quantity | html %]</th>
411                     <th class="tax_excluded">[% total_tax_excluded | $Price | html %]</th>
412                     <th class="tax_included">[% total_tax_included | $Price | html %]</th>
413                     <th>&nbsp;</th>
414                     <th>[% total_tax_value | $Price | html %]</th>
415                     <th>&nbsp;</th>
416                     <th>&nbsp;</th>
417                     [% IF ( active ) %]
418                         [% UNLESS ( closedate ) %]
419                             <th>&nbsp;</th>
420                             <th>&nbsp;</th>
421                         [% END %]
422                     [% END %]
423                 </tr>
424                 </tfoot>
425                 <tbody>
426                 [% FOREACH books_loo IN books_loop %]
427                     [% IF ( books_loo.order_received ) %]
428                         <tr class="disabled">
429                     [% ELSE %]
430                         <tr>
431                     [% END %]
432                         <td>
433                             [% books_loo.ordernumber | html %]
434                         </td>
435                         <td>
436                             <p>
437                                 [% IF ( books_loo.order_received ) %] (rcvd)[% END %]
438                                 [% IF books_loo.title %]
439                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber | html %]">[% books_loo.title | html %]</a>[% IF books_loo.author %] by [% books_loo.author | html %][% END %]
440                                 [% ELSE %]
441                                     <em>Deleted bibliographic record, can't find title</em><br />
442                                 [% END %]
443                                 <br />
444                                 [% IF ( books_loo.isbn ) %] - [% books_loo.isbn | html %][% END %]
445                                 [% IF ( books_loo.issn ) %] - [% books_loo.issn | html %][% END %]
446                                 [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode | html %][% END %]
447                                 [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear | html %]
448                                 [% ELSIF ( books_loo.copyrightdate ) %] [% books_loo.copyrightdate | html %][% END %]
449                                 [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement | html %][% END %]
450                                 [% IF ( books_loo.suggestionid ) %]
451                                     <br/>
452                                     Suggested by: [% books_loo.surnamesuggestedby | html %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby | html %] [% END %]
453                                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid | html %]&amp;op=show">suggestion #[% books_loo.suggestionid | html %]</a>)
454                                 [% END %]
455                             </p>
456                                 [% IF ( books_loo.order_internalnote ) %]
457                                     <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>
458                                 [% ELSE %]
459                                     <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>
460                                 [% END %]
461                                 [% IF ( books_loo.order_vendornote ) %]
462                                     <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>
463                                 [% ELSE %]
464                                     <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>
465                                 [% END %]
466                             [% IF (books_loo.transferred_from) %]
467                               [% basket = books_loo.transferred_from.basket | html %]
468                               [% bookseller = books_loo.transferred_from.bookseller | html %]
469                               [% timestamp = books_loo.transferred_from.timestamp | html %]
470                               <p>Transferred from basket:
471                                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | html %]"> [% basket.basketname | html %]</a>
472                                 (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | html %]">[% bookseller.name | html %]</a>)
473                                 on <span title="[% timestamp | $KohaDates with_hours = 1 | html %]">
474                                   [% timestamp | $KohaDates %]
475                                 </span>
476                               </p>
477                             [% END %]
478                         </td>
479                         [% 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 ... %]
480                         [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
481                         <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price | html %]</td>
482                         <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price | html %]</td>
483                         <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price | html %]</td>
484                         <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price | html %]</td>
485                         <td class="number replacementprice [% IF books_loo.replacementprice.search(zero_regex) %]error[% END %]">[% books_loo.replacementprice | $Price | html %]</td>
486                         <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity | html %]</td>
487                         <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price | html %]</td>
488                         <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price | html %]</td>
489                         <td class="number">[% books_loo.tax_rate * 100 | html %]</td>
490                         <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price | html %]</td>
491                         <td>[% books_loo.budget_name | html %]</td>
492                         <td>[% books_loo.suppliers_report | html %]</td>
493                         [% IF ( active ) %]
494                             [% UNLESS ( closedate ) %]
495                             <td>
496                                 <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber | html %]&amp;booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">Modify</a>
497                                 [% UNLESS (books_loo.order_received) %]
498                                     <br />
499                                     <a href="#" class="transfer_order" data-ordernumber="[% books_loo.ordernumber | html %]">Transfer</a>
500                                 [% END %]
501                             </td>
502                             <td>
503                             [% IF ( books_loo.left_holds_on_order ) %]
504                             <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>
505                             [% ELSE %]
506                             <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber | html %]&biblionumber=[% books_loo.biblionumber | html %]&basketno=[% basketno | html %]&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno | html %]" class="button">Cancel order</a><br>
507                             [% END %]
508                             [% IF ( books_loo.can_del_bib ) %]
509                             <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber | html %]&biblionumber=[% books_loo.biblionumber | html %]&basketno=[% basketno | html %]&del_biblio=1&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno | html %]" class="button">Cancel order and delete catalog record</a><br>
510                             [% ELSE %]
511                             <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
512                             [% END %]
513                             [% IF ( books_loo.left_item ) %]
514                             <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>
515                             [% END %]
516                             [% IF ( books_loo.left_biblio ) %]
517                             <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios | html %] order(s) left</b><br>
518                             [% END %]
519                             [% IF ( books_loo.left_subscription ) %]
520                             <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions | html %] subscription(s) left</b><br>
521                             [% END %]
522                             [% IF ( books_loo.left_holds ) %]
523                             <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds | html %] hold(s) left</b>
524                             [% END %]
525                             </td>
526                             [% END %]
527                         [% END %]
528                     </tr>
529                 [% END %]
530                 </tbody>
531             </table>
532         [% END %]
533         [% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
534         [% END %]
535         </div>
536         [% IF (cancelledorders_loop) %]
537           <div id="cancelledorders">
538             <h2>Cancelled orders</h2>
539             <table id="cancelledorderst">
540               <thead>
541                 <tr>
542                   <th>No.</th>
543                   <th>Order</th>
544                   <th class="tax_excluded">RRP tax exc.</th>
545                   <th class="tax_excluded">ecost tax exc.</th>
546                   <th class="tax_included">RRP tax inc.</th>
547                   <th class="tax_included">ecost tax inc.</th>
548                   <th class="replacementprice">Replacement price</th>
549                   <th>Qty.</th>
550                   <th class="tax_excluded">Total tax exc. ([% currency | html %])</th>
551                   <th class="tax_included">Total tax inc. ([% currency | html %])</th>
552                   <th>GST %</th>
553                   <th>GST</th>
554                   <th>Fund</th>
555                 </tr>
556               </thead>
557               <tbody>
558                 [% FOREACH order IN cancelledorders_loop %]
559                   <tr style="color:grey">
560                     <td>
561                         [% order.ordernumber | html %]
562                     </td>
563                     <td>
564                       <p>
565                         [% IF ( order.order_received ) %] (rcvd)[% END %]
566                         [% IF (order.title) %]
567                           [% order.title | html %][% IF order.author %] by [% order.author | html %][% END %]
568                         [% ELSE %]
569                           <em>Deleted bibliographic record, can't find title</em>
570                         [% END %]
571                         <br />
572                         [% IF ( order.order_internalnote ) %] [% order.order_internalnote | html %][% END %]
573                         [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
574                         [% IF ( order.issn ) %] - [% order.issn | html %][% END %]
575                         [% IF ( order.publishercode ) %], [% order.publishercode | html %][% END %]
576                         [% IF ( order.publicationyear ) %], [% order.publicationyear | html %]
577                         [% ELSIF ( order.copyrightdate ) %] [% order.copyrightdate | html %][% END %]
578                         [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement | html %][% END %]
579                         [% IF ( order.cancellationreason ) %]
580                           <br />
581                           Cancellation reason: [% AuthorisedValues.GetByCode( 'ORDER_CANCELLATION_REASON', order.cancellationreason ) | html %]
582                         [% END %]
583                       </p>
584                       [% IF order.transferred_to %]
585                         [% basket = order.transferred_to.basket | html %]
586                         [% bookseller = order.transferred_to.bookseller | html %]
587                         [% timestamp = order.transferred_to.timestamp | html %]
588                         <p>Transferred to basket:
589                           <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | html %]"> [% basket.basketname | html %]</a>
590                           (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | html %]">[% bookseller.name | html %]</a>)
591                           on <span title="[% timestamp | $KohaDates with_hours = 1 | html %]">
592                             [% timestamp | $KohaDates %]
593                           </span>
594                         </p>
595                       [% END %]
596                     </td>
597                     <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price | html %]</td>
598                     <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price | html %]</td>
599                     <td class="number tax_included">[% order.rrp_tax_included | $Price | html %]</td>
600                     <td class="number tax_included">[% order.ecost_tax_included | $Price | html %]</td>
601                     <td class="number replacementprice">[% order.replacementprice | $Price | html %]</td>
602                     <td class="number">[% order.quantity | html %]</td>
603                     <td class="number tax_excluded">[% order.total_tax_excluded | $Price | html %]</td>
604                     <td class="number tax_included">[% order.total_tax_included | $Price | html %]</td>
605                     <td class="number">[% order.tax_rate * 100 | html %]</td>
606                     <td class="number">[% order.tax_value | $Price | html %]</td>
607                     <td>[% order.budget_name | html %]
608                   </tr>
609                 [% END %]
610               </tbody>
611             </table>
612           </div>
613         [% END %]
614         <br />
615         [% UNLESS ( closedate ) %]
616
617     <!-- Modal -->
618     <div id="addtoBasket" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel" aria-hidden="true">
619         <div class="modal-dialog">
620         <div class="modal-content">
621         <div class="modal-body">
622         [% IF active %]
623             [% INCLUDE 'acquisitions-add-to-basket.inc' %]
624         [% END %]
625         </div>
626         <div class="modal-footer">
627             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
628         </div>
629         </div>
630         </div>
631     </div>
632
633         [% END %]
634
635 [% END %]
636 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
637     [% END %]
638 [% IF ( confirm_close ) %]
639         <div id="closebasket_needsconfirmation" class="dialog alert">
640
641         <form action="/cgi-bin/koha/acqui/basket.pl">
642             <h1>Are you sure you want to close basket [% basketname | html %]?</h1>
643             [% IF ( CAN_user_acquisition_group_manage ) %]
644             <p>
645             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
646             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
647             </p>
648             [% END %]
649             <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
650             <input type="hidden" value="close" name="op" />
651             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
652             <input type="hidden" name="confirm" value="1" />
653             <input type="hidden" name="basketgroupname" value="[% basketgroupname | html %]" />
654             <button type="submit" class="approve" accesskey="y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
655         </form>
656         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
657             <input type="hidden" name="basketno" value="[% basketno | html %]" />
658             <button type="submit" class="deny" accesskey="n"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
659         </form>
660         </div>
661     [% END %]
662 [% IF edi_confirm %]
663         <div id="closebasket_needsconfirmation" class="dialog alert">
664
665         <form action="/cgi-bin/koha/acqui/basket.pl">
666             <h1>Are you sure you want to generate an EDIFACT order and close basket [% basketname | html %]?</h1>
667             [% IF CAN_user_acquisition_group_manage %]
668             <p>
669             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
670             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
671             </p>
672             [% END %]
673             <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
674             <input type="hidden" value="ediorder" name="op" />
675             <input type="hidden" name="ean" value="[% ean | html %]" />
676             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
677             <input type="hidden" name="confirm" value="1" />
678             <input type="hidden" name="basketgroupname" value="[% basketgroupname | html %]" />
679             <button type="submit" class="approve" accesskey="Y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
680         </form>
681         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
682             <input type="hidden" name="basketno" value="[% basketno | html %]" />
683             <button type="submit" class="deny" accesskey="N"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
684         </form>
685         </div>
686     [% END %]
687 </div>
688 [% END %][%# IF (cannot_manage_basket) %]
689 </div>
690 <div class="yui-b">
691 [% INCLUDE 'acquisitions-menu.inc' %]
692 </div>
693 </div>
694
695 <!-- Modal for editing vendor and internal notes -->
696 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
697     <div class="modal-dialog" role="document">
698         <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
699             <div class="modal-content">
700                 <div class="modal-header">
701                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
702                     <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
703                 </div>
704                 <div class="modal-body">
705                 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
706                 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
707                 <input type="hidden" name="op" value="save" />
708                 <input type="hidden" id="type" name="type" value="" />
709             </div>
710             <div class="modal-footer">
711                 <button type="submit" class="btn btn-default">Save</button>
712                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
713             </div>
714         </form>
715     </div>
716 </div>
717 </div>
718
719 [% MACRO jsinclude BLOCK %]
720     [% Asset.js("js/acquisitions-menu.js") | $raw %]
721 [% INCLUDE 'datatables.inc' %]
722     [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %]
723     <script type="text/javascript">
724         function updateColumnsVisibility(visible) {
725             if ( visible ) {
726                 $("table .tax_excluded, .tax_included").show();
727             } else {
728                 [% IF ( listincgst ) %]
729                     $("table .tax_excluded").hide();
730                 [% ELSE %]
731                     $("table .tax_included").hide();
732                 [% END %]
733             }
734         }
735
736         $(document).ready(function() {
737             if ( $('#toolbar').length ) {$('#toolbar').fixFloat();}
738             $("#show_all_details").click(function(){
739                 updateColumnsVisibility($(this).is(":checked"));
740             });
741
742             $("#show_all_details").prop('checked', false);
743             updateColumnsVisibility(false);
744             [% UNLESS ( closedate ) %]
745                 $('#addtoBasket').on('show', function () {
746                    $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML);
747                 });
748             [% END %]
749
750             $("body").on("click", ".del_user", function(e){
751                 e.preventDefault();
752                 del_user( $(this).data("borrowernumber") );
753             });
754
755             $("#add_user").on("click",function(e){
756                 e.preventDefault();
757                 UserSearchPopup();
758             });
759
760             $(".transfer_order").on("click",function(e){
761                 e.preventDefault();
762                 transfer_order_popup( $(this).data("ordernumber"));
763             });
764
765             $(".edit_note").on("click", function(e) {
766                 e.preventDefault();
767                 var ordernumber = $(this).data("ordernumber");
768                 var note_type = $(this).data("note_type");
769                 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
770                 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
771                 $("#noteEditor .modal-title").text(modalTitle);
772                 $("#ordernumber").val( ordernumber );
773                 $("#ordernotes").html( note_text );
774                 $("#type").val( note_type );
775                 $("#noteEditor").modal("show");
776                 $("#ordernotes").focus();
777             });
778
779              $("#noteEditor").on('hidden.bs.modal', function (e) {
780                 $("#noteEditorLabel").html("");
781                 $("#noteEditor .modal-title").text("");
782                 $("#ordernotes").html( "" );
783                 $("#ordernumber").val("");
784                 $("#type").val("");
785             });
786
787         });
788     </script>
789
790     [% UNLESS ( closedate ) %]
791         <script type="text/javascript">
792             function transfer_order_popup(ordernumber) {
793                 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
794                     + "ordernumber=" + ordernumber
795                 window.open(url, 'TransferOrder','width=600,height=400,toolbar=false,scrollbars=yes');
796             }
797
798             function confirm_ediorder() {
799                 var is_confirmed = confirm(_("Are you sure you want to close this basket and generate an EDIFACT order?"));
800                 if (is_confirmed) {
801                     window.location = "/cgi-bin/koha/acqui/basket.pl?op=edi_confirm&basketno=[% basketno | html %]";
802                 }
803             }
804         </script>
805     [% ELSE %]
806         <script type="text/javascript">
807             $(document).ready(function(){
808                 $("#basketgroupid").change(function(){
809                     if($(this).val() == "new"){
810                         location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]";
811                     }
812                 });
813             });
814         </script>
815         [% UNLESS ( grouped ) %]
816             <script type="text/javascript">
817                 function confirm_reopen() {
818                     var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %];
819                     var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?"));
820                     if (is_confirmed) {
821                         window.location = "/cgi-bin/koha/acqui/basket.pl?op=reopen&basketno=[% basketno | html %]";
822                     }
823                 }
824             </script>
825         [% END %]
826     [% END %]
827     <script type="text/javascript">
828         $(document).ready(function() {
829             var orderst = $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, {
830                 "sPaginationType": "four_button",
831                 [% IF ( active ) %]
832                     "aoColumnDefs": [
833                         [% UNLESS ( closedate ) %]
834                             { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
835                         [% END %]
836                         { "sType": "anti-the", "aTargets": [ "anti-the" ] }
837                     ],
838                 [% END %]
839             } ) );
840             var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
841                 "sPaginationType": "four_button"
842             } ) );
843             $("#reopenbutton").on("click",function(e){
844                 e.preventDefault();
845                 confirm_reopen();
846             });
847             // Generates a dynamic link for exporting the selections data as CSV
848             $("#exportbutton, #export-csv-menu a").click(function() {
849                 // Building the url from currently checked boxes
850                 var url = '/cgi-bin/koha/acqui/basket.pl';
851                 url += $('#exportbutton').attr('href');
852                 if($(this).attr("data-value")) {
853                     url += '&amp;csv_profile=' + $(this).attr("data-value");
854                 }
855                 // And redirecting to the CSV page
856                 location.href = url;
857                 return false;
858             });
859         });
860
861         function UserSearchPopup(f) {
862             window.open(
863                 "/cgi-bin/koha/acqui/add_user_search.pl",
864                 'UserSearchPopup',
865                 'width=840, height=500, scrollbars=yes, toolbar=no,'
866              );
867         }
868
869         function add_user(borrowernumber, borrowername) {
870             var ids = $("#users_ids").val();
871             if(ids.length > 0) {
872                 ids = ids.split(':');
873             } else {
874                 ids = new Array;
875             }
876             if (ids.indexOf(borrowernumber.toString()) < 0) {
877                 ids.push(borrowernumber);
878                 $("#users_ids").val(ids.join(':'));
879                 var li = '<li id="user_'+borrowernumber+'">'+borrowername
880                 + ' <a href="#" data-borrowernumber="'+borrowernumber+'" class="del_user"><i class="fa fa-trash"></i> '
881                     + _("Delete user") + '</a></li>';
882                 $("#users_names").append(li);
883                 return 0;
884             }
885             return -1;
886         }
887
888         function del_user(borrowernumber) {
889             $("#user_"+borrowernumber).remove();
890             var ids = $("#users_ids").val().split(':');
891             ids.splice(ids.indexOf(borrowernumber.toString()), 1);
892             $("#users_ids").val(ids.join(':'));
893         }
894     </script>
895 [% END %]
896
897 [% INCLUDE 'intranet-bottom.inc' %]