BZ::Client::Product - Client side representation of a product in Bugzilla
version 4.4004
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 );
This section lists the class methods, which are available in this module.
$id = BZ::Client::Product->create( $client, \%params );
This allows you to create a new Product in Bugzilla.
Marked as experimental as of Bugzilla 5.0.
Some params must be set, or an error will be thrown. These params are noted as Required.
name (string) The name of this product. Must be globally unique within Bugzilla.
Required.
description (string) A description for this product. Allows some simple HTML.
version (string) The default version for this product.
has_unconfirmed (boolean) Allow the UNCONFIRMED status to be set on bugs in this product. Default: true.
classification (string) The name of the Classification which contains this product.
default_milestone (string) The default milestone for this product. Default '---'.
is_open (boolean) True if the product is currently allowing bugs to be entered into it. Default: true.
create_series (boolean) True if you want series for New Charts to be created for this new product. Default: true.
The ID of the newly-filed product.
You must specify an existing classification name.
You must specify a non-blank name for this product.
The name specified for this product was longer than the maximum allowed length.
You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.)
You must specify a description for this product.
You must specify a version for this product.
$id = BZ::Client::Product->update( $client, \%params );
This allows you to update a Group in Bugzilla.
As of Bugzilla 5.0. this is marked as experimental.
Added in Bugzilla 4.4.
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 (array) Numeric ID's of the products you wish to update.
names (array) Text names of the products that you wish to update.
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 (string) Update the long description for these products to this value.
has_unconfirmed (boolean) Allow the UNCONFIRMED status to be set on bugs in this products.
is_open (boolean) True if the product is currently allowing bugs to be entered into it. Otherwise false.
An array or arrayref of hashes containing the following:
id (int) The ID of the product that was updated.
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 (string) The value that this field was changed to.
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 ],
You must define a default milestone.
@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.
(none)
An array of product ID's
@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.
Returns a list of the ID's of the products the user can search or enter bugs against.
Marked as unstable as of Bugzilla 5.0.
@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.
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 (array) An array of product ID's.
names (array) An array of product names.
Added in Bugzilla 4.2.
The group of products to return. Valid values are: accessible (default), selectable, and enterable. "type" can be a single value or an array of values if more than one group is needed with duplicates removed.
accessible
selectable
enterable
An array or arrayref of bug instance objects with the given ID's.
See "INSTANCE METHODS" for how to use them.
Compatibilty with Bugzilla 3.0 API. Exactly equivalent to "get".
my $product = BZ::Client::Product->new( id => $id, name => $name, description => $description );
Creates a new instance with the given ID, name, and description.
This section lists the modules instance methods.
$id = $product->id();
Gets the products ID.
Read only.
$name = $product->name(); $product->name( $name );
Gets or sets the products name.
$description = $product->description(); $product->description( $description );
Gets or sets the products description.
$version = $product->version(); $product->version( $version );
Gets or sets the products version.
(Set only works for new products, not updates)
$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 = $product->classification(); $product->classification( $classification );
Gets or sets the products classification.
$milestone = $product->default_milestone(); $product->default_milestone( $milestone );
Gets or sets the products default milestone.
$bool = $product->is_open(); $product->is_open( $bool );
Gets or sets the products is_open setting.
$series = $product->create_series(); $product->create_series( $series );
@components = $product->components(); $components = $product->components();
An array of hashes, where each hash describes a component, and has the following items:
id (int) An integer ID uniquely identifying the component in this installation only.
name (string) The name of the component. This is a unique identifier for this component.
description (string) A description of the component, which may contain HTML.
default_assigned_to (string) The login name of the user to whom new bugs will be assigned by default.
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 (int) Components, when displayed in a list, are sorted first by this integer and then secondly by their name.
is_active (boolean) A boolean indicating if the component is active. Inactive components are not enabled for new bugs.
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 (int) Returns the ID of the flagtype.
name (string) Returns the name of the flagtype.
description (string) Returns the description of the flagtype.
cc_list (string) Returns the concatenated CC list for the flagtype, as a single string.
sort_key (int) Returns the sortkey of the flagtype.
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 (boolean) Returns whether you can request for the given flagtype (i.e. whether the '?' flag is available or not).
is_requesteeble (boolean) Returns whether you can ask someone specifically or not.
is_multiplicable (boolean) Returns whether you can have more than one flag for the given flagtype in a given bug/attachment.
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 (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.
$versions = $product->versions();
Returns an array of hashes, where each hash describes a version, and has the following items: name, sort_key and is_active.
name
sort_key
is_active
$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.
Returned by "get" until version 4.2, at which point it was dropped. Remains for compatibility. Please move away from using it asap.
See BZ::Client::Exception
BZ::Client, BZ::Client::API, Bugzilla API
Dean Hamstead <dean@bytefoundry.com.au>
Jochen Wiedmann <jochen.wiedmann@gmail.com>
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.
To install BZ::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BZ::Client
CPAN shell
perl -MCPAN -e shell install BZ::Client
For more information on module installation, please visit the detailed CPAN module installation guide.