Author: spadkins
Date: Thu Mar 12 10:36:58 2009
New Revision: 12604
Modified:
p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm
Log:
Check for multiple rows in _load_label
Modified: p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm Thu Mar 12
10:36:58 2009
@@ -237,9 +237,16 @@
}
$sql = $self->substitute($sql, undef, {undef_value => "NULL"});
my $rows = $rep->_do($sql);
- if ($rows && $#$rows > -1) {
- my $row = $rows->[0];
- $label = (defined $row->[1]) ? $row->[1] :
$value;
+ if ($rows) {
+ foreach my $row (@$rows) {
+ if ($row->[0] eq $value) {
+ $label = (defined $row->[1]) ?
$row->[1] : $value;
+ last;
+ }
+ }
+ if ($#$rows >= 1) {
+ $context->log("WARNING:
ValueDomain($self->{name})._load_label($value) returned multiple rows.
label=[$label]\n");
+ }
}
}
&App::sub_exit($label) if ($App::trace);