From: djfiander Date: Wed, 5 Nov 2008 02:53:58 +0000 (+0000) Subject: Add support for calculating the next value of an alternate enumeration. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=815f8c83fb751081ea3accff7fdb41fe2b24aff9;p=Evergreen.git Add support for calculating the next value of an alternate enumeration. git-svn-id: svn://svn.open-ils.org/ILS/trunk@11062 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm index 21c3ca5dc0..422e73143c 100755 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm @@ -102,10 +102,30 @@ sub next { my $caption = $self->{CAPTION}; my $next = {}; - foreach my $key ('a' .. 'f') { - last if !exists $self->{ENUMS}->{$key}; + foreach my $key ('a' .. 'h') { + next if !exists $self->{ENUMS}->{$key}; $next->{$key} = $self->{ENUMS}->{$key}->{HOLDINGS}; } + + # First handle any "alternative enumeration", since they're + # a lot simpler, and don't depend on the the calendar + foreach my $key ('h', 'g') { + next if !exists $next->{$key}; + if (!exists $caption->{ENUMS}->{$key}) { + warn "Holding data exists for $key, but no caption specified"; + $next->{$key} += 1; + last; + } + + my $cap = $caption->{ENUMS}->{$key}; + if ($cap->{RESTART} && $cap->{COUNT} + && ($next->{$key} == $cap->{COUNT})) { + $next->{$key} = 1; + } else { + $next->{$key} += 1; + last; + } + } foreach my $key (reverse('a'.. 'f')) { next if !exists $next->{$key}; if (!exists $caption->{ENUMS}->{$key}) {