From: djfiander Date: Tue, 30 Jun 2009 01:50:10 +0000 (+0000) Subject: add tests for weekly publication, fix bug in code for "day" publication patterns X-Git-Tag: sprint4-merge-nov22~9751 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8bd6450c72e7ce07f9c729e38adb9c7cf08857d2;p=working%2FEvergreen.git add tests for weekly publication, fix bug in code for "day" publication patterns git-svn-id: svn://svn.open-ils.org/ILS/trunk@13485 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm index 0180cd3da0..8886e325eb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm @@ -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; } diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t index 6f26524374..98e82a34e0 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t @@ -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.