[Rt-commit] rt branch, 4.2/cf-validation-messages, created. rt-4.0.8-549-g4c4e118
Alex Vandiver
alexmv at bestpractical.com
Tue Nov 20 17:16:43 EST 2012
The branch, 4.2/cf-validation-messages has been created
at 4c4e1185ba0c975795b6ff86d5590d900d573139 (commit)
- Log -----------------------------------------------------------------
commit 4c4e1185ba0c975795b6ff86d5590d900d573139
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Aug 24 14:33:20 2012 -0700
Use validation results returned by ValidateCustomFields
The primary ticket create page was missed by bc25369. This also causes
CF names to be localized in the error message, as Ticket/Update.html did
before bc25369, and as all similar pages do thereafter.
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 7d4784d..302d915 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -391,14 +391,6 @@ $QueueObj->Disabled && Abort(loc("Cannot create tickets in a disabled queue."));
my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty ticket object
-my $CFs = $QueueObj->TicketCustomFields();
-
-my $ValidCFs = $m->comp(
- '/Elements/ValidateCustomFields',
- CustomFields => $CFs,
- ARGSRef => \%ARGS
-);
-
# deal with deleting uploaded attachments
foreach my $key (keys %ARGS) {
if ($key =~ m/^DeleteAttach-(.+)$/) {
@@ -427,6 +419,18 @@ unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
my $checks_failure = 0;
+{
+ my ($status, @msg) = $m->comp(
+ '/Elements/ValidateCustomFields',
+ CustomFields => $QueueObj->TicketCustomFields,
+ ARGSRef => \%ARGS
+ );
+ unless ($status) {
+ $checks_failure = 1;
+ push @results, @msg;
+ }
+}
+
my $gnupg_widget = $m->comp('/Elements/GnuPG/SignEncryptWidget:new', Arguments => \%ARGS );
$m->comp( '/Elements/GnuPG/SignEncryptWidget:Process',
self => $gnupg_widget,
@@ -467,18 +471,11 @@ $m->comp( '/Articles/Elements/CheckSkipCreate', ARGSRef => \%ARGS, skip_create =
checks_failure => $checks_failure, results => \@results );
if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket?
- if ( $ValidCFs && !$checks_failure && !$skip_create ) {
+ if ( !$checks_failure && !$skip_create ) {
$m->comp('Display.html', %ARGS);
$RT::Logger->crit("After display call; error is $@");
$m->abort();
}
- elsif ( !$ValidCFs ) {
- # Invalid CFs
- while (my $CF = $CFs->Next) {
- my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
- push @results, $CF->Name . ': ' . $msg;
- }
- }
}
PageMenu->child( basics => raw_html => q[<a href="#basics" onclick="return switchVisibility('Ticket-Create-basics','Ticket-Create-details');">] . loc('Basics') . q[</a>]);
PageMenu->child( details => raw_html => q[<a href="#details" onclick="return switchVisibility('Ticket-Create-details','Ticket-Create-basics');">] . loc('Details') . q[</a>]);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list