Closed Bug 415544 Opened 16 years ago Closed 16 years ago

Mass-change erases all values from custom multi-select fields

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

3.1.3
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

(Keywords: dataloss, regression)

Attachments

(1 file)

I don't know what regressed it, but doing a mass-change deletes all values already set to multi-select fields, even with --do_not_change--.
Flags: blocking3.2+
Attached patch patch, v1Splinter Review
$cgi->param('defined_foo') must be deleted if $cgi->param('foo') eq '--do_not_change--' else process_bug.cgi sees that as a wish to clear the 'foo' field.
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #301373 - Flags: review?(mkanat)
Comment on attachment 301373 [details] [diff] [review]
patch, v1

>+        # Ignore defined_$name if param($name) eq dontchange.
>+        next if !defined $cgi->param($name);

  Wait, that doesn't seem to do what the comment above states...?
(In reply to comment #2)
>   Wait, that doesn't seem to do what the comment above states...?

It does. When cf_<multi_select_name> eq 'dontchange', we delete defined_cf_<multi_select_name> else we are going to erase everything. So when we encounter defined_cf_<multi_select_name> in the foreach loop (foreach my $name ($cgi->param)), we have to skip it as it has already been deleted, and so $cgi->param('defined_cf_<multi_select_name>') is undefined. Else we get an error about an uninitialized value when doing the 'eq' comparison.
Comment on attachment 301373 [details] [diff] [review]
patch, v1

Ah, I get it now.

On checkin, change the comment to:

# Skip ones we've already deleted (such as "defined_$name").
Attachment #301373 - Flags: review?(mkanat) → review+
Flags: approval+
I fixed the comment on checkin:

Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.404; previous revision: 1.403
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: