Bug 18639: (QA follow-up) Fix formatting of replacement cost when modifying an order
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Price %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Acquisitions &rsaquo; Basket [% basketno | html %] &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="acq_neworderempty" class="acq">
13
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
16
17 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% name | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketno | html %]</a> &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %]</div>
18
19 <div class="main container-fluid">
20     <div class="row">
21         <div class="col-sm-10 col-sm-push-2">
22             <main>
23
24 <h2>
25     [% IF ( ordernumber ) %]
26         Modify order line
27     [% ELSE %]
28         New order
29     [% END %]
30 </h2>
31
32 <div class="error" style="display:none"></div>
33
34 [% IF ( basketno ) %]
35     <div id="acqui_basket_summary"  class="yui-g">
36     <fieldset class="rows">
37         <legend>Basket details</legend>
38         <ol>
39         [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote | html %]</li>[% END %]
40         [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote | html %]</li>[% END %]
41         [% IF ( basketcontractno ) %]
42             <li><span class="label">Contract number: </span>[% basketcontractno | html %]</li>
43             <li><span class="label">Contract name:</span> <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno | html %]">[% basketcontractname | html %]</a></li>
44         [% END %]
45         [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname | html %]</li>[% END %]
46         [% IF ( creationdate ) %]<li><span class="label">Open on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
47         [% IF ( closedate ) %]
48         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
49         <li><span class="label">Closed on:</span>  [% closedate | $KohaDates %]</li>
50         [% IF ( basketgroups ) %]
51             <li>Basketgroup: <select id="basketgroupid" name="basketgroupid">
52                 [% FOREACH basketgroup IN basketgroups %]
53                     [% IF ( basketgroup.default ) %]
54                     <option value="[% basketgroup.id | html %]" selected="selected">[% basketgroup.name | html %]</option>
55                     [% ELSE %]
56                     <option value="[% basketgroup.id | html %]">[% basketgroup.name | html %]</option>
57                     [% END %]
58                 [% END %]
59                 </select>
60                 <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
61                 <input type="hidden" value="mod_basket" name="op" />
62                 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
63             </li>
64             <fieldset class="action"><input type="submit" value="Change basketgroup" /></fieldset>
65         [% END %]
66         </form>
67         [% END %]
68         </ol>
69     </fieldset>
70     </div>
71 [% END %]
72
73 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" class="validated" id="Aform" onsubmit="return Check(this);" >
74
75     <fieldset class="rows">
76         <legend>Patrons</legend>
77         <ol>
78             <li>
79                 <span class="label">To notify on receiving:</span>
80                 <div style="float:left">
81                     <ul id="users_names" style="padding-left:0">
82                       [% FOREACH user IN users %]
83                         <li id="user_[% user.borrowernumber | html %]">
84                             [% user.firstname | html %] [% user.surname | html %]
85                             [<a onclick="del_user([% user.borrowernumber | html %]);" style="cursor:pointer">Delete user</a>]
86                         </li>
87                       [% END %]
88                     </ul>
89                     <input type="hidden" id="users_ids" name="users_ids" value="[% users_ids | html %]" />
90                     <input type="hidden" id="op" name="op" value="mod_users" />
91                     <input type="button" id="add_user" onclick="UserSearchPopup();" value="Add user" />
92                 </div>
93             </li>
94         </ol>
95     </fieldset>
96
97 <fieldset class="rows">
98         <legend>
99             Catalog details
100             [% IF ( biblionumber ) %]
101                 <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | html %]"> Edit record</a></span>
102             [% END %]
103         </legend>
104         [% UNLESS ( existing ) %]
105         <input type="hidden" name="existing" value="no" />
106         [% END %]
107         <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
108         <input type="hidden" name="basketno" value="[% basketno | html %]" />
109         <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
110         <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
111         <input type="hidden" name="listinc" id="listinc" value="[% listincgst | html %]" />
112         <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst | html %]" />
113         <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
114         <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
115
116         [% FOREACH c IN currencies %]
117             <input type="hidden" id="currency_rate_[% c.currency | html %]"  name="[% c.currency | html %]" value="[% c.rate | html %]" />
118         [% END %]
119
120         [% IF NOT Koha.Preference('UseACQFrameworkForBiblioRecords') OR NoACQframework %]
121             <ol><li>
122                 [% IF ( biblionumber ) %]
123                 <span class="label">Title</span>
124                     <input type="hidden" name="title" value="[% title | html %]" /> <span class="title">[% title | html %]</span>
125                 [% ELSE %]
126                 <label for="entertitle">Title: </label>
127                     <input type="text" id="entertitle" size="50" name="title" value="[% title | html %]" class="focus" required="required" />
128                     <span class="required">Required</span>
129                 [% END %]
130             </li>
131             <li>
132                 [% IF ( biblionumber ) %]
133                 <span class="label">Author: </span>
134                     <input type="hidden" name="author" id="author" value="[% author | html %]" />[% author | html %]
135                 [% ELSE %]
136                 <label for="author">Author: </label>
137                     <input type="text" size="50" name="author" id="author" value="[% author | html %]" />
138                 [% END %]
139             </li>
140             <li>
141                 [% IF ( biblionumber ) %]
142                 <span class="label">Publisher: </span>
143                     <input type="hidden" name="publishercode" id="publishercode" value="[% publishercode | html %]" />[% publishercode | html %]
144                 [% ELSE %]
145                 <label for="publishercode"> Publisher: </label>
146                     <input type="text" size="50" name="publishercode" id="publishercode" value="[% publishercode | html %]" />
147                 [% END %]
148             </li>
149             <li>
150                 [% IF ( biblionumber ) %]
151                 <span class="label">Edition: </span>
152                     <input type="hidden" name="editionstatement" id="editionstatement" value="[% editionstatement | html %]" />[% editionstatement | html %]
153
154                 [% ELSE %]
155                 <label for="editionstatement">Edition: </label>
156                     <input type="text" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement | html %]" />
157                 [% END %]
158             </li>
159             <li>
160                 [% IF ( biblionumber ) %]
161                 <span class="label">Publication year: </span>
162                     <input type="hidden" name="publicationyear" id="publicationyear" value="[% publicationyear | html %]" />[% publicationyear | html %]
163                 [% ELSE %]
164                 <label for="publicationyear">Publication year: </label>
165                     <input type="text" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear | html %]" />
166                 [% END %]
167             </li>
168             <li>
169                 [% IF ( biblionumber ) %]
170                 <span class="label">ISBN: </span>
171                     <input type="hidden" name="isbn" id="ISBN" value="[% isbn | html %]" />[% isbn | html %]
172                 [% ELSE %]
173                 <label for="ISBN">ISBN: </label>
174                     <input type="text" size="50" name="isbn" id="ISBN" value="[% isbn | html %]" />
175                 [% END %]
176             </li>
177             [% IF (UNIMARC) %]
178             <li>
179                 [% IF ( biblionumber ) %]
180                 <span class="label">EAN: </span>
181                     <input type="hidden" name="ean" id="EAN" value="[% ean | html %]" />[% ean | html %]
182                 [% ELSE %]
183                 <label for="EAN">EAN: </label>
184                     <input type="text" size="20" name="ean" id="EAN" value="[% ean | html %]" />
185                 [% END %]
186             </li>
187             [% END %]
188             <li>
189                 [% IF ( biblionumber ) %]
190                 <span class="label">Series: </span>
191                     <input type="hidden" name="series" id="series" value="[% seriestitle | html %]" />[% seriestitle | html %]
192                 [% ELSE %]
193                 <label for="series">Series: </label>
194                     <input type="text" size="50" name="series" id="series" value="[% seriestitle | html %]" />
195                 [% END %]
196             </li>
197                 [% UNLESS ( biblionumber ) %]
198                 [% IF ( itemtypeloop ) %]
199                 <li>
200                     <span class="label">Item type:</span>
201                     <select name="itemtype" style="width:12em;">
202                     [% FOREACH itemtype IN itemtypeloop %]
203                         <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
204                     [% END %]
205                     </select>
206                 </li>
207                 [% END %]
208                 [% END %]
209             </ol>
210         [% ELSE %]
211             <input type="hidden" name="use_ACQ_framework" value="1" />
212             [% IF biblionumber %]
213                 <ol>
214                     [% FOREACH field IN catalog_details %]
215                         <li>
216                             <div class="subfield_line">
217                                 <label>[% field.lib | html %] ([% field.tag | html %][% field.subfield | html %])</label>
218                                 [% field.value | html %]
219                             </div>
220                         </li>
221                     [% END %]
222                 </ol>
223             [% ELSE %]
224                 <ol>
225                     [% FOREACH field IN catalog_details %]
226                         <li>
227                             <div class="subfield_line">
228                                 [% PROCESS display_subfield field=field %]
229                             </div>
230                         </li>
231                     [% END %]
232                 </ol>
233             [% END %]
234         [% END %]
235     </fieldset>
236
237     [% IF ( suggestionid ) %]
238         <fieldset class="rows">
239         <legend>Suggestion</legend>
240         <ol>
241           <li>
242             <span class="label">Suggested by: </span>
243             [% surnamesuggestedby | html %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid | html %]&amp;op=show">suggestion #[% suggestionid | html %]</a>)
244           </li>
245         </ol>
246         </fieldset>
247     [% END %]
248
249     [% UNLESS subscriptionid || basket.is_standing %][% # it is a suggestion, we have not items %]
250       [% IF (AcqCreateItemOrdering) %]
251
252       <div id="items_list" style="display:none">
253           <p><b>Items list</b></p>
254           <div style="width:100%;overflow:auto;">
255               <table>
256                   <thead>
257                       <tr>
258                           <th>&nbsp;</th>
259                           <th>&nbsp;</th>
260                           <th>Barcode</th>
261                           <th>Home library</th>
262                           <th>Holding library</th>
263                           <th>Not for loan</th>
264                           <th>Restricted</th>
265                           <th>Location</th>
266                           <th>Call number</th>
267                           <th>Copy number</th>
268                           <th>Inventory number</th>
269                           <th>Collection code</th>
270                           <th>Item type</th>
271                           <th>Materials</th>
272                           <th>Notes</th>
273                       </tr>
274                   </thead>
275                   <tbody>
276                   </tbody>
277               </table>
278           </div>
279       </div>
280
281       <fieldset class="rows" id="itemfieldset">
282           <legend>Item</legend>
283           [% IF ( NoACQframework ) %]
284               <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
285           [% END %]
286
287           [% UNLESS Koha.Preference('autoBarcode') == 'OFF' %]
288               <div class="dialog message">The autoBarcode system preference is set to [% Koha.Preference('autoBarcode') | html %] and items with blank barcodes will have barcodes generated upon save to database</div>
289           [% END %]
290
291           <div id="outeritemblock"></div>
292
293       </fieldset>
294       [% END %][%# | html UNLESS subscriptionid %]
295     [% END %][%# IF (AcqCreateItemOrdering) %]
296     <fieldset class="rows">
297         <legend>Accounting details</legend>
298         <ol>
299             <li>
300                 [% IF ( close ) %]
301                     <span class="label required">Quantity: </span>
302                     <input type="hidden" name="quantity" value="[% quantity | html %]" />[% quantity | html %]
303                 [% ELSE %]
304                     <label class="required" for="quantity">Quantity: </label>
305                     [% IF (AcqCreateItemOrdering) %]
306                         [% IF subscriptionid || basket.is_standing %]
307                             <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
308                         [% ELSE %]
309                             <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
310                         [% END %]
311                     [% ELSE %]
312                         [% IF subscriptionid || basket.is_standing %]
313                             <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
314                         [% ELSE %]
315                             <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec | html %]" onchange="updateCosts();" />
316                         [% END %]
317                     [% END %]
318                     <span class="required">Required</span>
319                 [% END %]
320                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
321                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
322             </li>
323             <li>
324                 [% IF ( close ) %]
325             <span class="label required">Fund: </span>
326                     <input type="hidden" name="budget_id" id="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
327                 [% ELSE %]
328                 <label class="required" for="budget_id">Fund: </label>
329                 [% active_count = 0 | html %]
330                 [% IF !ordernumber %]
331                     [% FOREACH budget_loo IN budget_loop %]
332                         [% active_count= active_count + budget_loo.b_active | html %]
333                     [% END %]
334                 [% END %]
335                 <select id="budget_id" size="1" name="budget_id">
336                     <option value="">Select a fund</option>
337                 [% FOREACH budget_loo IN budget_loop %]
338                     [% IF ( budget_loo.b_sel ) %]
339                         [% active_count = 0 #select no other fund | html %]
340                         <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
341                                 style="padding-left:[% budget_loo.b_level | html %]em;"
342                         >
343                     [% ELSIF active_count==1 && budget_loo.b_active %]
344                         <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
345                                 style="padding-left:[% budget_loo.b_level | html %]em;"
346                         >
347                     [% ELSE %]
348                         [% bdgclass=budget_loo.b_active? "": "b_inactive" | html %]
349                         <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
350                                 style="padding-left:[% budget_loo.b_level | html %]em;"
351                         >
352                     [% END %]
353                     [% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
354                     </option>
355                 [% END %]
356                 </select>
357                 <span class="required">Required</span>
358                 <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
359                 <input type="checkbox" id="showallbudgets" />
360                 [% END %]
361             </li>
362                 <li>
363                 [% IF ( close ) %]
364                         <span class="label">Currency: </span>
365             <input type="hidden" name="currency" id="currency" value="[% currency | html %]" />[% currency | html %]
366                 [% ELSE %]
367                         <label for="currency">Currency:</label>
368             <select name="currency" id="currency" onchange="updateCosts();">
369                 [% FOREACH c IN currencies %]
370                     [% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %]
371                         <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
372                     [% ELSIF not c.archived %]
373                         <option value="[% c.currency | html %]">[% c.currency | html %]</option>
374                     [% END %]
375                 [% END %]
376             </select>
377                 [% END %]
378                 </li>
379             <li>
380                 [% IF ( close ) %]
381                     <span class="label">Vendor price: </span>
382                     <input type="hidden" name="listprice" id="listprice" value="[% listprice | html %]" />[% listprice | html %] [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
383                 [% ELSE %]
384                 <label for="listprice">Vendor price: </label>
385                     <input type="text" size="20" name="listprice" id="listprice" value="[% listprice | html %]" onchange="updateCosts()" /> [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
386                 [% END %]
387             </li>
388             [% UNLESS ( close ) %]
389             <li>
390                     <label for="uncertainprice">Uncertain price: </label>
391                     [% IF ( uncertainprice ) %]
392                     <input type="checkbox" name="uncertainprice"  id="uncertainprice" value="1" checked="checked" />
393                     [% ELSE %]
394                     <input type="checkbox" name="uncertainprice" id="uncertainprice" value="1" />
395                 [% END %]
396             </li>
397             [% END %]
398             [% IF ( gst_values ) %]
399                 <li>
400                     [% IF ( close ) %]
401                         <span class="label">Tax rate: </span>
402                         <input type="hidden" name="tax_rate" id="tax_rate" value="[% tax_rate | html %]" />[% tax_rate | html %]%
403                     [% ELSE %]
404                         <label for="tax_rate">Tax rate: </label>
405                         <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
406                         [% FOREACH gst IN gst_values %]
407                           [% IF ( gst.option == tax_rate ) %]
408                             <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
409                           [% ELSE %]
410                             <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
411                           [% END %]
412                         [% END %]
413                         </select>
414                     [% END %]
415                 [% ELSE %]
416                     <input type="hidden" name="tax_rate" value="0" />
417                 </li>
418             [% END %]
419             <li>
420                 <label for="discount">Discount: </label>
421                 [% IF ( close ) %]
422                     [% IF ( orderdiscount ) %]
423                         <input type="hidden" name="discount" id="discount" value="[% orderdiscount | html %]" />[% orderdiscount_2dp | html %]%
424                     [% ELSE %]
425                         <input type="hidden" name="discount" id="discount" value="[% discount | html %]" />[% discount_2dp | html %]%
426                     [% END %]
427                 [% ELSE %]
428                     [% IF ( orderdiscount ) %]
429                         <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount | html %]" onchange="updateCosts();" />%
430                     [% ELSE %]
431                         <input type="text" size="6" name="discount" id="discount" value="[% discount | html %]" onchange="updateCosts();" />%
432                     [% END %]
433                 [% END %]
434             </li>
435             <li>
436                 [% IF ( close ) %]
437                     <span class="label">Retail price: </span>
438                     <input type="hidden" name="rrp" id="rrp" value="[% rrp | html %]" />[% rrp | html %]  (adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %])
439                 [% ELSE %]
440                     <label for="rrp">Retail price: </label>
441                     <input type="text" size="20" name="rrp" id="rrp" value="[% rrp | html %]" /> (adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %])
442                 [% END %]
443             </li>
444             <li>
445                 <label for="replacementprice">Replacement cost: </label>
446                 <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | html | $Price on_editing => 1 %]" />
447             </li>
448             <li>
449                 <label for="ecost">Budgeted cost: </label>
450                 <input type="text" size="20" name="ecost" id="ecost" value="[% ecost | html %]" readonly="readonly"  /> [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
451             </li>
452             <li>
453                 <label for="total">Total: </label>
454                 <input type="text" id="total" size="20" name="total" value="[% total | html %]" readonly="readonly" /> (budgeted cost * quantity)
455             </li>
456             <li>
457                 [% IF ( close ) %]
458                     <label for="unitprice">Actual cost: </label>
459                     <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice | html %]" readonly="readonly" /> [% IF (invoiceincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
460                 [% ELSE %]
461                     <label for="unitprice">Actual cost: </label>
462                     <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice | html %]" /> [% IF (invoiceincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
463                 [% END %]
464             </li>
465             <li>
466                 <label for="order_internalnote">Internal note: </label>
467                 <textarea id="order_internalnote" cols="30" rows="3" name="order_internalnote" >[% IF ( order_internalnote ) %][% order_internalnote | html %][% END %]</textarea>
468             </li>
469             <li>
470                 <label for="order_vendornote">Vendor note: </label>
471                 <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
472             </li>
473             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
474                 <label for="sort1">Statistic 1: </label>
475                 <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
476             <li>
477                 <label for="sort2">Statistic 2: </label>
478                 <input id="sort2" type="text" id="sort2" size="20" name="sort2" value="[% sort2 | html %]" />
479             </li>
480         </ol>
481     </fieldset>
482     <fieldset class="action">
483         <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
484         <input type="submit" value="Save" />
485         [% IF (suggestionid) %]
486             <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">Cancel</a>
487         [% ELSE %]
488             [% IF subscriptionid %]
489                 <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">Cancel</a>
490             [% ELSE %]
491                 <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a>
492             [% END %]
493         [% END %]
494     </fieldset>
495 </form>
496
497 <div id="procModal" data-backdrop="static" class="modal fade" aria-labelledby="procModal" aria-hidden="true">
498     <div class="modal-dialog">
499     <div class="modal-content">
500     <div class="modal-body">
501     <h3>Processing multiple items</h3>
502     </div>
503     </div>
504     </div>
505 </div>
506
507 <div id="multiCountModal" class="modal fade" aria-labelledby="multiCountModal" aria-hidden="true">
508     <div class="modal-dialog">
509     <div class="modal-content">
510     <h3>Invalid number of copies</h3>
511     <p>Please enter a <b>number</b>, greater than or equal to 1</p>
512     </div>
513     </div>
514 </div>
515
516 </main>
517 </div> <!-- /.col-sm-10.col-sm-push-2 -->
518
519 <div class="col-sm-2 col-sm-pull-10">
520     <aside>
521         [% INCLUDE 'acquisitions-menu.inc' %]
522     </aside>
523 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
524 </div> <!-- /.row -->
525
526 [% MACRO jsinclude BLOCK %]
527     [% Asset.js("js/acquisitions-menu.js") | $raw %]
528     [% Asset.js("js/acq.js") | $raw %]
529     [% INCLUDE 'additem.js.inc' %]
530     [% Asset.js("js/additem.js") | $raw %]
531     [% Asset.js("js/cataloging.js") | $raw %]
532     [% Asset.js("js/prevent_submit.js") | $raw %]
533     <script>
534         actTotal = "";
535
536         function Check(ff) {
537             [% IF (AcqCreateItemOrdering) %]
538                 // Remove last itemblock if it is not in items_list
539                 var lastitemblock = $("#outeritemblock > div:last");
540                 var tobedeleted = true;
541                 var listitems = $("#items_list tr");
542                 $(listitems).each(function(){
543                     if($(this).attr('idblock') == $(lastitemblock).attr('id')){
544                         tobedeleted = false;
545                     }
546                 });
547                 if(tobedeleted){
548                     $(lastitemblock).remove();
549                 }
550             [% END %]
551
552             var ok=0;
553             var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
554
555             _alertString +="-------------------------------------------------------------------\n\n";
556
557             if(isNull(ff.budget_id,1)){
558                 ok=1;
559                 _alertString += "\n- "+ _("You must select a fund");
560             }
561
562             if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
563                 ok=1;
564                             _alertString += "\n- " + _("Quantity must be greater than '0'");
565             }
566
567             if (!(isNum(ff.listprice,0))){
568                 ok=1;
569                             _alertString += "\n- " + _("Vendor price must be a number");
570             }
571
572             if (!(isNum(ff.total,0))){
573                 ok=1;
574                             _alertString += "\n- " + _("Total must be a number");
575             }
576
577             if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
578                 ok=1;
579                 _alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal);
580             }
581
582             if ( ff.field_value ) {
583                 var empty_item_mandatory = CheckMandatorySubfields(ff);
584                 if (empty_item_mandatory > 0) {
585                     ok = 1;
586                     _alertString +=
587                         "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory);
588                 }
589
590             }
591
592             if (ok) {
593                 alert(_alertString);
594                 [% IF (AcqCreateItemOrdering) %]
595                     if(tobedeleted) {
596                         $(lastitemblock).appendTo('#outeritemblock');
597                     }
598                 [% END %]
599                 return false;
600             }
601
602             [% IF (AcqCreateItemOrdering) %]
603                 if(check_additem('[% UniqueItemFields | html %]') == false) {
604                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
605                     if(tobedeleted) {
606                         $(lastitemblock).appendTo('#outeritemblock');
607                     }
608                     return false;
609                 }
610             [% END %]
611         }
612
613         $(document).ready(function(){
614             [% IF AcqCreateItemOrdering and not basket.is_standing %]
615                 cloneItemBlock(0, '[% UniqueItemFields | html %]');
616             [% END %]
617
618             [% IF ( suggestionid ) %]updateCosts();[% END %]
619             $("#quantity").change(function() {
620                 updateCosts();
621             });
622
623             //We apply the fonction only for modify option
624             [% IF ( quantityrec ) %]
625                 [% IF ( acqcreate ) %]
626                     $('#quantity').blur(function(){
627                         // if user decreases the quantity
628                         if($(this).val() < [% quantityrec | html %]){
629                             alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
630                             return true;
631                         } else {
632                             // if user increases the quantity
633                             alert(_("You can't add a new item, please create a new order line"));
634                             // and we replace the original value
635                             $(this).val([% quantityrec | html %])
636                             updateCosts(); // blur is invoked after change which updated values
637                             return false;
638                         }
639                     });
640                 [% END %]
641             [% END %]
642
643             //keep a copy of all budgets before removing the inactives
644             disabledBudgetsCopy = $('#budget_id').html();
645             $('#budget_id .b_inactive').remove();
646
647             $('#showallbudgets').click(function() {
648                 if ($(this).is(":checked")) {
649                     $('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds
650                 }
651                 else {
652                     $('#budget_id .b_inactive').remove();
653                 }
654             });
655
656             $("#budget_id").change(function(){
657                 var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]');
658                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
659                 var sort1 = $(destination_sort1).val() || "";
660                 if ( destination_sort1.length < 1 ) {
661                     destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]');
662                 }
663                 var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]');
664                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
665                 var sort2 = $(destination_sort2).val() || "";
666                 if ( destination_sort2.length < 1 ) {
667                     destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]');
668                 }
669                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
670                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
671             });
672             $("#budget_id").change();
673         });
674
675         function UserSearchPopup(f) {
676             window.open(
677                 "/cgi-bin/koha/acqui/add_user_search.pl",
678                 'UserSearchPopup',
679                 'width=740, height=450, scrollbars=yes, toolbar=no,'
680              );
681         }
682
683         function add_user(borrowernumber, borrowername) {
684             var ids = $("#users_ids").val();
685             if(ids.length > 0) {
686                 ids = ids.split(':');
687             } else {
688                 ids = new Array;
689             }
690         if (ids.indexOf(borrowernumber.toString()) < 0) {
691                 ids.push(borrowernumber);
692                 $("#users_ids").val(ids.join(':'));
693                 var li = '<li id="user_'+borrowernumber+'">'+borrowername
694                     + ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">'
695                     + _("Delete user") + '</a>]</li>';
696                 $("#users_names").append(li);
697                 return 0;
698             }
699             return -1;
700         }
701
702         function del_user(borrowernumber) {
703             $("#user_"+borrowernumber).remove();
704             var ids = $("#users_ids").val().split(':');
705             ids.splice(ids.indexOf(borrowernumber.toString()), 1);
706             $("#users_ids").val(ids.join(':'));
707         }
708     </script>
709 [% END %]
710
711 [% INCLUDE 'intranet-bottom.inc' %]
712
713 [% BLOCK display_subfield %]
714     <label>[% field.lib | html %] ([% field.tag | html %][% field.subfield | html %])</label>
715     [% IF field.authorised_value %]
716         [% SWITCH field.authorised_value %]
717         [% CASE 'branches' %]
718             [% IF field.mandatory %]
719             <select name="bib_field_value" required="required">
720             [% ELSE %]
721             <select name="bib_field_value">
722             [% END %]
723                 <option value=""></option>
724                 [% PROCESS options_for_libraries libraries => Branches.all( selected => "FIXME" ) %]
725             </select>
726         [% CASE 'itemtypes' %]
727             [% IF field.mandatory %]
728             <select name="bib_field_value" required="required">
729             [% ELSE %]
730             <select name="bib_field_value">
731             [% END %]
732                 <option value=""></option>
733                 [% PROCESS options_for_itemtypes itemtypes => ItemTypes.Get(), selected_itemtype => "FIXME" %]
734             </select>
735         [% CASE 'cn_source' %]
736         [% CASE %]
737             [% PROCESS 'av-build-dropbox.inc' name="bib_field_value", category=field.authorised_value, default="FIXME" %]
738         [% END %]
739     [% ELSE %]
740         [% IF field.mandatory %]
741         <input type="text" name="bib_field_value" value="[% field.value | html %]" required="required" size="50" />
742         [% ELSE %]
743         <input type="text" name="bib_field_value" value="[% field.value | html %]" size="50" />
744         [% END %]
745
746     [% END %]
747     <input type="hidden" name="bib_kohafield" value="[% field.kohafield | html %]" />
748     <input type="hidden" name="bib_tag" value="[% field.tag | html %]" />
749     <input type="hidden" name="bib_subfield" value="[% field.subfield | html %]" />
750     [% IF field.mandatory %] <span class="required">Required</span>[% END %]
751 [% END %]