[open-ils-commits] r13485 - in trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD: . test (djfiander)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jun 29 21:50:12 EDT 2009
Author: djfiander
Date: 2009-06-29 21:50:10 -0400 (Mon, 29 Jun 2009)
New Revision: 13485
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t
Log:
add tests for weekly publication, fix bug in code for "day" publication patterns
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm 2009-06-29 23:03:48 UTC (rev 13484)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm 2009-06-30 01:50:10 UTC (rev 13485)
@@ -67,6 +67,8 @@
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 @@
# $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 @@
$cur[$i] = '0' . (0+$cur[$i]) if $cur[$i] < 10;
}
+# printf("subsequent_day: returning '%s'\n", join('/', @cur));
+
return @cur;
}
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t 2009-06-29 23:03:48 UTC (rev 13484)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t 2009-06-30 01:50:10 UTC (rev 13485)
@@ -217,3 +217,8 @@
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.
More information about the open-ils-commits
mailing list