summaryrefslogtreecommitdiffstats
path: root/importxml.pl
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-04-04 06:54:51 +0200
committerlpsolit%gmail.com <>2007-04-04 06:54:51 +0200
commit52c8d09da827fbbbc4e7c34eb6c92d1408c64fb0 (patch)
treecbfe31bda5a6ed30567f5ee53d8280754d71c661 /importxml.pl
parent8c0a599aa93b352fe86edbbb21249a3bbb580982 (diff)
downloadbugzilla-52c8d09da827fbbbc4e7c34eb6c92d1408c64fb0.tar.gz
bugzilla-52c8d09da827fbbbc4e7c34eb6c92d1408c64fb0.tar.xz
Bug 368311: Custom field data is not imported into the database from the XML file - Patch by Erik <shaggy+bugzilla@eta.org> r/a=LpSolit
Diffstat (limited to 'importxml.pl')
-rwxr-xr-ximportxml.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/importxml.pl b/importxml.pl
index f0fd0d8ec..6e6f4a619 100755
--- a/importxml.pl
+++ b/importxml.pl
@@ -22,6 +22,7 @@
# Gregary Hendricks <ghendricks@novell.com>
# Vance Baarda <vrb@novell.com>
# Guzman Braso <gbn@hqso.net>
+# Erik Purins <epurins@day1studios.com>
# This script reads in xml bug data from standard input and inserts
# a new bug into bugzilla. Everything before the beginning <?xml line
@@ -1007,6 +1008,27 @@ sub process_bug {
push( @query, "bug_status" );
push( @values, $status );
+ # Custom fields
+ foreach my $custom_field (Bugzilla->custom_field_names) {
+ next unless defined($bug_fields{$custom_field});
+ my $field = new Bugzilla::Field({name => $custom_field});
+ if ($field->type == FIELD_TYPE_FREETEXT) {
+ push(@query, $custom_field);
+ push(@values, clean_text($bug_fields{$custom_field}));
+ } elsif ($field->type == FIELD_TYPE_SINGLE_SELECT) {
+ my $is_well_formed = check_field($custom_field, scalar $bug_fields{$custom_field},
+ undef, ERR_LEVEL);
+ if ($is_well_formed) {
+ push(@query, $custom_field);
+ push(@values, $bug_fields{$custom_field});
+ } else {
+ $err .= "Skipping illegal value \"$bug_fields{$custom_field}\" in $custom_field.\n" ;
+ }
+ } else {
+ $err .= "Type of custom field $custom_field is an unhandled FIELD_TYPE: " .
+ $field->type . "\n";
+ }
+ }
# For the sake of sanitycheck.cgi we do this.
# Update lastdiffed if you do not want to have mail sent