Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions &rsaquo; Basket [% basketno %] &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="acq_neworderempty" class="acq">
11
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'acquisitions-search.inc' %]
14
15 <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 %]">[% name %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</div>
16
17 <div id="doc3" class="yui-t2">
18
19 <div id="bd">
20     <div id="yui-main">
21     <div class="yui-b">
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 %]</li>[% END %]
39         [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote %]</li>[% END %]
40         [% IF ( basketcontractno ) %]
41             <li><span class="label">Contract number: </span>[% basketcontractno %]</li>
42             <li><span class="label">Contract name:</span> <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]">[% basketcontractname %]</a></li>
43         [% END %]
44         [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname %]</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 %]" selected="selected">[% basketgroup.name %]</option>
54                     [% ELSE %]
55                     <option value="[% basketgroup.id %]">[% basketgroup.name %]</option>
56                     [% END %]
57                 [% END %]
58                 </select>
59                 <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
60                 <input type="hidden" value="mod_basket" name="op" />
61                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
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 %]">
83                             [% user.firstname %] [% user.surname %]
84                             [<a onclick="del_user([% user.borrowernumber %]);" 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 %]" />
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 %]"> 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 %]" />
107         <input type="hidden" name="basketno" value="[% basketno %]" />
108         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
109         <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
110         <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
111         <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
112         <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
113         <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
114
115         [% FOREACH c IN currencies %]
116             <input type="hidden" id="currency_rate_[% c.currency %]"  name="[% c.currency %]" value="[% c.rate %]" />
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 %]" />[% author %]
134                 [% ELSE %]
135                 <label for="author">Author: </label>
136                     <input type="text" size="50" name="author" id="author" value="[% author %]" />
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 %]" />[% publishercode %]
143                 [% ELSE %]
144                 <label for="publishercode"> Publisher: </label>
145                     <input type="text" size="50" name="publishercode" id="publishercode" value="[% publishercode %]" />
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 %]" />[% editionstatement %]
152
153                 [% ELSE %]
154                 <label for="editionstatement">Edition: </label>
155                     <input type="text" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement %]" />
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 %]" />[% publicationyear %]
162                 [% ELSE %]
163                 <label for="publicationyear">Publication year: </label>
164                     <input type="text" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear %]" />
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 %]" />[% isbn %]
171                 [% ELSE %]
172                 <label for="ISBN">ISBN: </label>
173                     <input type="text" size="50" name="isbn" id="ISBN" value="[% isbn %]" />
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 %]" />[% ean %]
181                 [% ELSE %]
182                 <label for="EAN">EAN: </label>
183                     <input type="text" size="20" name="ean" id="EAN" value="[% ean %]" />
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 %]" />[% seriestitle %]
191                 [% ELSE %]
192                 <label for="series">Series: </label>
193                     <input type="text" size="50" name="series" id="series" value="[% seriestitle %]" />
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 %]">[% itemtype.description %]</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 %] ([% field.tag %][% field.subfield %])</label>
217                                 [% field.value %]
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 %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]&amp;op=show">suggestion #[% suggestionid %]</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') %] 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 %][%# 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 %]" />[% quantity %]
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 %]" 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 %]" />[% Budget_name %]
326                 [% ELSE %]
327                 <label class="required" for="budget_id">Fund: </label>
328                 [% active_count = 0 %]
329                 [% IF !ordernumber %]
330                     [% FOREACH budget_loo IN budget_loop %]
331                         [% active_count= active_count + budget_loo.b_active %]
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 %]
339                         <option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]"
340                                 style="padding-left:[% budget_loo.b_level %]em;"
341                         >
342                     [% ELSIF active_count==1 && budget_loo.b_active %]
343                         <option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]"
344                                 style="padding-left:[% budget_loo.b_level %]em;"
345                         >
346                     [% ELSE %]
347                         [% bdgclass=budget_loo.b_active? "": "b_inactive" %]
348                         <option value="[% budget_loo.b_id %]" class="[% bdgclass %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]"
349                                 style="padding-left:[% budget_loo.b_level %]em;"
350                         >
351                     [% END %]
352                     [% budget_loo.b_txt %][% 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 %]" />[% currency %]
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 %]" selected="selected">[% c.currency %]</option>
371                     [% ELSIF not c.archived %]
372                         <option value="[% c.currency %]">[% c.currency %]</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 %]" />[% listprice %] [% 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 %]" 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 %]" />[% tax_rate %]%
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 %]" selected="selected">[% gst.option * 100 %]%</option>
408                           [% ELSE %]
409                             <option value="[% gst.option %]">[% gst.option * 100 %]%</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 %]" />[% orderdiscount_2dp %]%
423                     [% ELSE %]
424                         <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
425                     [% END %]
426                 [% ELSE %]
427                     [% IF ( orderdiscount ) %]
428                         <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
429                     [% ELSE %]
430                         <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
431                     [% END %]
432                 [% END %]
433             </li>
434             <li>
435                 [% IF ( close ) %]
436                     <span class="label">Replacement cost: </span>
437                     <input type="hidden" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]  (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %])
438                 [% ELSE %]
439                     <label for="rrp">Replacement cost: </label>
440                     <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %])
441                 [% END %]
442             </li>
443             <li>
444                 <label for="ecost">Budgeted cost: </label>
445                 <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  /> [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
446             </li>
447             <li>
448                 <label for="total">Total: </label>
449                 <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" /> (budgeted cost * quantity)
450             </li>
451             <li>
452                 [% IF ( close ) %]
453                     <label for="unitprice">Actual cost: </label>
454                     <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" /> [% IF (invoiceincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
455                 [% ELSE %]
456                     <label for="unitprice">Actual cost: </label>
457                     <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" /> [% IF (invoiceincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
458                 [% END %]
459             </li>
460             <li>
461                 <label for="order_internalnote">Internal note: </label>
462                 <textarea id="order_internalnote" cols="30" rows="3" name="order_internalnote" >[% IF ( order_internalnote ) %][% order_internalnote %][% END %]</textarea>
463             </li>
464             <li>
465                 <label for="order_vendornote">Vendor note: </label>
466                 <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote %][% END %]</textarea>
467             </li>
468             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
469                 <label for="sort1">Statistic 1: </label>
470                 <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
471             <li>
472                 <label for="sort2">Statistic 2: </label>
473                 <input id="sort2" type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
474             </li>
475         </ol>
476     </fieldset>
477     <fieldset class="action">
478         <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
479         <input type="submit" value="Save" />
480         [% IF (suggestionid) %]
481             <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
482         [% ELSE %]
483             [% IF subscriptionid %]
484                 <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
485             [% ELSE %]
486                 <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
487             [% END %]
488         [% END %]
489     </fieldset>
490 </form>
491
492 <div id="procModal" data-backdrop="static" class="modal fade" aria-labelledby="procModal" aria-hidden="true">
493     <div class="modal-dialog">
494     <div class="modal-content">
495     <div class="modal-body">
496     <h3>Processing multiple items</h3>
497     </div>
498     </div>
499     </div>
500 </div>
501
502 <div id="multiCountModal" class="modal fade" aria-labelledby="multiCountModal" aria-hidden="true">
503     <div class="modal-dialog">
504     <div class="modal-content">
505     <h3>Invalid number of copies</h3>
506     <p>Please enter a <b>number</b>, greater than or equal to 1</p>
507     </div>
508     </div>
509 </div>
510
511 </div>
512 </div>
513 <div class="yui-b">
514 [% INCLUDE 'acquisitions-menu.inc' %]
515 </div>
516 </div>
517
518 [% MACRO jsinclude BLOCK %]
519     [% Asset.js("js/acquisitions-menu.js") %]
520     [% Asset.js("js/acq.js") %]
521     [% INCLUDE 'additem.js.inc' %]
522     [% Asset.js("js/additem.js") %]
523     [% Asset.js("js/cataloging.js") %]
524     [% Asset.js("js/prevent_submit.js") %]
525     <script type="text/javascript">
526         actTotal = "";
527
528         function Check(ff) {
529             [% IF (AcqCreateItemOrdering) %]
530                 // Remove last itemblock if it is not in items_list
531                 var lastitemblock = $("#outeritemblock > div:last");
532                 var tobedeleted = true;
533                 var listitems = $("#items_list tr");
534                 $(listitems).each(function(){
535                     if($(this).attr('idblock') == $(lastitemblock).attr('id')){
536                         tobedeleted = false;
537                     }
538                 });
539                 if(tobedeleted){
540                     $(lastitemblock).remove();
541                 }
542             [% END %]
543
544             var ok=0;
545             var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
546
547             _alertString +="-------------------------------------------------------------------\n\n";
548
549             if(isNull(ff.budget_id,1)){
550                 ok=1;
551                 _alertString += "\n- "+ _("You must select a fund");
552             }
553
554             if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
555                 ok=1;
556                             _alertString += "\n- " + _("Quantity must be greater than '0'");
557             }
558
559             if (!(isNum(ff.listprice,0))){
560                 ok=1;
561                             _alertString += "\n- " + _("Vendor price must be a number");
562             }
563
564             if (!(isNum(ff.total,0))){
565                 ok=1;
566                             _alertString += "\n- " + _("Total must be a number");
567             }
568
569             if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
570                 ok=1;
571                 _alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal);
572             }
573
574             if ( ff.field_value ) {
575                 var empty_item_mandatory = CheckMandatorySubfields(ff);
576                 if (empty_item_mandatory > 0) {
577                     ok = 1;
578                     _alertString +=
579                         "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory);
580                 }
581
582             }
583
584             if (ok) {
585                 alert(_alertString);
586                 [% IF (AcqCreateItemOrdering) %]
587                     if(tobedeleted) {
588                         $(lastitemblock).appendTo('#outeritemblock');
589                     }
590                 [% END %]
591                 return false;
592             }
593
594             [% IF (AcqCreateItemOrdering) %]
595                 if(check_additem('[% UniqueItemFields %]') == false) {
596                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
597                     if(tobedeleted) {
598                         $(lastitemblock).appendTo('#outeritemblock');
599                     }
600                     return false;
601                 }
602             [% END %]
603         }
604
605         $(document).ready(function(){
606             [% IF AcqCreateItemOrdering and not basket.is_standing %]
607                 cloneItemBlock(0, '[% UniqueItemFields %]');
608             [% END %]
609
610             [% IF ( suggestionid ) %]updateCosts();[% END %]
611             $("#quantity").change(function() {
612                 updateCosts();
613             });
614
615             //We apply the fonction only for modify option
616             [% IF ( quantityrec ) %]
617                 [% IF ( acqcreate ) %]
618                     $('#quantity').blur(function(){
619                         // if user decreases the quantity
620                         if($(this).val() < [% quantityrec %]){
621                             alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
622                             return true;
623                         } else {
624                             // if user increases the quantity
625                             alert(_("You can't add a new item, please create a new order line"));
626                             // and we replace the original value
627                             $(this).val([% quantityrec %])
628                             updateCosts(); // blur is invoked after change which updated values
629                             return false;
630                         }
631                     });
632                 [% END %]
633             [% END %]
634
635             //keep a copy of all budgets before removing the inactives
636             disabledBudgetsCopy = $('#budget_id').html();
637             $('#budget_id .b_inactive').remove();
638
639             $('#showallbudgets').click(function() {
640                 if ($(this).is(":checked")) {
641                     $('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds
642                 }
643                 else {
644                     $('#budget_id .b_inactive').remove();
645                 }
646             });
647
648             $("#budget_id").change(function(){
649                 var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]');
650                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
651                 var sort1 = $(destination_sort1).val() || "";
652                 if ( destination_sort1.length < 1 ) {
653                     destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]');
654                 }
655                 var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]');
656                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
657                 var sort2 = $(destination_sort2).val() || "";
658                 if ( destination_sort2.length < 1 ) {
659                     destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]');
660                 }
661                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
662                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
663             });
664             $("#budget_id").change();
665         });
666
667         function UserSearchPopup(f) {
668             window.open(
669                 "/cgi-bin/koha/acqui/add_user_search.pl",
670                 'UserSearchPopup',
671                 'width=740, height=450, scrollbars=yes, toolbar=no,'
672              );
673         }
674
675         function add_user(borrowernumber, borrowername) {
676             var ids = $("#users_ids").val();
677             if(ids.length > 0) {
678                 ids = ids.split(':');
679             } else {
680                 ids = new Array;
681             }
682         if (ids.indexOf(borrowernumber.toString()) < 0) {
683                 ids.push(borrowernumber);
684                 $("#users_ids").val(ids.join(':'));
685                 var li = '<li id="user_'+borrowernumber+'">'+borrowername
686                     + ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">'
687                     + _("Delete user") + '</a>]</li>';
688                 $("#users_names").append(li);
689                 return 0;
690             }
691             return -1;
692         }
693
694         function del_user(borrowernumber) {
695             $("#user_"+borrowernumber).remove();
696             var ids = $("#users_ids").val().split(':');
697             ids.splice(ids.indexOf(borrowernumber.toString()), 1);
698             $("#users_ids").val(ids.join(':'));
699         }
700     </script>
701 [% END %]
702
703 [% INCLUDE 'intranet-bottom.inc' %]
704
705 [% BLOCK display_subfield %]
706     <label>[% field.lib %] ([% field.tag %][% field.subfield %])</label>
707     [% IF field.authorised_value %]
708         [% SWITCH field.authorised_value %]
709         [% CASE 'branches' %]
710             [% IF field.mandatory %]
711             <select name="bib_field_value" required="required">
712             [% ELSE %]
713             <select name="bib_field_value">
714             [% END %]
715                 <option value=""></option>
716                 [% PROCESS options_for_libraries libraries => Branches.all( selected => "FIXME" ) %]
717             </select>
718         [% CASE 'itemtypes' %]
719             [% IF field.mandatory %]
720             <select name="bib_field_value" required="required">
721             [% ELSE %]
722             <select name="bib_field_value">
723             [% END %]
724                 <option value=""></option>
725                 [% PROCESS options_for_itemtypes itemtypes => ItemTypes.Get(), selected_itemtype => "FIXME" %]
726             </select>
727         [% CASE 'cn_source' %]
728         [% CASE %]
729             [% PROCESS 'av-build-dropbox.inc' name="bib_field_value", category=field.authorised_value, default="FIXME" %]
730         [% END %]
731     [% ELSE %]
732         [% IF field.mandatory %]
733         <input type="text" name="bib_field_value" value="[% field.value %]" required="required" size="50" />
734         [% ELSE %]
735         <input type="text" name="bib_field_value" value="[% field.value %]" size="50" />
736         [% END %]
737
738     [% END %]
739     <input type="hidden" name="bib_kohafield" value="[% field.kohafield %]" />
740     <input type="hidden" name="bib_tag" value="[% field.tag %]" />
741     <input type="hidden" name="bib_subfield" value="[% field.subfield %]" />
742     [% IF field.mandatory %] <span class="required">Required</span>[% END %]
743 [% END %]