diff options
author | 2010-06-23 17:39:11 -0700 | |
---|---|---|
committer | 2010-06-23 17:39:11 -0700 | |
commit | 8f33041e6542f12e6897ef6ed7a67c43a118c504 (patch) | |
tree | c5caf60f706dfa1043a69e135b5246bd63455aae /Bugzilla/Component.pm | |
parent | Bug 509303: Update the CGI.pm requirement to 3.49 to make redirection (diff) | |
download | bugzilla-8f33041e6542f12e6897ef6ed7a67c43a118c504.tar.gz bugzilla-8f33041e6542f12e6897ef6ed7a67c43a118c504.tar.bz2 bugzilla-8f33041e6542f12e6897ef6ed7a67c43a118c504.zip |
Bug 572602: Change the way that Bugzilla::Object determines what fields
are required for create(). It now assumes that any column that is NOT NULL
and has not DEFAULT in the database is required. We also shift the burden
of throwing errors about empty values to the validators. This fixes the bug
that Bugzilla::Bug->create() wasn't populating default values for fields
if they weren't specified in the create() parameters.
r=timello, a=mkanat
Diffstat (limited to 'Bugzilla/Component.pm')
-rw-r--r-- | Bugzilla/Component.pm | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index a1f5144e5..e5eb78a2d 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -47,13 +47,6 @@ use constant DB_COLUMNS => qw( description ); -use constant REQUIRED_CREATE_FIELDS => qw( - name - product - initialowner - description -); - use constant UPDATE_COLUMNS => qw( name initialowner @@ -61,6 +54,10 @@ use constant UPDATE_COLUMNS => qw( description ); +use constant REQUIRED_FIELD_MAP => { + product_id => 'product', +}; + use constant VALIDATORS => { create_series => \&Bugzilla::Object::check_boolean, product => \&_check_product, @@ -234,6 +231,8 @@ sub _check_initialqacontact { sub _check_product { my ($invocant, $product) = @_; + $product || ThrowCodeError('param_required', + { function => "$invocant->create", param => 'product' }); return Bugzilla->user->check_can_admin_product($product->name); } |