1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha › Serials › <!-- 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" -->
6 <script type="text/javascript">
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"));
13 var is_hemisphere = 1;
14 var irregular_issues; // will hold irregularity object.
16 <!-- TMPL_IF NAME="weekarrayjs" -->
17 var weeks = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->);
20 function formatDate(myDate) {
21 var d = new Array( myDate.getFullYear(), myDate.getMonth() + 1 ,myDate.getDate());
22 if(d[1].toString().length == 1) { d[1] = '0'+d[1] };
23 if(d[2].toString().length == 1) { d[2] = '0'+d[2] };
24 <!-- TMPL_IF NAME="dateformat_us" -->
25 return(d[1] + '/' + d[2] + '/' + d[0]) ;
26 <!-- TMPL_ELSIF NAME="dateformat_metric" -->
27 return(d[2] + '/' + d[1] + '/' + d[0]) ;
29 return(''+d[0] + '-' + d[1] + '-' + d[2]) ;
33 Date.prototype.addDays = function(days) {
34 this.setDate(this.getDate()+days);
37 function getWeeksArray(startDate) {
38 // returns a 52 element array with dates starting with startDate.
39 var weeksArray = new Array;
40 var myDate = new Date;
41 for(var i=0;i<52;i++) {
42 startDate.addDays( 7 );
43 weeksArray[i] = formatDate(startDate);
48 function YMDaToYWDa(S) {
49 with (new Date(Date.UTC(S[0], S[1] - 1, S[2]))) {
50 var DoW = getUTCDay();
51 setUTCDate(getUTCDate() - (DoW + 6) % 7 + 3);
54 var WN = Math.round((ms - valueOf()) / 604800000) + 1;
55 return [getUTCFullYear(), WN, DoW == 0 ? 7 : DoW];
58 function dayofyear(d) { // d is a Date object
59 var yn = d.getFullYear();
60 var mn = d.getMonth();
62 var d1 = new Date(yn,0,1,12,0,0); // noon on Jan. 1
63 var d2 = new Date(yn,mn,dn,12,0,0); // noon on input date
64 var ddiff = Math.round((d2-d1)/864e5);
69 // create irregularity object.
70 function IrregularPattern() {
71 this.months = new Array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December"));
72 this.seasons = new Array(_("Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall"));
73 this.daynames = new Array(_("Monday"),_("Tuesday"),_("Wednesday"),_("Thursday"),_("Friday"),_("Saturday"),_("Sunday"));
74 <!-- TMPL_IF NAME="weekarrayjs" -->
75 this.weeks = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->);
79 var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
80 // var periodicity = document.f.periodicity.value;
81 this.skipped = irregular.split(',');
84 IrregularPattern.prototype.update = function() {
85 this.skipped= new Array;
87 // daily periodicity, we interpret irregular array as which days of week to skip.
88 // else irregular array is list of issues to skip
91 for( var i in document.f.irregularity_select.options ) {
92 if( document.f.irregularity_select.options[i].selected ) {
93 this.skipped[cnt] = document.f.irregularity_select.options[i].value ;
94 summary_str += document.f.irregularity_select.options[i].text + "\n" ;
99 var summary = document.getElementById("irregularity_summary");
101 summary.value = summary_str;
102 summary.rows= ( cnt > 6 ) ? cnt : 6 ;
106 IrregularPattern.prototype.irregular = function(index) {
107 for( var i in this.skipped) {
108 if( this.skipped[i] == index) {
115 function init_pattern() {
116 irregular_issues = new IrregularPattern();
118 function reset_pattern() {
119 document.getElementById("numberpattern").value = '';
120 // document.getElementById("numberpattern").value = '';
125 // common pre defined number patterns
126 function reset_num_pattern() {
127 var patternchoice = document.getElementById("numberpattern").value;
128 switch(patternchoice){
130 document.f.add1.value=1;
131 document.f.add2.value=1;
132 document.f.add3.value=1;
133 document.f.every1.value=12;
134 document.f.every2.value=1;
135 document.f.every3.value=1;
136 document.f.whenmorethan1.value=9999999;
137 document.f.whenmorethan2.value=12;
138 document.f.whenmorethan3.value=4;
139 document.f.setto1.value=0;
140 document.f.setto2.value=1;
141 document.f.setto3.value=1;
142 document.f.lastvalue1.value=1;
143 document.f.lastvalue2.value=1;
144 document.f.lastvalue3.value=1;
145 document.f.numberingmethod.value=_("Vol {X}, No {Y}, Issue {Z}");
146 moreoptions(text[1],text[0],text[2]);
147 display_table(0); // toggle info box on (1) or off (0)
150 document.f.add1.value=1;
151 document.f.add2.value=1;
152 document.f.add3.value='';
153 document.f.every1.value=12;
154 document.f.every2.value=1;
155 document.f.every3.value='';
156 document.f.whenmorethan1.value=9999999;
157 document.f.whenmorethan2.value=12;
158 document.f.whenmorethan3.value='';
159 document.f.setto1.value=0;
160 document.f.setto2.value=1;
161 document.f.setto3.value='';
162 document.f.lastvalue1.value=1;
163 document.f.lastvalue2.value=1;
164 document.f.lastvalue3.value='';
165 document.f.numberingmethod.value=_("Vol {X}, No {Y}");
166 moreoptions(text[1],text[0]);
170 document.f.add1.value=1;
171 document.f.add2.value=1;
172 document.f.add3.value='';
173 document.f.every1.value=12;
174 document.f.every2.value=1;
175 document.f.every3.value='';
176 document.f.whenmorethan1.value=9999999;
177 document.f.whenmorethan2.value=12;
178 document.f.whenmorethan3.value='';
179 document.f.setto1.value=0;
180 document.f.setto2.value=1;
181 document.f.setto3.value='';
182 document.f.lastvalue1.value=1;
183 document.f.lastvalue2.value=1;
184 document.f.lastvalue3.value='';
185 document.f.numberingmethod.value=_("Vol {X}, Issue {Y}");
186 moreoptions(text[1],text[2]);
190 // var d = new Date(document.f.firstacquidate.value);
191 // var smonth = d.getMonth();
192 document.f.add1.value=1;
193 document.f.add2.value=1;
194 document.f.add3.value='';
195 document.f.every1.value=12;
196 document.f.every2.value=1;
197 document.f.every3.value='';
198 document.f.whenmorethan1.value=9999999;
199 document.f.whenmorethan2.value=12;
200 document.f.whenmorethan3.value='';
201 document.f.setto1.value=0;
202 document.f.setto2.value=1;
203 document.f.setto3.value='';
204 document.f.numberingmethod.value=_("No {X}, Issue {Y}");
205 moreoptions(text[0],text[2]);
209 var d = new Date(document.f.firstacquidate.value);
210 var sYear = d.getFullYear();
211 moreoptions_seasons(text[15],sYear);
212 var d = new Date(document.f.firstacquidate.value);
213 var sYear = d.getFullYear();
214 document.f.add1.value=1;
215 document.f.add2.value='1';
216 document.f.add3.value='';
217 document.f.every1.value=4;
218 document.f.every2.value='1';
219 document.f.every3.value='';
220 document.f.whenmorethan1.value=9999999;
221 document.f.whenmorethan2.value='4';
222 document.f.whenmorethan3.value='';
223 document.f.setto1.value=0;
224 document.f.setto2.value='1';
225 document.f.setto3.value='';
226 document.f.lastvaluetemp1.value=sYear;
227 document.f.periodicity.value='8';
228 document.f.numberingmethod.value=_("{Y} {X}");
229 moreoptions_seasons(text[15],sYear);
235 document.getElementById("more_options").innerHTML = '';
236 document.f.irreg_check.value=1;
239 var d = new Date(document.f.startdate.value);
240 var sYear = d.getFullYear();
241 document.f.add1.value=1;
242 document.f.add2.value=1;
243 document.f.add3.value='';
244 document.f.every1.value=12;
245 document.f.every2.value=1;
246 document.f.every3.value='';
247 document.f.whenmorethan1.value=9999999;
248 document.f.whenmorethan2.value=12;
249 document.f.whenmorethan3.value='';
250 document.f.setto1.value=0;
251 document.f.setto2.value=1;
252 document.f.setto3.value='';
253 if (document.f.lastvalue1.value==0){document.f.lastvalue1.value=sYear};
254 if (document.f.lastvalue2.value==0 ||document.f.lastvalue2.value=='' ){
255 switch (document.f.periodicity.value){
257 var doy = dayofyear(d);
258 //var Weeknumber=YWDA[1];
259 document.f.lastvalue2.value=doy;
262 var doy = dayofyear(d);
263 //var Weeknumber=YWDA[1];
264 document.f.lastvalue2.value=doy*2;
267 var doy = dayofyear(d);
268 //var Weeknumber=YWDA[1];
269 document.f.lastvalue2.value=doy/3;
274 var YWDa = YMDaToYWDa(d);
275 //var Weeknumber=YWDA[1];
276 document.f.lastvalue2.value=YWDA[1]/(document.f.periodicity.value-1);
279 var smonth = d.getMonth();
280 document.f.lastvalue2.value=smonth;
283 var smonth = d.getMonth();
284 document.f.lastvalue2.value=smonth/2;
288 var smonth = d.getMonth();
289 document.f.lastvalue2.value=smonth/3;
292 var smonth = d.getMonth();
293 document.f.lastvalue2.value=smonth/6;
298 // document.f.lastvalue2.value=document.f.lastvaluetemp2.value;
299 document.f.lastvalue3.value='';
300 document.f.numberingmethod.value=_("{X}/{Y}");
301 moreoptions(text[16],text[0]);
305 document.f.add1.value=1;
306 document.f.add2.value='';
307 document.f.add3.value='';
308 document.f.every1.value=1;
309 document.f.every2.value='';
310 document.f.every3.value='';
311 document.f.whenmorethan1.value=9999999;
312 document.f.whenmorethan2.value='';
313 document.f.whenmorethan3.value='';
314 document.f.setto1.value=0;
315 document.f.setto2.value='';
316 document.f.setto3.value='';
317 document.f.lastvalue1.value=1;
318 document.f.lastvalue2.value='';
319 document.f.lastvalue3.value='';
320 document.f.numberingmethod.value='{X}';
321 // moreoptions_daily_check(text[0]);
322 moreoptions(text[0]);
323 document.f.irreg_check.value=1;
329 function display_table(n) {
331 document.getElementById("basetable").style.display = 'block';
333 document.getElementById("basetable").style.display = 'none';
335 var disp_val = ( document.getElementById("basetable").style.display == 'none' ) ? 'block' : 'none' ;
336 document.getElementById("basetable").style.display = disp_val;
340 function set_num_pattern_from_template_vars() {
341 if(!document.getElementById("numberpattern")){ return false; }
342 document.getElementById("numberpattern").value = '<!-- TMPL_VAR NAME="numberpattern" -->';
345 document.f.add1.value='<!-- TMPL_VAR NAME="add1" -->';
346 document.f.add2.value='<!-- TMPL_VAR NAME="add2" -->';
347 document.f.add3.value='<!-- TMPL_VAR NAME="add3" -->';
348 document.f.every1.value='<!-- TMPL_VAR NAME="every1" -->';
349 document.f.every2.value='<!-- TMPL_VAR NAME="every2" -->';
350 document.f.every3.value='<!-- TMPL_VAR NAME="every3" -->';
351 document.f.whenmorethan1.value='<!-- TMPL_VAR NAME="whenmorethan1" -->';
352 document.f.whenmorethan2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
353 document.f.whenmorethan3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
354 document.f.setto1.value='<!-- TMPL_VAR NAME="setto1" -->';
355 document.f.setto2.value='<!-- TMPL_VAR NAME="setto2" -->';
356 document.f.setto3.value='<!-- TMPL_VAR NAME="setto3" -->';
357 document.f.lastvalue1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
358 document.f.lastvalue2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
359 document.f.lastvalue3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
360 document.f.numberingmethod.value='<!-- TMPL_VAR NAME="numberingmethod" -->';
364 <!-- TMPL_IF NAME="add2" -->
365 if(<!-- TMPL_VAR NAME="add2" --> > 0){
369 <!-- TMPL_IF NAME="add3" -->
370 if(<!-- TMPL_VAR NAME="add3" --> > 0){
374 document.f.lastvaluetemp1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
376 document.f.lastvaluetemp2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
377 document.f.whenmorethantemp2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
380 document.f.lastvaluetemp3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
381 document.f.whenmorethantemp3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
385 // a pre check with more options to see if 'number' and '1/day' are chosen
387 function moreoptions_daily_check(x) {
388 var periodicity = document.f.periodicity.value;
390 if(periodicity == 1){ // i.e. daily
391 document.getElementById("irregularity").innerHTML = '';
392 errortext =_("Please indicate which days of the week you <b>DO NOT<\/b> expect to receive issues.<br \/>");
393 for(var j=0;j<irregular_issues.daynames.length;j++){
394 errortext +="<input type='checkbox' name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+irregular_issues.daynames[j]+" ";
396 var error = errortext;
398 document.getElementById("irregularity").innerHTML = error;
400 document.getElementById("irregularity").innerHTML = '';
401 document.getElementById("more_options").innerHTML = '';
407 // to dispaly the more options section
408 function moreoptions(x,y,z){
409 document.getElementById("irregularity").innerHTML = '';
410 document.getElementById("more_options").innerHTML = '';
412 // alert("X: "+x+"Y: "+y+"Z: "+z);
414 textbox +="<table>\n<tr><th> <\/th><th>"+x+"<\/th>";
416 textbox +="<th>"+y+"<\/th>";
418 textbox +="<th>"+z+"<\/th>";
421 textbox +="<\/tr>\n";
422 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";
424 textbox +="<td><input type='text' name='lastvaluetemp2' size='4' onkeyup='moreoptionsupdate(\"lastvalue2\")' value=\"" + document.f.lastvalue2.value + "\" /><\/td>\n";
426 textbox +="<td><input type='text' name='lastvaluetemp3' size='4' onkeyup='moreoptionsupdate(\"lastvalue3\")' value=\"" + document.f.lastvalue3.value + "\" /><\/td>\n";
429 textbox +="<\/tr>\n";
431 textbox +="<tr><th scope=\"row\">"+text[6]+"<\/th>";
432 textbox +="<td> <\/td>\n";
433 textbox +="<td><input type='text' name='whenmorethantemp2' size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
435 textbox +="<td><input type='text' name='whenmorethantemp3' size='4' onkeyup='moreoptionsupdate(\"whenmorethan3\",1)'><\/td>\n";
439 textbox +="<tr> <td>"+_("issues expected")+"</td><td><input type='text' name='issuesexpectedtemp1' size='4' onkeyup='moreoptionsupdate(\"issuesexpected1\",0)' value=\"" + document.f.issuesexpected1.value + "\" ></td></tr>";
441 textbox +="<\/table>\n";
443 document.getElementById("more_options").innerHTML = textbox;
446 function hemispheres(chosen){
447 var selbox = document.getElementById("season1");
449 var selboxselected = selbox.options[selbox.selectedIndex].value;
450 selbox.options.length = 0;
452 if ( (chosen == "1") || ( ! (chosen) && is_hemisphere == 1 )) {
453 selbox.options[selbox.options.length] = new Option(text[11],'1');
454 selbox.options[selbox.options.length] = new Option(text[12],'2');
455 selbox.options[selbox.options.length] = new Option(text[13],'3');
456 selbox.options[selbox.options.length] = new Option(text[14],'4');
458 selbox.options[selboxselected-1].selected = true;
461 if ( (chosen == "2") || ( ! (chosen) && is_hemisphere == 2 )) {
462 selbox.options[selbox.options.length] = new Option(text[13],'1');
463 selbox.options[selbox.options.length] = new Option(text[10],'2');
464 selbox.options[selbox.options.length] = new Option(text[11],'3');
465 selbox.options[selbox.options.length] = new Option(text[12],'4');
467 selbox.options[selboxselected-1].selected = true;
472 // to display the more options section for seasons
473 function moreoptions_seasons(x,y){
474 document.getElementById("irregularity").innerHTML = '';
475 document.getElementById("more_options").innerHTML = '';
477 //alert("X: "+x+"Year: "+y);
479 var hemi_select = parseInt('<!-- TMPL_VAR NAME="hemisphere" -->');
480 textbox +="<li><label for=\"hemisphere\">"+ text[7] +"<\/label><select name='hemisphere' id=\"hemisphere\" onchange='hemispheres(this.options[this.selectedIndex].value)'>";
481 for(var i = 1; i <= 2; i++){
482 textbox +="<option value='"+i+"'";
483 if(i == hemi_select){
484 textbox += " selected "
486 textbox +=">"+text[i+7]+"<\/option>";
488 textbox +="<\/li>\n";
489 textbox +="<table><tr><th> <\/th><th>"+x+"<\/th>";
490 textbox +="<th>"+text[16]+"<\/th>";
491 textbox +="<\/tr>\n";
492 textbox +="<tr><th scope=\"row\">"+text[5]+"<\/th><td><select name='lastvaluetemp2' id='season1' onchange='moreoptionsupdate(\"lastvalue2\")'>";
493 for(var j = 1; j <= 4; j++){
494 textbox +="<option value='"+j+"'>"+text[j+10]+"<\/option>";
496 textbox +="<\/select><\/td><td><select name='lastvaluetemp1' onchange='moreoptionsupdate(\"lastvalue1\")'>";
497 for(var k = parseInt(y); k <= parseInt(y)+15; k++){
498 textbox +="<option value='"+k+"'>"+k+"<\/option>";
500 textbox +="<\/select><\/td><\/tr>\n";
501 textbox +="<tr><th scope=\"row\">"+text[6]+"<\/th>";
502 textbox +="<td><input type='text' name='whenmorethantemp2' size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
503 textbox +="<\/tr><\/table>\n";
506 document.getElementById("more_options").innerHTML = textbox;
509 function irregularity_check(){
510 document.f.irreg_check.value = 1; // Irregularity button now pushed
511 var periodicity = document.f.periodicity.value;
512 var rollover = document.f.issuesexpected1.value;
513 if( (document.f.whenmorethan2) && ( document.f.whenmorethan2.value > 0) ){
514 rollover = document.f.whenmorethan2.value;
516 if((document.f.whenmorethan3) && document.f.whenmorethan3.value > 0 ){
517 // FIXME: This assumes that whenmorethan3 issues are published in one year.
518 // the other option is that whenmorethan3 * whenmorethan2 issues are published,
519 // e.g. where there are two volumes of six issues each in one year.
520 // a way to distinguish between these two cases is needed.
521 rollover = document.f.whenmorethan3.value;
526 var errortext = _("<b>Warning irregularity detected<\/b><br \/>");
529 if(rollover < 730) expected =730;
536 if(rollover < 365) expected =365;
543 if(rollover < 156) expected =156;
550 if(rollover < 52) expected =52;
557 if(rollover < 26) expected =26;
564 if(rollover < 17) expected =17;
571 if(rollover < 12) expected =12;
578 if(rollover < 6) expected =6;
585 if(rollover < 4) expected =4;
592 if(rollover < 4) expected =4;
599 if(rollover < 2) expected =2;
606 if(rollover < 1) expected =1;
616 if(expected == 365 || expected==730){ // what about leap years ?
617 // FIXME: We interpret irregularity as which days per week for periodicity==1.
618 // We need two cases: one in which we're published n days/week, in which case irregularity should be per week,
619 // and a regular daily pub, where irregularity should be per year.
620 errortext += _("Please indicate which days of the week you <b>DO NOT<\/b> expect to receive issues.<br \/>");
622 errortext +=expected+_(" issues expected, ")+rollover+_(" were entered. <br \/>Please indicate which date(s) an issue is not expected<br \/>");
623 irregular_issues.numskipped = expected - rollover;
625 errortext +="<select multiple id='irregularity_select' name='irregularity_select' onchange='irregular_issues.update();'>\n";
626 errortext +=irregular_options(periodicity);
627 errortext += "</select>\n <textarea rows='6' width='18' id='irregularity_summary' name='irregularity_summary' value='foo' />";
631 errortext +=expectedover+_(" issues expected, ")+rollover+_(" were entered.<br \/> You seem to have indicated more issues per year than expected.");
634 if(error.length ==0){
635 error=_("No irregularities noticed");
637 display_example(expected);
638 document.getElementById("irregularity").innerHTML = error;
639 irregular_issues.update();
642 function irregular_options(periodicity){
646 if(periodicity == 1) {
651 if(periodicity == 2 || periodicity == 3 || periodicity == 4) {
653 titles = irregular_issues.weeks;
654 <!-- TMPL_IF NAME="weekno" -->
655 count = 1; // This doesn't make sense given the behavior of the script.
656 // we should count from the first serial date, not from this week!
657 // <!-- TMPL_VAR NAME="weekno" -->;
662 if(periodicity == 5 || periodicity == 6 || periodicity == 7 || periodicity == 8 || periodicity == 9) {
663 if(periodicity == 8) {
664 is_season = 1; // setting up from edit page
667 titles = irregular_issues.seasons;
669 if(is_hemisphere == 2){
675 titles = irregular_issues.months;
681 return ''; // don't know how to deal with irregularity.
683 for(var j=1;j<=expected;j++){
686 count = count-expected;
688 if(is_season && is_hemisphere == 1){
689 errortext +="<option value='"+((count*3)-2)+"'>"+titles[j]+"<\/option>\n";
690 // alert("value: "+((count*3)-2)+" title: "+titles[j]);
691 } else if(is_season && is_hemisphere == 2){
692 errortext +="<option value='"+((count*3)-2)+"'>"+titles[j-1]+"<\/option>\n";
693 // alert("value: "+((count*3)-2)+" title: "+titles[j-1]);
695 errortext += "<option value='" + count ;
696 if(irregular_issues.irregular(j)) {
697 errortext += "' selected='selected" ;
699 errortext += "'>"+titles[j-1]+"<\/option>\n";
703 errortext +="<option value='"+j+"'>"+titles+" "+j+"<\/option>\n";
710 function display_example(expected){
711 var startfrom1 = parseInt(document.f.lastvalue1.value);
712 var startfrom2 = parseInt(document.f.lastvalue2.value);
713 var startfrom3 = parseInt(document.f.lastvalue3.value);
714 var every1 = parseInt(document.f.every1.value);
715 var every2 = parseInt(document.f.every2.value);
716 var every3 = parseInt(document.f.every3.value);
717 var numberpattern = document.f.numberingmethod.value;
718 var whenmorethan2 = parseInt(document.f.whenmorethan2.value);
719 var whenmorethan3 = parseInt(document.f.whenmorethan3.value);
720 var setto2 = parseInt(document.f.setto2.value);
721 var setto3 = parseInt(document.f.setto3.value);
722 var displaytext = _("Based on the information entered, the Numbering Pattern will look like this: <br \/><ul class=\"numpattern_preview\">");
724 var count=startfrom3-1;
725 var count2=startfrom2;
726 for(var i = 0 ; i < 12; i++){
727 if(count>=whenmorethan3){
729 if(count2>=whenmorethan2){
738 displaytext += '<li>' + numberpattern.replace(/{Z}/,count) + '</li>\n';
739 displaytext = displaytext.replace(/{Y}/,count2);
740 displaytext = displaytext.replace(/{X}/,startfrom1);
744 if(startfrom2>0 && !startfrom3){
745 var count=startfrom2-1;
746 for(var i=0;i<12;i++){
747 if(count>=whenmorethan2){
755 if(is_hemisphere == 2){
757 displaytext += numberpattern.replace(/{Y}/,text[count+12])+'\n';
759 displaytext += numberpattern.replace(/{Y}/,text[count+8])+'\n';
762 displaytext += numberpattern.replace(/{Y}/,text[count+10])+'\n';
765 displaytext += numberpattern.replace(/{Y}/,count)+'\n';
767 displaytext = displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
770 if(startfrom1>0 && !startfrom2 && !startfrom3){
771 var offset=eval(document.f.issuesexpected1.value);
775 for(var i=startfrom1;i<(startfrom1+offset);i+=every1){
776 displaytext += numberpattern.replace(/{X}/,i)+'<br \/>\n';
779 // displaytext = "<div style='padding: 5px; background-color: #CCCCCC'>"+displaytext+"<\/div>";
780 document.getElementById("displayexample").innerHTML = displaytext;
783 function isArray(obj) {
784 if (obj.constructor.toString().indexOf("Array") == -1)
790 function moreoptionsupdate(fieldnames,rollover){
791 fieldname = fieldnames;
792 fld = fieldname.length;
794 fieldnametempnumber = fieldname.substr(fld);
795 //alert(fieldnametempnumber);
796 fieldnametemp = fieldname.slice(0,-1)+"temp"+fieldnametempnumber;
797 // alert(fieldnametemp);
798 eval("document.f."+fieldname+".value = document.f."+fieldnametemp+".value");
799 // alert (fieldname+" : "+eval("document.f."+fieldname+".value") +' '+fieldnametemp+' : ' +eval("document.f."+fieldnametemp+".value"));
800 var patternchoice = document.getElementById("numberpattern").value;
801 switch(patternchoice){
806 if (document.f.lastvaluetemp2.value>0){document.f.innerloop1.value = document.f.lastvaluetemp2.value - 1;}
810 eval("document.f.every"+(fieldnametempnumber-1)+".value = document.f."+fieldnametemp+".value");
815 function check_input(e){
816 var unicode=e.charCode? e.charCode : e.keyCode
817 if (unicode!=8 && unicode !=46 && unicode!=9 && unicode !=13){ // if key isn't backspace or delete
818 if (unicode<48||unicode>57) { // if not a number
819 alert(_("Needs to be entered in digit form -eg 10"));
820 return false // disable key press
825 function addbiblioPopup(biblionumber) {
826 var destination = "/cgi-bin/koha/cataloguing/addbiblio.pl?mode=popup";
827 if(biblionumber){ destination += "&biblionumber="+biblionumber; }
828 window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes');
833 window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
836 function FindAcqui(f)
838 window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes');
841 function Find_ISSN(f)
843 window.open('issn-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
848 if (f.aqbooksellerid.value.length==0) {
849 input_box = confirm(_("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor"));
850 if (input_box==true) {
856 if (f.biblionumber.value.length==0) {
857 alert(_("You must choose or create a biblio"));
858 } else if(f.startdate.value.length != 0 && f.sublength.value > 0) {
859 if (f.irreg_check.value == 1) {
862 if(f.numbering_pattern.value == ''){
863 alert(_("Please choose a numbering pattern"));
865 alert(_("Please check for irregularity by clicking 'Test Prediction Pattern'"));
869 alert(_("You must choose a start date and a subscription length"));
871 if(irregular_issues.numskipped < irregular_issues.skipped.length ) {
872 alert(_("You have not accounted for all missing issues."));
877 $(document).ready(function() {
878 <!-- TMPL_IF name="mod" -->
879 set_num_pattern_from_template_vars();
880 <!-- TMPL_IF name="hemisphere" -->
881 is_hemisphere = <!-- TMPL_VAR NAME="hemisphere" --> ;
885 <!-- TMPL_IF name="irregularity" -->
886 irregularity_check();
889 $('#numberpattern').change( function() {
897 <!-- TMPL_INCLUDE NAME="header.inc" -->
898 <!-- TMPL_INCLUDE NAME="serials-search.inc" -->
900 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › <!-- TMPL_IF name="mod" --> Modify subscription for <span class="title"><!-- TMPL_VAR name="bibliotitle" --></span><!-- TMPL_ELSE -->New subscription<!-- /TMPL_IF --></div>
902 <div id="doc3" class="yui-t7">
906 <h1><!-- TMPL_IF name="mod" --> Modify subscription for <i><!-- TMPL_VAR name="bibliotitle" --></i><!-- TMPL_ELSE -->Add a new subscription<!-- /TMPL_IF --></h1>
907 <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
908 <!-- TMPL_IF name="mod" -->
909 <input type="hidden" name="op" value="modsubscription" />
910 <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
912 <input type="hidden" name="op" value="addsubscription" />
914 <input type="hidden" name="user" value="<!-- TMPL_VAR name="loggedinusername" -->" />
915 <input type="hidden" name="irreg_check" value="0" />
916 <input type="hidden" name="issuesexpected1" value="0" />
918 <div class="yui-u first">
919 <fieldset id="subscription_add_information" class="rows">
920 <legend>Subscription details</legend>
922 <li><span class="label">Subscription #</span> <!--TMPL_VAR name="subscriptionid"--></li>
924 <span class="label">Librarian: </span> <!-- TMPL_VAR name="loggedinusername" -->
927 <label for="aqbooksellerid">Vendor: </label>
928 <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>
931 <label for="biblionumber" class="required" title="Subscriptions must be associated with a bibliographic record">Biblio:</label>
933 <input type="text" name="biblionumber" id="biblionumber" value="<!-- TMPL_VAR name="bibnum" -->" size="8" />
934 (<input type="text" name="title" value="<!-- TMPL_VAR name="bibliotitle" -->" disabled="disabled" readonly="readonly" />) <span class="required" title="Subscriptions must be associated with a bibliographic record">Required</span>
935 <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 -->
936 <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a><!--/TMPL_IF--></div>
940 <!-- TMPL_IF name="serialsadditems" -->
941 <p><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1" checked="checked" /><label for="serialsadditems-yes">create an item record when receiving this serial</label></p>
942 <p><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" /><label for="serialsadditems-no">do not create an item record when receiving this serial </label></p>
944 <p><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1"/><label for="serialsadditems-yes">create an item record when receiving this serial</label></p>
945 <p><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" checked="checked" /><label for="serialsadditems-no">do not create an item record when receiving this serial</label></p>
949 <label for="callnumber">Call Number:</label>
950 <input type="text" name="callnumber" id="callnumber" value="<!-- TMPL_VAR name="callnumber" -->" size="20" />
953 <label for="branchcode">Library:</label>
955 <select name="branchcode" id="branchcode" style="width: 20em;">
956 <!-- TMPL_UNLESS NAME="Independantbranches" --><option value="">None</option><!-- /TMPL_UNLESS -->
957 <!-- TMPL_LOOP name="branchloop" --><!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
959 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
962 </select> (select a library)
966 <label for="notes">Public note:</label>
967 <textarea name="notes" id="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea>
970 <label for="internalnotes">Nonpublic note:</label>
971 <textarea name="internalnotes" id="internalnotes" cols="30" rows="2"><!-- TMPL_VAR name="internalnotes" --></textarea>
974 <label for="letter">Patron notification: </label>
976 <!-- TMPL_IF NAME="letterloop" -->
977 <select name="letter" id="letter">
978 <option value="">None</option>
979 <!-- TMPL_LOOP name="letterloop" -->
980 <!-- TMPL_IF name="selected" -->
981 <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="lettername" --></option>
983 <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="lettername" --></option>
987 <div class="hint">Select a notice and patrons on the routing list will be notified when new issues are received.</div>
989 <div class="hint">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
994 <div style="float:left;clear:left;margin:1em;"><strong>Note:</strong>
997 <li>The subscription <strong>must</strong> be associated with a bibliographic record.</li>
998 <li>You <strong>must</strong> select a vendor if you wish to generate claims.</li>
1006 <div id="subscription_form_planning">
1007 <fieldset class="rows">
1008 <legend>Serials planning</legend>
1011 <label for="firstacquidate"> First issue publication date:</label>
1013 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button2" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1014 <input type="text" name="firstacquidate" value="<!-- TMPL_VAR name="firstacquidate" -->" size="13" maxlength="10" id="acqui_date" style="border-width: 0px;" />
1015 <!-- both scripts for calendar must follow the input field -->
1016 <script type="text/javascript">
1018 inputField:"acqui_date",
1019 ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1024 <script type="text/javascript">
1026 inputField : "acqui_date",
1027 ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1028 button : "acqui_date",
1030 onUpdate : function(cal) { weeks = getWeeksArray(cal.date);
1037 <label for="periodicity" class="required">Frequency:</label>
1039 <select name="periodicity" size="1" id="periodicity" onchange="javascript:document.getElementsByName('manualhist')[0].checked=(this.value==1); reset_num_pattern();">
1040 <option value="" selected="selected">-- please choose --</option>
1041 <!-- TMPL_IF name="periodicity16" -->
1042 <option value="16" selected="selected">Without periodicity</option>
1044 <option value="16">Without periodicity</option>
1046 <!-- TMPL_IF name="periodicity48" -->
1047 <option value="48" selected="selected">Unknown</option>
1049 <option value="48">Unknown</option>
1051 <!-- TMPL_IF name="periodicity32" -->
1052 <option value="32" selected="selected">Irregular</option>
1054 <option value="32">Irregular</option>
1057 <!-- TMPL_IF name="periodicity12" -->
1058 <option value="12" selected="selected">2/day</option>
1060 <option value="12">2/day</option>
1062 <!-- TMPL_IF name="periodicity1" -->
1063 <option value="1" selected="selected">1/day</option>
1065 <option value="1">1/day</option>
1067 <!-- TMPL_IF name="periodicity13" -->
1068 <option value="13" selected="selected">3/week</option>
1070 <option value="13">3/week</option>
1072 <!-- TMPL_IF name="periodicity2" -->
1073 <option value="2" selected="selected">1/week</option>
1075 <option value="2">1/week</option>
1077 <!-- TMPL_IF name="periodicity3" -->
1078 <option value="3" selected="selected">1/2 weeks </option>
1080 <option value="3">1/2 weeks </option>
1082 <!-- TMPL_IF name="periodicity4" -->
1083 <option value="4" selected="selected">1/3 weeks</option>
1085 <option value="4">1/3 weeks</option>
1087 <!-- TMPL_IF name="periodicity5" -->
1088 <option value="5" selected="selected">1/month</option>
1090 <option value="5">1/month</option>
1092 <!-- TMPL_IF name="periodicity6" -->
1093 <option value="6" selected="selected">1/2 months (6/year)</option>
1095 <option value="6">1/2 months (6/year)</option>
1097 <!-- TMPL_IF name="periodicity7" -->
1098 <option value="7" selected="selected">1/3 months (1/quarter)</option>
1100 <option value="7">1/3 months (1/quarter)</option>
1102 <!-- periodicity8 is 1/quarter, exactly like periodicity7 but will use it for seasonal option -->
1103 <!-- TMPL_IF name="periodicity8" -->
1104 <option value="8" selected="selected">1/quarter (seasonal)</option>
1106 <option value="8">1/quarter (seasonal)</option>
1109 <!-- TMPL_IF name="periodicity9" -->
1110 <option value="9" selected="selected">2/years</option>
1112 <option value="9">2/year</option>
1114 <!-- TMPL_IF name="periodicity10" -->
1115 <option value="10" selected="selected">1/year</option>
1117 <option value="10">1/year</option>
1119 <!-- TMPL_IF name="periodicity11" -->
1120 <option value="11" selected="selected">1/2 years</option>
1122 <option value="11">1/2 years</option>
1124 </select> <span class="required">Required</span></li>
1125 <li><label for="manuallist"> Manual history:</label> <input type="checkbox" name="manualhist" id="manuallist" value="1" /></li>
1127 <label for="numberpattern"> Numbering pattern:</label>
1129 <select name="numbering_pattern" size="1" id="numberpattern" onchange="reset_num_pattern()">
1130 <option value="" selected="selected">-- please choose --</option>
1131 <!-- TMPL_IF name="numberpattern1" -->
1132 <option value="1" selected="selected">Number</option>
1134 <option value="1">Number</option>
1136 <!-- TMPL_IF name="numberpattern2" -->
1137 <option value="2" selected="selected">Volume, Number, Issue</option>
1139 <option value="2">Volume, Number, Issue</option>
1141 <!-- TMPL_IF name="numberpattern3" -->
1142 <option value="3" selected="selected">Volume, Number</option>
1144 <option value="3">Volume, Number</option>
1146 <!-- TMPL_IF name="numberpattern4" -->
1147 <option value="4" selected="selected">Volume, Issue</option>
1149 <option value="4">Volume, Issue</option>
1151 <!-- TMPL_IF name="numberpattern5" -->
1152 <option value="5" selected="selected">Number, Issue</option>
1154 <option value="5">Number, Issue</option>
1156 <!-- TMPL_IF name="numberpattern6" -->
1157 <option value="6" selected="selected">Seasonal only</option>
1159 <option value="6">Seasonal only</option>
1161 <!-- TMPL_IF name="numberpattern8" -->
1162 <option value="8" selected="selected">Year/Number</option>
1164 <option value="8">Year/Number</option>
1166 <!-- TMPL_IF name="numberpattern7" -->
1167 <option value="7" selected="selected">None of the above</option>
1169 <option value="7">None of the above</option>
1173 <li id="more_options"></li>
1174 <li id="irregularity"></li>
1175 <li id="displayexample"></li>
1177 <label for="startdate" class="required"> Subscription start date:</label>
1179 <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="button1" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1180 <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size="13" maxlength="10" id="beginning_date" style="border-width: 0px;" />
1181 <!-- both scripts for calendar must follow the input field -->
1182 <script type="text/javascript">
1184 inputField : "beginning_date",
1185 ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1190 <script type="text/javascript">
1192 inputField : "beginning_date",
1193 ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
1194 button : "beginning_date",
1198 <span class="required">Required</span>
1201 <label for="subtype" class="required">Subscription length:</label>
1203 <select name="subtype" id="subtype">
1204 <!-- TMPL_LOOP NAME="subtype" -->
1205 <!-- TMPL_IF NAME="selected" -->
1206 <option value="<!-- TMPL_VAR NAME="name" -->" selected="selected">
1208 <option value="<!-- TMPL_VAR NAME="name" -->">
1210 <!-- TMPL_VAR NAME="name" -->
1214 <input type="text" name="sublength" value="<!-- TMPL_VAR name="sublength" -->" size="3" onkeypress="return check_input(event)" /> (enter amount in numerals)
1215 <span class="required">Required</span>
1217 <li><label for="numberingmethod">Numbering formula:</label> <input type="text" name="numberingmethod" id="numberingmethod" value="<!-- TMPL_VAR name="numberingmethod" -->" />
1222 <fieldset class="action">
1223 <input type="button" class="action_test" value="Test Prediction Pattern" onclick="javascript:irregularity_check()" />
1224 <input type="button" class="action_reset" value="Reset Pattern" onclick="javascript:reset_pattern()" />
1225 <input type="button" class="action_save" value="Save subscription" onclick="Check(this.form)" accesskey="w" />
1227 <fieldset class="action">
1228 <input type="button" class="action_advanced" value="Show/Hide Advanced Pattern" onclick="javascript:display_table()" />
1230 <div id="basetable" style="display: none;">
1231 <table class="small">
1232 <tr><th colspan="4">Advanced Prediction Pattern</th></tr>
1242 <input type="text" name="add1" value="<!-- TMPL_VAR name="add1" -->" />
1245 <input type="text" name="add2" value="<!-- TMPL_VAR name="add2" -->" />
1248 <input type="text" name="add3" value="<!-- TMPL_VAR name="add3" -->" />
1253 <td><input type="text" name="every1" value="<!-- TMPL_VAR name="every1" -->" /></td>
1254 <td><input type="text" name="every2" value="<!-- TMPL_VAR name="every2" -->" /></td>
1255 <td><input type="text" name="every3" value="<!-- TMPL_VAR name="every3" -->" /></td>
1258 <td>When more than</td>
1259 <td><input type="text" name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->" /></td>
1260 <td><input type="text" name="whenmorethan2" value="<!-- TMPL_VAR name="whenmorethan2" -->" /></td>
1261 <td><input type="text" name="whenmorethan3" value="<!-- TMPL_VAR name="whenmorethan3" -->" /></td>
1264 <td>inner counter</td>
1265 <td><input type="text" name="innerloop1" value="<!-- TMPL_VAR name="innerloop1" -->" /></td>
1266 <td><input type="text" name="innerloop2" value="<!-- TMPL_VAR name="innerloop2" -->" /></td>
1267 <td><input type="text" name="innerloop3" value="<!-- TMPL_VAR name="innerloop3" -->" /></td>
1270 <td>Set back to</td>
1271 <td><input type="text" name="setto1" value="<!-- TMPL_VAR name="setto1" -->" /></td>
1272 <td><input type="text" name="setto2" value="<!-- TMPL_VAR name="setto2" -->" /></td>
1273 <td><input type="text" name="setto3" value="<!-- TMPL_VAR name="setto3" -->" /></td>
1277 <!-- TMPL_IF name="mod" -->
1283 <td><input type="text" name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->" /></td>
1284 <td><input type="text" name="lastvalue2" value="<!-- TMPL_VAR name="lastvalue2" -->" /></td>
1285 <td><input type="text" name="lastvalue3" value="<!-- TMPL_VAR name="lastvalue3" -->" /></td>
1295 <!--TMPL_IF Name="history"-->
1296 <div id="subscription_form_history">
1297 <h2>Subscription history</h2>
1298 <form method="post" action="/cgi-bin/koha/serials/subscription-add.pl">
1299 <input type="hidden" name="op" value="modsubscription" />
1300 <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
1301 <input type="hidden" name="history_only" value="1" />
1302 <p>Hint : you can update the serial history manually. This can be useful for an old subscription or to clean the existing history. Modify these fields with care, as future serial receive will continue to update them automatically.</p>
1305 <td>Subscription start date</td>
1306 <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->" /> (start date of the 1st subscription)</td>
1309 <td>Subscription end date</td>
1310 <td><input type="text" name="histenddate" value="<!-- TMPL_VAR name="histenddate" -->" />(if empty, subscription is still active)</td>
1313 <td>Received issues</td>
1314 <td><textarea name="recievedlist" cols="60" rows="5"><!-- TMPL_VAR name="recievedlist" --></textarea></td>
1317 <td>Missing issues</td>
1318 <td><textarea name="missinglist" cols="60" rows="5"><!-- TMPL_VAR name="missinglist" --></textarea></td>
1321 <td>Note for OPAC</td>
1322 <td><textarea name="opacnote" cols="60" rows="5"><!-- TMPL_VAR name="opacnote" --></textarea></td>
1325 <td>Note for staff</td>
1326 <td><textarea name="librariannote" cols="60" rows="5"><!-- TMPL_VAR name="librariannote" --></textarea></td>
1329 <input type="submit" value="Save subscription history" />
1336 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->