[open-ils-commits] r11062 - trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Nov 4 21:54:00 EST 2008
Author: djfiander
Date: 2008-11-04 21:53:58 -0500 (Tue, 04 Nov 2008)
New Revision: 11062
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
Log:
Add support for calculating the next value of an alternate enumeration.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm 2008-11-05 01:49:31 UTC (rev 11061)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm 2008-11-05 02:53:58 UTC (rev 11062)
@@ -102,10 +102,30 @@
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}) {
More information about the open-ils-commits
mailing list