[open-ils-commits] r13427 - trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD (djfiander)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Jun 21 20:19:59 EDT 2009


Author: djfiander
Date: 2009-06-21 20:19:58 -0400 (Sun, 21 Jun 2009)
New Revision: 13427

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
Log:
Implement subsequent_month() to generate next publication month
based on $yp publication pattern. Somehow I missed this on the
first pass.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm	2009-06-22 00:17:14 UTC (rev 13426)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm	2009-06-22 00:19:58 UTC (rev 13427)
@@ -324,6 +324,22 @@
     return ($pat eq $date[1]);
 }
 
+sub subsequent_month {
+    my $pat = shift;
+    my @cur = @_;
+
+    if ($cur[1] >= $pat) {
+	# Current date is on or after the patter date, so the next
+	# occurence is next year
+	$cur[0] += 1;
+    }
+
+    # The year is right, just set the month to the pattern date.
+    $cur[1] = $pat;
+
+    return @cur;
+}
+
 sub match_season {
     my $pat = shift;
     my @date = @_;



More information about the open-ils-commits mailing list