Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
13c42365
Commit
13c42365
authored
Apr 07, 2011
by
Julien Heyman
Committed by
Frédéric Buclin
Apr 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 469193: WebService function to create new products (Product.create)
r/a=mkanat
parent
c949aab1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
0 deletions
+124
-0
Constants.pm
Bugzilla/WebService/Constants.pm
+9
-0
Product.pm
Bugzilla/WebService/Product.pm
+115
-0
No files found.
Bugzilla/WebService/Constants.pm
View file @
13c42365
...
...
@@ -150,6 +150,15 @@ use constant WS_ERROR_CODE => {
# Error 605 attachment_url_disabled no longer exists.
zero_length_file
=>
606
,
# Product erros are 700-800
product_blank_name
=>
700
,
product_name_too_long
=>
701
,
product_name_already_in_use
=>
702
,
product_name_diff_in_case
=>
702
,
product_must_have_description
=>
703
,
product_must_have_version
=>
704
,
product_must_define_defaultmilestone
=>
705
,
# Errors thrown by the WebService itself. The ones that are negative
# conform to http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
xmlrpc_invalid_value
=>
-
32600
,
...
...
Bugzilla/WebService/Product.pm
View file @
13c42365
...
...
@@ -21,6 +21,9 @@ use strict;
use
base
qw(Bugzilla::WebService)
;
use
Bugzilla::
Product
;
use
Bugzilla::
User
;
use
Bugzilla::
Error
;
use
Bugzilla::
Constants
;
use
Bugzilla::WebService::
Constants
;
use
Bugzilla::WebService::
Util
qw(validate)
;
use
constant
READ_ONLY
=>
qw(
...
...
@@ -79,6 +82,28 @@ sub get {
return
{
products
=>
\
@products
};
}
sub
create
{
my
(
$self
,
$params
)
=
@_
;
Bugzilla
->
login
(
LOGIN_REQUIRED
);
Bugzilla
->
user
->
in_group
(
'editcomponents'
)
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
action
=>
"add"
,
object
=>
"products"
});
# Create product
my
$product
=
Bugzilla::
Product
->
create
({
allows_unconfirmed
=>
$params
->
{
has_unconfirmed
},
classification
=>
$params
->
{
classification
},
name
=>
$params
->
{
name
},
description
=>
$params
->
{
description
},
version
=>
$params
->
{
version
},
defaultmilestone
=>
$params
->
{
default_milestone
},
isactive
=>
$params
->
{
is_open
},
create_series
=>
$params
->
{
create_series
}
});
return
{
id
=>
$self
->
type
(
'int'
,
$product
->
id
)
};
}
1
;
__END__
...
...
@@ -198,3 +223,93 @@ is returned.
=item B<Errors> (none)
=back
=head1 Product Creation
=head2 create
B<EXPERIMENTAL>
=over
=item B<Description>
This allows you to create a new product in Bugzilla.
=item B<Params>
Some params must be set, or an error will be thrown. These params are marked Required.
=over
=item C<name>
B<Required> C<string> The name of this product. Must be unique.
=item C<description>
B<Required> C<string> A description for this product. Allows some simple HTML.
=item C<version>
B<Required> C<string> The default version for this product.
=item C<has_unconfirmed>
C<boolean> Allows unconfirmed bugs in the product.
=item C<classification>
C<boolean> Classification wich contains the product.
=item C<default_milestone>
C<boolean> The default milestone of this product.
=item C<is_open>
C<boolean> True if the product is currently allowing bugs to be entered into it.
=item C<create_series>
C<boolean> Set if series are creating for the new product.
=back
=item B<Returns>
A hash with one element, id. This is the id of the newly-filed product.
=item B<Errors>
=over
=item 700 (Product blank name)
You must specify a non blank name for this product.
=item 701 (Product name too long)
The name specified for this product was longer than the maximum allowed length.
=item 702 (Product name already exists)
You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.)
=item 703 (Product must have description)
You must specify a description for this product.
=item 704 (Product must have version)
You must specify a version for this product.
=item 705 (Product must define a defaut milestone)
You must define a default milestone.
=back
=back
=cut
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment