Bug 9507: prevent submit: refactor some code in a js file
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Acquisitions &rsaquo; Basket [% basketno %] &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5
6 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
7 [% INCLUDE 'additem.js.inc' %]
8 <script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
9 <script type="text/javascript" src="[% themelang %]/js/prevent_submit.js"></script>
10 <script type="text/javascript">
11 //<![CDATA[
12 actTotal = "";
13
14 function Check(ff) {
15     [% IF (AcqCreateItemOrdering) %]
16         // Remove last itemblock if it is not in items_list
17         var lastitemblock = $("#outeritemblock > div:last");
18         var tobedeleted = true;
19         var listitems = $("#items_list tr");
20         $(listitems).each(function(){
21             if($(this).attr('idblock') == $(lastitemblock).attr('id')){
22                 tobedeleted = false;
23             }
24         });
25         if(tobedeleted){
26             $(lastitemblock).remove();
27         }
28     [% END %]
29
30     var ok=0;
31     var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
32
33     _alertString +="-------------------------------------------------------------------\n\n";
34
35     if ( isNull(ff.title,1)  &&  isNull(ff.entertitle,1)   ){
36         ok=1;
37                     _alertString += "\n- " + _("Title cannot be empty");
38     }
39     
40     if(isNull(ff.budget_id,1)){
41                 ok=1;
42                                         _alertString += "\n- "+ _("You must select a budget");
43     }
44
45     if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
46         ok=1;
47                     _alertString += "\n- " + _("Quantity must be greater than '0'");
48     }
49
50     if (!(isNum(ff.listprice,0))){
51         ok=1;
52                     _alertString += "\n- " + _("Vendor price must be a number");
53     }
54
55     if (!(isNum(ff.total,0))){
56         ok=1;
57                     _alertString += "\n- " + _("Total must be a number");
58     }
59
60     if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
61         ok=1;
62         _alertString += "\n- " + _("Order total (") + ff.total.value +
63             _(") exceeds budget available (") + actTotal+")";
64     }
65
66     if ( ff.field_value ) {
67         var empty_item_mandatory = 0;
68         for (i = 0; i < ff.field_value.length; i++) {
69             //alert("i = " + i + " => " + ff.kohafield[i] );
70             if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
71                 empty_item_mandatory++;
72             }
73         }
74         if (empty_item_mandatory > 0) {
75             ok = 1;
76             _alertString +=
77                 "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
78         }
79
80     }
81
82     if (ok) {
83         alert(_alertString);
84         [% IF (AcqCreateItemOrdering) %]
85             if(tobedeleted) {
86                 $(lastitemblock).appendTo('#outeritemblock');
87             }
88         [% END %]
89         return false;
90     }
91
92     [% IF (AcqCreateItemOrdering) %]
93         if(check_additem('[% UniqueItemFields %]') == false) {
94             alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
95             if(tobedeleted) {
96                 $(lastitemblock).appendTo('#outeritemblock');
97             }
98             return false;
99         }
100     [% END %]
101 }
102
103 $(document).ready(function() 
104     {
105         [% IF (AcqCreateItemOrdering) %]
106             cloneItemBlock(0, '[% UniqueItemFields %]');
107         [% END %]
108
109         $("#quantity").change(function() {
110             updateCosts();
111         });
112
113         //We apply the fonction only for modify option
114         [% IF ( quantityrec ) %]
115         [% IF ( acqcreate ) %]
116         $('#quantity').blur(function() 
117         {
118             // if user decreases the quantity
119             if($(this).val() < [% quantityrec %]) 
120             {
121                 alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
122                 return true;
123             } 
124             else 
125             {
126                 // if user increases the quantity
127                 alert(_("You can't add a new item, please create a new order line"));
128                 // and we replace the original value
129                 $(this).val([% quantityrec %])
130                 updateCosts(); // blur is invoked after change which updated values
131                 return false;
132             }
133         });
134         [% END %]
135         [% END %]
136         
137         //keep a copy of all budgets before removing the inactives
138         disabledBudgetsCopy = $('#budget_id').html();
139         $('#budget_id .b_inactive').remove();
140
141         $('#showallbudgets').click(function() {
142             if ($(this).is(":checked")) {
143                 $('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds
144             }
145             else {
146                 $('#budget_id .b_inactive').remove();
147             }
148         });
149     });
150 //]]>
151 </script>
152 </head>
153 <body id="acq_neworderempty" class="acq">
154
155 [% INCLUDE 'header.inc' %]
156 [% INCLUDE 'acquisitions-search.inc' %]
157
158 <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>
159
160 <div id="doc3" class="yui-t2">
161
162 <div id="bd">
163     <div id="yui-main">
164     <div class="yui-b">
165
166 <h2>
167     [% IF ( ordernumber ) %]
168         Modify order line
169     [% ELSE %]
170         New order
171     [% END %]
172 </h2>
173
174 <div class="error" style="display:none"></div>
175
176 [% IF ( basketno ) %]
177     <div id="acqui_basket_summary"  class="yui-g">
178     <fieldset class="rows">
179         <legend>Basket details</legend>
180         <ol>
181         [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote %]</li>[% END %]
182         [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote %]</li>[% END %]
183         [% IF ( basketcontractno ) %]
184             <li><span class="label">Contract number: </span>[% basketcontractno %]</li>
185             <li><span class="label">Contract name:</span> <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]">[% basketcontractname %]</a></li>
186         [% END %]
187         [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname %]</li>[% END %]
188         [% IF ( creationdate ) %]<li><span class="label">Open on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
189         [% IF ( closedate ) %]
190         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
191         <li><span class="label">Closed on:</span>  [% closedate | $KohaDates %]</li>
192         [% IF ( basketgroups ) %]
193             <li>Basketgroup: <select id="basketgroupid" name="basketgroupid">
194                 [% FOREACH basketgroup IN basketgroups %]
195                     [% IF ( basketgroup.default ) %]
196                     <option value="[% basketgroup.id %]" selected="selected">[% basketgroup.name %]</option>
197                     [% ELSE %]
198                     <option value="[% basketgroup.id %]">[% basketgroup.name %]</option>
199                     [% END %]
200                 [% END %]
201                 </select>
202                 <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
203                 <input type="hidden" value="mod_basket" name="op" />
204                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
205             </li>
206             <fieldset class="action"><input type="submit" value="Change basketgroup" /></fieldset>
207         [% END %]
208         </form>
209         [% END %]
210         </ol>
211     </fieldset>
212     </div>
213 [% END %]
214
215 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform" onsubmit="return Check(this);">
216
217 <fieldset class="rows">
218         <legend>
219             Catalog details
220             [% IF ( biblionumber ) %]
221                 <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]"> Edit record</a></span>
222             [% END %]
223         </legend>
224         [% UNLESS ( existing ) %]
225         <input type="hidden" name="existing" value="no" />
226         [% END %]
227         <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
228         <input type="hidden" name="basketno" value="[% basketno %]" />
229         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
230         <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
231         <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
232         <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
233         <input type="hidden" name="applygst" id="applygst" value="[% gstreg %]" />
234         <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
235         <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
236         <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
237
238         [% FOREACH loop_currencie IN loop_currencies %]
239             <input type="hidden" id="currency_rate_[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
240         [% END %]
241
242         <ol><li>
243             [% IF ( biblionumber ) %]
244             <span class="label">Title</span>
245                 <input type="hidden" size="50" name="title" value="[% title |html %]" /> <span class="title">[% title |html %]</span>
246             [% ELSE %]
247             <label for="entertitle" class="required">Title: </label>
248                 <input type="text" id="entertitle" size="50" name="title" value="[% title |html %]" />
249             [% END %]
250         </li>
251         <li>
252             [% IF ( biblionumber ) %]
253             <span class="label">Author: </span>
254                 <input type="hidden" size="50" name="author" id="author" value="[% author %]" />[% author %]
255             [% ELSE %]
256             <label for="author">Author: </label>
257                 <input type="text" size="50" name="author" id="author" value="[% author %]" />
258             [% END %]
259         </li>
260         <li>
261             [% IF ( biblionumber ) %]
262             <span class="label">Publisher: </span>
263                 <input type="hidden" size="50" name="publishercode" id="publishercode" value="[% publishercode %]" />[% publishercode %]
264             [% ELSE %]
265             <label for="publishercode"> Publisher: </label>
266                 <input type="text" size="50" name="publishercode" id="publishercode" value="[% publishercode %]" />
267             [% END %]
268         </li>
269         <li>
270             [% IF ( biblionumber ) %]
271             <span class="label">Edition: </span>
272                 <input type="hidden" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement %]" />[% editionstatement %]
273
274             [% ELSE %]
275             <label for="editionstatement">Edition: </label>
276                 <input type="text" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement %]" />
277             [% END %]
278         </li>
279         <li>
280             [% IF ( biblionumber ) %]
281             <span class="label">Publication year: </span>
282                 <input type="hidden" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear %]" />[% publicationyear %]
283             [% ELSE %]
284             <label for="publicationyear">Publication year: </label>
285                 <input type="text" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear %]" />
286             [% END %]
287         </li>
288         <li>
289             [% IF ( biblionumber ) %]
290             <span class="label">ISBN: </span>
291                 <input type="hidden" size="50" name="isbn" id="ISBN" value="[% isbn %]" />[% isbn %]
292             [% ELSE %]
293             <label for="ISBN">ISBN: </label>
294                 <input type="text" size="50" name="isbn" id="ISBN" value="[% isbn %]" />
295             [% END %]
296         </li>
297         [% IF (UNIMARC) %]
298         <li>
299             [% IF ( biblionumber ) %]
300             <span class="label">EAN: </span>
301                 <input type="hidden" size="20" name="ean" id="EAN" value="[% ean %]" />[% ean %]
302             [% ELSE %]
303             <label for="EAN">EAN: </label>
304                 <input type="text" size="20" name="ean" id="EAN" value="[% ean %]" />
305             [% END %]
306         </li>
307         [% END %]
308         <li>
309             [% IF ( biblionumber ) %]
310             <span class="label">Series: </span>
311                 <input type="hidden" size="50" name="series" id="series" value="[% seriestitle %]" />[% seriestitle %]
312             [% ELSE %]
313             <label for="series">Series: </label>
314                 <input type="text" size="50" name="series" id="series" value="[% seriestitle %]" />
315             [% END %]
316         </li>
317         </li>
318             [% UNLESS ( biblionumber ) %]
319             [% IF ( itemtypeloop ) %]
320             <li>
321                 <span class="label">Item type:</span>
322                 <select name="itemtype" style="width:12em;">
323                 [% FOREACH itemtype IN itemtypeloop %]
324                     [% IF ( itemtype.selected ) %]
325                         <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
326                     [% ELSE %]
327                         <option value="[% itemtype.itemtype %]">[% itemtype.description %]</option>
328                     [% END %]
329                 [% END %]
330                 </select>
331             </li>
332             [% END %]
333             [% END %]
334         </ol>
335     </fieldset>
336
337     [% IF ( suggestionid ) %]
338         <fieldset class="rows">
339         <legend>Suggestion</legend>
340         <ol>
341           <li>
342             <span class="label">Suggested by: </span>
343             [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]&amp;op=show">suggestion #[% suggestionid %]</a>)
344           </li>
345         </ol>
346         </fieldset>
347     [% END %]
348
349     [% UNLESS subscriptionid %][% # it is a suggestion, we have not items %]
350       [% IF (AcqCreateItemOrdering) %]
351
352       <div id="items_list" style="display:none">
353           <p><b>Items list</b></p>
354           <div style="width:100%;overflow:auto;">
355               <table>
356                   <thead>
357                       <tr>
358                           <th>&nbsp;</th>
359                           <th>&nbsp;</th>
360                           <th>Barcode</th>
361                           <th>Home library</th>
362                           <th>Holding library</th>
363                           <th>Not for loan</th>
364                           <th>Restricted</th>
365                           <th>Location</th>
366                           <th>Call number</th>
367                           <th>Copy number</th>
368                           <th>Stock number</th>
369                           <th>Collection code</th>
370                           <th>Item type</th>
371                           <th>Materials</th>
372                           <th>Notes</th>
373                       </tr>
374                   </thead>
375                   <tbody>
376                   </tbody>
377               </table>
378           </div>
379       </div>
380
381       <fieldset class="rows" id="itemfieldset">
382           <legend>Item</legend>
383           [% IF ( NoACQframework ) %]
384               <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
385           [% END %]
386
387           <div id="outeritemblock"></div>
388
389       </fieldset>
390       [% END %][%# UNLESS subscriptionid %]
391     [% END %][%# IF (AcqCreateItemOrdering) %]
392     <fieldset class="rows">
393         <legend>Accounting Details</legend>
394         <ol>
395             <li>
396                 [% IF ( close ) %]
397             <span class="label required">Quantity: </span>
398                     <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
399                 [% ELSE %]
400                     <label class="required" for="quantity">Quantity: </label>
401                     [% IF (AcqCreateItemOrdering) %]
402                         [% IF subscriptionid %]
403                             <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
404                         [% ELSE %]
405                             <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
406                         [% END %]
407                     [% ELSE %]
408                         [% IF subscriptionid %]
409                             <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
410                         [% ELSE %]
411                             <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
412                         [% END %]
413                     [% END %]
414                 [% END %]
415                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
416                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
417             </li>
418             <li>
419                 [% IF ( close ) %]
420             <span class="label required">Fund: </span>
421                     <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
422                 [% ELSE %]
423                 <label class="required" for="budget_id">Fund: </label>
424                 <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
425                         <option value="">Select a budget</option>
426                 [% FOREACH budget_loo IN budget_loop %]
427                     [% IF ( budget_loo.b_sel ) %]
428                         <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
429                     [% ELSE %]
430                         [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
431                         [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option>
432                         [% END %]
433                     [% END %]
434                 [% END %]
435                 </select>
436                 <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
437                 <input type="checkbox" id="showallbudgets" />
438                 [% END %]
439             </li>
440                 <li>
441                 [% IF ( close ) %]
442                         <span class="label">Currency: </span>
443                         <input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
444                 [% ELSE %]
445                         <label for="currency">Currency:</label>
446                         <select name="currency" id="currency" onchange="updateCosts();">
447                         [% FOREACH loop_currencie IN loop_currencies %]
448                         [% 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 %]
449                         </select>
450                 [% END %]
451                 </li>
452             <li>
453                 [% IF ( close ) %]
454                     <span class="label">Vendor price: </span>
455                     <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
456                 [% ELSE %]
457                 <label for="listprice">Vendor price: </label>
458                     <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="updateCosts()" />
459                 [% END %]
460             </li>
461             [% UNLESS ( close ) %]
462             <li>
463                     <label for="uncertainprice">Uncertain price: </label>
464                     [% IF ( uncertainprice ) %]
465                     <input type="checkbox" name="uncertainprice"  id="uncertainprice" value="1" checked="checked" />
466                     [% ELSE %]
467                     <input type="checkbox" name="uncertainprice" id="uncertainprice" value="1" />
468                 [% END %]
469             </li>
470             [% END %]
471             [% IF ( gst_values ) %]
472                 <li>
473                     [% IF ( close ) %]
474                         <span class="label">Tax rate: </span>
475                         <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
476                     [% ELSE %]
477                         <label for="gst">Tax rate: </label>
478                         <select name="gstrate" id="gstrate" onchange="updateCosts();">
479                         [% FOREACH gst IN gst_values %]
480                           [% IF ( gst.option == gstrate ) %]
481                             <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
482                           [% ELSE %]
483                             <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
484                           [% END %]
485                         [% END %]
486                         </select>
487                     [% END %]
488                 [% ELSE %]
489                     <input type="hidden" name="gstrate" value="0" />
490                 </li>
491             [% END %]
492             <li>
493                 <label for="discount">Discount: </label>
494                 [% IF ( close ) %]
495                     [% IF ( orderdiscount ) %]
496                         <input type="hidden" name="discount" id="discount" value="[% orderdiscount %]" />[% orderdiscount_2dp %]%
497                     [% ELSE %]
498                         <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
499                     [% END %]
500                 [% ELSE %]
501                     [% IF ( orderdiscount ) %]
502                         <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
503                     [% ELSE %]
504                         <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
505                     [% END %]
506                 [% END %]
507             </li>
508             <li>
509                 [% IF ( close ) %]
510                     <span class="label">Replacement cost: </span>
511                     <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
512                 [% ELSE %]
513                     <label for="rrp">Replacement cost: </label>
514                     <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
515                 [% END %]
516             </li>
517             <li>
518                 [% IF ( close ) %]
519                     <label for="ecost">Budgeted cost: </label>
520                     <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
521                 [% ELSE %]
522                     <label for="ecost">Budgeted cost: </label>
523                     <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
524                 [% END %]
525             </li>
526             <li>
527                 [% IF ( close ) %]
528                     <label for="total">Total: </label>
529                     <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
530                 [% ELSE %]
531                     <label for="total">Total: </label>
532                     <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
533                 [% END %]
534             </li>
535             <li>
536                 [% IF ( close ) %]
537                     <label for="unitprice">Actual cost: </label>
538                     <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
539                 [% ELSE %]
540                     <label for="unitprice">Actual cost: </label>
541                     <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
542                 [% END %]
543             </li>
544             <li>
545                 <label for="notes">Notes: </label>
546                 <textarea id="notes" cols="30" rows="3" name="notes" >[% IF ( notes ) %][% notes %][% END %]</textarea>
547             </li>
548             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
549                 <label for="sort1">Statistic 1: </label>
550                 <span id="sort1_zone">
551                 [% IF CGIsort1 %]
552                     <select id="sort1" size="1" name="sort1">
553                     [% FOREACH sort_opt IN CGIsort1 %]
554                        [% IF sort_opt.default %]
555                           <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option>
556                         [% ELSE %]
557                           <option value="[% sort_opt.value %]">[% sort_opt.label %]</option>
558                         [% END %]
559                     [% END %]
560                     </select>
561                 [% ELSE %]
562                     <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
563                 [% END %]
564                 </span>
565             </li>
566             <li>
567                 <label for="sort2">Statistic 2: </label>
568                 <span id="sort2_zone">
569                 [% IF CGIsort2 %]
570                     <select id="sort2" size="1" name="sort2">
571                     [% FOREACH sort_opt IN CGIsort2 %]
572                        [% IF sort_opt.default %]
573                           <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option>
574                         [% ELSE %]
575                           <option value="[% sort_opt.value %]">[% sort_opt.label %]</option>
576                         [% END %]
577                     [% END %]
578                     </select>
579                 [% ELSE %]
580                     <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
581                 [% END %]
582                 </span>
583             </li>
584         </ol>
585     </fieldset>
586     <fieldset class="action">
587         <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
588         <input type="submit" value="Save" />
589         [% IF (suggestionid) %]
590             <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
591         [% ELSE %]
592             [% IF subscriptionid %]
593                 <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
594             [% ELSE %]
595                 <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
596             [% END %]
597         [% END %]
598     </fieldset>
599 </form>
600 </div>
601 </div>
602 <div class="yui-b">
603 [% INCLUDE 'acquisitions-menu.inc' %]
604 </div>
605 </div>
606 [% INCLUDE 'intranet-bottom.inc' %]