]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 381737: Unable to get legal values of custom fields via XML-RPC - Patch by FrÃ...
authorlpsolit%gmail.com <>
Sat, 26 May 2007 06:03:33 +0000 (06:03 +0000)
committerlpsolit%gmail.com <>
Sat, 26 May 2007 06:03:33 +0000 (06:03 +0000)
Bugzilla/WebService/Bug.pm
contrib/bz_webservice_demo.pl

index a632ffaf0901ce9dbdb89477ff0a4f78f0f04832..a2710c48240e759a628d0e310962563e3912656a 100755 (executable)
@@ -130,6 +130,8 @@ sub legal_values {
 
     my @custom_select =
         Bugzilla->get_fields({ type => FIELD_TYPE_SINGLE_SELECT });
+    # We only want field names.
+    @custom_select = map {$_->name} @custom_select;
 
     my $values;
     if (grep($_ eq $field, GLOBAL_SELECT_FIELDS, @custom_select)) {
index aa92d1dd992e32d7b27ddcd2e0b71c52982d6620..d21405d4ad795cc5cdc2cc3717401762d4d353ce 100755 (executable)
@@ -49,6 +49,7 @@ my $Bugzilla_remember;
 my $bug_id;
 my $product_name;
 my $create_file_name;
+my $legal_field_values;
 
 GetOptions('help|h|?'       => \$help,
            'uri=s'          => \$Bugzilla_uri,
@@ -57,7 +58,8 @@ GetOptions('help|h|?'       => \$help,
            'rememberlogin!' => \$Bugzilla_remember,
            'bug_id:s'       => \$bug_id,
            'product_name:s' => \$product_name,
-           'create:s'       => \$create_file_name
+           'create:s'       => \$create_file_name,
+           'field:s'        => \$legal_field_values
           ) or pod2usage({'-verbose' => 0, '-exitval' => 1});
 
 =head1 OPTIONS
@@ -269,6 +271,21 @@ if ($create_file_name) {
 
 }
 
+=head2 Getting Legal Field Values
+
+Call C<Bug.legal_values> with the name of the field (including custom
+select fields). The call will return a reference to an array with the
+list of legal values for this field.
+
+=cut
+
+if ($legal_field_values) {
+    $soapresult = $proxy->call('Bug.legal_values', {field => $legal_field_values} );
+    _die_on_fault($soapresult);
+    $result = $soapresult->result;
+
+    print join("\n", @{$result->{values}}) . "\n";
+}
 
 
 =head1 NOTES