[Rt-commit] r6369 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Tue Nov 7 08:33:26 EST 2006
Author: ruz
Date: Tue Nov 7 08:33:26 2006
New Revision: 6369
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields
Log:
r4097 at cubic-pc: cubic | 2006-11-06 23:04:21 +0300
* return error messages if the component is called in the list context
Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields Tue Nov 7 08:33:26 2006
@@ -1,8 +1,7 @@
<%INIT>
-my $valid = 1;
+my ($valid, @res) = (1, ());
$CustomFields->GotoFirstItem;
-while (my $CF = $CustomFields->Next) {
- my $pattern = $CF->Pattern;
+while ( my $CF = $CustomFields->Next ) {
my $field = $NamePrefix . $CF->Id . "-Value";
my $value;
@@ -18,14 +17,14 @@
$m->notes(('Field-' . $CF->Id) => $value);
next if $CF->MatchPattern($value);
- $m->notes(
- ('InvalidField-' . $CF->Id)
- => (loc("Input must match [_1]", $CF->FriendlyPattern))
- );
+
+ my $msg = loc("Input must match [_1]", $CF->FriendlyPattern);
+ $m->notes( ('InvalidField-' . $CF->Id) => $msg );
+ push @res, $msg;
$valid = 0;
}
$m->notes('ValidFields', $valid);
-return $valid;
+return wantarray? ($valid, @res): $valid;
</%INIT>
<%ARGS>
$CustomFields
More information about the Rt-commit
mailing list