[Rt-commit] r12920 - rt/branches/3.8-TESTING/share/html

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jun 5 12:03:12 EDT 2008


Author: sunnavy
Date: Thu Jun  5 12:03:11 2008
New Revision: 12920

Modified:
   rt/branches/3.8-TESTING/share/html/index.html

Log:
check if cfs are validate for "Quick ticket creation" too

Modified: rt/branches/3.8-TESTING/share/html/index.html
==============================================================================
--- rt/branches/3.8-TESTING/share/html/index.html	(original)
+++ rt/branches/3.8-TESTING/share/html/index.html	Thu Jun  5 12:03:11 2008
@@ -84,18 +84,34 @@
 my @results;
 
 if ( $ARGS{'QuickCreate'} ) {
-    my ($t, $msg) = CreateTicket( 
-                    Queue => $ARGS{'Queue'},
-                    Owner => $ARGS{'Owner'},
-                    Status => 'new',
-                    # yes! it's Requestors, not Requestor
-                    Requestors => $session{'CurrentUser'}->id,
-                    From => $session{'CurrentUser'}->id,
-                    Content => $ARGS{'Content'},
-                    Subject => $ARGS{'Subject'});
-
-
-    push (@results, $msg);
+    my $QueueObj = new RT::Queue($session{'CurrentUser'});
+    $QueueObj->Load($ARGS{Queue}) or Abort(loc("Queue could not be loaded."));
+    
+    my $CFs = $QueueObj->TicketCustomFields();
+    
+    my $ValidCFs = $m->comp(
+        '/Elements/ValidateCustomFields',
+        CustomFields => $CFs,
+        ARGSRef => \%ARGS
+    );
+
+
+    if ( $ValidCFs ) {
+        my ($t, $msg) = CreateTicket( 
+                        Queue => $ARGS{'Queue'},
+                        Owner => $ARGS{'Owner'},
+                        Status => 'new',
+                        # yes! it's Requestors, not Requestor
+                        Requestors => $session{'CurrentUser'}->id,
+                        From => $session{'CurrentUser'}->id,
+                        Content => $ARGS{'Content'},
+                        Subject => $ARGS{'Subject'});
+        push @results, $msg;
+    }
+    else {
+        push @results, "can't quickly create ticket in queue " .
+            $QueueObj->Name . ' because some cfs need to be set, please go to normal ticket creation page to do that.';
+    }
 }
 
 


More information about the Rt-commit mailing list