93e2219aa28e8a72463570efad746616fb830a94
[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 class="radio">
841             <!-- TMPL_IF name="serialsadditems" -->
842                 <label for="serialsadditems-yes">serial recieve create an item </label><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1" checked="checked" />
843                 <label for="serialsadditems-no">serial recieve don't create an item </label><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" />
844             <!-- TMPL_ELSE -->
845                 <label for="serialsadditems-yes">serial recieve create an item </label><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1"/>
846                 <label for="serialsadditems-no">serial recieve don't create an item </label><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" checked="checked" />
847             <!-- /TMPL_IF -->
848         </li>
849         <li>
850             <label for="callnumber">Call Number</label>
851             <input type="text" name="callnumber" id="callnumber" value="<!-- TMPL_VAR name="callnumber" -->" size="20" />
852         </li>
853         <li>
854             <label for="branchcode">Library</label>
855             
856                 <select name="branchcode" id="branchcode">
857                     <!-- TMPL_UNLESS NAME="Independantbranches" --><option value="">Any branch</option><!-- /TMPL_UNLESS -->
858                     <!-- TMPL_LOOP name="branchloop" --><!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
859                                 <!-- TMPL_ELSE -->
860                                 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
861                                 <!-- /TMPL_IF -->
862                     <!-- /TMPL_LOOP -->
863                 </select> (select a library)
864             
865         </li>
866         <li>
867             <label for="notes">Public note</label>
868             <textarea name="notes" id="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea>
869         </li>
870         <li>
871             <label for="internalnotes">Nonpublic note</label>
872             <textarea name="internalnotes" id="internalnotes" cols="30" rows="2"><!-- TMPL_VAR name="internalnotes" --></textarea>
873         </li>
874         <li>
875             <label for="letter">Patron notification </label>
876             
877                <!-- TMPL_IF NAME="letterloop" -->
878                            <select name="letter" id="letter">
879                     <option value="">none</option>
880                 <!-- TMPL_LOOP name="letterloop" -->
881                                 <!-- TMPL_IF name="selected" -->
882                     <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="lettername" --></option>
883 <!-- TMPL_ELSE -->
884                     <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="lettername" --></option>
885 <!-- /TMPL_IF -->
886                 <!-- /TMPL_LOOP -->
887                 </select> 
888                                 <div class="inputnote">Select a notice and patrons on the routing list will be notified when new issues are received.</div>
889                 <!-- TMPL_ELSE -->
890                                 <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>
891                                 <!-- /TMPL_IF -->
892         </li>
893         </ol>
894
895             <div class="warning"><b>Note:</b>
896             
897                 <ul>
898                     <li>The subscription <b>must</b> be associated with a bibliographic record.</li>
899                     <li>You <b>must</b> select a vendor if you wish to generate claims.</li>
900                 </ul></div>
901             
902             
903         </fieldset>
904         </div>
905         
906 <div class="yui-u">
907 <div id="subscription_form_planning">
908         <fieldset class="rows">
909         <legend>Serials planning</legend>
910     <ol>
911         <li>
912            <label for="firstacquidate"> First issue publication date:</label>
913             
914                 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button2" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
915                 <input type="text" name="firstacquidate" value="<!-- TMPL_VAR name="firstacquidate" -->" size="13" maxlength="10" id="acqui_date" style="border-width: 0px;" />
916                 <!-- both scripts for calendar must follow the input field --> 
917                 <script type="text/javascript">
918                     Calendar.setup({
919                         inputField:"acqui_date",
920                         ifFormat       :   "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
921                         button         :   "button2",
922                         align          :   "Tl"
923                     });
924                 </script>
925                 <script type="text/javascript">
926                     Calendar.setup({
927                         inputField     :   "acqui_date",
928                         ifFormat       :   "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
929                         button         :   "acqui_date",
930                         align          :   "Tl"
931                     });
932                 </script>
933            
934         </li>
935         <li>
936             <label for="periodicity">Frequency: (*)</label>
937             
938                 <select name="periodicity" size="1" id="periodicity" onchange="javascript:document.getElementsByName('manualhist')[0].checked=(this.value==1); num_pattern();">
939                 <option value="" selected="selected">-- please choose --</option>
940                 <!-- TMPL_IF name="periodicity16" -->
941                 <option value="16" selected="selected">Without periodicity</option>
942                 <!-- TMPL_ELSE -->
943                     <option value="16">Without periodicity</option>
944                 <!-- /TMPL_IF -->
945                 <!-- TMPL_IF name="periodicity48" -->
946                 <option value="48" selected="selected">Unknown</option>
947                 <!-- TMPL_ELSE -->
948                 <option value="48">Unknown</option>
949                 <!-- /TMPL_IF -->
950                 <!-- TMPL_IF name="periodicity32" -->
951                 <option value="32" selected="selected">Irregular</option>
952                 <!-- TMPL_ELSE -->
953                     <option value="32">Irregular</option>
954                 <!-- /TMPL_IF -->
955
956                 <!-- TMPL_IF name="periodicity12" -->
957                     <option value="12" selected="selected">2/day</option>
958                 <!-- TMPL_ELSE -->
959                     <option value="12">2/day</option>
960                 <!-- /TMPL_IF -->
961                 <!-- TMPL_IF name="periodicity1" -->
962                     <option value="1" selected="selected">1/day</option>
963                 <!-- TMPL_ELSE -->
964                     <option value="1">1/day</option>
965                 <!-- /TMPL_IF -->
966                 <!-- TMPL_IF name="periodicity13" -->
967                     <option value="13" selected="selected">3/week</option>
968                 <!-- TMPL_ELSE -->
969                     <option value="13">3/week</option>
970                 <!-- /TMPL_IF -->
971                 <!-- TMPL_IF name="periodicity2" -->
972                     <option value="2" selected="selected">1/week</option>
973                 <!-- TMPL_ELSE -->
974                     <option value="2">1/week</option>
975                 <!-- /TMPL_IF -->
976                 <!-- TMPL_IF name="periodicity3" -->
977                     <option value="3" selected="selected">1/2 weeks </option>
978                 <!-- TMPL_ELSE -->
979                     <option value="3">1/2 weeks </option>
980                 <!-- /TMPL_IF -->
981                 <!-- TMPL_IF name="periodicity4" -->
982                     <option value="4" selected="selected">1/3 weeks</option>
983                 <!-- TMPL_ELSE -->
984                     <option value="4">1/3 weeks</option>
985                 <!-- /TMPL_IF -->
986                 <!-- TMPL_IF name="periodicity5" -->
987                     <option value="5" selected="selected">1/month</option>
988                 <!-- TMPL_ELSE -->
989                     <option value="5">1/month</option>
990                 <!-- /TMPL_IF -->
991                 <!-- TMPL_IF name="periodicity6" -->
992                     <option value="6" selected="selected">1/2 months (6/year)</option>
993                 <!-- TMPL_ELSE -->
994                     <option value="6">1/2 months (6/year)</option>
995                 <!-- /TMPL_IF -->
996                 <!-- TMPL_IF name="periodicity7" -->
997                     <option value="7" selected="selected">1/3 months (1/quarter)</option>
998                 <!-- TMPL_ELSE -->
999                     <option value="7">1/3 months (1/quarter)</option>
1000                 <!-- /TMPL_IF -->
1001                 <!-- periodicity8 is 1/quarter, exactly like periodicity7 but will use it for seasonal option -->
1002                 <!-- TMPL_IF name="periodicity8" -->
1003                     <option value="8" selected="selected">1/quarter (seasonal)</option>
1004                 <!-- TMPL_ELSE -->
1005                     <option value="8">1/quarter (seasonal)</option>
1006                 <!-- /TMPL_IF -->
1007
1008                 <!-- TMPL_IF name="periodicity9" -->
1009                     <option value="9" selected="selected">2/years</option>
1010                 <!-- TMPL_ELSE -->
1011                     <option value="9">2/year</option>
1012                 <!-- /TMPL_IF -->
1013                 <!-- TMPL_IF name="periodicity10" -->
1014                     <option value="10" selected="selected">1/year</option>
1015                 <!-- TMPL_ELSE -->
1016                     <option value="10">1/year</option>
1017                 <!-- /TMPL_IF -->
1018                 <!-- TMPL_IF name="periodicity11" -->
1019                     <option value="11" selected="selected">1/2 years</option>
1020                 <!-- TMPL_ELSE -->
1021                     <option value="11">1/2 years</option>
1022                 <!-- /TMPL_IF -->
1023                 </select></li>
1024                                 <li><label for="manuallist"> Manual history:</label> <input type="checkbox" name="manualhist" id="manuallist" value="1" /></li>
1025         <li>
1026            <label for="numberpattern"> Numbering pattern:</label>
1027             
1028                 <select name="numbering_pattern" size="1" id="numberpattern" onchange="num_pattern()">
1029                     <option value="" selected="selected">-- please choose --</option>
1030                     <!-- TMPL_IF name="numberpattern1" -->
1031                         <option value="1" selected="selected">Number</option>
1032                     <!-- TMPL_ELSE -->
1033                         <option value="1">Number</option>
1034                     <!-- /TMPL_IF -->
1035                     <!-- TMPL_IF name="numberpattern2" -->
1036                         <option value="2" selected="selected">Volume, Number, Issue</option>
1037                     <!-- TMPL_ELSE -->
1038                         <option value="2">Volume, Number, Issue</option>
1039                     <!-- /TMPL_IF -->
1040                     <!-- TMPL_IF name="numberpattern3" -->
1041                         <option value="3" selected="selected">Volume, Number</option>
1042                     <!-- TMPL_ELSE -->
1043                         <option value="3">Volume, Number</option>
1044                     <!-- /TMPL_IF -->
1045                     <!-- TMPL_IF name="numberpattern4" -->
1046                         <option value="4" selected="selected">Volume, Issue</option>
1047                     <!-- TMPL_ELSE -->
1048                         <option value="4">Volume, Issue</option>
1049                     <!-- /TMPL_IF -->
1050                     <!-- TMPL_IF name="numberpattern5" -->
1051                         <option value="5" selected="selected">Number, Issue</option>
1052                     <!-- TMPL_ELSE -->
1053                         <option value="5">Number, Issue</option>
1054                     <!-- /TMPL_IF -->
1055                     <!-- TMPL_IF name="numberpattern6" -->
1056                         <option value="6" selected="selected">Seasonal only</option>
1057                     <!-- TMPL_ELSE -->
1058                         <option value="6">Seasonal only</option>
1059                     <!-- /TMPL_IF -->
1060                     <!-- TMPL_IF name="numberpattern8" -->
1061                         <option value="8" selected="selected">Year/Number</option>
1062                     <!-- TMPL_ELSE -->
1063                         <option value="8">Year/Number</option>
1064                     <!-- /TMPL_IF -->          
1065                     <!-- TMPL_IF name="numberpattern7" -->
1066                         <option value="7" selected="selected">None of the above</option>
1067                     <!-- TMPL_ELSE -->
1068                         <option value="7">None of the above</option>
1069                     <!-- /TMPL_IF -->
1070                 </select>
1071         </li>
1072                 <li id="more_options"></li>
1073                 <li id="irregularity"></li>
1074                    <li id="displayexample"></li>
1075         <li>
1076            <label for="startdate"> Subscription start date: (*)</label>
1077             
1078                 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button1" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1079                 <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size="13" maxlength="10" id="beginning_date" style="border-width: 0px;" />
1080                 <!-- both scripts for calendar must follow the input field --> 
1081                 <script type="text/javascript">
1082                     Calendar.setup({
1083                         inputField   : "beginning_date",
1084                         ifFormat     : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1085                         button       : "button1",
1086                         align        : "Tl"
1087                     });
1088                 </script>
1089                 <script type="text/javascript">
1090                     Calendar.setup({
1091                         inputField   : "beginning_date",
1092                         ifFormat     : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1093                         button       : "beginning_date",
1094                         align        : "Tl"
1095                     });
1096                 </script>
1097             
1098         </li>
1099         <li>
1100             <label for="subtype">Subscription length:</label>
1101             
1102                 <select name="subtype" id="subtype">
1103                     <!-- TMPL_LOOP NAME="subtype" -->
1104                         <!-- TMPL_IF NAME="selected" -->
1105                         <option value="<!-- TMPL_VAR NAME="name" -->" selected="selected">
1106                         <!-- TMPL_ELSE -->
1107                         <option value="<!-- TMPL_VAR NAME="name" -->">
1108                         <!-- /TMPL_IF -->
1109                         <!-- TMPL_VAR NAME="name" -->
1110                         </option>
1111                     <!-- /TMPL_LOOP -->
1112                 </select>
1113                 <input type="text" name="sublength" value="<!-- TMPL_VAR name="sublength" -->" size="3" onkeypress="return check_input(event)" /> (*) (enter amount in numerals)
1114             
1115         </li>
1116     <li><label for="numberingmethod">Numbering formula:</label> <input type="text" name="numberingmethod" id="numberingmethod" value="<!-- TMPL_VAR name="numberingmethod" -->" />
1117     </li>
1118     <li>
1119            <div id="basetable" style="display: none;">
1120             <table class="small">
1121                 <tr>
1122                     <th>&nbsp;</th>
1123                     <th>X</th>
1124                     <th>Y</th>
1125                     <th>Z</th>
1126                 </tr>
1127                 <tr>
1128                     <td>Add</td>
1129                     <td>
1130                         <input type="text" name="add1" value="<!-- TMPL_VAR name="add1" -->" />
1131                     </td>
1132                     <td>
1133                         <input type="text" name="add2" value="<!-- TMPL_VAR name="add2" -->" />
1134                     </td>
1135                     <td>
1136                         <input type="text" name="add3" value="<!-- TMPL_VAR name="add3" -->" />
1137                     </td>
1138                 </tr>
1139                 <tr>
1140                     <td>once every</td>
1141                     <td><input type="text" name="every1" value="<!-- TMPL_VAR name="every1" -->" /></td>
1142                     <td><input type="text" name="every2" value="<!-- TMPL_VAR name="every2" -->" /></td>
1143                     <td><input type="text" name="every3" value="<!-- TMPL_VAR name="every3" -->" /></td>
1144                 </tr>
1145                 <tr>
1146                     <td>When more than</td>
1147                     <td><input type="text" name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->" /></td>
1148                     <td><input type="text" name="whenmorethan2" value="<!-- TMPL_VAR name="whenmorethan2" -->" /></td>
1149                     <td><input type="text" name="whenmorethan3" value="<!-- TMPL_VAR name="whenmorethan3" -->" /></td>
1150                 </tr>
1151                 <tr>
1152                     <td>inner counter</td>
1153                     <td><input type="text" name="innerloop1" value="<!-- TMPL_VAR name="innerloop1" -->" /></td>
1154                     <td><input type="text" name="innerloop2" value="<!-- TMPL_VAR name="innerloop2" -->" /></td>
1155                     <td><input type="text" name="innerloop3" value="<!-- TMPL_VAR name="innerloop3" -->" /></td>
1156                 </tr>
1157                 <tr>
1158                     <td>Set back to</td>
1159                     <td><input type="text" name="setto1" value="<!-- TMPL_VAR name="setto1" -->" /></td>
1160                     <td><input type="text" name="setto2" value="<!-- TMPL_VAR name="setto2" -->" /></td>
1161                     <td><input type="text" name="setto3" value="<!-- TMPL_VAR name="setto3" -->" /></td>
1162                 </tr>
1163                 <tr>
1164                     <td>
1165                         <!-- TMPL_IF name="mod" -->
1166                             Last value
1167                         <!-- TMPL_ELSE -->
1168                             Begins with
1169                         <!-- /TMPL_IF -->
1170                     </td>
1171                     <td><input type="text" name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->" /></td>
1172                     <td><input type="text" name="lastvalue2" value="<!-- TMPL_VAR name="lastvalue2" -->" /></td>
1173                     <td><input type="text" name="lastvalue3" value="<!-- TMPL_VAR name="lastvalue3" -->" /></td>
1174                 </tr>
1175             </table>
1176         </div>
1177         </li>
1178     </ol>
1179         </fieldset>
1180 </div>
1181     <input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" />
1182 </div>
1183
1184 </form>
1185 </div>
1186
1187 <!--TMPL_IF Name="history"-->
1188 <div id="subscription_form_history">
1189     <h2>Subscription history</h2>
1190     <form method="post" action="/cgi-bin/koha/serials/subscription-add.pl">
1191         <input type="hidden" name="op" value="modsubscription" />
1192         <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
1193         <input type="hidden" name="history_only" value="1" />
1194         <p>Hint : you can update the serial history manually. This can be useful for an old subscription or to clean the existing history. Modify those fields with care, as future serial recieve will continue to update them automatically.</p>
1195         <table>
1196             <tr>
1197             <td>Subscription start date</td>
1198             <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->" /> (start date of the 1st subscription)</td>
1199             </tr>
1200             <tr>
1201             <td>Subscription end date</td>
1202             <td><input type="text" name="histenddate" value="<!-- TMPL_VAR name="histenddate" -->" />(if empty, subscription is still active)</td>
1203             </tr>
1204             <tr>
1205                 <td>Received issues</td>
1206                 <td><textarea name="recievedlist" cols="60" rows="5"><!-- TMPL_VAR name="recievedlist" --></textarea></td>
1207             </tr>
1208             <tr>
1209                 <td>Missing issues</td>
1210                 <td><textarea name="missinglist" cols="60" rows="5"><!-- TMPL_VAR name="missinglist" --></textarea></td>
1211             </tr>
1212             <tr>
1213                 <td>Note for OPAC</td>
1214                 <td><textarea name="opacnote" cols="60" rows="5"><!-- TMPL_VAR name="opacnote" --></textarea></td>
1215             </tr>
1216             <tr>
1217                 <td>Note for staff</td>
1218                 <td><textarea name="librariannote" cols="60" rows="5"><!-- TMPL_VAR name="librariannote" --></textarea></td>
1219             </tr>
1220         </table>
1221     <input type="submit" value="Save subscription history"  />
1222     </form>
1223 </div>
1224 <!--/TMPL_IF-->
1225
1226 </div>
1227
1228 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->