<<

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 $id               = $product->id;
    my $name             = $product->name;
    my $description      = $product->description;
    my isactive          = $product->is_active;
    my votesperuser      = $product->votes_per_user;
    my maxvotesperbug    = $product->max_votes_per_bug;
    my votestoconfirm    = $product->votes_to_confirm;
    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_mandatory_for
Description

Tells you what groups are mandatory for bugs in this product.

Params

$user - The user who you want to check.

Returns An arrayref of Bugzilla::Group objects.
groups_valid
Description

Returns an arrayref of Bugzilla::Group objects, representing groups that bugs could validly be restricted to within this product. Used mostly by Bugzilla::Bug to assure that you're adding valid groups to a bug.

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.
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 him 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.

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.

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

check_product($product_name)
 Description: Checks if the product name was passed in and if is a valid
              product.

 Params:      $product_name - String with a product name.

 Returns:     Bugzilla::Product object.

SEE ALSO

Bugzilla::Object

<<