Date format fix for serials irregularities.
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / subscription-add.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Serials &rsaquo; <!-- TMPL_IF name="mod" --> Modify subscription to <!-- TMPL_VAR name="bibliotitle" --><!-- TMPL_ELSE -->New subscription<!-- /TMPL_IF --></title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
5
6 <script type="text/javascript">
7 <!--
8
9 // the english words used in display purposes
10 var text = new Array(_("Number"),_("Volume"),_("Issue"),_("Month"),_("Week"),_("Starting with:"),_("Rollover at:"),_("Choose Hemisphere:"),_("Northern"),_("Southern"),
11 _("Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall"),_("Season"),_("Year"));
12 var is_season = 0;
13 var is_hemisphere = 1;
14
15 function YMDaToYWDa(S) {
16     with (new Date(Date.UTC(S[0], S[1] - 1, S[2]))) {
17         var DoW = getUTCDay();
18         setUTCDate(getUTCDate() - (DoW + 6) % 7 + 3);
19         var ms = valueOf();
20         setUTCMonth(0, 4);
21         var WN = Math.round((ms - valueOf()) / 604800000) + 1;
22         return [getUTCFullYear(), WN, DoW == 0 ? 7 : DoW];
23     }
24 }
25 function dayofyear(d) { // d is a Date object
26 var yn = d.getFullYear();
27 var mn = d.getMonth();
28 var dn = d.getDate();
29 var d1 = new Date(yn,0,1,12,0,0); // noon on Jan. 1
30 var d2 = new Date(yn,mn,dn,12,0,0); // noon on input date
31 var ddiff = Math.round((d2-d1)/864e5);
32 return ddiff+1;
33 }
34
35
36 // common pre defined number patterns
37 function num_pattern() {
38 var patternchoice = document.getElementById("numberpattern").value;
39     switch(patternchoice){
40     case "2":
41         document.f.add1.value=1;
42         document.f.add2.value=1;
43         document.f.add3.value=1;
44         document.f.every1.value=12;
45         document.f.every2.value=1;
46         document.f.every3.value=1;
47         document.f.whenmorethan1.value=9999999;
48         document.f.whenmorethan2.value=12;
49         document.f.whenmorethan3.value=4;
50         document.f.setto1.value=0;
51         document.f.setto2.value=1;
52         document.f.setto3.value=1;
53 /*        document.f.lastvalue1.value=1;
54         document.f.lastvalue2.value=1;
55         document.f.lastvalue3.value=1;*/
56         document.f.numberingmethod.value=_("Vol {X}, No {Y}, Issue {Z}");
57         moreoptions(text[1],text[0],text[2]);
58         display_table(0); // toggle info box on (1) or off (0)
59         break;
60     case "3":
61         document.f.add1.value=1;
62         document.f.add2.value=1;
63         document.f.add3.value='';
64         document.f.every1.value=12;
65         document.f.every2.value=1;
66         document.f.every3.value='';
67         document.f.whenmorethan1.value=9999999;
68         document.f.whenmorethan2.value=12;
69         document.f.whenmorethan3.value='';
70         document.f.setto1.value=0;
71         document.f.setto2.value=1;
72         document.f.setto3.value='';
73 /*        document.f.lastvalue1.value=1;
74         document.f.lastvalue2.value=1;
75         document.f.lastvalue3.value='';*/
76         document.f.numberingmethod.value=_("Vol {X}, No {Y}");
77         moreoptions(text[1],text[0]);
78         display_table(0);
79         break;
80     case "4":
81         document.f.add1.value=1;
82         document.f.add2.value=1;
83         document.f.add3.value='';
84         document.f.every1.value=12;
85         document.f.every2.value=1;
86         document.f.every3.value='';
87         document.f.whenmorethan1.value=9999999;
88         document.f.whenmorethan2.value=12;
89         document.f.whenmorethan3.value='';
90         document.f.setto1.value=0;
91         document.f.setto2.value=1;
92         document.f.setto3.value='';
93         document.f.numberingmethod.value=_("Vol {X}, Issue {Y}");
94         moreoptions(text[1],text[2]);
95         display_table(0);
96         break;
97     case "5":
98 //        var d = new Date(document.f.firstacquidate.value);
99 //        var smonth = d.getMonth();
100         document.f.add1.value=1;
101         document.f.add2.value=1;
102         document.f.add3.value='';
103         document.f.every1.value=12;
104         document.f.every2.value=1;
105         document.f.every3.value='';
106         document.f.whenmorethan1.value=9999999;
107         document.f.whenmorethan2.value=12;
108         document.f.whenmorethan3.value='';
109         document.f.setto1.value=0;
110         document.f.setto2.value=1;
111         document.f.setto3.value='';
112         document.f.numberingmethod.value=_("No {X}, Issue {Y}");
113         moreoptions(text[0],text[2]);
114         display_table(0);
115         break;
116     case "6":
117         var d = new Date(document.f.firstacquidate.value);
118         var sYear = d.getFullYear();
119         moreoptions_seasons(text[15],sYear);
120         var d = new Date(document.f.firstacquidate.value);
121         var sYear = d.getFullYear();
122         document.f.add1.value=1;
123         document.f.add2.value='1';
124         document.f.add3.value='';
125         document.f.every1.value=4;
126         document.f.every2.value='1';
127         document.f.every3.value='';
128         document.f.whenmorethan1.value=9999999;
129         document.f.whenmorethan2.value='4';
130         document.f.whenmorethan3.value='';
131         document.f.setto1.value=0;
132         document.f.setto2.value='1';
133         document.f.setto3.value='';
134         document.f.lastvaluetemp1.value=sYear;
135         document.f.periodicity.value='8';
136         document.f.numberingmethod.value=_("{Y} {X}");
137         moreoptions_seasons(text[15],sYear);
138         display_table(0);
139         is_season = 1;
140         break;
141     case "7":
142         display_table(1);
143         document.getElementById("more_options").innerHTML = '';
144         document.f.irreg_check.value=1; 
145         break;
146     case "8":
147         var d = new Date(document.f.startdate.value);
148         var sYear = d.getFullYear();
149         document.f.add1.value=1;
150         document.f.add2.value=1;
151         document.f.add3.value='';
152         document.f.every1.value=12;
153         document.f.every2.value=1;
154         document.f.every3.value='';
155         document.f.whenmorethan1.value=9999999;
156         document.f.whenmorethan2.value=12;
157         document.f.whenmorethan3.value='';
158         document.f.setto1.value=0;
159         document.f.setto2.value=1;
160         document.f.setto3.value='';
161 //         document.f.setto3.value='';
162         if (document.f.lastvalue1.value==0){document.f.lastvalue1.value=sYear};
163         if (document.f.lastvalue2.value==0 ||document.f.lastvalue2.value=='' ){    
164           switch (document.f.periodicity.value){
165             case 1:              
166               var doy = dayofyear(d);
167               //var Weeknumber=YWDA[1];
168               document.f.lastvalue2.value=doy; 
169               break;      
170             case 12:     
171               var doy = dayofyear(d);
172               //var Weeknumber=YWDA[1];
173               document.f.lastvalue2.value=doy*2; 
174               break;      
175             case 13:     
176               var doy = dayofyear(d);
177               //var Weeknumber=YWDA[1];
178               document.f.lastvalue2.value=doy/3; 
179               break;      
180             case 2:
181             case 3:
182             case 4:
183               var YWDa = YMDaToYWDa(d);
184               //var Weeknumber=YWDA[1];
185               document.f.lastvalue2.value=YWDA[1]/(document.f.periodicity.value-1); 
186               break;      
187             case 5:
188               var smonth = d.getMonth();
189               document.f.lastvalue2.value=smonth;
190               break;      
191             case 6:
192               var smonth = d.getMonth();
193               document.f.lastvalue2.value=smonth/2;
194               break;      
195             case 7:
196             case 8:      
197               var smonth = d.getMonth();
198               document.f.lastvalue2.value=smonth/3;
199               break;      
200             case 9:                        
201               var smonth = d.getMonth();
202               document.f.lastvalue2.value=smonth/6;
203               break;      
204             default:
205           } 
206         }    
207         //         document.f.lastvalue2.value=document.f.lastvaluetemp2.value;
208         document.f.lastvalue3.value='';
209         document.f.numberingmethod.value=_("{X}/{Y}");
210         moreoptions(text[16],text[0]);
211         display_table(0);
212         break;
213     default:
214         document.f.add1.value=1;
215         document.f.add2.value='';
216         document.f.add3.value='';
217         document.f.every1.value=1;
218         document.f.every2.value='';
219         document.f.every3.value='';
220         document.f.whenmorethan1.value=9999999;
221         document.f.whenmorethan2.value='';
222         document.f.whenmorethan3.value='';
223         document.f.setto1.value=0;
224         document.f.setto2.value='';
225         document.f.setto3.value='';
226 /*        document.f.lastvalue1.value=1;
227         document.f.lastvalue2.value='';
228         document.f.lastvalue3.value='';*/
229         document.f.numberingmethod.value='{X}';
230         moreoptions_daily_check(text[0]);
231         document.f.irreg_check.value=1;
232         display_table(0);
233         break;
234     }
235 }
236
237 function display_table(n) {
238     if(n==1){
239         document.getElementById("basetable").style.display = 'block';
240     } else {
241         document.getElementById("basetable").style.display = 'none';
242     }
243 }
244
245 function modify_num_pattern() {
246         if(!document.getElementById("numberpattern")){ return false; }
247     document.getElementById("numberpattern").value = '<!-- TMPL_VAR NAME="numberpattern" -->';
248     num_pattern();
249     
250     document.f.add1.value='<!-- TMPL_VAR NAME="add1" -->';
251     document.f.add2.value='<!-- TMPL_VAR NAME="add2" -->';
252     document.f.add3.value='<!-- TMPL_VAR NAME="add3" -->';
253     document.f.every1.value='<!-- TMPL_VAR NAME="every1" -->';
254     document.f.every2.value='<!-- TMPL_VAR NAME="every2" -->';
255     document.f.every3.value='<!-- TMPL_VAR NAME="every3" -->';
256     document.f.whenmorethan1.value='<!-- TMPL_VAR NAME="whenmorethan1" -->';
257     document.f.whenmorethan2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
258     document.f.whenmorethan3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
259     document.f.setto1.value='<!-- TMPL_VAR NAME="setto1" -->';
260     document.f.setto2.value='<!-- TMPL_VAR NAME="setto2" -->';
261     document.f.setto3.value='<!-- TMPL_VAR NAME="setto3" -->';
262     document.f.lastvalue1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
263     document.f.lastvalue2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
264     document.f.lastvalue3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
265     document.f.numberingmethod.value='<!-- TMPL_VAR NAME="numberingmethod" -->';
266
267     var more_strY;
268     var more_strZ;
269     <!-- TMPL_IF NAME="add2" -->
270     if(<!-- TMPL_VAR NAME="add2" --> > 0){
271         more_strY="Y";
272     }
273     <!-- /TMPL_IF -->
274     <!-- TMPL_IF NAME="add3" -->
275     if(<!-- TMPL_VAR NAME="add3" --> > 0){
276         more_strZ="Z";
277     }
278     <!-- /TMPL_IF -->
279
280     document.f.lastvaluetemp1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
281     if(more_strY){
282         document.f.lastvaluetemp2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
283     document.f.whenmorethantemp2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
284     }
285     if(more_strZ){
286         document.f.lastvaluetemp3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
287     document.f.whenmorethantemp3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
288     }
289 }
290
291 // a pre check with more options to see if 'number' and '1/day' are chosen
292 function moreoptions_daily_check(x) {
293     var periodicity = document.f.periodicity.value;
294     var errortext='';
295     if(periodicity == 1){
296         document.getElementById("irregularity").innerHTML = '';
297         var daynames = new Array(_("Monday"),_("Tuesday"),_("Wednesday"),_("Thursday"),_("Friday"),_("Saturday"),_("Sunday"));
298         errortext =_("Please indicate which days of the week you <b>DO NOT<\/b> expect to receive issues.<br \/>");
299         for(var j=0;j<daynames.length;j++){
300             errortext +="<input type='checkbox' name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" &nbsp; ";
301         }
302         var error = errortext;
303         moreoptions(x);
304         document.getElementById("irregularity").innerHTML = error;
305     } else {
306         document.getElementById("irregularity").innerHTML = '';
307         document.getElementById("more_options").innerHTML = '';
308         moreoptions(x);
309     }
310 }
311
312 // to dispaly the more options section
313 function moreoptions(x,y,z){
314 document.getElementById("irregularity").innerHTML = '';
315 document.getElementById("more_options").innerHTML = '';
316 var textbox = '';
317     // alert("X: "+x+"Y: "+y+"Z: "+z);
318     if(x){
319         textbox +="<table>\n<tr><th>&nbsp;<\/th><th>"+x+"<\/th>";
320         if(y){
321             textbox +="<th>"+y+"<\/th>";
322             if(z){
323                 textbox +="<th>"+z+"<\/th>";
324             }
325         }
326         textbox +="<\/tr>\n";
327         textbox +="<tr><th scope=\"row\">"+text[5]+"<\/td><td><input type='text' name='lastvaluetemp1' size='4' onkeyup='moreoptionsupdate(\"lastvalue1\")' value=\"" + document.f.lastvalue1.value +  "\" /><\/td>\n";
328         if(y){
329             textbox +="<td><input type='text' name='lastvaluetemp2' size='4' onkeyup='moreoptionsupdate(\"lastvalue2\")' value=\"" + document.f.lastvalue2.value + "\" /><\/td>\n";
330             if(z){
331                 textbox +="<td><input type='text' name='lastvaluetemp3' size='4' onkeyup='moreoptionsupdate(\"lastvalue3\")' value=\"" + document.f.lastvalue3.value + "\" /><\/td>\n";
332             }
333         }
334         textbox +="<\/tr>\n";
335         if(y){
336             textbox +="<tr><th scope=\"row\">"+text[6]+"<\/th>";
337             textbox +="<td><a href='javascript:irregularity_check()'>"+_("Irregularity?")+"<\/a><\/td>\n";
338             textbox +="<td><input type='text' name='whenmorethantemp2' size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
339             if(z){
340                 textbox +="<td><input type='text' name='whenmorethantemp3' size='4' onkeyup='moreoptionsupdate(\"whenmorethan3\",1)'><\/td>\n";
341             }
342             textbox +="<\/tr>";
343         } else {
344           textbox +="<tr> <td>"+_("issues expected")+"</td><td><input type='text' name='issuesexpectedtemp1' size='4' onkeyup='moreoptionsupdate(\"issuesexpected1\",0)' value=\"" + document.f.issuesexpected1.value + "\" ><br/><a href='javascript:irregularity_check()'>"+_("Irregularity?")+"</a></td></tr>";
345         }
346         textbox +="<\/table>\n";
347     }
348     document.getElementById("more_options").innerHTML = textbox;
349 }
350
351 function hemispheres(chosen){
352 var selbox = document.getElementById("season1");
353     if(selbox){
354     var selboxselected = selbox.options[selbox.selectedIndex].value;
355     selbox.options.length = 0;
356
357     if (chosen == "1") {
358         selbox.options[selbox.options.length] = new Option(text[11],'1');
359         selbox.options[selbox.options.length] = new Option(text[12],'2');
360         selbox.options[selbox.options.length] = new Option(text[13],'3');
361         selbox.options[selbox.options.length] = new Option(text[14],'4');
362         is_hemisphere = 1;
363         selbox.options[selboxselected-1].selected = true;
364     }
365
366     if (chosen == "2") {
367         selbox.options[selbox.options.length] = new Option(text[13],'1');
368         selbox.options[selbox.options.length] = new Option(text[10],'2');
369         selbox.options[selbox.options.length] = new Option(text[11],'3');
370         selbox.options[selbox.options.length] = new Option(text[12],'4');
371         is_hemisphere = 2;
372         selbox.options[selboxselected-1].selected = true;
373     }
374     }
375 }
376
377 // to dispaly the more options section for seasons
378 function moreoptions_seasons(x,y){
379 document.getElementById("irregularity").innerHTML = '';
380 document.getElementById("more_options").innerHTML = '';
381 var textbox = '';
382     //alert("X: "+x+"Year: "+y);
383     if(x){
384         var hemi_select = parseInt('<!-- TMPL_VAR NAME="hemisphere" -->');
385         textbox +="<li><label for=\"hemisphere\">"+ text[7]  +"<\/label><select name='hemisphere' id=\"hemisphere\" onchange='hemispheres(this.options[this.selectedIndex].value)'>";
386         for(var i = 1; i <= 2; i++){
387             textbox +="<option value='"+i+"'";
388             if(i == hemi_select){
389                 textbox += " selected "
390             }
391             textbox +=">"+text[i+7]+"<\/option>";
392         }
393         textbox +="<\/li>\n";
394         textbox +="<table><tr><th>&nbsp;<\/th><th>"+x+"<\/th>";
395         textbox +="<th>"+text[16]+"<\/th>";
396         textbox +="<\/tr>\n";
397         textbox +="<tr><th scope=\"row\">"+text[5]+"<\/th><td><select name='lastvaluetemp2' id='season1' onchange='moreoptionsupdate(\"lastvalue2\")'>";
398         for(var j = 1; j <= 4; j++){
399             textbox +="<option value='"+j+"'>"+text[j+10]+"<\/option>";
400         }
401         textbox +="<\/select><\/td><td><select name='lastvaluetemp1' onchange='moreoptionsupdate(\"lastvalue1\")'>";
402         for(var k = parseInt(y); k <= parseInt(y)+15; k++){
403             textbox +="<option value='"+k+"'>"+k+"<\/option>";
404         }
405         textbox +="<\/select><\/td><\/tr>\n";
406         textbox +="<tr><th scope=\"row\">"+text[6]+"<\/th>";
407         textbox +="<td><a href='javascript:irregularity_check()'>"+_("Irregularity?")+"<\/a><\/td>\n";
408         textbox +="<td><input type='text' name='whenmorethantemp2' size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
409                 textbox +="<\/tr><\/table>\n";
410
411     }
412     document.getElementById("more_options").innerHTML = textbox;
413 }
414
415 function irregularity_check(){
416     document.f.irreg_check.value = 1; // Irregularity button now pushed
417     var periodicity = document.f.periodicity.value;
418         var rollover = document.f.issuesexpected1.value;
419     if(document.f.whenmorethantemp2){
420       rollover = document.f.whenmorethantemp2.value;
421     }
422     if(document.f.whenmorethantemp3){
423         rollover = document.f.whenmorethantemp3.value;
424     }
425     var error='';
426     var toobig;
427     var expected; 
428     var errortext = _("<b>Warning irregularity detected<\/b><br \/>");
429     switch(periodicity){
430     case "12":
431         if(rollover < 730) expected =730;
432         if(rollover > 730) {
433             expectedover=730;
434             toobig=1;
435         }
436         break;
437     case "1":
438         if(rollover < 365) expected =365;
439         if(rollover > 365) {
440             expectedover=365;
441             toobig=1;
442         }
443         break;
444     case "13":
445         if(rollover < 156) expected =156;
446         if(rollover > 156) {
447             expectedover=156;
448             toobig=1;
449         }
450         break;
451     case "2":
452         if(rollover < 52) expected =52;
453         if(rollover > 52){
454             expectedover=52;
455             toobig=1;
456         }
457         break;
458     case "3":
459         if(rollover < 26) expected =26;
460         if(rollover > 26){
461             expectedover=26;
462             toobig=1;
463         }
464         break;
465     case "4":
466         if(rollover < 17) expected =17;
467         if(rollover > 17){
468             expectedover=17;
469             toobig=1;
470         }
471         break;
472     case "5":
473         if(rollover < 12) expected =12;
474         if(rollover > 12){
475             expectedover=12;
476             toobig=1;
477         }
478         break;
479     case "6":
480         if(rollover < 6) expected =6;
481         if(rollover > 6){
482             expectedover=6;
483             toobig=1;
484         }
485         break;
486     case "7":
487         if(rollover < 4) expected =4;
488         if(rollover > 4){
489             expectedover=4;
490             toobig=1;
491         }
492         break;
493     case "8":
494         if(rollover < 4) expected =4;
495         if(rollover > 4){
496             expectedover=4;
497             toobig=1;
498         }
499         break;
500     case "9":
501         if(rollover < 2) expected =2;
502         if(rollover > 2){
503             expectedover=2;
504             toobig=1;
505         }
506         break;
507     case "10":
508         if(rollover < 1) expected =1;
509         if(rollover > 1){
510             expectedover=1;
511             toobig=1;
512         }
513         break;
514     default:
515         break;
516     }
517     if(expected){
518         if(expected == 365 || expected==730){
519             var daynames = new Array(_("Monday"),_("Tuesday"),_("Wednesday"),_("Thursday"),_("Friday"),_("Saturday"),_("Sunday"));
520             errortext += _("Please indicate which days of the week you <b>DO NOT<\/b> expect to receive issues.<br \/>");
521             for(var j=0;j<daynames.length;j++){
522                 errortext +="<input type='checkbox' name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" &nbsp; ";
523             }
524             error=errortext;
525         } else {
526             errortext +=expected+_(" issues expected, ")+rollover+_(" were entered. <br \/>Please indicate which date(s) an issue is not expected<br \/>");
527             var count=0;
528             for(var i=rollover;i<expected;i++){
529                 errortext +="<select name='irregular' id='irregular"+count+"' onchange='display_example(expected)'>\n";
530                 errortext +=irregular_options(periodicity);
531                 errortext +="<\/select>\n";
532                 count++;
533             }
534             error=errortext;
535         }
536     }
537     if(toobig){
538         errortext +=expectedover+_(" issues expected, ")+rollover+_(" were entered.<br \/> You seem to have indicated more issues per year than expected.");
539         error=errortext;
540     }
541     if(error.length ==0){
542         error=_("No irregularities noticed");
543     }
544     display_example(expected);
545     document.getElementById("irregularity").innerHTML = error;
546 }
547
548 function irregular_options(periodicity){
549     var titles;
550     var count;
551 <!-- TMPL_IF NAME="weekarrayjs" -->
552     var weeks = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
553 <!-- /TMPL_IF -->
554     var months = new Array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December"));
555     var seasons = new Array(_("Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall"));
556     var errortext='';
557     if(periodicity == 1) {
558         expected = 366;
559         titles = "Day";
560         count = 1;
561     }
562     if(periodicity == 2 || periodicity == 3 || periodicity == 4) { 
563         expected = 52;
564     <!-- TMPL_IF NAME="weekarrayjs" -->
565         titles = weeks;
566         count = <!-- TMPL_VAR NAME="weekno" -->;
567     <!-- TMPL_ELSE -->
568         titles = "Week";
569         count = 1;
570     <!-- /TMPL_IF -->
571     }
572     if(periodicity == 5 || periodicity == 6 || periodicity == 7 || periodicity == 8 || periodicity == 9) {
573         if(periodicity == 8) {
574             is_season = 1; // setting up from edit page
575         } 
576         if(is_season){
577             titles = seasons;
578             expected = 4;
579             if(is_hemisphere == 2){
580                 count = 2;
581             } else {
582                 count = 1;
583             }
584         } else {
585             titles = months;
586             expected = 12;
587             count = 1;
588         }
589     }
590     for(var j=1;j<=expected;j++){
591         if(isArray(titles)){
592             if(count>expected){
593                 count = count-expected;
594             }
595             if(is_season && is_hemisphere == 1){
596                 errortext +="<option value='"+((count*3)-2)+"'>"+titles[j]+"<\/option>\n";
597 // alert("value: "+((count*3)-2)+" title: "+titles[j]);
598             } else if(is_season && is_hemisphere == 2){
599                 errortext +="<option value='"+((count*3)-2)+"'>"+titles[j-1]+"<\/option>\n";
600 // alert("value: "+((count*3)-2)+" title: "+titles[j-1]);
601             } else {
602                 errortext +="<option value='"+count+"'>"+titles[j-1]+"<\/option>\n";
603             }
604             count++;
605         } else {
606             errortext +="<option value='"+j+"'>"+titles+" "+j+"<\/option>\n";
607         }
608     }
609     return errortext;
610 }
611
612 function irregular_order(){
613     var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
614     var periodicity = document.f.periodicity.value;
615     var irregarray = irregular.split(',');
616     if(periodicity ==1){
617         for(j=0;j<irregarray.length;j++){
618         document.getElementById("irregular"+irregarray[j]).checked = true; 
619         }
620     } else {
621         for(i=0;i<irregarray.length;i++){    
622             document.getElementById("irregular"+i).value = irregarray[i];
623         }
624     }
625 }
626
627 function display_example(expected){
628     var startfrom1 = parseInt(document.f.lastvalue1.value);
629     var startfrom2 = parseInt(document.f.lastvalue2.value);
630     var startfrom3 = parseInt(document.f.lastvalue3.value);
631     var every1 = parseInt(document.f.every1.value);
632     var every2 = parseInt(document.f.every2.value);
633     var every3 = parseInt(document.f.every3.value);
634     var numberpattern = document.f.numberingmethod.value;
635     var whenmorethan2 = parseInt(document.f.whenmorethan2.value);
636     var whenmorethan3 = parseInt(document.f.whenmorethan3.value);
637     var setto2 = parseInt(document.f.setto2.value);
638     var setto3 = parseInt(document.f.setto3.value);
639     var displaytext = _("Based on the information<br \/>entered the Numbering Pattern<br \/>will look like this<br \/>\n");
640     if(startfrom3>0){
641         var count=startfrom3-1;
642         var count2=startfrom2;
643         for(var i=0;i<12;i++){
644             if(count>=whenmorethan3){
645                 count=setto3;
646                 if(count2>=whenmorethan2){
647                     startfrom1++;
648                     count2=setto2;
649                 } else {
650                     count2++;
651                 }
652             } else {
653                 count++;
654             }
655             displaytext += numberpattern.replace(/{Z}/,count)+'\n';
656             displaytext = displaytext.replace(/{Y}/,count2)+'<br \/>\n';
657             displaytext = displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
658
659         }
660     }
661     if(startfrom2>0 && !startfrom3){
662         var count=startfrom2-1;
663         for(var i=0;i<12;i++){
664             if(count>=whenmorethan2){
665                 startfrom1++;
666                 count=setto2;
667             } else {
668                 count++;
669             }
670
671             if(is_season){
672                 if(is_hemisphere == 2){
673                     if(count == 1) {
674                         displaytext += numberpattern.replace(/{Y}/,text[count+12])+'\n';
675                     } else {
676                         displaytext += numberpattern.replace(/{Y}/,text[count+8])+'\n';
677                     }
678                 } else {
679                 displaytext += numberpattern.replace(/{Y}/,text[count+10])+'\n';
680                 }
681             } else {
682                 displaytext += numberpattern.replace(/{Y}/,count)+'\n';
683             }
684             displaytext = displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
685         }
686     }
687     if(startfrom1>0 && !startfrom2 && !startfrom3){
688         var offset=eval(document.f.issuesexpected1.value);
689         if (!offset){
690             offset = 12 
691         }
692         for(var i=startfrom1;i<(startfrom1+offset);i+=every1){
693             displaytext += numberpattern.replace(/{X}/,i)+'<br \/>\n';
694         }
695     }
696     displaytext = "<div style='padding: 5px; background-color: #CCCCCC'>"+displaytext+"<\/div>";
697     document.getElementById("displayexample").innerHTML = displaytext;
698 }
699
700 function isArray(obj) {
701 if (obj.constructor.toString().indexOf("Array") == -1)
702     return false;
703 else
704     return true;
705 }
706
707 function moreoptionsupdate(fieldnames,rollover){
708     fieldname = fieldnames;
709     fld = fieldname.length;
710     fld = fld-1;
711     fieldnametempnumber = fieldname.substr(fld);
712     //alert(fieldnametempnumber);
713     fieldnametemp = fieldname.slice(0,-1)+"temp"+fieldnametempnumber;
714     // alert(fieldnametemp);
715     eval("document.f."+fieldname+".value = document.f."+fieldnametemp+".value");
716 //     alert (fieldname+" : "+eval("document.f."+fieldname+".value") +' '+fieldnametemp+' : ' +eval("document.f."+fieldnametemp+".value"));
717     var patternchoice = document.getElementById("numberpattern").value;
718     switch(patternchoice){
719     case "2":
720     case "4":
721     case "5":
722     case "8":
723        if (document.f.lastvaluetemp2.value>0){document.f.innerloop1.value = document.f.lastvaluetemp2.value - 1;}
724       break;   
725     }  
726     if(rollover){
727         eval("document.f.every"+(fieldnametempnumber-1)+".value = document.f."+fieldnametemp+".value");
728     }
729 }
730
731
732 function check_input(e){
733     var unicode=e.charCode? e.charCode : e.keyCode
734     if (unicode!=8 && unicode !=46 && unicode!=9 && unicode !=13){ // if key isn't backspace or delete
735         if (unicode<48||unicode>57) { // if not a number
736             alert(_("Needs to be entered in digit form -eg 10"));
737             return false // disable key press
738         }
739     }
740 }
741
742 function addbiblioPopup(biblionumber) {
743         var destination = "/cgi-bin/koha/cataloguing/addbiblio.pl?mode=popup";
744         if(biblionumber){ destination += "&biblionumber="+biblionumber; }
745  window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes');
746 }
747
748 function Plugin(f)
749 {
750          window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
751 }
752
753 function FindAcqui(f)
754 {
755          window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes');
756 }
757
758 function Find_ISSN(f)
759 {
760          window.open('issn-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
761 }
762
763
764 function Check(f) {
765     if (f.aqbooksellerid.value.length==0) {
766         alert(_("You must choose a supplier"));
767     } else if (f.biblionumber.value.length==0) {
768         alert(_("You must choose or create a biblio"));
769     } else if(f.startdate.value.length != 0 && f.sublength.value > 0) {
770         if (f.irreg_check.value == 1) {
771             document.f.submit();
772         } else {
773             if(f.numbering_pattern.value == ''){
774                 alert(_("Please choose a numbering pattern"));
775             } else {
776                 alert(_("Please check for irregularity by clicking 'Irregularity?'"));
777             }
778         }
779     } else {
780         alert(_("You must choose a start date and a subscription length"));
781     }
782     return false;
783 }
784 <!-- TMPL_IF name="mod" -->
785 window.onload = modify_num_pattern();
786     <!-- TMPL_IF name="hemisphere" -->
787     window.onload = hemispheres(<!-- TMPL_VAR NAME="hemisphere" -->);
788     <!-- /TMPL_IF -->
789 <!-- /TMPL_IF -->
790 <!-- TMPL_IF name="irregularity" -->
791 window.onload = irregularity_check();
792 window.onload = irregular_order();
793 <!-- /TMPL_IF -->
794 -->
795 </script>
796 </head>
797 <body>
798 <!-- TMPL_INCLUDE NAME="header.inc" -->
799 <!-- TMPL_INCLUDE NAME="serials-search.inc" -->
800
801 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; <!-- TMPL_IF name="mod" --> Modify subscription for <span class="title"><!-- TMPL_VAR name="bibliotitle" --></span><!-- TMPL_ELSE -->New subscription<!-- /TMPL_IF --></div>
802
803 <div id="doc3" class="yui-t7">
804    
805    <div id="bd">
806    <div class="yui-g">
807 <h1><!-- TMPL_IF name="mod" --> Modify subscription for <i><!-- TMPL_VAR name="bibliotitle" --></i><!-- TMPL_ELSE -->Add a new subscription<!-- /TMPL_IF --></h1>
808     <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
809 <!-- TMPL_IF name="mod" -->
810         <input type="hidden" name="op" value="modsubscription" />
811         <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
812 <!-- TMPL_ELSE -->
813         <input type="hidden" name="op" value="addsubscription" />
814 <!-- /TMPL_IF -->
815 <input type="hidden" name="user" value="<!-- TMPL_VAR name="loggedinusername" -->" />
816 <input type="hidden" name="irreg_check" value="0" />
817 <input type="hidden" name="issuesexpected1" value="0" />
818
819         <div class="yui-u first">
820     <fieldset id="subscription_add_information" class="rows">
821         <legend>Subscription details</legend>
822         <ol>
823         <li><span class="label">Subscription #</span> <!--TMPL_VAR name="subscriptionid"--></li>
824         <li>
825             <span class="label">Librarian: </span>            <!-- TMPL_VAR name="loggedinusername" -->
826         </li>
827         <li>
828             <label for="aqbooksellerid">Vendor: </label>
829             <input type="text" name="aqbooksellerid" id="aqbooksellerid" value="<!-- TMPL_VAR name="aqbooksellerid" -->" size="8" /> (<input type="text" name="aqbooksellername" value="<!-- TMPL_VAR name="aqbooksellername" -->" disabled="disabled" readonly="readonly" />) <div class="inputnote"><a href="#" onclick="FindAcqui(f)">Search for a vendor</a></div>
830         </li>
831         <li>
832             <label for="biblionumber">Biblio: (*)</label>
833             
834                 <input type="text" name="biblionumber" id="biblionumber" value="<!-- TMPL_VAR name="bibnum" -->" size="8" /> 
835                 (<input type="text" name="title" value="<!-- TMPL_VAR name="bibliotitle" -->" disabled="disabled" readonly="readonly" />)
836                <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a> | <!--TMPL_IF Name="mod"--><a href="#" onclick="addbiblioPopup(<!-- TMPL_VAR NAME="bibnum" -->); return false;">Edit biblio</a><!-- TMPL_ELSE -->
837                 <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a><!--/TMPL_IF--></div>
838             
839         </li>
840         <li>
841             <label for="callnumber">Call Number</label>
842             <input type="text" name="callnumber" id="callnumber" value="<!-- TMPL_VAR name="callnumber" -->" size="20" />
843         </li>
844         <li>
845             <label for="branchcode">Library</label>
846             
847                 <select name="branchcode" id="branchcode">
848                     <!-- TMPL_UNLESS NAME="Independantbranches" --><option value="">Any branch</option><!-- /TMPL_UNLESS -->
849                     <!-- TMPL_LOOP name="branchloop" --><!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
850                                 <!-- TMPL_ELSE -->
851                                 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
852                                 <!-- /TMPL_IF -->
853                     <!-- /TMPL_LOOP -->
854                 </select> (select a library)
855             
856         </li>
857         <li>
858             <label for="notes">Public note</label>
859             <textarea name="notes" id="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea>
860         </li>
861         <li>
862             <label for="internalnotes">Nonpublic note</label>
863             <textarea name="internalnotes" id="internalnotes" cols="30" rows="2"><!-- TMPL_VAR name="internalnotes" --></textarea>
864         </li>
865         <li>
866             <label for="letter">Patron notification </label>
867             
868                <!-- TMPL_IF NAME="letterloop" -->
869                            <select name="letter" id="letter">
870                     <option value="">none</option>
871                 <!-- TMPL_LOOP name="letterloop" -->
872                                 <!-- TMPL_IF name="selected" -->
873                     <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="lettername" --></option>
874 <!-- TMPL_ELSE -->
875                     <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="lettername" --></option>
876 <!-- /TMPL_IF -->
877                 <!-- /TMPL_LOOP -->
878                 </select> 
879                                 <div class="inputnote">Select a notice and patrons on the routing list will be notified when new issues are received.</div>
880                 <!-- /TMPL_ELSE -->
881                                 <div class="inputnote">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
882                                 <!-- /TMPL_IF -->
883         </li>
884         </ol>
885
886             <div class="warning"><b>Note:</b>
887             
888                 <ul>
889                     <li>The subscription <b>must</b> be associated with a bibliographic record.</li>
890                     <li>You <b>must</b> select a vendor if you wish to generate claims.</li>
891                 </ul></div>
892             
893
894         </fieldset>
895         </div>
896         
897 <div class="yui-u">
898 <div id="subscription_form_planning">
899         <fieldset class="rows">
900         <legend>Serials planning</legend>
901     <ol>
902         <li>
903            <label for="firstacquidate"> First issue publication date:</label>
904             
905                 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button2" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
906                 <input type="text" name="firstacquidate" value="<!-- TMPL_VAR name="firstacquidate" -->" size="13" maxlength="10" id="acqui_date" style="border-width: 0px;" />
907                 <!-- both scripts for calendar must follow the input field --> 
908                 <script type="text/javascript">
909                     Calendar.setup({
910                         inputField:"acqui_date",
911                         ifFormat       :   "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
912                         button         :   "button2",
913                         align          :   "Tl"
914                     });
915                 </script>
916                 <script type="text/javascript">
917                     Calendar.setup({
918                         inputField     :   "acqui_date",
919                         ifFormat       :   "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
920                         button         :   "acqui_date",
921                         align          :   "Tl"
922                     });
923                 </script>
924            
925         </li>
926         <li>
927             <label for="periodicity">Frequency: (*)</label>
928             
929                 <select name="periodicity" size="1" id="periodicity" onchange="javascript:document.getElementsByName('manualhist')[0].checked=(this.value==1); num_pattern();">
930                 <option value="" selected="selected">-- please choose --</option>
931                 <!-- TMPL_IF name="periodicity16" -->
932                 <option value="16" selected="selected">Without periodicity</option>
933                 <!-- TMPL_ELSE -->
934                     <option value="16">Without periodicity</option>
935                 <!-- /TMPL_IF -->
936                 <!-- TMPL_IF name="periodicity48" -->
937                 <option value="48" selected="selected">Unknown</option>
938                 <!-- TMPL_ELSE -->
939                 <option value="48">Unknown</option>
940                 <!-- /TMPL_IF -->
941                 <!-- TMPL_IF name="periodicity32" -->
942                 <option value="32" selected="selected">Irregular</option>
943                 <!-- TMPL_ELSE -->
944                     <option value="32">Irregular</option>
945                 <!-- /TMPL_IF -->
946
947                 <!-- TMPL_IF name="periodicity12" -->
948                     <option value="12" selected="selected">2/day</option>
949                 <!-- TMPL_ELSE -->
950                     <option value="12">2/day</option>
951                 <!-- /TMPL_IF -->
952                 <!-- TMPL_IF name="periodicity1" -->
953                     <option value="1" selected="selected">1/day</option>
954                 <!-- TMPL_ELSE -->
955                     <option value="1">1/day</option>
956                 <!-- /TMPL_IF -->
957                 <!-- TMPL_IF name="periodicity13" -->
958                     <option value="13" selected="selected">3/week</option>
959                 <!-- TMPL_ELSE -->
960                     <option value="13">3/week</option>
961                 <!-- /TMPL_IF -->
962                 <!-- TMPL_IF name="periodicity2" -->
963                     <option value="2" selected="selected">1/week</option>
964                 <!-- TMPL_ELSE -->
965                     <option value="2">1/week</option>
966                 <!-- /TMPL_IF -->
967                 <!-- TMPL_IF name="periodicity3" -->
968                     <option value="3" selected="selected">1/2 weeks </option>
969                 <!-- TMPL_ELSE -->
970                     <option value="3">1/2 weeks </option>
971                 <!-- /TMPL_IF -->
972                 <!-- TMPL_IF name="periodicity4" -->
973                     <option value="4" selected="selected">1/3 weeks</option>
974                 <!-- TMPL_ELSE -->
975                     <option value="4">1/3 weeks</option>
976                 <!-- /TMPL_IF -->
977                 <!-- TMPL_IF name="periodicity5" -->
978                     <option value="5" selected="selected">1/month</option>
979                 <!-- TMPL_ELSE -->
980                     <option value="5">1/month</option>
981                 <!-- /TMPL_IF -->
982                 <!-- TMPL_IF name="periodicity6" -->
983                     <option value="6" selected="selected">1/2 months (6/year)</option>
984                 <!-- TMPL_ELSE -->
985                     <option value="6">1/2 months (6/year)</option>
986                 <!-- /TMPL_IF -->
987                 <!-- TMPL_IF name="periodicity7" -->
988                     <option value="7" selected="selected">1/3 months (1/quarter)</option>
989                 <!-- TMPL_ELSE -->
990                     <option value="7">1/3 months (1/quarter)</option>
991                 <!-- /TMPL_IF -->
992                 <!-- periodicity8 is 1/quarter, exactly like periodicity7 but will use it for seasonal option -->
993                 <!-- TMPL_IF name="periodicity8" -->
994                     <option value="8" selected="selected">1/quarter (seasonal)</option>
995                 <!-- TMPL_ELSE -->
996                     <option value="8">1/quarter (seasonal)</option>
997                 <!-- /TMPL_IF -->
998
999                 <!-- TMPL_IF name="periodicity9" -->
1000                     <option value="9" selected="selected">2/years</option>
1001                 <!-- TMPL_ELSE -->
1002                     <option value="9">2/year</option>
1003                 <!-- /TMPL_IF -->
1004                 <!-- TMPL_IF name="periodicity10" -->
1005                     <option value="10" selected="selected">1/year</option>
1006                 <!-- TMPL_ELSE -->
1007                     <option value="10">1/year</option>
1008                 <!-- /TMPL_IF -->
1009                 <!-- TMPL_IF name="periodicity11" -->
1010                     <option value="11" selected="selected">1/2 years</option>
1011                 <!-- TMPL_ELSE -->
1012                     <option value="11">1/2 years</option>
1013                 <!-- /TMPL_IF -->
1014                 </select></li>
1015                                 <li><label for="manuallist"> Manual history:</label> <input type="checkbox" name="manualhist" id="manuallist" value="1" /></li>
1016         <li>
1017            <label for="numberpattern"> Numbering pattern:</label>
1018             
1019                 <select name="numbering_pattern" size="1" id="numberpattern" onchange="num_pattern()">
1020                     <option value="" selected="selected">-- please choose --</option>
1021                     <!-- TMPL_IF name="numberpattern1" -->
1022                         <option value="1" selected="selected">Number</option>
1023                     <!-- TMPL_ELSE -->
1024                         <option value="1">Number</option>
1025                     <!-- /TMPL_IF -->
1026                     <!-- TMPL_IF name="numberpattern2" -->
1027                         <option value="2" selected="selected">Volume, Number, Issue</option>
1028                     <!-- TMPL_ELSE -->
1029                         <option value="2">Volume, Number, Issue</option>
1030                     <!-- /TMPL_IF -->
1031                     <!-- TMPL_IF name="numberpattern3" -->
1032                         <option value="3" selected="selected">Volume, Number</option>
1033                     <!-- TMPL_ELSE -->
1034                         <option value="3">Volume, Number</option>
1035                     <!-- /TMPL_IF -->
1036                     <!-- TMPL_IF name="numberpattern4" -->
1037                         <option value="4" selected="selected">Volume, Issue</option>
1038                     <!-- TMPL_ELSE -->
1039                         <option value="4">Volume, Issue</option>
1040                     <!-- /TMPL_IF -->
1041                     <!-- TMPL_IF name="numberpattern5" -->
1042                         <option value="5" selected="selected">Number, Issue</option>
1043                     <!-- TMPL_ELSE -->
1044                         <option value="5">Number, Issue</option>
1045                     <!-- /TMPL_IF -->
1046                     <!-- TMPL_IF name="numberpattern6" -->
1047                         <option value="6" selected="selected">Seasonal only</option>
1048                     <!-- TMPL_ELSE -->
1049                         <option value="6">Seasonal only</option>
1050                     <!-- /TMPL_IF -->
1051                     <!-- TMPL_IF name="numberpattern8" -->
1052                         <option value="8" selected="selected">Year/Number</option>
1053                     <!-- TMPL_ELSE -->
1054                         <option value="8">Year/Number</option>
1055                     <!-- /TMPL_IF -->          
1056                     <!-- TMPL_IF name="numberpattern7" -->
1057                         <option value="7" selected="selected">None of the above</option>
1058                     <!-- TMPL_ELSE -->
1059                         <option value="7">None of the above</option>
1060                     <!-- /TMPL_IF -->
1061                 </select>
1062         </li>
1063                 <li id="more_options"></li>
1064                 <li id="irregularity"></li>
1065                    <li id="displayexample"></li>
1066         <li>
1067            <label for="startdate"> Subscription start date: (*)</label>
1068             
1069                 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button1" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1070                 <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size="13" maxlength="10" id="beginning_date" style="border-width: 0px;" />
1071                 <!-- both scripts for calendar must follow the input field --> 
1072                 <script type="text/javascript">
1073                     Calendar.setup({
1074                         inputField   : "beginning_date",
1075                         ifFormat     : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1076                         button       : "button1",
1077                         align        : "Tl"
1078                     });
1079                 </script>
1080                 <script type="text/javascript">
1081                     Calendar.setup({
1082                         inputField   : "beginning_date",
1083                         ifFormat     : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1084                         button       : "beginning_date",
1085                         align        : "Tl"
1086                     });
1087                 </script>
1088             
1089         </li>
1090         <li>
1091             <label for="subtype">Subscription length:</label>
1092             
1093                 <select name="subtype" id="subtype">
1094                     <!-- TMPL_LOOP NAME="subtype" -->
1095                         <!-- TMPL_IF NAME="selected" -->
1096                         <option value="<!-- TMPL_VAR NAME="name" -->" selected="selected">
1097                         <!-- TMPL_ELSE -->
1098                         <option value="<!-- TMPL_VAR NAME="name" -->">
1099                         <!-- /TMPL_IF -->
1100                         <!-- TMPL_VAR NAME="name" -->
1101                         </option>
1102                     <!-- /TMPL_LOOP -->
1103                 </select>
1104                 <input type="text" name="sublength" value="<!-- TMPL_VAR name="sublength" -->" size="3" onkeypress="return check_input(event)" /> (*) (enter amount in numerals)
1105             
1106         </li>
1107     <li><label for="numberingmethod">Numbering formula:</label> <input type="text" name="numberingmethod" id="numberingmethod" value="<!-- TMPL_VAR name="numberingmethod" -->" />
1108     </li>
1109     <li>
1110            <div id="basetable" style="display: none;">
1111             <table class="small">
1112                 <tr>
1113                     <th>&nbsp;</th>
1114                     <th>X</th>
1115                     <th>Y</th>
1116                     <th>Z</th>
1117                 </tr>
1118                 <tr>
1119                     <td>Add</td>
1120                     <td>
1121                         <input type="text" name="add1" value="<!-- TMPL_VAR name="add1" -->" />
1122                     </td>
1123                     <td>
1124                         <input type="text" name="add2" value="<!-- TMPL_VAR name="add2" -->" />
1125                     </td>
1126                     <td>
1127                         <input type="text" name="add3" value="<!-- TMPL_VAR name="add3" -->" />
1128                     </td>
1129                 </tr>
1130                 <tr>
1131                     <td>once every</td>
1132                     <td><input type="text" name="every1" value="<!-- TMPL_VAR name="every1" -->" /></td>
1133                     <td><input type="text" name="every2" value="<!-- TMPL_VAR name="every2" -->" /></td>
1134                     <td><input type="text" name="every3" value="<!-- TMPL_VAR name="every3" -->" /></td>
1135                 </tr>
1136                 <tr>
1137                     <td>When more than</td>
1138                     <td><input type="text" name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->" /></td>
1139                     <td><input type="text" name="whenmorethan2" value="<!-- TMPL_VAR name="whenmorethan2" -->" /></td>
1140                     <td><input type="text" name="whenmorethan3" value="<!-- TMPL_VAR name="whenmorethan3" -->" /></td>
1141                 </tr>
1142                 <tr>
1143                     <td>inner counter</td>
1144                     <td><input type="text" name="innerloop1" value="<!-- TMPL_VAR name="innerloop1" -->" /></td>
1145                     <td><input type="text" name="innerloop2" value="<!-- TMPL_VAR name="innerloop2" -->" /></td>
1146                     <td><input type="text" name="innerloop3" value="<!-- TMPL_VAR name="innerloop3" -->" /></td>
1147                 </tr>
1148                 <tr>
1149                     <td>Set back to</td>
1150                     <td><input type="text" name="setto1" value="<!-- TMPL_VAR name="setto1" -->" /></td>
1151                     <td><input type="text" name="setto2" value="<!-- TMPL_VAR name="setto2" -->" /></td>
1152                     <td><input type="text" name="setto3" value="<!-- TMPL_VAR name="setto3" -->" /></td>
1153                 </tr>
1154                 <tr>
1155                     <td>
1156                         <!-- TMPL_IF name="mod" -->
1157                             Last value
1158                         <!-- TMPL_ELSE -->
1159                             Begins with
1160                         <!-- /TMPL_IF -->
1161                     </td>
1162                     <td><input type="text" name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->" /></td>
1163                     <td><input type="text" name="lastvalue2" value="<!-- TMPL_VAR name="lastvalue2" -->" /></td>
1164                     <td><input type="text" name="lastvalue3" value="<!-- TMPL_VAR name="lastvalue3" -->" /></td>
1165                 </tr>
1166             </table>
1167         </div>
1168         </li>
1169     </ol>
1170         </fieldset>
1171 </div>
1172     <input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" />
1173 </div>
1174
1175 </form>
1176 </div>
1177
1178 <!--TMPL_IF Name="history"-->
1179 <div id="subscription_form_history">
1180     <h2>Subscription history</h2>
1181     <table>
1182         <tr>
1183           <td>Subscription start date</td>
1184           <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->" /> (start date of the 1st subscription)</td>
1185         </tr>
1186         <tr>
1187           <td>Subscription end date</td>
1188           <td><input type="text" name="enddate" value="<!-- TMPL_VAR name="enddate" -->" />(if empty, subscription is still active)</td>
1189         </tr>
1190         <tr>
1191             <td>Received issues</td>
1192             <td><textarea name="recievedlist" cols="60" rows="5" disabled="true" ><!-- TMPL_VAR name="recievedlist" --></textarea></td>
1193         </tr>
1194         <tr>
1195             <td>Missing issues</td>
1196             <td><textarea name="missinglist" cols="60" rows="5" disabled="true"><!-- TMPL_VAR name="missinglist" --></textarea></td>
1197         </tr>
1198     </table>
1199 </div>
1200 <!--/TMPL_IF-->
1201
1202 </div>
1203
1204 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->