<<

Bugzilla::Flag

NAME

Bugzilla::Flag - A module to deal with Bugzilla flag values.

SYNOPSIS

Flag.pm provides an interface to flags as stored in Bugzilla. See below for more information.

NOTES

METHODS

id

Returns the ID of the flag.

name

Returns the name of the flagtype the flag belongs to.

bug_id

Returns the ID of the bug this flag belongs to.

attach_id

Returns the ID of the attachment this flag belongs to, if any.

status

Returns the status '+', '-', '?' of the flag.

type

Returns the type of the flag, as a Bugzilla::FlagType object.

setter

Returns the user who set the flag, as a Bugzilla::User object.

requestee

Returns the user who has been requested to set the flag, as a Bugzilla::User object.

attachment

Returns the attachment object the flag belongs to if the flag is an attachment flag, else undefined.

match($criteria)

Queries the database for flags matching the given criteria (specified as a hash of field names and their matching values) and returns an array of matching records.

count($criteria)

Queries the database for flags matching the given criteria (specified as a hash of field names and their matching values) and returns an array of matching records.

validate($cgi, $bug_id, $attach_id, $skip_requestee_on_error)

Validates fields containing flag modifications.

If the attachment is new, it has no ID yet and $attach_id is set to -1 to force its check anyway.

process($bug, $attachment, $timestamp, $cgi)

Processes changes to flags.

The bug and/or the attachment objects are the ones this flag is about, the timestamp is the date/time the bug was last touched (so that changes to the flag can be stamped with the same date/time), the cgi is the CGI object used to obtain the flag fields that the user submitted.

create($flag, $bug, $attachment, $timestamp)

Creates a flag record in the database.

modify($bug, $attachment, $cgi, $timestamp)

Modifies flags in the database when a user changes them.

retarget($flag, $bug)

Change the type of the flag, if possible. The new flag type must have the same name as the current flag type, must exist in the product and component the bug is in, and the current settings of the flag must pass validation. If no such flag type can be found, the type remains unchanged.

Retargetting flags is a good way to keep flags when moving bugs from one product where a flag type is available to another product where the flag type is unavailable, but another flag type having the same name exists. Most of the time, if they have the same name, this means that they have the same meaning, but with different settings.

clear($flag, $bug, $attachment)

Remove a flag from the DB.

FormToNewFlags($bug, $attachment, $cgi)

Checks whether or not there are new flags to create and returns an array of flag objects. This array is then passed to Flag::create().

notify($flag, $bug, $attachment)

Sends an email notification about a flag being created, fulfilled or deleted.

<<