]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 460742: The type should be mandatory to create a custom field - Patch by Nitish...
authorlpsolit%gmail.com <>
Fri, 30 Oct 2009 01:14:11 +0000 (01:14 +0000)
committerlpsolit%gmail.com <>
Fri, 30 Oct 2009 01:14:11 +0000 (01:14 +0000)
Bugzilla/Field.pm
template/en/default/global/code-error.html.tmpl

index a2a08cd4b0b7311eda3ea24f0da6a37a29bfeb97..077c67e20e6de5b736e7b76ed24df8758fb0b73c 100644 (file)
@@ -837,6 +837,11 @@ sub run_create_validators {
                                      $params->{visibility_field_id});
 
     my $type = $params->{type} || 0;
+    
+    if ($params->{custom} && !$type) {
+        ThrowCodeError('field_type_not_specified');
+    }
+    
     $params->{value_field_id} = 
         $class->_check_value_field_id($params->{value_field_id},
             ($type == FIELD_TYPE_SINGLE_SELECT 
index 3c9f73f4c47d81475b2b092a056ed0b44f2332b1..64bd41af3a9c1353eb1c67180946c1c3034d421a 100644 (file)
     to generate the right class (you can't call class methods directly
     on Bugzilla::Field::Choice).
 
+  [% ELSIF error == "field_not_custom" %]
+    '[% field.description FILTER html %]' ([% field.name FILTER html %])
+    is not a custom field.
+
   [% ELSIF error == "field_type_mismatch" %]
     Cannot seem to handle <code>[% field FILTER html %]</code>
     and <code>[% type FILTER html %]</code> together.
 
-  [% ELSIF error == "field_not_custom" %]
-    '[% field.description FILTER html %]' ([% field.name FILTER html %])
-    is not a custom field.
+  [% ELSIF error == "field_type_not_specified" %]
+    [% title = "Field Type Not Specified" %]
+    You must specify a type when creating a custom field.
 
   [% ELSIF error == "illegal_content_type_method" %]
     Your form submission got corrupted somehow.  The <em>content