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