From 3cea91884b28b52df4e38f2ba88c00b65071a81f Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 25 Oct 2008 04:11:30 +0000 Subject: Bug 291433: Ability to have custom fields whose visibility depends on the values of other fields Patch By Max Kanat-Alexander r=bbaetz, a=mkanat --- Bugzilla/Object.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Bugzilla/Object.pm') diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index 1e624e5f7..53720327b 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -117,12 +117,10 @@ sub check { if (!ref $param) { $param = { name => $param }; } - # Don't allow empty names. - if (exists $param->{name}) { - $param->{name} = trim($param->{name}); - $param->{name} || ThrowUserError('object_name_not_specified', - { class => $class }); - } + # Don't allow empty names or ids. + my $check_param = exists $param->{id} ? $param->{id} : $param->{name}; + $check_param = trim($check_param); + $check_param || ThrowUserError('object_not_specified', { class => $class }); my $obj = $class->new($param) || ThrowUserError('object_does_not_exist', {%$param, class => $class}); return $obj; -- cgit v1.2.3-24-g4f1b