NAME
BZ::Client::Product - Client side representation of a product in Bugzilla
VERSION
version 4.4004
SYNOPSIS
This class provides methods for accessing and managing products in Bugzilla. Instances of this class are returned by BZ::Client::Product::get.
my $client = BZ::Client->new( url => $url,
user => $user,
password => $password );
my $ids = BZ::Client::Product->get_accessible_products( $client );
my $products = BZ::Client::Product->get( $client, \%params );
CLASS METHODS
This section lists the class methods, which are available in this module.
create
$id = BZ::Client::Product->create( $client, \%params );
This allows you to create a new Product in Bugzilla.
History
Marked as experimental as of Bugzilla 5.0.
Parameters
Some params must be set, or an error will be thrown. These params are noted as Required.
- name
-
name (string) The name of this product. Must be globally unique within Bugzilla.
Required.
- description
-
description (string) A description for this product. Allows some simple HTML.
Required.
- version
-
version (string) The default version for this product.
Required.
- has_unconfirmed
-
has_unconfirmed (boolean) Allow the UNCONFIRMED status to be set on bugs in this product. Default: true.
- classification
-
classification (string) The name of the Classification which contains this product.
- default_milestone
-
default_milestone (string) The default milestone for this product. Default '---'.
- is_open
-
is_open (boolean) True if the product is currently allowing bugs to be entered into it. Default: true.
- create_series
-
create_series (boolean) True if you want series for New Charts to be created for this new product. Default: true.
Returns
The ID of the newly-filed product.
Errors
- 51 - Classification does not exist
-
You must specify an existing classification name.
- 700 - Product blank name
-
You must specify a non-blank name for this product.
- 701 - Product name too long
-
The name specified for this product was longer than the maximum allowed length.
- 702 - Product name already exists
-
You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.)
- 703 - Product must have description
-
You must specify a description for this product.
- 704 - Product must have version
-
You must specify a version for this product.
update
$id = BZ::Client::Product->update( $client, \%params );
This allows you to update a Group in Bugzilla.
History
As of Bugzilla 5.0. this is marked as experimental.
Added in Bugzilla 4.4.
Parameters
Either "ids" or "names" is required to select the bugs you want to update.
All other values change or set something in the product.
- ids
-
ids (array) Numeric ID's of the products you wish to update.
- names
-
names (array) Text names of the products that you wish to update.
- default_milestone
-
default_milestone (string) When a new bug is filed, what milestone does it get by default if the user does not choose one? Must represent a milestone that is valid for this product.
- description
-
description (string) Update the long description for these products to this value.
- has_unconfirmed
-
has_unconfirmed (boolean) Allow the UNCONFIRMED status to be set on bugs in this products.
- is_open
-
is_open (boolean) True if the product is currently allowing bugs to be entered into it. Otherwise false.
Returns
An array or arrayref of hashes containing the following:
- id
-
id (int) The ID of the product that was updated.
- changes
-
The changes that were actually done on this product. The keys are the names of the fields that were changed, and the values are a hash with two keys:
- added
-
added (string) The value that this field was changed to.
- removed
-
removed (string) The value that was previously set in this field.
Note that booleans will be represented with the strings '1' and '0'.
Here's an example of what a return value might look like:
[ { id => 123, changes => { name => { removed => 'FooName', added => 'BarName' }, has_unconfirmed => { removed => '1', added => '0', } } }, \%etc ],
Errors
- 700 - Product blank name
-
You must specify a non-blank name for this product.
- 701 - Product name too long
-
The name specified for this product was longer than the maximum allowed length.
- 702 - Product name already exists
-
You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.)
- 703 - Product must have description
-
You must specify a description for this product.
- 705 - Product must define a default milestone
-
You must define a default milestone.
get_selectable_products
@products = BZ::Client::Product->get_selectable_products( $client );
$products = BZ::Client::Product->get_selectable_products( $client );
Returns a list of the ID's of the products the user can search on.
History
Marked as experimental as of Bugzilla 5.0.
Parameters
(none)
Returns
An array of product ID's
Errors
(none)
get_enterable_products
@products = BZ::Client::Product->get_enterable_products( $client );
$products = BZ::Client::Product->get_enterable_products( $client );
Returns a list of the ID's of the products the user can enter bugs against.
History
Marked as experimental as of Bugzilla 5.0.
Parameters
(none)
Returns
An array of product ID's
Errors
(none)
get_accessible_products
@products = BZ::Client::Product->get_selectable_products( $client );
$products = BZ::Client::Product->get_selectable_products( $client );
Returns a list of the ID's of the products the user can search or enter bugs against.
History
Marked as unstable as of Bugzilla 5.0.
Parameters
(none)
Returns
An array of product ID's
Errors
(none)
get
@products = BZ::Client::Product->get( $client, \%params );
$products = BZ::Client::Product->get( $client, \%params );
Returns a list of BZ::Client::Product instances based on the given parameters.
Note, that if the user tries to access a product that is not in the list of accessible products for the user, or a product that does not exist, that is silently ignored, and no information about that product is returned.
Parameters
In addition to the parameters below, this method also accepts the standard "include_fields" in BZ::Client::Bug and "exclude_fields" in BZ::Client::Bug arguments.
Note: You must at least specify one of "ids" or "names".
- ids
-
ids (array) An array of product ID's.
- names
-
names (array) An array of product names.
Added in Bugzilla 4.2.
- type
-
The group of products to return. Valid values are:
accessible
(default),selectable
, andenterable
. "type" can be a single value or an array of values if more than one group is needed with duplicates removed.
Returns
An array or arrayref of bug instance objects with the given ID's.
See "INSTANCE METHODS" for how to use them.
Errors
(none)
get_products
Compatibilty with Bugzilla 3.0 API. Exactly equivalent to "get".
new
my $product = BZ::Client::Product->new( id => $id,
name => $name,
description => $description );
Creates a new instance with the given ID, name, and description.
INSTANCE METHODS
This section lists the modules instance methods.
id
$id = $product->id();
Gets the products ID.
Read only.
name
$name = $product->name();
$product->name( $name );
Gets or sets the products name.
description
$description = $product->description();
$product->description( $description );
Gets or sets the products description.
version
$version = $product->version();
$product->version( $version );
Gets or sets the products version.
(Set only works for new products, not updates)
has_unconfirmed
$bool = $product->has_unconfirmed();
$product->has_unconfirmed( $bool );
Gets or sets the products has_unconfirmed setting.
Added in Bugzilla 4.2 as a replacement for "internals".
classification
$classification = $product->classification();
$product->classification( $classification );
Gets or sets the products classification.
Added in Bugzilla 4.2 as a replacement for "internals".
default_milestone
$milestone = $product->default_milestone();
$product->default_milestone( $milestone );
Gets or sets the products default milestone.
Added in Bugzilla 4.2 as a replacement for "internals".
is_open
$bool = $product->is_open();
$product->is_open( $bool );
Gets or sets the products is_open setting.
create_series
$series = $product->create_series();
$product->create_series( $series );
Gets or sets the products is_open setting.
components
@components = $product->components();
$components = $product->components();
An array of hashes, where each hash describes a component, and has the following items:
- id
-
id (int) An integer ID uniquely identifying the component in this installation only.
- name
-
name (string) The name of the component. This is a unique identifier for this component.
- description
-
description (string) A description of the component, which may contain HTML.
- default_assigned_to
-
default_assigned_to (string) The login name of the user to whom new bugs will be assigned by default.
- default_qa_contact
-
default_qa_contact (string) The login name of the user who will be set as the QA Contact for new bugs by default. Empty string if the QA contact is not defined.
- sort_key
-
sort_key (int) Components, when displayed in a list, are sorted first by this integer and then secondly by their name.
- is_active
-
is_active (boolean) A boolean indicating if the component is active. Inactive components are not enabled for new bugs.
- flag_types
-
Added in Bugzilla 4.4.
A hash containing the two items bug and attachment that each contains an array of hashes, where each hash describes a flagtype, and has the following items:
- id
-
id (int) Returns the ID of the flagtype.
- name
-
name (string) Returns the name of the flagtype.
- description
-
description (string) Returns the description of the flagtype.
- cc_list
-
cc_list (string) Returns the concatenated CC list for the flagtype, as a single string.
- sort_key
-
sort_key (int) Returns the sortkey of the flagtype.
- is_active
-
is_active (boolean) Returns whether the flagtype is active or disabled. Flags being in a disabled flagtype are not deleted. It only prevents you from adding new flags to it.
- is_requestable
-
is_requestable (boolean) Returns whether you can request for the given flagtype (i.e. whether the '?' flag is available or not).
- is_requesteeble
-
is_requesteeble (boolean) Returns whether you can ask someone specifically or not.
- is_multiplicable
-
is_multiplicable (boolean) Returns whether you can have more than one flag for the given flagtype in a given bug/attachment.
- grant_group
-
grant_group (int) the group ID that is allowed to grant/deny flags of this type. If the item is not included all users are allowed to grant/deny this flagtype.
- request_group
-
request_group (int) the group ID that is allowed to request the flag if the flag is of the type requestable. If the item is not included all users are allowed request this flagtype.
Added in Bugzilla 4.2 as a replacement for "internals".
versions
$versions = $product->versions();
Added in Bugzilla 4.2 as a replacement for "internals".
Returns an array of hashes, where each hash describes a version, and has the following items: name
, sort_key
and is_active
.
milestones
$milestones = $product->milestones();
Returns an array of hashes, where each hash describes a milestones, and has the following items: name
, sort_key
and is_active
.
Added in Bugzilla 4.2 as a replacement for "internals".
internals
Returned by "get" until version 4.2, at which point it was dropped. Remains for compatibility. Please move away from using it asap.
EXCEPTION HANDLING
SEE ALSO
BZ::Client, BZ::Client::API, Bugzilla API
AUTHORS
Dean Hamstead <dean@bytefoundry.com.au>
Jochen Wiedmann <jochen.wiedmann@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by Dean Hamstad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.