Bug fixing : irregularities were not saved. Nor were innerloops.
[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/subscription-add.pl">Serials</a> &rsaquo; <!-- TMPL_IF name="mod" --> Modify subscription to <i><!-- TMPL_VAR name="bibliotitle" --></i><!-- 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
808 <!-- TMPL_IF name="mod" -->
809     <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
810         <input type="hidden" name="op" value="modsubscription" />
811         <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
812 <!-- TMPL_ELSE -->
813     <form method="post" action="/cgi-bin/koha/serials/subscription-add.pl" name="f">
814         <input type="hidden" name="op" value="addsubscription" />
815 <!-- /TMPL_IF -->
816 <input type="hidden" name="user" value="<!-- TMPL_VAR name="loggedinusername" -->" />
817 <input type="hidden" name="irreg_check" value="0" />
818 <input type="hidden" name="issuesexpected1" value="0" />
819
820         <div class="yui-u first">
821     <fieldset id="subscription_add_information" class="rows">
822         <legend>Subscription information for subscription #<!--TMPL_VAR name="subscriptionid"--></legend>
823         <ol>
824         <li>
825             <span class="label">Librarian: </span>            <!-- TMPL_VAR name="loggedinusername" -->
826         </li>
827         <li>
828             <label for="aqbooksellerid">Supplier: (*)</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 Supplier</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">Branch</label>
846             
847                 <select name="branchcode" id="branchcode">
848                     <option value="">Any branch</option>
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 branch)
855             
856         </li>
857         <li>
858             <label for="notes">Notes</label>
859             <textarea name="notes" id="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea>
860         </li>
861         <li>
862             <label for="internalnotes">Management Notes</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 alert with </label>
867             
868                 <select name="letter" id="letter">
869                     <option value="">un-activated</option>
870                 <!-- TMPL_LOOP name="letterloop" -->
871                                 <!-- TMPL_IF name="selected" -->
872                     <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="lettername" --></option>
873 <!-- TMPL_ELSE -->
874                     <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="lettername" --></option>
875 <!-- /TMPL_IF -->
876                 <!-- /TMPL_LOOP -->
877                 </select> <div class="inputnote">(select a letter &amp; patrons will be able to "follow" this subscription and recieve a mail on every new issue)</div>
878             
879         </li>
880         </ol>
881
882             <div class="warning"><b>Note:</b>
883             
884                 <ul>
885                     <li>Remember you <b>must</b> create a biblio</li>
886                     <li>You <b>must</b> select a supplier</li>
887                 </ul></div>
888             
889
890         </fieldset>
891         </div>
892         
893 <div class="yui-u">
894 <div id="subscription_form_planning">
895         <fieldset class="rows">
896         <legend>Planning</legend>
897     <ol>
898         <li>
899            <label for="firstacquidate"> First Issue ETA:</label>
900             
901                 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button2" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
902                 <input type="text" name="firstacquidate" value="<!-- TMPL_VAR name="firstacquidate" -->" size="13" maxlength="10" id="acqui_date" style="border-width: 0px;" />
903                 <!-- both scripts for calendar must follow the input field --> 
904                 <script type="text/javascript">
905                     Calendar.setup({
906                         inputField:"acqui_date",
907                         ifFormat       :   "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
908                         button         :   "button2",
909                         align          :   "Tl"
910                     });
911                 </script>
912                 <script type="text/javascript">
913                     Calendar.setup({
914                         inputField     :   "acqui_date",
915                         ifFormat       :   "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
916                         button         :   "acqui_date",
917                         align          :   "Tl"
918                     });
919                 </script>
920            
921         </li>
922         <li>
923             <label for="periodicity">Frequency: (*)</label>
924             
925                 <select name="periodicity" size="1" id="periodicity" onchange="javascript:document.getElementsByName('manualhist')[0].checked=(this.value==1);num_pattern;">
926                 <option value="" selected="selected">-- please choose --</option>
927                 <!-- TMPL_IF name="periodicity16" -->
928                 <option value="16" selected="selected">Without Periodicity</option>
929                 <!-- TMPL_ELSE -->
930                     <option value="16">Without Periodicity</option>
931                 <!-- /TMPL_IF -->
932                 <!-- TMPL_IF name="periodicity48" -->
933                 <option value="48" selected="selected">Unknown</option>
934                 <!-- TMPL_ELSE -->
935                 <option value="48">Unknown</option>
936                 <!-- /TMPL_IF -->
937                 <!-- TMPL_IF name="periodicity32" -->
938                 <option value="32" selected="selected">Irregular</option>
939                 <!-- TMPL_ELSE -->
940                     <option value="32">Irregular</option>
941                 <!-- /TMPL_IF -->
942
943                 <!-- TMPL_IF name="periodicity12" -->
944                     <option value="12" selected="selected">2/day</option>
945                 <!-- TMPL_ELSE -->
946                     <option value="12">2/day</option>
947                 <!-- /TMPL_IF -->
948                 <!-- TMPL_IF name="periodicity1" -->
949                     <option value="1" selected="selected">1/day</option>
950                 <!-- TMPL_ELSE -->
951                     <option value="1">1/day</option>
952                 <!-- /TMPL_IF -->
953                 <!-- TMPL_IF name="periodicity13" -->
954                     <option value="13" selected="selected">3/week</option>
955                 <!-- TMPL_ELSE -->
956                     <option value="13">3/week</option>
957                 <!-- /TMPL_IF -->
958                 <!-- TMPL_IF name="periodicity2" -->
959                     <option value="2" selected="selected">1/week</option>
960                 <!-- TMPL_ELSE -->
961                     <option value="2">1/week</option>
962                 <!-- /TMPL_IF -->
963                 <!-- TMPL_IF name="periodicity3" -->
964                     <option value="3" selected="selected">1/2 weeks (2/month)</option>
965                 <!-- TMPL_ELSE -->
966                     <option value="3">1/2 weeks (2/months)</option>
967                 <!-- /TMPL_IF -->
968                 <!-- TMPL_IF name="periodicity4" -->
969                     <option value="4" selected="selected">1/3 weeks</option>
970                 <!-- TMPL_ELSE -->
971                     <option value="4">1/3 weeks</option>
972                 <!-- /TMPL_IF -->
973                 <!-- TMPL_IF name="periodicity5" -->
974                     <option value="5" selected="selected">1/month</option>
975                 <!-- TMPL_ELSE -->
976                     <option value="5">1/month</option>
977                 <!-- /TMPL_IF -->
978                 <!-- TMPL_IF name="periodicity6" -->
979                     <option value="6" selected="selected">1/2 months (6/year)</option>
980                 <!-- TMPL_ELSE -->
981                     <option value="6">1/2 months (6/year)</option>
982                 <!-- /TMPL_IF -->
983                 <!-- TMPL_IF name="periodicity7" -->
984                     <option value="7" selected="selected">1/3 months (1/quarter)</option>
985                 <!-- TMPL_ELSE -->
986                     <option value="7">1/3 months (1/quarter)</option>
987                 <!-- /TMPL_IF -->
988                 <!-- periodicity8 is 1/quarter, exactly like periodicity7 but will use it for seasonal option -->
989                 <!-- TMPL_IF name="periodicity8" -->
990                     <option value="8" selected="selected">1/quarter (seasonal)</option>
991                 <!-- TMPL_ELSE -->
992                     <option value="8">1/quarter (seasonal)</option>
993                 <!-- /TMPL_IF -->
994
995                 <!-- TMPL_IF name="periodicity9" -->
996                     <option value="9" selected="selected">2/years</option>
997                 <!-- TMPL_ELSE -->
998                     <option value="9">2/year</option>
999                 <!-- /TMPL_IF -->
1000                 <!-- TMPL_IF name="periodicity10" -->
1001                     <option value="10" selected="selected">1/year</option>
1002                 <!-- TMPL_ELSE -->
1003                     <option value="10">1/year</option>
1004                 <!-- /TMPL_IF -->
1005                 <!-- TMPL_IF name="periodicity11" -->
1006                     <option value="11" selected="selected">1/2 years</option>
1007                 <!-- TMPL_ELSE -->
1008                     <option value="11">1/2 years</option>
1009                 <!-- /TMPL_IF -->
1010                 </select></li>
1011                                 <li><label for="manuallist"> Manual History:</label> <input type="checkbox" name="manualhist" id="manuallist" value="1" /></li>
1012         <li>
1013            <label for="numberpattern"> Numbering Pattern:</label>
1014             
1015                 <select name="numbering_pattern" size="1" id="numberpattern" onchange="num_pattern()">
1016                     <option value="" selected="selected">-- please choose --</option>
1017                     <!-- TMPL_IF name="numberpattern1" -->
1018                         <option value="1" selected="selected">Number</option>
1019                     <!-- TMPL_ELSE -->
1020                         <option value="1">Number</option>
1021                     <!-- /TMPL_IF -->
1022                     <!-- TMPL_IF name="numberpattern2" -->
1023                         <option value="2" selected="selected">Volume, Number, Issue</option>
1024                     <!-- TMPL_ELSE -->
1025                         <option value="2">Volume, Number, Issue</option>
1026                     <!-- /TMPL_IF -->
1027                     <!-- TMPL_IF name="numberpattern3" -->
1028                         <option value="3" selected="selected">Volume, Number</option>
1029                     <!-- TMPL_ELSE -->
1030                         <option value="3">Volume, Number</option>
1031                     <!-- /TMPL_IF -->
1032                     <!-- TMPL_IF name="numberpattern4" -->
1033                         <option value="4" selected="selected">Volume, Issue</option>
1034                     <!-- TMPL_ELSE -->
1035                         <option value="4">Volume, Issue</option>
1036                     <!-- /TMPL_IF -->
1037                     <!-- TMPL_IF name="numberpattern5" -->
1038                         <option value="5" selected="selected">Number, Issue</option>
1039                     <!-- TMPL_ELSE -->
1040                         <option value="5">Number, Issue</option>
1041                     <!-- /TMPL_IF -->
1042                     <!-- TMPL_IF name="numberpattern6" -->
1043                         <option value="6" selected="selected">Seasonal only</option>
1044                     <!-- TMPL_ELSE -->
1045                         <option value="6">Seasonal only</option>
1046                     <!-- /TMPL_IF -->
1047                     <!-- TMPL_IF name="numberpattern8" -->
1048                         <option value="8" selected="selected">Year/Number</option>
1049                     <!-- TMPL_ELSE -->
1050                         <option value="8">Year/Number</option>
1051                     <!-- /TMPL_IF -->          
1052                     <!-- TMPL_IF name="numberpattern7" -->
1053                         <option value="7" selected="selected">None of the above</option>
1054                     <!-- TMPL_ELSE -->
1055                         <option value="7">None of the above</option>
1056                     <!-- /TMPL_IF -->
1057                 </select>
1058         </li>
1059                 <li id="more_options"></li>
1060                 <li id="irregularity"></li>
1061                    <li id="displayexample"></li>
1062         <li>
1063            <label for="startdate"> Begins On: (*)</label>
1064             
1065                 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button1" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1066                 <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size="13" maxlength="10" id="beginning_date" />
1067                 <!-- both scripts for calendar must follow the input field --> 
1068                 <script type="text/javascript">
1069                     Calendar.setup({
1070                         inputField   : "beginning_date",
1071                         ifFormat     : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1072                         button       : "button1",
1073                         align        : "Tl"
1074                     });
1075                 </script>
1076                 <script type="text/javascript">
1077                     Calendar.setup({
1078                         inputField   : "beginning_date",
1079                         ifFormat     : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1080                         button       : "beginning_date",
1081                         align        : "Tl"
1082                     });
1083                 </script>
1084             
1085         </li>
1086         <li>
1087             <label for="subtype">Subscription length</label>
1088             
1089                 <select name="subtype" id="subtype">
1090                     <!-- TMPL_LOOP NAME="subtype" -->
1091                         <!-- TMPL_IF NAME="selected" -->
1092                         <option value="<!-- TMPL_VAR NAME="name" -->" selected="selected">
1093                         <!-- TMPL_ELSE -->
1094                         <option value="<!-- TMPL_VAR NAME="name" -->">
1095                         <!-- /TMPL_IF -->
1096                         <!-- TMPL_VAR NAME="name" -->
1097                         </option>
1098                     <!-- /TMPL_LOOP -->
1099                 </select>
1100                 <input type="text" name="sublength" value="<!-- TMPL_VAR name="sublength" -->" size="3" onkeypress="return check_input(event)" /> (*) (enter amount in numerals)
1101             
1102         </li>
1103     <li><label for="numberingmethod">Numbering formula:</label> <input type="text" name="numberingmethod" id="numberingmethod" value="<!-- TMPL_VAR name="numberingmethod" -->" />
1104     </li>
1105     <li>
1106            <div id="basetable" style="display: none;">
1107             <table class="small">
1108                 <tr>
1109                     <th>&nbsp;</th>
1110                     <th>X</th>
1111                     <th>Y</th>
1112                     <th>Z</th>
1113                 </tr>
1114                 <tr>
1115                     <td>Add</td>
1116                     <td>
1117                         <input type="text" name="add1" value="<!-- TMPL_VAR name="add1" -->" />
1118                     </td>
1119                     <td>
1120                         <input type="text" name="add2" value="<!-- TMPL_VAR name="add2" -->" />
1121                     </td>
1122                     <td>
1123                         <input type="text" name="add3" value="<!-- TMPL_VAR name="add3" -->" />
1124                     </td>
1125                 </tr>
1126                 <tr>
1127                     <td>once every</td>
1128                     <td><input type="text" name="every1" value="<!-- TMPL_VAR name="every1" -->" /></td>
1129                     <td><input type="text" name="every2" value="<!-- TMPL_VAR name="every2" -->" /></td>
1130                     <td><input type="text" name="every3" value="<!-- TMPL_VAR name="every3" -->" /></td>
1131                 </tr>
1132                 <tr>
1133                     <td>When more than</td>
1134                     <td><input type="text" name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->" /></td>
1135                     <td><input type="text" name="whenmorethan2" value="<!-- TMPL_VAR name="whenmorethan2" -->" /></td>
1136                     <td><input type="text" name="whenmorethan3" value="<!-- TMPL_VAR name="whenmorethan3" -->" /></td>
1137                 </tr>
1138                 <tr>
1139                     <td>inner counter</td>
1140                     <td><input type="text" name="innerloop1" value="<!-- TMPL_VAR name="innerloop1" -->" /></td>
1141                     <td><input type="text" name="innerloop2" value="<!-- TMPL_VAR name="innerloop2" -->" /></td>
1142                     <td><input type="text" name="innerloop3" value="<!-- TMPL_VAR name="innerloop3" -->" /></td>
1143                 </tr>
1144                 <tr>
1145                     <td>Set back to</td>
1146                     <td><input type="text" name="setto1" value="<!-- TMPL_VAR name="setto1" -->" /></td>
1147                     <td><input type="text" name="setto2" value="<!-- TMPL_VAR name="setto2" -->" /></td>
1148                     <td><input type="text" name="setto3" value="<!-- TMPL_VAR name="setto3" -->" /></td>
1149                 </tr>
1150                 <tr>
1151                     <td>
1152                         <!-- TMPL_IF name="mod" -->
1153                             Last value
1154                         <!-- TMPL_ELSE -->
1155                             Begins with
1156                         <!-- /TMPL_IF -->
1157                     </td>
1158                     <td><input type="text" name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->" /></td>
1159                     <td><input type="text" name="lastvalue2" value="<!-- TMPL_VAR name="lastvalue2" -->" /></td>
1160                     <td><input type="text" name="lastvalue3" value="<!-- TMPL_VAR name="lastvalue3" -->" /></td>
1161                 </tr>
1162             </table>
1163         </div>
1164         </li>
1165     </ol>
1166         </fieldset>
1167 </div>
1168 <!--TMPL_IF Name="history"-->
1169 <div id="subscription_form_history">
1170     <h2>History</h2>
1171     <table>
1172         <tr>
1173           <td>Starting date:</td>
1174           <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->" /> (the date of the 1st subscription)</td>
1175         </tr>
1176         <tr>
1177           <td>Ending date:</td>
1178           <td><input type="text" name="enddate" value="<!-- TMPL_VAR name="enddate" -->" />(if empty : subscription still active)</td>
1179         </tr>
1180         <tr>
1181             <td>Received issues</td>
1182             <td><textarea name="recievedlist" cols="60" rows="5"><!-- TMPL_VAR name="recievedlist" --></textarea></td>
1183         </tr>
1184         <tr>
1185             <td>Missing issues</td>
1186             <td><textarea name="missinglist" cols="60" rows="5"><!-- TMPL_VAR name="missinglist" --></textarea></td>
1187         </tr>
1188         <tr>
1189             <td>Opac's notes</td>
1190             <td><textarea name="opacnote" cols="60" rows="5"><!-- TMPL_VAR name="opacnote" --></textarea></td>
1191         </tr>
1192         <tr>
1193             <td>Librarian notes</td>
1194             <td><textarea name="librariannote" cols="60" rows="5"><!-- TMPL_VAR name="librariannote" --></textarea></td>
1195         </tr>
1196     </table>
1197 </div>
1198 <!--/TMPL_IF-->
1199
1200
1201     <input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" />
1202 </div>
1203
1204 </form>
1205
1206 </div>
1207 </div>
1208
1209 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->