summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-06-14 02:44:00 +0000
committerlpsolit%gmail.com <>2008-06-14 02:44:00 +0000
commit7634b5f6cd563471fdeb9c9cb7ae101289a1b0de (patch)
treee9a2f10107b5d21a28abda8ce392a71090158cdf /importxml.pl
parentBug 438739: Permissions are not set properly on extensions by checksetup (diff)
downloadbugzilla-7634b5f6cd563471fdeb9c9cb7ae101289a1b0de.tar.gz
bugzilla-7634b5f6cd563471fdeb9c9cb7ae101289a1b0de.tar.bz2
bugzilla-7634b5f6cd563471fdeb9c9cb7ae101289a1b0de.zip
Bug 439075: Importing bugs which have a multi-select field with a single value fails - Patch by Frédéric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
Diffstat (limited to 'importxml.pl')
-rwxr-xr-ximportxml.pl16
1 files changed, 12 insertions, 4 deletions
diff --git a/importxml.pl b/importxml.pl
index 63146c151..eaec9d99b 100755
--- a/importxml.pl
+++ b/importxml.pl
@@ -281,6 +281,14 @@ sub flag_handler {
return $err;
}
+# Converts and returns the input data as an array.
+sub _to_array {
+ my $value = shift;
+
+ $value = [$value] if !ref($value);
+ return @$value;
+}
+
###############################################################################
# XML Handlers #
###############################################################################
@@ -565,11 +573,11 @@ sub process_bug {
$comments .= $urlbase . "show_bug.cgi?id=" . $bug_fields{'bug_id'} . "\n";
if ( defined $bug_fields{'dependson'} ) {
$comments .= "This bug depended on bug(s) " .
- join(' ', @{$bug_fields{'dependson'}}) . ".\n";
+ join(' ', _to_array($bug_fields{'dependson'})) . ".\n";
}
if ( defined $bug_fields{'blocked'} ) {
$comments .= "This bug blocked bug(s) " .
- join(' ', @{$bug_fields{'blocked'}}) . ".\n";
+ join(' ', _to_array($bug_fields{'blocked'})) . ".\n";
}
# Now we process each of the fields in turn and make sure they contain
@@ -1057,7 +1065,7 @@ sub process_bug {
}
} elsif ($field->type == FIELD_TYPE_MULTI_SELECT) {
my @legal_values;
- foreach my $item (@$value) {
+ foreach my $item (_to_array($value)) {
my $is_well_formed = check_field($custom_field, $item, undef, ERR_LEVEL);
if ($is_well_formed) {
push(@legal_values, $item);
@@ -1116,7 +1124,7 @@ sub process_bug {
if ( defined $bug_fields{'cc'} ) {
my %ccseen;
my $sth_cc = $dbh->prepare("INSERT INTO cc (bug_id, who) VALUES (?,?)");
- foreach my $person (@{$bug_fields{'cc'}}) {
+ foreach my $person (_to_array($bug_fields{'cc'})) {
next unless $person;
my $uid;
if ($uid = login_to_id($person)) {