NAME
BZ::Client::Bug - Client side representation of a bug in Bugzilla
VERSION
version 4.4004
SYNOPSIS
This class provides methods for accessing and managing bugs in Bugzilla.
my $client = BZ::Client->new( url => $url,
user => $user,
password => $password );
my $bugs = BZ::Client::Bug->get( $client, \%params );
COMMON PARAMETERS
Many Bugzilla Webservice methods take similar arguments. Instead of re-writing the documentation for each method, we document the parameters here, once, and then refer back to this documentation from the individual methods where these parameters are used.
Limiting What Fields Are Returned
Many methods return an array of structs with various fields in the structs. (For example, "get" in BZ::Client::Bug returns a list of bugs that have fields like "id", "summary", "creation_time", etc.)
These parameters allow you to limit what fields are present in the structs, to possibly improve performance or save some bandwidth.
Fields follow:
include_fields
include_fields (array) - An array of strings, representing the (case-sensitive) names of fields in the return value. Only the fields specified in this hash will be returned, the rest will not be included.
If you specify an empty array, then this function will return empty hashes.
Invalid field names are ignored.
Example:
BZ::Client::Bug->get( $client,
{ ids => [1], include_fields => ['id', 'name'] })
would return something like:
[{ id => 1, name => 'user@domain.com' }]
exclude_fields
exclude_fields (array) - An array of strings, representing the (case-sensitive) names of fields in the return value. The fields specified will not be included in the returned hashes.
If you specify all the fields, then this function will return empty hashes.
Some RPC calls support specifying sub fields. If an RPC call states that it support sub field restrictions, you can restrict what information is returned within the first field. For example, if you call Product.get with an include_fields of components.name, then only the component name would be returned (and nothing else). You can include the main field, and exclude a sub field.
Invalid field names are ignored.
Specifying fields here overrides "include_fields", so if you specify a field in both, it will be excluded, not included.
Example:
BZ::Client::Bug->get( $client,
{ ids => [1], exclude_fields => ['name'] })
would return something like:
[{ id => 1, real_name => 'John Smith' }]
shortcuts
There are several shortcut identifiers to ask for only certain groups of fields to be returned or excluded.
- _all
-
All possible fields are returned if
_all
is specified in "include_fields". - _default
-
These fields are returned if "include_fields" is empty or
_default
is specified. All fields described in the documentation are returned by default unless specified otherwise. - _extra
-
These fields are not returned by default and need to be manually specified in "include_fields" either by field name, or using
_extra
. - _custom
-
Only custom fields are returned if
_custom
is specified in "include_fields". This is normally specific to bug objects and not relevant for other returned objects.
Example:
BZ::Client::Bug->get( $client,
{ ids => [1], include_fields => ['_all'] })
EXCEPTION HANDLING
UTILITY FUNCTIONS
This section lists the utility functions provided by this module.
These deal with bug-related information, but not bugs directly.
fields
$fields = BZ::Client::Bug->fields( $client, $params )
@fields = BZ::Client::Bug->fields( $client, $params )
Get information about valid bug fields, including the lists of legal values for each field.
History
Added in Bugzilla 3.6
Parameters
You can pass either field ids or field names.
Note: If neither ids nor names is specified, then all non-obsolete fields will be returned.
- ids
-
ids (array) - An array of integer field ids
- names
-
names (array) - An array of strings representing field names.
In addition to the parameters above, this method also accepts the standard "include_fields" and "exclude_fields" arguments.
Returns
Returns an array or an arrayref of hashes, containing the following keys:
- id
-
id (int) - An integer id uniquely identifying this field in this installation only.
- type
-
type (int) The number of the fieldtype. The following values are defined:
- is_custom
-
is_custom (boolean) True when this is a custom field, false otherwise.
- name
-
name (string) The internal name of this field. This is a unique identifier for this field. If this is not a custom field, then this name will be the same across all Bugzilla installations.
- display_name
-
display_name (string) The name of the field, as it is shown in the user interface.
- is_mandatory
-
is_mandatory (boolean) True if the field must have a value when filing new bugs. Also, mandatory fields cannot have their value cleared when updating bugs.
This return value was added in Bugzilla 4.0.
- is_on_bug_entry
-
is_on_bug_entry (boolean) For custom fields, this is true if the field is shown when you enter a new bug. For standard fields, this is currently always false, even if the field shows up when entering a bug. (To know whether or not a standard field is valid on bug entry, see "create".)
- visibility_field
-
visibility_field (string) The name of a field that controls the visibility of this field in the user interface. This field only appears in the user interface when the named field is equal to one of the values in "visibility_values". Can be null.
- visibility_values
-
visibility_values (array) of strings This field is only shown when visibility_field matches one of these values. When visibility_field is null, then this is an empty array.
- value_field
-
value_field (string) The name of the field that controls whether or not particular values of the field are shown in the user interface. Can be null.
- values
-
This is an array of hashes, representing the legal values for select-type (drop-down and multiple-selection) fields. This is also populated for the "component", "version", "target_milestone", and "keywords" fields, but not for the
product
field (you must use "get_accessible_products" in BZ::Client::Product for that).For fields that aren't select-type fields, this will simply be an empty array.
Each hash has the following keys:
- name
-
name (string) The actual value--this is what you would specify for this field in "create", etc.
- sort_key
-
sort_key (int) Values, when displayed in a list, are sorted first by this integer and then secondly by their name.
- sortkey
-
DEPRECATED - Use "sort_key" instead.
Renamed to
sort_key
in Bugzilla 4.2. - visibility_values
-
If "value_field" is defined for this field, then this value is only shown if the "value_field" is set to one of the values listed in this array.
Note that for per-product fields, "value_field" is set to
product
and "visibility_values" will reflect which product(s) this value appears in. - is_active
-
is_active (boolean) This value is defined only for certain product specific fields such as "version", "target_milestone" or "component".
When true, the value is active, otherwise the value is not active.
Added in Bugzilla 4.4.
- description
-
description (string) The description of the value. This item is only included for the "keywords" field.
- is_open
-
is_open (boolean) For "bug_status" values, determines whether this status specifies that the bug is "open" (true) or "closed" (false). This item is only included for the "bug_status" field.
- can_change_to
-
For "bug_status" values, this is an array of hashes that determines which statuses you can transition to from this status. (This item is only included for the "bug_status" field.)
Each hash contains the following items:
- name
-
The name of the new status
- comment_required
-
comment_required (boolean) True if a comment is required when you change a bug into this status using this transition.
Errors:
legal_values
$values = BZ::Client::Bug->legal_values( $client, $field )
@values = BZ::Client::Bug->legal_values( $client, $field )
Tells you what values are allowed for a particular field.
Note: This is deprecated in Bugzilla, use "fields" instead.
Parameters
- field
-
The name of the field you want information about. This should be the same as the name you would use in "create", below.
- product_id
-
If you're picking a product-specific field, you have to specify the id of the product you want the values for.
Returns
- values
-
An array or arrayref of strings: the legal values for this field. The values will be sorted as they normally would be in Bugzilla.
Errors
- 106 - Invalid Product
-
You were required to specify a product, and either you didn't, or you specified an invalid product (or a product that you can't access).
- 108 - Invalid Field Name
-
You specified a field that doesn't exist or isn't a drop-down field.
FUNCTIONS FOR FINDING AND RETRIEVING BUGS
This section lists the class methods pertaining to finding and retrieving bugs from your server.
Listed here in order of what you most likely want to do... maybe?
get
@bugs = BZ::Client::Bug->get( $client, $id );
$bugs = BZ::Client::Bug->get( $client, $id );
@bugs = BZ::Client::Bug->get( $client, \@ids );
$bugs = BZ::Client::Bug->get( $client, \@ids );
@bugs = BZ::Client::Bug->get( $client, \%params );
$bugs = BZ::Client::Bug->get( $client, \%params );
Gets information about particular bugs in the database.
Parameters
A single $id or array ref of @ids may be provided, otherwise a hash ref with the following:
- ids
-
An array of numbers and strings.
If an element in the array is entirely numeric, it represents a
bug_id
from the Bugzilla database to fetch. If it contains any non-numeric characters, it is considered to be a bug alias instead, and the bug with that alias will be loaded. - permissive
-
permissive (boolean) Normally, if you request any inaccessible or invalid bug ids, will throw an error.
If this parameter is True, instead of throwing an error we return an array of hashes with a
id
,faultString
andfaultCode
for each bug that fails, and return normal information for the other bugs that were accessible.Note: marked as EXPERIMENTAL in Bugzilla 4.4
Added in Bugzilla 3.4.
Returns
An array or arrayref of bug instance objects with the given ID's.
See "INSTANCE METHODS" for how to use them.
FIXME missing the faults return values (added in 3.4)
Errors
- 100 - Invalid Bug Alias
-
If you specified an alias and there is no bug with that alias.
- 101 - Invalid Bug ID
-
The bug_id you specified doesn't exist in the database.
- 102 - Access Denied
-
You do not have access to the bug_id you specified.
search
FIXME Documentation not fully fleshed out
@bugs = BZ::Client::Bug->search( $client, \%params );
$bugs = BZ::Client::Bug->search( $client, \%params );
Searches for bugs matching the given parameters.
Parameters
This is just a quick example, there are lot's of fields
%params = (
'alias' => 'ACONVENIENTALIAS',
'assigned_to' => 'hopefullynotme@domain.local',
'creator' => 'littlejohnnytables@school.local',
'severity' => 'major',
'status' => 'OPEN',
);
Criteria are joined in a logical AND. That is, you will be returned bugs that match all of the criteria, not bugs that match any of the criteria.
See also https://bugzilla.readthedocs.io/en/5.0/api/core/v1/bug.html#search-bugs
Returns
Returns an array or arrayref of bug instance objects with the given ID's.
See "INSTANCE METHODS" for how to use them.
history
@history = BZ::Client::Bug->history( $client, \%params );
$history = BZ::Client::Bug->history( $client, \%params );
Gets the history of changes for particular bugs in the database.
Added in Bugzilla 3.4.
Parameters
- ids
-
An array of numbers and strings.
If an element in the array is entirely numeric, it represents a
bug_id
from the Bugzilla database to fetch. If it contains any non-numeric characters, it is considered to be a bug alias instead, and the data bug with that alias will be loaded.
Returns
An array or arrayref of hashes, containing the following keys:
- id
-
id (int) The numeric id of the bug
- alias
-
alias (array) The alias of this bug. If there is no alias, this will be undef.
- history
-
history (An array of hashes) - Each hash having the following keys:
- when
-
when (DateTime) The date the bug activity/change happened.
- who
-
who (string) The login name of the user who performed the bug change.
- changes
-
An array of hashes which contain all the changes that happened to the bug at this time (as specified by when). Each hash contains the following items:
- field_name
-
field_name (string) The name of the bug field that has changed.
- removed
-
removed (string) The previous value of the bug field which has been deleted by the change.
- added
-
added (string) The new value of the bug field which has been added by the change.
- attachment_id
-
attachment_id (int) The id of the attachment that was changed. This only appears if the change was to an attachment, otherwise "attachment_id" will not be present in this hash.
Errors
- 100 - Invalid Bug Alias
-
If you specified an alias and there is no bug with that alias.
- 101 - Invalid Bug ID
-
The bug_id you specified doesn't exist in the database.
- 102 - Access Denied
-
You do not have access to the bug_id you specified.
possible_duplicates
@bugs = BZ::Client::Bug->possible_duplicates( $client, \%params );
$bugs = BZ::Client::Bug->possible_duplicates( $client, \%params );
Allows a user to find possible duplicate bugs based on a set of keywords such as a user may use as a bug summary. Optionally the search can be narrowed down to specific products.
History
Added in Bugzilla 4.0.
Parameters
- summary
-
summary (string) A string of keywords defining the type of bug you are trying to report. Required.
- product
-
product (array) One or more product names to narrow the duplicate search to. If omitted, all bugs are searched.
Returns
The same as "get".
Note that you will only be returned information about bugs that you can see. Bugs that you can't see will be entirely excluded from the results. So, if you want to see private bugs, you will have to first log in and then call this method.
Errors
- 50 - Param Required
-
You must specify a value for "summary" containing a string of keywords to search for duplicates.
FUNCTIONS FOR CREATING AND MODIFYING BUGS
This section lists the class methods pertaining to the creation and modification of bugs.
Listed here in order of what you most likely want to do... maybe?
create
my $id = BZ::Client::Bug->create( $client, \%params );
This allows you to create a new bug in Bugzilla. If you specify any invalid fields, an error will be thrown stating which field is invalid. If you specify any fields you are not allowed to set, they will just be set to their defaults or ignored.
You cannot currently set all the items here that you can set on enter_bug.cgi (i.e. the web page to enter bugs).
The Bugzilla WebService API itself may allow you to set things other than those listed here, but realize that anything undocumented is UNSTABLE and will very likely change in the future.
History
Before Bugzilla 3.0.4, parameters marked as Defaulted were actually Required, due to a bug in Bugzilla itself.
The groups argument was added in Bugzilla 4.0. Before Bugzilla 4.0, bugs were only added into Mandatory groups by this method. Since Bugzilla 4.0.2, passing an illegal group name will throw an error. In Bugzilla 4.0 and 4.0.1, illegal group names were silently ignored.
The comment_is_private
argument was added in Bugzilla 4.0. Before Bugzilla 4.0, you had to use the undocumented commentprivacy
argument.
Error 116
was added in Bugzilla 4.0. Before that, dependency loop errors had a generic code of 32000
.
The ability to file new bugs with a resolution
was added in Bugzilla 4.4.
Parameters
Some params must be set, or an error will be thrown. These params are marked Required.
Some parameters can have defaults set in Bugzilla, by the administrator. If these parameters have defaults set, you can omit them. These parameters are marked Defaulted.
Clients that want to be able to interact uniformly with multiple Bugzillas should always set both the params marked Required and those marked Defaulted, because some Bugzillas may not have defaults set for Defaulted parameters, and then this method will throw an error if you don't specify them.
The descriptions of the parameters below are what they mean when Bugzilla is being used to track software bugs. They may have other meanings in some installations.
- product (string) Required - The name of the product the bug is being filed against.
-
product (string) Required - The name of the product the bug is being filed against.
- component
-
component (string) Required - The name of a component in the product above.
- summary
-
summary (string) Required - A brief description of the bug being filed.
- version
-
version (string) Required - A version of the product above; the version the bug was found in.
- description
-
description (string) Defaulted - The initial description for this bug. Some Bugzilla installations require this to not be blank.
- op_sys
-
op_sys (string) Defaulted - The operating system the bug was discovered on.
- platform
-
platform (string) Defaulted - What type of hardware the bug was experienced on.
- priority
-
priority (string) Defaulted - What order the bug will be fixed in by the developer, compared to the developer's other bugs.
- severity
-
severity (string) Defaulted - How severe the bug is.
- alias
-
alias (string) - A brief alias for the bug that can be used instead of a bug number when accessing this bug. Must be unique in all of this Bugzilla.
- assigned_to
-
assigned_to (username) - A user to assign this bug to, if you don't want it to be assigned to the component owner.
- cc
-
cc (array) - An array of usernames to CC on this bug.
- comment_is_private
-
comment_is_private (boolean) - If set to true, the description is private, otherwise it is assumed to be public.
- groups
-
groups (array) - An array (ref) of group names to put this bug into. You can see valid group names on the Permissions tab of the Preferences screen, or, if you are an administrator, in the Groups control panel. If you don't specify this argument, then the bug will be added into all the groups that are set as being "Default" for this product. (If you want to avoid that, you should specify
groups
as an empty array.) - qa_contact
-
qa_contact (username) - If this installation has QA Contacts enabled, you can set the QA Contact here if you don't want to use the component's default QA Contact.
- status
-
status (string) - The status that this bug should start out as. Note that only certain statuses can be set on bug creation.
- resolution
-
resolution (string) - If you are filing a closed bug, then you will have to specify a resolution. You cannot currently specify a resolution of
DUPLICATE
for new bugs, though. That must be done with "update". - target_milestone
-
target_milestone (string) - A valid target milestone for this product.
- depends_on
-
depends_on (array) - An array of bug id's that this new bug should depend upon.
As of Bugzilla 5.0 this option isn't included in the WebService API docks for =create()=, although it is mentioned in it's error codes.
- blocks
-
blocks (array) - An array of bug id's that this new bug should block.
As of Bugzilla 5.0 this option isn't included in the WebService API docks for =create()=, although it is mentioned in it's error codes.
Note: In addition to the above parameters, if your installation has any custom fields, you can set them just by passing in the name of the field and its value as a string.
Returns
A hash with one element, id
. This is the id of the newly-filed bug.
Errors
- 51 - Invalid Object
-
You specified a field value that is invalid. The error message will have more details.
- 103 - Invalid Alias
-
The alias you specified is invalid for some reason. See the error message for more details.
- 104 - Invalid Field
-
One of the drop-down fields has an invalid value, or a value entered in a text field is too long. The error message will have more detail.
- 105 - Invalid Component
-
You didn't specify a component.
- 106 - Invalid Product
-
Either you didn't specify a product, this product doesn't exist, or you don't have permission to enter bugs in this product.
- 107 - Invalid Summary
-
You didn't specify a summary for the bug.
- 116 - Dependency Loop
-
You specified values in the blocks or depends_on fields that would cause a circular dependency between bugs.
- 120 - Group Restriction Denied
-
You tried to restrict the bug to a group which does not exist, or which you cannot use with this product.
- 504 - Invalid User
-
Either the QA Contact, Assignee, or CC lists have some invalid user in them. The error message will have more details.
update
my $id = BZ::Client::Bug->update( $client, \%params );
Allows you to update the fields of a bug.
(Your Bugzilla server may automatically sends emails out about the changes)
History
Added in Bugzilla 4.0.
Parameters
- ids
-
ids (Array of
int
s orstring
s) - The ids or aliases of the bugs that you want to modify.Note: All following fields specify the values you want to set on the bugs you are updating.
- alias
-
alias (string) - The alias of the bug. You can only set this if you are modifying a single bug. If there is more than one bug specified in
ids
, passing in a value foralias
will cause an error to be thrown. - assigned_to
-
assigned_to (string) - The full login name of the user this bug is assigned to.
- blocks
-
blocks (hash) - These specify the bugs that this bug blocks. To set these, you should pass a hash as the value. The hash may contain the following fields:
- add
-
add (Array of
int
s) - Bug ids to add to this field. - remove
-
remove (Array of
int
s) - Bug ids to remove from this field. If the bug ids are not already in the field, they will be ignored. - set
-
set (Array of
int
s) - An exact set of bug ids to set this field to, overriding the current value. If you specifyset
, thenadd
andremove
will be ignored.
- depends_on
-
depends_on (hash) - These specify the bugs that this depends on. To set these, you should pass a hash as the value. The hash may contain the following fields:
- add
-
add (Array of
int
s) - Bug ids to add to this field. - remove
-
remove (Array of
int
s) - Bug ids to remove from this field. If the bug ids are not already in the field, they will be ignored. - set
-
set (Array of
int
s) - An exact set of bug ids to set this field to, overriding the current value. If you specifyset
, thenadd
andremove
will be ignored.
- cc
-
cc (hash) - The users on the cc list. To modify this field, pass a hash, which may have the following fields:
- add
-
add (Array of
string
s) - User names to add to the CC list. They must be full user names, and an error will be thrown if you pass in an invalid user name. - remove
-
remove (Array of
string
s) - User names to remove from the CC list. They must be full user names, and an error will be thrown if you pass in an invalid user name.
- is_cc_accessible
-
is_cc_accessible (boolean) - Whether or not users in the CC list are allowed to access the bug, even if they aren't in a group that can normally access the bug.
- comment
-
comment (hash) - A comment on the change. The hash may contain the following fields:
- body
-
body (string) - The actual text of the comment. Note: For compatibility with the parameters to "add_comment", you can also call this field
comment
, if you wish. - is_private
-
is_private (boolean) - Whether the comment is private or not. If you try to make a comment private and you don't have the permission to, an error will be thrown.
- comment_is_private
-
comment_is_private (hash) - This is how you update the privacy of comments that are already on a bug. This is a hash, where the keys are the
int
id of comments (not their count on a bug, like #1, #2, #3, but their globally-unique id, as returned by "comments") and the value is aboolean
which specifies whether that comment should become private (true
) or public (false
).The comment ids must be valid for the bug being updated. Thus, it is not practical to use this while updating multiple bugs at once, as a single comment id will never be valid on multiple bugs.
- component component (string) - The Component the bug is in.
- deadline
-
deadline (string) - The Deadline field--a date specifying when the bug must be completed by, in the format
YYYY-MM-DD
. - dupe_of
-
dupe_of (int) - The bug that this bug is a duplicate of. If you want to mark a bug as a duplicate, the safest thing to do is to set this value and not set the
status
orresolution
fields. They will automatically be set by Bugzilla to the appropriate values for duplicate bugs. - estimated_time
-
estimated_time (double) - The total estimate of time required to fix the bug, in hours. This is the total estimate, not the amount of time remaining to fix it.
- groups
-
groups (hash) - The groups a bug is in. To modify this field, pass a hash, which may have the following fields:
- add
-
add (Array of
string
s) - The names of groups to add. Passing in an invalid group name or a group that you cannot add to this bug will cause an error to be thrown. - remove
-
remove (Array of
string
s) - The names of groups to remove. Passing in an invalid group name or a group that you cannot remove from this bug will cause an error to be thrown.
- keywords
-
keywords (hash) - Keywords on the bug. To modify this field, pass a hash, which may have the following fields:
- add
-
add (An array of
string
s) - The names of keywords to add to the field on the bug. Passing something that isn't a valid keyword name will cause an error to be thrown. - remove
-
remove (An array of
string
s) - The names of keywords to remove from the field on the bug. Passing something that isn't a valid keyword name will cause an error to be thrown. - set
-
set (An array of
string
s) - An exact set of keywords to set the field to, on the bug. Passing something that isn't a valid keyword name will cause an error to be thrown. Specifyingset
overridesadd
andremove
.
- op_sys
-
op_sys (string) - The Operating System ("OS") field on the bug.
- platform
-
platform (string) - The Platform or "Hardware" field on the bug.
- priority
-
priority (string) - The Priority field on the bug.
- product
-
product (string) - The name of the product that the bug is in. If you change this, you will probably also want to change
target_milestone
,version
, andcomponent
, since those have different legal values in every product.If you cannot change the
target_milestone
field, it will be reset to the default for the product, when you move a bug to a new product.You may also wish to add or remove groups, as which groups are valid on a bug depends on the product. Groups that are not valid in the new product will be automatically removed, and groups which are mandatory in the new product will be automaticaly added, but no other automatic group changes will be done.
Note: that users can only move a bug into a product if they would normally have permission to file new bugs in that product.
- qa_contact
-
qa_contact (string) - The full login name of the bug's QA Contact.
- is_creator_accessible
-
is_creator_accessible (boolean) - Whether or not the bug's reporter is allowed to access the bug, even if he or she isn't in a group that can normally access the bug.
- remaining_time
-
remaining_time (double) - How much work time is remaining to fix the bug, in hours. If you set
work_time
but don't explicitly setremaining_time
, then thework_time
will be deducted from the bug'sremaining_time
. - reset_assigned_to
-
reset_assigned_to (boolean) - If true, the
assigned_to
field will be reset to the default for the component that the bug is in. (If you have set the component at the same time as using this, then the component used will be the new component, not the old one.) - reset_qa_contact
-
reset_qa_contact (boolean) - If true, the
qa_contact
field will be reset to the default for the component that the bug is in. (If you have set the component at the same time as using this, then the component used will be the new component, not the old one.) - resolution
-
resolution (string) The current resolution. May only be set if you are closing a bug or if you are modifying an already-closed bug. Attempting to set the resolution to any value (even an empty or null string) on an open bug will cause an error to be thrown.
If you change the
status
field to an open status, the resolution field will automatically be cleared, so you don't have to clear it manually. - see_also
-
see_also (hash) - The See Also field on a bug, specifying URLs to bugs in other bug trackers. To modify this field, pass a hash, which may have the following fields:
- add
-
add (An array of
string
s) - URLs to add to the field. Each URL must be a valid URL to a bug-tracker, or an error will be thrown. - remove
-
remove (An array of
string
s) - URLs to remove from the field. Invalid URLs will be ignored.
- severity
-
severity (string) - The Severity field of a bug.
- status
-
status (string) - The status you want to change the bug to. Note that if a bug is changing from open to closed, you should also specify a resolution.
- summary
-
summary (string) - The Summary field of the bug.
- target_milestone
-
target_milestone (string) - The bug's Target Milestone.
- url
-
url (string) - The "URL" field of a bug.
- version
-
version (string) - The bug's Version field.
- whiteboard
-
whiteboard (string) - The Status Whiteboard field of a bug.
- work_time
-
work_time (double) - The number of hours worked on this bug as part of this change. If you set
work_time
but don't explicitly setremaining_time
, then thework_time
will be deducted from the bug's remaining_time.
Note: You can also set the value of any custom field by passing its name as a parameter, and the value to set the field to. For multiple-selection fields, the value should be an array of strings.
Returns
A hash
with a single field, "bugs". This points to an array of hashes with the following fields:
- id
-
id (int) - The id of the bug that was updated.
- alias
-
alias (string) - The alias of the bug that was updated, if this bug has an alias.
- last_change_time
-
last_change_time (DateTime) - The exact time that this update was done at, for this bug. If no update was done (that is, no fields had their values changed and no comment was added) then this will instead be the last time the bug was updated.
- changes
-
changes (hash) - The changes that were actually done on this bug. The keys are the names of the fields that were changed, and the values are a hash with two keys:
- added
-
added (string) - The values that were added to this field, possibly a comma-and-space-separated list if multiple values were added.
- removed
-
removed (string) - The values that were removed from this field, possibly a comma-and-space-separated list if multiple values were removed.
Here's an example of what a return value might look like:
{
bugs => [
{
id => 123,
alias => 'foo',
last_change_time => '2010-01-01T12:34:56',
changes => {
status => {
removed => 'NEW',
added => 'ASSIGNED'
},
keywords => {
removed => 'bar',
added => 'qux, quo, qui',
},
},
},
],
}
Note: Currently, some fields are not tracked in changes: comment
, comment_is_private
, and work_time
. This means that they will not show up in the return value even if they were successfully updated. This may change in a future version of Bugzilla.
Errors
This function can throw all of the errors that "get", "create", and "add_comment" can throw, plus:
- 50 - Empty Field
-
You tried to set some field to be empty, but that field cannot be empty. The error message will have more details.
- 52 - Input Not A Number
-
You tried to set a numeric field to a value that wasn't numeric.
- 54 - Number Too Large
-
You tried to set a numeric field to a value larger than that field can accept.
- 55 - Number Too Small
-
You tried to set a negative value in a numeric field that does not accept negative values.
- 56 - Bad Date/Time
-
You specified an invalid date or time in a date/time field (such as the deadline field or a custom date/time field).
- 112 - See Also Invalid
-
You attempted to add an invalid value to the see_also field.
- 115 - Permission Denied
-
You don't have permission to change a particular field to a particular value. The error message will have more detail.
- 116 - Dependency Loop
-
You specified a value in the blocks or depends_on fields that causes a dependency loop.
- 117 - Invalid Comment ID
-
You specified a comment id in comment_is_private that isn't on this bug.
- 118 - Duplicate Loop
-
You specified a value for dupe_of that causes an infinite loop of duplicates.
- 119 - dupe_of Required
-
You changed the resolution to DUPLICATE but did not specify a value for the dupe_of field.
- 120 - Group Add/Remove Denied
-
You tried to add or remove a group that you don't have permission to modify for this bug, or you tried to add a group that isn't valid in this product.
- 121 - Resolution Required
-
You tried to set the status field to a closed status, but you didn't specify a resolution.
- 122 - Resolution On Open Status
-
This bug has an open status, but you specified a value for the resolution field.
- 123 - Invalid Status Transition
-
You tried to change from one status to another, but the status workflow rules don't allow that change.
update_see_also
@changes = BZ::Client::Bug->update_see_also( $client, \%params );
$changes = BZ::Client::Bug->update_see_also( $client, \%params );
Adds or removes URLs for the See Also field on bugs. These URLs must point to some valid bug in some Bugzilla installation or in Launchpad.
History
This is marked as EXPERIMENTAL in Bugzilla 4.4
Added in Bugzilla 3.4.
Parameters
- ids
-
An array of integers or strings. The IDs or aliases of bugs that you want to modify.
- add
-
Array of strings. URLs to Bugzilla bugs. These URLs will be added to the See Also field.
If the URLs don't start with
http://
orhttps://
, it will be assumed thathttp://
should be added to the beginning of the string.It is safe to specify URLs that are already in the See Also field on a bug as they will just be silently ignored.
- remove
-
An array of strings. These URLs will be removed from the See Also field. You must specify the full URL that you want removed. However, matching is done case-insensitively, so you don't have to specify the URL in exact case, if you don't want to.
If you specify a URL that is not in the See Also field of a particular bug, it will just be silently ignored. Invaild URLs are currently silently ignored, though this may change in some future version of Bugzilla.
Note: If you specify the same URL in both "add" and "remove", it will be added. (That is, "add" overrides "remove".)
Returns
A hash or hashref where the keys are numeric bug ids and the contents are a hash with one key, see_also
.
see_also
points to a hash, which contains two keys, added
and removed
.
These are arrays of strings, representing the actual changes that were made to the bug.
Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
{
1 => {
see_also => {
added => [(an array of bug URLs)],
removed => [(an array of bug URLs)],
}
},
2 => {
see_also => {
added => [(an array of bug URLs)],
removed => [(an array of bug URLs)],
}
}
}
This return value allows you to tell what this method actually did.
It is in this format to be compatible with the return value of a future "update" method.
Errors
- 100 - Invalid Bug Alias
-
If you specified an alias and there is no bug with that alias.
- 101 - Invalid Bug ID
-
The bug_id you specified doesn't exist in the database.
- 102 - Access Denied
-
You do not have access to the bug_id you specified.
- 109 - Bug Edit Denied
-
You did not have the necessary rights to edit the bug.
- 112 - Invalid Bug URL
-
One of the URLs you provided did not look like a valid bug URL.
- 115 - See Also Edit Denied
-
You did not have the necessary rights to edit the See Also field for this bug.
Before Bugzilla 3.6, error 115 had a generic error code of 32000.
update_tags
@changes = BZ::Client::Bug->update_tags( $client, \%params );
$changes = BZ::Client::Bug->update_tags( $client, \%params );
Adds or removes tags on bugs.
Unlike Keywords which are global and visible by all users, Tags are personal and can only be viewed and edited by their author. Editing them won't send any notification to other users. Use them to tag and keep track of bugs.
Bugzilla will lower case the text of the tags. This doesn't seem to be documented.
Reminder: to retrieve these tags, specify _extra
or the field name tags
in "include_fields" when searching etc.
History
This is marked as UNSTABLE in Bugzilla 4.4
Added in Bugzilla 4.4.
Parameters
- ids
-
An array of ints and/or strings--the ids or aliases of bugs that you want to add or remove tags to. All the tags will be added or removed to all these bugs.
-
A hash representing tags to be added and/or removed. The hash has the following fields:
- add
-
An array of strings representing tag names to be added to the bugs.
It is safe to specify tags that are already associated with the bugs as they will just be silently ignored.
- remove
-
An array of strings representing tag names to be removed from the bugs.
It is safe to specify tags that are not associated with any bugs as they will just be silently ignored.
Returns
A hash or hashref where the keys are numeric bug ids and the contents are a hash with one key, tags
.
tags
points to a hash, which contains two keys, added
and removed
.
These are arrays of strings, representing the actual changes that were made to the bug.
Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
{
1 => {
tags => {
added => [(an array of tags)],
removed => [(an array of tags)],
}
},
2 => {
tags => {
added => [(an array of tags)],
removed => [(an array of tags)],
}
}
}
This return value allows you to tell what this method actually did.
Errors
- 100 - Invalid Bug Alias
-
If you specified an alias and there is no bug with that alias.
- 101 - Invalid Bug ID
-
The bug_id you specified doesn't exist in the database.
- 102 - Access Denied
-
You do not have access to the bug_id you specified.
new
my $bug = BZ::Client::Bug->new( id => $id );
Creates a new bug object instance with the given ID.
Note: Doesn't actually touch your bugzilla server.
See "INSTANCE METHODS" for how to use it.
INSTANCE METHODS
This section lists the modules instance methods.
Once you have a bug object, you can use these methods to inspect and manipulate the bug.
id
$id = $bug->id();
$bug->id( $id );
Gets or sets the bugs ID.
alias
$alias = $bug->alias();
$bug->alias( $alias );
Gets or sets the bugs alias. If there is no alias or aliases are disabled in Bugzilla, this will be an empty string.
assigned_to
$assigned_to = $bug->assigned_to();
$bug->assigned_to( $assigned_to );
Gets or sets the login name of the user to whom the bug is assigned.
component
$component = $bug->component();
$bug->component( $component );
Gets or sets the name of the current component of this bug.
creation_time
$dateTime = $bug->creation_time();
$bug->creation_time( $dateTime );
Gets or sets the date and time, when the bug was created.
dupe_of
$dupeOf = $bug->dupe_of();
$bug->dupe_of( $dupeOf );
Gets or sets the bug ID of the bug that this bug is a duplicate of. If this bug isn't a duplicate of any bug, this will be an empty int.
is_open
$isOpen = $bug->is_open();
$bug->is_open( $isOpen );
Gets or sets, whether this bug is closed. The return value, or parameter value is true (1) if this bug is open, false (0) if it is closed.
last_change_time
$lastChangeTime = $bug->last_change_time();
$bug->last_change_time( $lastChangeTime );
Gets or sets the date and time, when the bug was last changed.
priority
$priority = $bug->priority();
$bug->priority( $priority );
Gets or sets the priority of the bug.
product
$product = $bug->product();
$bug->product( $product );
Gets or sets the name of the product this bug is in.
resolution
$resolution = $bug->resolution();
$bug->resolution( $resolution );
Gets or sets the current resolution of the bug, or an empty string if the bug is open.
severity
$severity = $bug->severity();
$bug->severity( $severity );
Gets or sets the current severity of the bug.
status
$status = $bug->status();
$bug->status( $status );
Gets or sets the current status of the bug.
summary
$summary = $bug->summary();
$bug->summary( $summary );
Gets or sets the summary of this bug.
ATTACHMENTS & COMMENTS
These are implemented by other modules.
See BZ::Client::Bug::Attachment and BZ::Client::Bug::Comment
TODO
Bugzilla 5.0. introduced the search_comment_tags
and update_comment_tags
methods, these are yet to be specifically implemented.
SEE ALSO
BZ::Client, BZ::Client::Bug::Attachment, BZ::Client::Bug::Comment
BZ::Client::API, Bugzilla WebService 4.4 API, Bugzilla WebService 5.0 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.