<<

Bugzilla::Product

NAME

Bugzilla::Product - Bugzilla product class.

SYNOPSIS

    use Bugzilla::Product;

    my $product = new Bugzilla::Product(1);
    my $product = new Bugzilla::Product({ name => 'AcmeProduct' });

    my @components      = $product->components();
    my $groups_controls = $product->group_controls();
    my @milestones      = $product->milestones();
    my @versions        = $product->versions();
    my $bugcount        = $product->bug_count();
    my $bug_ids         = $product->bug_ids();
    my $has_access      = $product->user_has_access($user);
    my $flag_types      = $product->flag_types();
    my $classification  = $product->classification();

    my $id               = $product->id;
    my $name             = $product->name;
    my $description      = $product->description;
    my isactive          = $product->is_active;
    my $defaultmilestone = $product->default_milestone;
    my $classificationid = $product->classification_id;
    my $allows_unconfirmed = $product->allows_unconfirmed;

DESCRIPTION

Product.pm represents a product object. It is an implementation of Bugzilla::Object, and thus provides all methods that Bugzilla::Object provides.

The methods that are specific to Bugzilla::Product are listed below.

METHODS

components
 Description: Returns an array of component objects belonging to
              the product.

 Params:      none.

 Returns:     An array of Bugzilla::Component object.
group_controls()
 Description: Returns a hash (group id as key) with all product
              group controls.

 Params:      $full_data (optional, false by default) - when true,
              the number of bugs per group applicable to the product
              is also returned. Moreover, bug groups which have no
              special settings for the product are also returned.

 Returns:     A hash with group id as key and hash containing 
              a Bugzilla::Group object and the properties of group
              relative to the product.
groups_available

Tells you what groups are set to Default or Shown for the currently-logged-in user (taking into account both OtherControl and MemberControl). Returns an arrayref of Bugzilla::Group objects with an extra hash keys set, is_default, which is true if the group is set to Default for the currently-logged-in user.

groups_mandatory

Tells you what groups are mandatory for bugs in this product, for the currently-logged-in user. Returns an arrayref of Bugzilla::Group objects.

group_is_settable
Description

Tells you whether or not the currently-logged-in user can set a group on a bug (whether or not they match the MemberControl/OtherControl settings for a group in this product). Groups that are Mandatory for the currently-loggeed-in user are also acceptable since from Bugzilla's perspective, there's no problem with "setting" a Mandatory group on a bug. (In fact, the user must set the Mandatory group on the bug.)

Params
$group - A Bugzilla::Group object.
Returns

1 if the group is valid in this product, 0 otherwise.

groups_valid
Description

Returns an arrayref of Bugzilla::Group objects, representing groups that bugs could validly be restricted to within this product. Used mostly when you need the list of all possible groups that could be set in a product by anybody, disregarding whether or not the groups are active or who the currently logged-in user is.

Note: This doesn't check whether or not the current user can add/remove bugs to/from these groups. It just tells you that bugs could be in these groups, in this product.

Params (none)
Returns An arrayref of Bugzilla::Group objects.
group_is_valid

Returns 1 if the passed-in Bugzilla::Group or group id could be set on a bug by anybody, in this product. Even inactive groups are considered valid. (This is a shortcut for searching "groups_valid" to find out if a group is valid in a particular product.)

versions
 Description: Returns all valid versions for that product.

 Params:      none.

 Returns:     An array of Bugzilla::Version objects.
milestones
 Description: Returns all valid milestones for that product.

 Params:      none.

 Returns:     An array of Bugzilla::Milestone objects.
bug_count()
 Description: Returns the total of bugs that belong to the product.

 Params:      none.

 Returns:     Integer with the number of bugs.
bug_ids()
 Description: Returns the IDs of bugs that belong to the product.

 Params:      none.

 Returns:     An array of integer.
user_has_access()
 Description: Tells you whether or not the user is allowed to enter
              bugs into this product, based on the C<entry> group
              control. To see whether or not a user can actually
              enter a bug into a product, use C<$user-&gt;can_enter_product>.

 Params:      C<$user> - A Bugzilla::User object.

 Returns      C<1> If this user's groups allow them C<entry> access to
              this Product, C<0> otherwise.
flag_types()
 Description: Returns flag types available for at least one of
              its components.

 Params:      none.

 Returns:     Two references to an array of flagtype objects.
classification()
 Description: Returns the classification the product belongs to.

 Params:      none.

 Returns:     A Bugzilla::Classification object.

SUBROUTINES

preload

When passed an arrayref of Bugzilla::Product objects, preloads their "milestones", "components", and "versions", which is much faster than calling those accessors on every item in the array individually.

If the 2nd argument passed to preload is true, flag types for these products and their components are also preloaded.

This function is not exported, so must be called like Bugzilla::Product::preload($products).

SEE ALSO

Bugzilla::Object

Methods in need of POD

set_allows_unconfirmed
allows_unconfirmed
set_name
set_default_milestone
set_group_controls
create
set_description
set_is_active
classification_id
description
default_milestone
remove_from_db
is_active
update

<<