diff options
author | mkanat%bugzilla.org <> | 2007-09-08 05:14:25 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2007-09-08 05:14:25 +0000 |
commit | aa888f2218179d59b4f0b8e51e43b863f1da3e43 (patch) | |
tree | 4e6bf6ff4b7066b19c5b1728dd325adf4bed1f78 /Bugzilla/Field.pm | |
parent | 16336299f17522d040736cb0f063694381d9d761 (diff) | |
download | bugs-aa888f2218179d59b4f0b8e51e43b863f1da3e43.tar bugs-aa888f2218179d59b4f0b8e51e43b863f1da3e43.tar.gz bugs-aa888f2218179d59b4f0b8e51e43b863f1da3e43.tar.bz2 bugs-aa888f2218179d59b4f0b8e51e43b863f1da3e43.tar.xz bugs-aa888f2218179d59b4f0b8e51e43b863f1da3e43.zip |
Bug 287330: Multi-Select Custom Fields
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Field.pm')
-rw-r--r-- | Bugzilla/Field.pm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm index 1830784a9..6555bba96 100644 --- a/Bugzilla/Field.pm +++ b/Bugzilla/Field.pm @@ -252,9 +252,9 @@ sub _check_sortkey { sub _check_type { my ($invocant, $type) = @_; my $saved_type = $type; - # FIELD_TYPE_SINGLE_SELECT here should be updated every time a new, + # The constant here should be updated every time a new, # higher field type is added. - (detaint_natural($type) && $type <= FIELD_TYPE_SINGLE_SELECT) + (detaint_natural($type) && $type <= FIELD_TYPE_MULTI_SELECT) || ThrowCodeError('invalid_customfield_type', { type => $saved_type }); return $type; } @@ -454,13 +454,20 @@ sub create { if ($field->custom) { my $name = $field->name; my $type = $field->type; - # Create the database column that stores the data for this field. - $dbh->bz_add_column('bugs', $name, SQL_DEFINITIONS->{$type}); + if (SQL_DEFINITIONS->{$type}) { + # Create the database column that stores the data for this field. + $dbh->bz_add_column('bugs', $name, SQL_DEFINITIONS->{$type}); + } - if ($type == FIELD_TYPE_SINGLE_SELECT) { + if ($type == FIELD_TYPE_SINGLE_SELECT + || $type == FIELD_TYPE_MULTI_SELECT) + { # Create the table that holds the legal values for this field. - $dbh->bz_add_field_table($name); - # And insert a default value of "---" into it. + $dbh->bz_add_field_tables($field); + } + + if ($type == FIELD_TYPE_SINGLE_SELECT) { + # Insert a default value of "---" into the legal values table. $dbh->do("INSERT INTO $name (value) VALUES ('---')"); } } |