add tests for weekly publication, fix bug in code for "day" publication patterns
authordjfiander <djfiander@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Jun 2009 01:50:10 +0000 (01:50 +0000)
committerdjfiander <djfiander@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Jun 2009 01:50:10 +0000 (01:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13485 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t

index 0180cd3..8886e32 100644 (file)
@@ -67,6 +67,8 @@ sub subsequent_day {
                           month => $cur[1],
                           day   => $cur[2]);
 
+#     printf("# subsequent_day: pat='%s' cur='%s'\n", $pat, join('/', @cur));
+
     if (exists $daynames{$pat}) {
        # dd: published on the given weekday
        my $dow = $dt->day_of_week;
@@ -81,15 +83,14 @@ sub subsequent_day {
            # $corr will take care of it.
            $dt->add(days => $corr);
        }
+       @cur = ($dt->year, $dt->month, $dt->day);
     } elsif (length($pat) == 2) {
        # DD: published on the give day of every month
        if ($dt->day >= $pat) {
            # current date is on or after $pat: next one is next month
            $dt->set(day => $pat);
            $dt->add(months => 1);
-           $cur[0] = $dt->year;
-           $cur[1] = $dt->month;
-           $cur[2] = $dt->day;
+           @cur = ($dt->year, $dt->month, $dt->day);
        } else {
            # current date is before $pat: set day to pattern
            $cur[2] = $pat;
@@ -116,6 +117,8 @@ sub subsequent_day {
        $cur[$i] = '0' . (0+$cur[$i]) if $cur[$i] < 10;
     }
 
+#     printf("subsequent_day: returning '%s'\n", join('/', @cur));
+
     return @cur;
 }
 
index 6f26524..98e82a3 100644 (file)
@@ -217,3 +217,8 @@ __END__
 863 41 $820.2$a1$b3$i1990$j06/08$x|a1|b4|i1990|j10$zFrom Jun/Aug to Oct
 863 41 $820.3$a1$b5$i1990$j12$x|a2|b1|i1991|j02$zWrap at end of year/vol.
 
+245 00 $aEconomist: pub. w on Sa, except combined iss on last two weeks of year
+853 20 $821$av.$bno.$u12$vc$i(year)$j(month)$k(day)$ww$x01,04,07,10$ypdsa$yow1299
+863 41 $821.1$a100$b1200$i2008$j12$k06$x|a100|b1201|i2008|j12|k13$zwithin vol.
+863 41 $821.2$a100$b1201$i2008$j12$k13$x|a100|b1202|i2008|j12|k20$zwithin vol. combined iss.
+863 41 $821.3$a100$b1202$i2008$j12$k20$x|a101|b1203|i2009|j01|k03$zvolume change over omitted iss.