[open-ils-commits] r12676 - in trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD: . test (djfiander)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 25 22:40:30 EDT 2009


Author: djfiander
Date: 2009-03-25 22:40:28 -0400 (Wed, 25 Mar 2009)
New Revision: 12676

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t
Log:
Change test for whether enumeration fields hold chronology:
 $x subfield implies $a is volume number, $y doesnt matter any more.

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm	2009-03-26 02:39:21 UTC (rev 12675)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm	2009-03-26 02:40:28 UTC (rev 12676)
@@ -157,14 +157,14 @@
 # recorded in the enumeration subfields $a - $f.  We can tell
 # that this is the case if there are $a - $f subfields and no
 # chronology subfields ($i-$k), and none of the $a-$f subfields
-# have associated $u or $v subfields, but there are $w and $y
-# subfields.
+# have associated $u or $v subfields, but there's a $w and no $x
 
 sub enumeration_is_chronology {
     my $self = shift;
 
     # There is always a '$a' subfield in well-formed fields.
-    return 0 if exists $self->{_mfhdc_CHRONS}->{i};
+    return 0 if exists $self->{_mfhdc_CHRONS}->{i}
+      || exists $self->{_mfhdc_PATTERN}->{x};
 
     foreach my $key ('a' .. 'f') {
 	my $enum;
@@ -175,7 +175,7 @@
 	return 0 if defined $enum->{COUNT} || defined $enum->{RESTART};
     }
 
-    return (exists $self->{_mfhdc_PATTERN}->{w} && exists $self->{_mfhdc_PATTERN}->{y});
+    return (exists $self->{_mfhdc_PATTERN}->{w});
 }
 
 my %daynames = (

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm	2009-03-26 02:39:21 UTC (rev 12675)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm	2009-03-26 02:40:28 UTC (rev 12676)
@@ -136,8 +136,6 @@
 
 	    last if !defined $caption->capstr($key);
 
-	    # 	printf("fmt %s: '%s'\n", $key, $caption->capstr($key));
-
 	    $capstr = $caption->capstr($key);
 	    if (substr($capstr, 0, 1) eq '(') {
 		# a caption enclosed in parentheses is not displayed
@@ -221,7 +219,7 @@
 	    if ($new[1] > 24) {
 		# carry
 		$new[0] += 1;
-		$new[1] -= 24;
+		$new[1] -= 4;	# 25 - 4 == 21 == Spring after Winter
 	    }
 	} else {
 	    # month
@@ -287,10 +285,6 @@
 	    ($month, $day) = unpack("a2a2", $change);
 	}
 
-	# 	print "# next_date: month = '$month', day = '$day'\n";
-	# 	print "# next_date: cur[0] = '$cur->[0]', cur[1] = '$cur->[1]'\n";
-	# 	print "# next_date: new[0] = '$new[0]', new[1] = '$new[1]'\n";
-
 	if ($cur->[0] == $new[0]) {
 	    # Same year, so a 'simple' month/day comparison will be fine
 	    $incr = (!on_or_after($cur->[1], $cur->[2], $month, $day)
@@ -474,7 +468,7 @@
     my $self = shift;
     my $caption = $self->{_mfhdh_CAPTION};
     my $next = {};
-    my $carry;
+    my $carry = 0;
 
     # Initialize $next with current enumeration & chronology, then
     # we can just operate on $next, based on the contents of the caption
@@ -484,7 +478,7 @@
 	    $next->{$key} = $self->{_mfhdh_SUBFIELDS}->{$key}
 	      if exists $self->{_mfhdh_SUBFIELDS}->{$key};
 	}
-	$self->next_date($next, ('a' .. 'h'));
+	$self->next_date($next, $carry, ('a' .. 'h'));
 
 	return $next;
     }

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t	2009-03-26 02:39:21 UTC (rev 12675)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t	2009-03-26 02:40:28 UTC (rev 12676)
@@ -184,5 +184,11 @@
 853 20 $815$av.$bno.$u11$vr$i(year)$j(month)$wm$x01$yom07
 
 245 00 $aQuarterly, chronology in enumeration fields
-853 20 $816$a(year)$b(season)$wq$x21$yps21,22,23,24
+853 20 $816$a(year)$b(season)$wq$yps21,22,23,24
 863 41 $816.1$a2007$b21$x|a2007|b22$zSimple case: quarterly in mid-volume
+863 41 $816.2$a2007$b24$x|a2008|b21$zRoll over to new year
+
+245 00 $aFour issues a year, chronology in enum fields, combined Sum/Fall issue
+853 20 $817$a(year)$b(season)$wq$ycs22/23
+863 41 $817.1$a2007$b21$x|a2007|b22/23$zSpring to Summer/Fall
+863 41 $817.2$a2007$b22/23$x|a2007|b24$zSummer/Fall to Winter



More information about the open-ils-commits mailing list