From: djfiander Date: Thu, 26 Mar 2009 02:40:28 +0000 (+0000) Subject: Change test for whether enumeration fields hold chronology: X-Git-Tag: sprint4-merge-nov22~10407 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=620fc6605b2ea0e20746ce5d76153f7b30b12053;p=working%2FEvergreen.git Change test for whether enumeration fields hold chronology: $x subfield implies $a is volume number, $y doesnt matter any more. git-svn-id: svn://svn.open-ils.org/ILS/trunk@12676 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm index d4f38c90ce..2502a5cc22 100755 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm @@ -157,14 +157,14 @@ sub calendar_change { # 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 @@ sub enumeration_is_chronology { 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 = ( diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm index dbd02d0727..4029478a7e 100755 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm @@ -136,8 +136,6 @@ sub format { 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 @@ sub incr_date { 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 @@ sub calendar_increment { ($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 @@ sub next { 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 @@ sub next { $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; } 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 d7ac268e26..119e9434c4 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t @@ -184,5 +184,11 @@ __END__ 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