Date format fix for serials irregularities.
authorRyan Higgins <ryan.higgins@liblime.com>
Sat, 16 Feb 2008 20:09:33 +0000 (09:09 +1300)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 19 Feb 2008 01:30:42 +0000 (19:30 -0600)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
serials/subscription-add.pl

index 05aee6e..4626a63 100644 (file)
@@ -95,8 +95,8 @@ var patternchoice = document.getElementById("numberpattern").value;
         display_table(0);
         break;
     case "5":
-        var d = new Date(document.f.firstacquidate.value);
-        var smonth = d.getMonth();
+//        var d = new Date(document.f.firstacquidate.value);
+//        var smonth = d.getMonth();
         document.f.add1.value=1;
         document.f.add2.value=1;
         document.f.add3.value='';
@@ -415,7 +415,7 @@ var textbox = '';
 function irregularity_check(){
     document.f.irreg_check.value = 1; // Irregularity button now pushed
     var periodicity = document.f.periodicity.value;
-    var rollover = document.f.issuesexpected1.value;
+       var rollover = document.f.issuesexpected1.value;
     if(document.f.whenmorethantemp2){
       rollover = document.f.whenmorethantemp2.value;
     }
@@ -926,7 +926,7 @@ window.onload = irregular_order();
         <li>
             <label for="periodicity">Frequency: (*)</label>
             
-                <select name="periodicity" size="1" id="periodicity" onchange="javascript:document.getElementsByName('manualhist')[0].checked=(this.value==1);num_pattern;">
+                <select name="periodicity" size="1" id="periodicity" onchange="javascript:document.getElementsByName('manualhist')[0].checked=(this.value==1); num_pattern();">
                 <option value="" selected="selected">-- please choose --</option>
                 <!-- TMPL_IF name="periodicity16" -->
                 <option value="16" selected="selected">Without periodicity</option>
index f79a31c..6142a4a 100755 (executable)
@@ -55,20 +55,21 @@ my ($template, $loggedinuser, $cookie)
 
 my $weekarrayjs='';
 my $count = 0;
+# FIXME - This assumes first pub date of today().
+# You can't enter past-date irregularities.
 my ($year, $month, $day) = Today;
 my $firstday   =  Day_of_Year($year,$month,$day);
 my ($wkno,$yr) = Week_of_Year($year,$month,$day); # week starting monday
 my $weekno = $wkno;
 for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
-        $count = $i;
-        if($wkno > 52){$year++; $wkno=1;}
-        if($count>365){$count=$i-365;}    
-        my ($y,$m,$d) = Add_Delta_Days(1,1,1,$i - 1);
-
+        #$count = $i;
+        #if($wkno > 52){$year++; $wkno=1;}
+        #if($count>365){$count=$i-365;}    
+        my ($y,$m,$d) = Add_Delta_Days($year,1,1,$i - 1);
+#warn "$y-$m-$d";
         #BUGFIX padding add_delta_days() date
-        my $output  = sprintf("%04d-%02d-%02d",$y , $m, $d );
-
-        $weekarrayjs .= "'Wk $wkno: ".format_date($output)."',";
+        my $output  =  sprintf("%04d-%02d-%02d",$y , $m, $d );
+        $weekarrayjs .= "'Wk $wkno: ". format_date($output) ."',";
         $wkno++;    
 }
 chop($weekarrayjs);