From aa888f2218179d59b4f0b8e51e43b863f1da3e43 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 8 Sep 2007 05:14:25 +0000 Subject: Bug 287330: Multi-Select Custom Fields Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- process_bug.cgi | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index e5e873e86..d4bf213ad 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -571,11 +571,11 @@ foreach my $field ("version", "target_milestone") { # Add custom fields data to the query that will update the database. foreach my $field (Bugzilla->get_fields({custom => 1, obsolete => 0})) { my $fname = $field->name; - if (defined $cgi->param($fname) - && (!$cgi->param('dontchange') - || $cgi->param($fname) ne $cgi->param('dontchange'))) + if ( (defined $cgi->param($fname) || defined $cgi->param("defined_$fname")) + && (!$cgi->param('dontchange') + || $cgi->param($fname) ne $cgi->param('dontchange'))) { - $_->set_custom_field($field, $cgi->param($fname)) foreach @bug_objects; + $_->set_custom_field($field, [$cgi->param($fname)]) foreach @bug_objects; } } @@ -1010,6 +1010,11 @@ foreach my $id (@idlist) { my $bug_changed = 0; my $write = "WRITE"; # Might want to make a param to control # whether we do LOW_PRIORITY ... + + my @multi_select_locks = map {'bug_' . $_->name . " $write"} + Bugzilla->get_fields({ custom => 1, type => FIELD_TYPE_MULTI_SELECT, + obsolete => 0 }); + $dbh->bz_lock_tables("bugs $write", "bugs_activity $write", "cc $write", "profiles READ", "dependencies $write", "votes $write", "products READ", "components READ", "milestones READ", @@ -1020,7 +1025,8 @@ foreach my $id (@idlist) { "keyworddefs READ", "groups READ", "attachments READ", "bug_status READ", "group_control_map AS oldcontrolmap READ", "group_control_map AS newcontrolmap READ", - "group_control_map READ", "email_setting READ", "classifications READ"); + "group_control_map READ", "email_setting READ", + "classifications READ", @multi_select_locks); # It may sound crazy to set %formhash for each bug as $cgi->param() # will not change, but %formhash is modified below and we prefer -- cgit v1.2.3-24-g4f1b