Merge remote-tracking branch 'kc/new/bug_5995' into kcmaster
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Acquisitions &rsaquo; Basket [% basketno %] &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
6 <script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
7 <script type="text/javascript">
8 //<![CDATA[
9 actTotal = "";
10
11 function Check(ff) {
12     var ok=0;
13     var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
14
15     _alertString +="-------------------------------------------------------------------\n\n";
16
17     if ( isNull(ff.title,1)  &&  isNull(ff.entertitle,1)   ){
18         ok=1;
19                     _alertString += "\n- " + _("Title cannot be empty");
20     }
21     
22     if(isNull(ff.budget_id,1)){
23                 ok=1;
24                                         _alertString += "\n- "+ _("You must select a budget");
25     }
26
27     if (!(isNum(ff.quantity,0))){
28         ok=1;
29                     _alertString += "\n- " + _("Quantity must be greater than '0'");
30     }
31
32     if (!(isNum(ff.listprice,0))){
33         ok=1;
34                     _alertString += "\n- " + _("Vendor price must be a number");
35     }
36
37     if (!(isNum(ff.total,0))){
38         ok=1;
39                     _alertString += "\n- " + _("Total must be a number");
40     }
41
42     if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
43         ok=1;
44         _alertString += "\n- " + _("Order total (") + ff.total.value +
45             _(") exceeds budget available (") + actTotal+")";
46     }
47
48     if ( ff.field_value ) {
49         var empty_item_mandatory = 0;
50         for (i = 0; i < ff.field_value.length; i++) {
51             //alert("i = " + i + " => " + ff.kohafield[i] );
52             if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
53                 empty_item_mandatory++;
54             }
55         }
56         if (empty_item_mandatory > 0) {
57             ok = 1;
58             _alertString +=
59                 "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
60         }
61     }
62
63 if (ok) {
64         alert(_alertString);
65     return false;
66     }
67
68 ff.submit();
69
70 }
71
72 $(document).ready(function() 
73     {
74         //We apply the fonction only for modify option
75         [% IF ( quantityrec ) %]
76         $('#quantity').blur(function() 
77         {
78             // if user decreases the quantity
79             if($(this).val() < [% quantityrec %]) 
80             {
81                 alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
82                 return true;
83             } 
84             else 
85             {
86                 // if user increases the quantity
87                 alert(_("You can't add a new item, please create a new order line"));
88                 // and we replace the original value
89                 $(this).val([% quantityrec %])
90                 return false;
91             }
92         });
93         [% END %]
94         
95         $('#showallbudgets').click(function() {
96             if ( $('#budget_id .b_inactive').is(":visible") )
97             {
98             $('#budget_id .b_inactive').hide();
99             }
100             else {
101             $('#budget_id .b_inactive').show();
102             }
103         });
104     });
105 //]]>
106 </script>
107 </head>
108 <body>
109
110 [% INCLUDE 'header.inc' %]
111 [% INCLUDE 'acquisitions-search.inc' %]
112
113 <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?supplierid=[% 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>
114
115 <div id="doc3" class="yui-t2">
116
117 <div id="bd">
118     <div id="yui-main">
119     <div class="yui-b">
120
121 <h2>
122     [% IF ( ordernumber ) %]
123         Modify order line
124     [% ELSE %]
125         New order
126     [% END %]
127         [% IF ( suggestionid ) %](defined from suggestion #[% suggestionid %])[% END %]
128 </h2>
129
130 [% IF ( basketno ) %]
131     <div id="acqui_basket_summary"  class="yui-g">
132         <fieldset class="rows">
133         <legend>Basket details</legend>
134                 <ol>
135         [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote %]</li>[% END %]
136         [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote %]</li>[% END %]
137         [% IF ( basketcontractno ) %]
138             <li><span class="label">Contract number: </span>[% basketcontractno %]</li>
139             <li><span class="label">Contract name:</span> <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]">[% basketcontractname %]</a></li>
140         [% END %]
141         [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname %]</li>[% END %]
142         [% IF ( creationdate ) %]<li><span class="label">Open on:</span>  [% creationdate %]</li>[% END %]
143         [% IF ( closedate ) %]
144         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
145         <li><span class="label">Closed on:</span>  [% closedate %]</li>
146         [% IF ( basketgroups ) %]
147             <li>Basketgroup: <select id="basketgroupid" name="basketgroupid">
148                 [% FOREACH basketgroup IN basketgroups %]
149                     [% IF ( basketgroup.default ) %]
150                     <option value="[% basketgroup.id %]" selected="selected">[% basketgroup.name %]</option>
151                     [% ELSE %]
152                     <option value="[% basketgroup.id %]">[% basketgroup.name %]</option>
153                     [% END %]
154                 [% END %]
155                 </select>
156                 <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
157                 <input type="hidden" value="mod_basket" name="op" />
158                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
159             </li>
160                 <fieldset class="action"><input type="submit" value="Change basketgroup" /></fieldset>
161         </form>
162         [% END %]
163         [% END %]
164                         </ol>
165 </fieldset>
166     </div>
167 [% END %]
168
169 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
170
171 <fieldset class="rows">
172         <legend>
173             Catalog details
174             [% IF ( biblionumber ) %]
175                 <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]"> Edit record</a></span>
176             [% END %]
177         </legend>
178         [% UNLESS ( existing ) %]
179         <input type="hidden" name="existing" value="no" />
180         [% END %]
181         <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
182         <input type="hidden" name="basketno" value="[% basketno %]" />
183         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
184         <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
185         <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
186         <input type="hidden" name="discount" value="[% discount %]" />
187         <input type="hidden" name="listinc" value="[% listincgst %]" />
188 <!--        <input type="hidden" name="currency" value="[% currency %]" />-->
189         <input type="hidden" name="applygst" value="[% gstreg %]" />
190         <input type="hidden" name="invoiceincgst" value="[% invoiceincgst %]" />
191         <input type="hidden" name="gstrate" value="[% gstrate %]" />
192         <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
193         <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
194
195         [% FOREACH loop_currencie IN loop_currencies %]
196             <input type="hidden" id="[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
197         [% END %]
198         <ol><li>
199             [% IF ( biblionumber ) %]
200             <span class="label">Title</span>
201                 <input type="hidden" size="50" name="title" value="[% title |html %]" /> <span class="title">[% title |html %]</span>
202             [% ELSE %]
203             <label for="entertitle" class="required">Title: </label>
204                 <input type="text" id="entertitle" size="50" name="title" value="[% title |html %]" />
205             [% END %]
206         </li>
207         <li>
208             [% IF ( biblionumber ) %]
209             <span class="label">Author: </span>
210                 <input type="hidden" size="50" name="author" id="author" value="[% author %]" />[% author %]
211             [% ELSE %]
212             <label for="author">Author: </label>
213                 <input type="text" size="50" name="author" id="author" value="[% author %]" />
214             [% END %]
215         </li>
216         <li>
217             [% IF ( biblionumber ) %]
218             <span class="label">Publisher: </span>
219                 <input type="hidden" size="50" name="publishercode" id="publishercode" value="[% publishercode %]" />[% publishercode %]
220             [% ELSE %]
221             <label for="publishercode"> Publisher: </label>
222                 <input type="text" size="50" name="publishercode" id="publishercode" value="[% publishercode %]" />
223             [% END %]
224         </li>
225         <li>
226             [% IF ( biblionumber ) %]
227             <span class="label">Publication year: </span>
228                 <input type="hidden" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear %]" />[% publicationyear %]
229             [% ELSE %]
230             <label for="publicationyear">Publication year: </label>
231                 <input type="text" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear %]" />
232             [% END %]
233         </li>
234         <li>
235             [% IF ( biblionumber ) %]
236             <span class="label">ISBN: </span>
237                 <input type="hidden" size="50" name="isbn" id="ISBN" value="[% isbn %]" />[% isbn %]
238             [% ELSE %]
239             <label for="ISBN">ISBN: </label>
240                 <input type="text" size="50" name="isbn" id="ISBN" value="[% isbn %]" />
241             [% END %]
242         </li>
243         <li>
244             [% IF ( biblionumber ) %]
245             <span class="label">Series: </span>
246                 <input type="hidden" size="50" name="series" id="series" value="[% seriestitle %]" />[% seriestitle %]
247             [% ELSE %]
248             <label for="series">Series: </label>
249                 <input type="text" size="50" name="series" id="series" value="[% seriestitle %]" />
250             [% END %]
251         </li>
252         </li>
253             [% UNLESS ( biblionumber ) %]
254             [% IF ( itemtypeloop ) %]
255             <li>
256                 <span class="label">Item type:</span>
257                 <select name="itemtype" style="width:12em;">
258                 [% FOREACH itemtype IN itemtypeloop %]
259                     [% IF ( itemtype.selected ) %]
260                         <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
261                     [% ELSE %]
262                         <option value="[% itemtype.itemtype %]">[% itemtype.description %]</option>
263                     [% END %]
264                 [% END %]
265                 </select>
266             </li>
267             [% END %]
268             [% END %]
269         </ol>
270     </fieldset>
271     [% IF ( items ) %]
272     <fieldset class="rows">
273         <legend>Item</legend>
274         [% IF ( NoACQframework ) %]
275             <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
276         [% END %]
277
278         [% FOREACH item IN items %]
279         <div id="outeritemblock">
280         <div id="itemblock">
281             <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
282                 <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
283
284                     <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
285                     [% iteminformatio.marc_value %]
286                     <input type="hidden" name="itemid" value="1" />
287                     <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
288                     <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
289                     <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
290                     <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
291                     [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
292                         <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
293                     [% END %]
294
295                 </div></li>
296             [% END %]
297             </ol>
298             <a style="cursor: pointer; color: grey; font-size: 180%;" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">+</a>
299             <a style="display:none; cursor: pointer; color: grey; font-size: 180%;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">-</a>
300         </div><!-- /iteminformation -->
301         </div>
302
303         [% END %] <!-- /items -->
304     </fieldset>
305     [% END %] <!-- items -->
306     <fieldset class="rows">
307         <legend>Accounting Details</legend>
308         <ol>
309             <li>
310                 [% IF ( close ) %]
311             <span class="label required">Quantity: </span>
312                     <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
313                 [% ELSE %]
314                 <label class="required" for="quantity">Quantity: </label>
315                     [% IF ( items ) %]
316                         <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="calcNeworderTotal();" />
317                     [% ELSE %]
318                         <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
319                     [% END %]
320                 [% END %]
321                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
322                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
323             </li>
324             <li>
325                 [% IF ( close ) %]
326             <span class="label">Fund: </span>
327                     <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
328                 [% ELSE %]
329                 <label for="budget_id">Fund: </label>
330                 <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
331                 [% FOREACH budget_loo IN budget_loop %]
332                     [% IF ( budget_loo.b_sel ) %]
333                         <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
334                     [% ELSE %]
335                         [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
336                         [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive" style="display : none;">[% budget_loo.b_txt %]</option>    
337                         [% END %]
338                     [% END %]
339                 [% END %]
340                 </select>
341                 <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
342                 <input type="checkbox" id="showallbudgets" />
343                 [% END %]
344             </li>
345                 <li>
346                 [% IF ( close ) %]
347                         <span class="label">Currency: </span>
348                         <input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
349                 [% ELSE %]
350                         <label for="currency">Currency:</label>
351                         <select name="currency" id="currency" onchange="calcNeworderTotal();">
352                         [% FOREACH loop_currencie IN loop_currencies %]
353                         [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
354                         </select>
355                 [% END %]
356                 </li>
357             <li>
358                 [% IF ( close ) %]
359             <span class="label">Vendor price: </span>
360                     <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
361                 [% ELSE %]
362                 <label for="listprice">Vendor price: </label>
363                     <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="calcNeworderTotal()" />
364                 [% END %]
365             </li>
366             [% UNLESS ( close ) %]
367             <li>
368                     <label for="uncertainprice">Uncertain price: </label>
369                     [% IF ( uncertainprice ) %]
370                     <input type="checkbox" name="uncertainprice"  id="uncertainprice" value="1" checked="checked" />
371                     [% ELSE %]
372                     <input type="checkbox" name="uncertainprice" id="uncertainprice" value="1" />
373                 [% END %]
374             </li>
375             [% END %]
376                         <li>
377                 [% IF ( close ) %]
378             <span class="label">Replacement cost: </span>
379                     <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
380                 [% ELSE %]
381                 <label for="rrp">Replacement cost: </label>
382                     <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
383                 [% END %]
384             </li>
385             <li>
386                 [% IF ( close ) %]
387             <label for="ecost">Budgeted cost: </label>
388                     <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
389                 [% ELSE %]
390                 <label for="ecost">Budgeted cost: </label>
391                     <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
392                 [% END %]
393                 [% IF ( discount_2dp ) %]  (adjusted for [% discount_2dp %]% discount)  [% END %]
394
395             </li>
396             [% IF ( GST ) %]
397             <li>
398                 [% IF ( close ) %]
399             <label for="GST">Budgeted GST: </label>
400                 <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
401                 [% ELSE %]
402                 <label for="GST">Budgeted GST: </label>
403                 <input type="text" size="20" name="gst" id="GST" value="" />
404                 [% END %]
405             </li>
406             [% END %]
407             <li>
408                 [% IF ( close ) %]
409             <label for="total">Total: </label>
410                 <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
411                 [% ELSE %]
412                 <label for="total">Total: </label>
413                 <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
414                 [% END %]
415             </li>
416             <li>
417                 [% IF ( close ) %]
418             <label for="cost">Actual cost: </label>
419                 <input type="text" id="cost" size="20" name="cost" value="[% ecost %]" readonly="readonly" />
420                 [% ELSE %]
421                 <label for="cost">Actual cost: </label>
422                 <input type="text" id="cost" size="20" name="cost" value="[% ecost %]" />
423                 [% END %]
424             </li>
425             <li>
426                 <label for="notes">Notes: </label>
427                 <textarea id="notes" cols="30" rows="3" name="notes" >[% notes %]</textarea>
428             </li>
429             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
430                 <label for="sort1">Statistic 1: </label>
431
432                 [% IF CGIsort1 %]
433                     <select id="sort1" size="1" name="sort1">
434                     [% FOREACH sort_opt IN CGIsort1 %]
435                        [% IF sort_opt.default %]
436                           <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
437                         [% ELSE %]
438                           <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
439                         [% END %]
440                     [% END %]
441                     </select>
442                 [% ELSE %]
443
444                     <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
445                 [% END %]
446             </li>
447             <li>
448                 <label for="sort2">Statistic 2: </label>
449
450                 [% IF CGIsort2 %]
451                     <select id="sort2" size="1" name="sort1">
452                     [% FOREACH sort_opt IN CGIsort2 %]
453                        [% IF sort_opt.default %]
454                           <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
455                         [% ELSE %]
456                           <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
457                         [% END %]
458                     [% END %]
459                     </select>
460                 [% ELSE %]
461                     <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
462                 [% END %]
463             </li>
464 </ol>
465     </fieldset>
466     <fieldset class="action">
467         <input type="button" value="Save" onclick="Check(this.form)" /> [% IF ( suggestionid ) %]<a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>[% ELSE %]<a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>[% END %]
468     </fieldset>
469 </form>
470 </div>
471 </div>
472 <div class="yui-b">
473 [% INCLUDE 'acquisitions-menu.inc' %]
474 </div>
475 </div>
476 [% INCLUDE 'intranet-bottom.inc' %]