blib/lib/BZ/Client/Bug.pm untested

filter: Statementstmt 0.0% 0 / 132 Branchbran 0.0% 0 / 56 Conditioncond 0.0% 0 / 10 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 28 Podpod 0.0% 0 / 25 totaltotal 0.0% 0 / 251 CC 29 SCAR 25.4
CC
29
Cov
0%
alias
56.0
get
12.0
update_see_also
12.0
CRAP 12.6
1 #!/bin/false
2 # PODNAME: BZ::Client::Bug
3 # ABSTRACT: Client side representation of a bug in Bugzilla
4  
5 use strict;
6 use warnings 'all';
7  
8 package BZ::Client::Bug;
9 $BZ::Client::Bug::VERSION = '4.4001';
10  
11 use parent qw( BZ::Client::API );
12  
13 # See https://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
14 # These are in order as per the above
15  
16 ## functions
17  
18 sub fields {
19 my($class, $client, $params) = @_;
20 return $class->_returns_array($client, 'Bug.fields', $params, 'fields');
21 }
22  
23 sub legal_values {
24 my($class, $client, $field) = @_;
25 my $params = { 'field' => $field };
26 return $class->_returns_array($client, 'Bug.legal_values', $params, 'values');
27 }
28  
29 sub get {
30 my($class, $client, $params) = @_;
31 $params->{'permissive'} = BZ::Client::XMLRPC::boolean::TRUE()
32 if $params->{'permissive'};
33 my $bugs = $class->_returns_array($client, 'Bug.get', $params, 'bugs');
34 my @result;
35 for my $bug (@$bugs) {
36 push(@result, $class->new(%$bug));
37 }
38 $client->log('debug', $class . '::get: Got ' . scalar(@result));
39 return wantarray ? @result : \@result
40 }
41  
42 sub history {
43 my($class, $client, $params) = @_;
44 return $class->_returns_array($client, 'Bug.history', $params, 'bugs');
45 }
46  
47 sub possible_duplicates {
48 my($class, $client, $params) = @_;
49 my $bugs = $class->_returns_array($client, 'Bug.possible_duplicates', $params, 'bugs');
50 my @result;
51 for my $bug (@$bugs) {
52 push(@result, $class->new(%$bug));
53 }
54 $client->log('debug', $class . '::possible_duplicates: Got ' . scalar(@result));
55 return wantarray ? @result : \@result
56 }
57  
58 sub search {
59 my($class, $client, $params) = @_;
60 my $bugs = $class->_returns_array($client, 'Bug.search', $params, 'bugs');
61 my @result;
62 for my $bug (@$bugs) {
63 push(@result, $class->new(%$bug));
64 }
65 $client->log('debug', $class . '::search: Found ' . join(',',@result));
66 return wantarray ? @result : \@result
67 }
68  
69 sub create {
70 my($class, $client, $params) = @_;
71 return $class->_create($client, 'Bug.create', $params);
72 }
73  
74 sub update {
75 my($class, $client, $params) = @_;
76 return $class->_returns_array($client, 'Bug.update', $params, 'bugs');
77  
78 }
79  
80 sub update_see_also {
81 my($class, $client, $params) = @_;
82 $client->log('debug', $class . '::update_see_also: Updating See-Also');
83 my $result = $class->api_call($client, 'Bug.update_see_also', $params);
84 my $changes = $result->{'changes'};
85 if (!$changes || 'HASH' ne ref($changes)) {
86 $class->error($client, 'Invalid reply by server, expected hash of changed bug details.');
87 }
88 $client->log('debug', $class . '::update_see_also: Updated stuff');
89 return wantarray ? %$changes : $changes
90 }
91  
92 sub update_tags {
93 my($class, $client, $params) = @_;
94 $client->log('debug', $class . '::update_tags: Updating Tags');
95 my $result = $class->api_call($client, 'Bug.update_tags', $params);
96 my $changes = $result->{'changes'};
97 if (!$changes || 'HASH' ne ref($changes)) {
98 $class->error($client, 'Invalid reply by server, expected hash of changed bug details.');
99 }
100 $client->log('debug', $class . '::update_tags: Updated stuff');
101 return wantarray ? %$changes : $changes
102 }
103  
104 ## methods
105  
106 sub id {
107 my $self = shift;
108 if (@_) {
109 $self->{'id'} = shift;
110 }
111 else {
112 return $self->{'id'}
113 }
114 }
115  
116 sub alias {
117 my $self = shift;
118 if (@_) {
119 my $alias = shift;
120 if (ref $alias eq 'ARRAY' && @$a) {
121 $self->{'alias'} = $alias->[0];
122 }
123 if (not ref $alias) {
124 $self->{'alias'} = $alias;
125 }
126 # silently ignore anything else
127 }
128 else {
129  
130 return '' unless defined $self->{'alias'};
131  
132 # long form so its clear what is going on.
133 if (ref $self->{'alias'}) {
134 if (ref $self->{'alias'} eq 'ARRAY'
135 and @{$self->{'alias'}}) {
136 return $self->{'alias'}->[0];
137 }
138 return ''
139 }
140  
141 # fall back
142 return $self->{'alias'}
143 }
144 }
145  
146 sub assigned_to {
147 my $self = shift;
148 if (@_) {
149 $self->{'assigned_to'} = shift;
150 }
151 else {
152 return $self->{'assigned_to'}
153 }
154 }
155  
156 sub component {
157 my $self = shift;
158 if (@_) {
159 $self->{'component'} = shift;
160 } e
161 lse {
162 return $self->{'component'}
163 }
164 }
165  
166 sub creation_time {
167 my $self = shift;
168 if (@_) {
169 $self->{'creation_time'} = shift;
170 }
171 else {
172 return $self->{'creation_time'}
173 }
174 }
175  
176 sub dupe_of {
177 my $self = shift;
178 if (@_) {
179 $self->{'dupe_of'} = shift;
180 }
181 else {
182 return $self->{'dupe_of'}
183 }
184 }
185  
186 sub internals {
187 my $self = shift;
188 if (@_) {
189 $self->{'internals'} = shift;
190 }
191 else {
192 return $self->{'internals'}
193 }
194 }
195  
196 sub is_open {
197 my $self = shift;
198 if (@_) {
199 $self->{'is_open'} = shift;
200 }
201 else {
202 return $self->{'is_open'}
203 }
204 }
205  
206 sub last_change_time {
207 my $self = shift;
208 if (@_) {
209 $self->{'last_change_time'} = shift;
210 }
211 else {
212 return $self->{'last_change_time'}
213 }
214 }
215  
216 sub priority {
217 my $self = shift;
218 if (@_) {
219 $self->{'priority'} = shift;
220 }
221 else {
222 return $self->{'priority'}
223 }
224 }
225  
226 sub product {
227 my $self = shift;
228 if (@_) {
229 $self->{'product'} = shift;
230 }
231 else {
232 return $self->{'product'}
233 }
234 }
235  
236 sub resolution {
237 my $self = shift;
238 if (@_) {
239 $self->{'resolution'} = shift;
240 }
241 else {
242 return $self->{'resolution'}
243 }
244 }
245  
246 sub severity {
247 my $self = shift;
248 if (@_) {
249 $self->{'severity'} = shift;
250 }
251 else {
252 return $self->{'severity'}
253 }
254 }
255  
256 sub status {
257 my $self = shift;
258 if (@_) {
259 $self->{'status'} = shift;
260 }
261 else {
262 return $self->{'status'}
263 }
264 }
265  
266 sub summary {
267 my $self = shift;
268 if (@_) {
269 $self->{'summary'} = shift;
270 }
271 else {
272 return $self->{'summary'}
273 }
274 }
275  
276 1;
277  
278 __END__
279  
280 =pod
281  
282 =encoding UTF-8
283  
284 =head1 NAME
285  
286 BZ::Client::Bug - Client side representation of a bug in Bugzilla
287  
288 =head1 VERSION
289  
290 version 4.4001
291  
292 =head1 SYNOPSIS
293  
294 This class provides methods for accessing and managing bugs in Bugzilla.
295  
296 my $client = BZ::Client->new( url => $url,
297 user => $user,
298 password => $password );
299  
300 my $bugs = BZ::Client::Bug->get( $client, $ids );
301  
302 =head1 COMMON PARAMETERS
303  
304 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.
305  
306 =head2 Limiting What Fields Are Returned
307  
308 Many methods return an array of structs with various fields in the structs.
309 (For example, L</get> in L<BZ::Client::Bug> returns a list of bugs that have fields like
310 L</id>, L</summary>, L</creation_time>, etc.)
311  
312 These parameters allow you to limit what fields are present in the structs, to possibly improve performance or save some bandwidth.
313  
314 Fields follow:
315  
316 =head3 include_fields
317  
318 I<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.
319  
320 If you specify an empty array, then this function will return empty hashes.
321  
322 Invalid field names are ignored.
323  
324 Example:
325  
326 BZ::Client::User->get( $client,
327 { ids => [1], include_fields => ['id', 'name'] })
328  
329 would return something like:
330  
331 [{ id => 1, name => 'user@domain.com' }]
332  
333 =head3 exclude_fields
334  
335 I<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.
336  
337 If you specify all the fields, then this function will return empty hashes.
338  
339 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.
340  
341 Invalid field names are ignored.
342  
343 Specifying fields here overrides L</include_fields>, so if you specify a field in both, it will be excluded, not included.
344  
345 Example:
346  
347 BZ::Client::User->get( $client,
348 { ids => [1], exclude_fields => ['name'] })
349  
350 would return something like:
351  
352 [{ id => 1, real_name => 'John Smith' }]
353  
354 =head3 shortcuts
355  
356 There are several shortcut identifiers to ask for only certain groups of fields to be returned or excluded.
357  
358 =over 4
359  
360 =item _all
361  
362 All possible fields are returned if C<_all> is specified in L</include_fields>.
363  
364 =item _default
365  
366 These fields are returned if L</include_fields> is empty or C<_default> is specified. All fields described in the documentation are returned by default unless specified otherwise.
367  
368 =item _extra
369  
370 These fields are not returned by default and need to be manually specified in L</include_fields> either by field name, or using C<_extra>.
371  
372 =item _custom
373  
374 Only custom fields are returned if C<_custom> is specified in L</include_fields>. This is normally specific to bug objects and not relevant for other returned objects.
375  
376 =back
377  
378 Example:
379  
380 BZ::Client::User->get( $client,
381 { ids => [1], include_fields => ['_all'] })
382  
383 =head1 EXCEPTION HANDLING
384  
385 See L<BZ::Client::Exception>
386  
387 =head1 UTILITY FUNCTIONS
388  
389 This section lists the utility functions provided by this module.
390  
391 These deal with bug-related information, but not bugs directly.
392  
393 =head2 fields
394  
395 $fields = BZ::Client::Bug->fields( $client, $params )
396 @fields = BZ::Client::Bug->fields( $client, $params )
397  
398 Get information about valid bug fields, including the lists of legal values for each field.
399  
400 =head3 History
401  
402 Added in Bugzilla 3.6
403  
404 =head3 Parameters
405  
406 You can pass either field ids or field names.
407  
408 Note: If neither ids nor names is specified, then all non-obsolete fields will be returned.
409  
410 =over 4
411  
412 =item ids
413  
414 I<ids> (array) - An array of integer field ids
415  
416 =item names
417  
418 I<names> (array) - An array of strings representing field names.
419  
420 =back
421  
422 In addition to the parameters above, this method also accepts the standard L</include_fields> and L</exclude_fields> arguments.
423  
424 =head3 Returns
425  
426 Returns an array or an arrayref of hashes, containing the following keys:
427  
428 =over 4
429  
430 =item id
431  
432 I<id> (int) - An integer id uniquely identifying this field in this installation only.
433  
434 =item type
435  
436 I<type> (int) The number of the fieldtype. The following values are defined:
437  
438 =over 4
439  
440 =item 0 Unknown
441  
442 =item 1 Free Text
443  
444 =item 2 Drop Down
445  
446 =item 3 Multiple-Selection Box
447  
448 =item 4 Large Text Box
449  
450 =item 5 Date/Time
451  
452 =item 6 Bug ID
453  
454 =item 7 Bug URLs ("See Also")
455  
456 =back
457  
458 =item is_custom
459  
460 I<is_custom> (boolean) True when this is a custom field, false otherwise.
461  
462 =item name
463  
464 I<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.
465  
466 =item display_name
467  
468 I<display_name> (string) The name of the field, as it is shown in the user interface.
469  
470 =item is_mandatory
471  
472 I<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.
473  
474 This return value was added in Bugzilla 4.0.
475  
476 =item is_on_bug_entry
477  
478 I<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 L</create>.)
479  
480 =item visibility_field
481  
482 I<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 L</visibility_values>. Can be null.
483  
484 =item visibility_values
485  
486 I<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.
487  
488 =item value_field
489  
490 I<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.
491  
492 =item values
493  
494 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 L</component>, L</version>, L</target_milestone>, and L</keywords> fields, but not for the C<product> field (you must use L<BZ::Client::Product/get_accessible_products> for that).
495  
496 For fields that aren't select-type fields, this will simply be an empty array.
497  
498 Each hash has the following keys:
499  
500 =over 4
501  
502 =item name
503  
504 I<name> (string) The actual value--this is what you would specify for this field in L</create>, etc.
505  
506 =item sort_key
507  
508 I<sort_key> (int) Values, when displayed in a list, are sorted first by this integer and then secondly by their name.
509  
510 =item sortkey
511  
512 B<DEPRECATED> - Use L</sort_key> instead.
513  
514 Renamed to C<sort_key> in Bugzilla 4.2.
515  
516 =item visibility_values
517  
518 If L</value_field> is defined for this field, then this value is only shown if the L</value_field> is set to one of the values listed in this array.
519  
520 Note that for per-product fields, L</value_field> is set to C<product> and L</visibility_values> will reflect which product(s) this value appears in.
521  
522 =item is_active
523  
524 I<is_active> (boolean) This value is defined only for certain product specific fields such as L</version>, L</target_milestone> or L</component>.
525  
526 When true, the value is active, otherwise the value is not active.
527  
528 Added in Bugzilla 4.4.
529  
530 =item description
531  
532 I<description> (string) The description of the value. This item is only included for the L</keywords> field.
533  
534 =item is_open
535  
536 I<is_open> (boolean) For L</bug_status> values, determines whether this status specifies that the bug is "open" (true) or "closed" (false). This item is only included for the L</bug_status> field.
537  
538 =item can_change_to
539  
540 For L</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 L</bug_status> field.)
541  
542 Each hash contains the following items:
543  
544 =over 4
545  
546 =item name
547  
548 The name of the new status
549  
550 =item comment_required
551  
552 I<comment_required> (boolean) True if a comment is required when you change a bug into this status using this transition.
553  
554 =back
555  
556 =back
557  
558 =back
559  
560 Errors:
561  
562 =over 4
563  
564 =item 51 - Invalid Field Name or ID
565  
566 You specified an invalid field name or id.
567  
568 =back
569  
570 =head2 legal_values
571  
572 $values = BZ::Client::Bug->legal_values( $client, $field )
573 @values = BZ::Client::Bug->legal_values( $client, $field )
574  
575 Tells you what values are allowed for a particular field.
576  
577 Note: This is deprecated in Bugzilla, use L</fields> instead.
578  
579 =head3 Parameters
580  
581 =over 4
582  
583 =item field
584  
585 The name of the field you want information about. This should be the same as the name you would use in L</create>, below.
586  
587 =item product_id
588  
589 If you're picking a product-specific field, you have to specify the id of the product you want the values for.
590  
591 =back
592  
593 =head3 Returns
594  
595 =over 4
596  
597 =item values
598  
599 An array or arrayref of strings: the legal values for this field. The values will be sorted as they normally would be in Bugzilla.
600  
601 =back
602  
603 =head3 Errors
604  
605 =over 4
606  
607 =item 106 - Invalid Product
608  
609 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).
610  
611 =item 108 - Invalid Field Name
612  
613 You specified a field that doesn't exist or isn't a drop-down field.
614  
615 =back
616  
617 =head1 FUNCTIONS FOR FINDING AND RETRIEVING BUGS
618  
619 This section lists the class methods pertaining to finding and retrieving bugs from your server.
620  
621 Listed here in order of what you most likely want to do... maybe?
622  
623 =head2 get
624  
625 @bugs = BZ::Client::Bug->get( $client, \%params );
626 $bugs = BZ::Client::Bug->get( $client, \%params );
627  
628 Gets information about particular bugs in the database.
629  
630 =head3 Parameters
631  
632 =over 4
633  
634 =item ids
635  
636 An array of numbers and strings.
637  
638 If an element in the array is entirely numeric, it represents a C<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.
639  
640 =item permissive
641  
642 I<permissive> (boolean) Normally, if you request any inaccessible or invalid bug ids, will throw an error.
643  
644 If this parameter is True, instead of throwing an error we return an array of hashes with a C<id>, C<faultString> and C<faultCode> for each bug that fails, and return normal information for the other bugs that were accessible.
645  
646 Note: marked as B<EXPERIMENTAL> in Bugzilla 4.4
647  
648 Added in Bugzilla 3.4.
649  
650 =back
651  
652 =head3 Returns
653  
654 An array or arrayref of bug instance objects with the given ID's.
655  
656 See L</INSTANCE METHODS> for how to use them.
657  
658 FIXME missing the I<faults> return values (added in 3.4)
659  
660 =head3 Errors
661  
662 =over 4
663  
664 =item 100 - Invalid Bug Alias
665  
666 If you specified an alias and there is no bug with that alias.
667  
668 =item 101 - Invalid Bug ID
669  
670 The bug_id you specified doesn't exist in the database.
671  
672 =item 102 - Access Denied
673  
674 You do not have access to the bug_id you specified.
675  
676 =back
677  
678 =head2 search
679  
680 FIXME Documentation not fully fleshed out
681  
682 @bugs = BZ::Client::Bug->search( $client, \%params );
683 $bugs = BZ::Client::Bug->search( $client, \%params );
684  
685 Searches for bugs matching the given parameters.
686  
687 =head3 Parameters
688  
689 This is just a quick example, there are lot's of fields
690  
691 %params = (
692  
693 'alias' => 'ACONVENIENTALIAS',
694  
695 'assigned_to' => 'hopefullynotme@domain.local',
696  
697 'creator' => 'littlejohnnytables@school.local',
698  
699 'severity' => 'major',
700  
701 'status' => 'OPEN',
702  
703 );
704  
705 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.
706  
707 See also L<https://bugzilla.readthedocs.io/en/5.0/api/core/v1/bug.html#search-bugs>
708  
709 =head3 Returns
710  
711 Returns an array or arrayref of bug instance objects with the given ID's.
712  
713 See L<INSTANCE METHODS> for how to use them.
714  
715 =head2 history
716  
717 @history = BZ::Client::Bug->history( $client, \%params );
718 $history = BZ::Client::Bug->history( $client, \%params );
719  
720 Gets the history of changes for particular bugs in the database.
721  
722 Added in Bugzilla 3.4.
723  
724 =head3 Parameters
725  
726 =over 4
727  
728 =item ids
729  
730 An array of numbers and strings.
731  
732 If an element in the array is entirely numeric, it represents a C<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.
733  
734 =back
735  
736 =head3 Returns
737  
738 An array or arrayref of hashes, containing the following keys:
739  
740 =over 4
741  
742 =item id
743  
744 I<id> (int) The numeric id of the bug
745  
746 =item alias
747  
748 I<alias> (array) The alias of this bug. If there is no alias, this will be undef.
749  
750 =item history
751  
752 I<history> (An array of hashes) - Each hash having the following keys:
753  
754 =over 4
755  
756 =item when
757  
758 I<when> (L<DateTime>) The date the bug activity/change happened.
759  
760 =item who
761  
762 I<who> (string) The login name of the user who performed the bug change.
763  
764 =item changes
765  
766 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:
767  
768 =over 4
769  
770 =item field_name
771  
772 I<field_name> (string) The name of the bug field that has changed.
773  
774 =item removed
775  
776 I<removed> (string) The previous value of the bug field which has been deleted by the change.
777  
778 =item added
779  
780 I<added> (string) The new value of the bug field which has been added by the change.
781  
782 =item attachment_id
783  
784 I<attachment_id> (int) The id of the attachment that was changed. This only appears if the change was to an attachment, otherwise L</attachment_id> will not be present in this hash.
785  
786 =back
787  
788 =back
789  
790 =back
791  
792 =head3 Errors
793  
794 =over 4
795  
796 =item 100 - Invalid Bug Alias
797  
798 If you specified an alias and there is no bug with that alias.
799  
800 =item 101 - Invalid Bug ID
801  
802 The bug_id you specified doesn't exist in the database.
803  
804 =item 102 - Access Denied
805  
806 You do not have access to the bug_id you specified.
807  
808 =back
809  
810 =head2 possible_duplicates
811  
812 @bugs = BZ::Client::Bug->possible_duplicates( $client, \%params );
813 $bugs = BZ::Client::Bug->possible_duplicates( $client, \%params );
814  
815 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.
816  
817 =head3 History
818  
819 Added in Bugzilla 4.0.
820  
821 =head3 Parameters
822  
823 =over 4
824  
825 =item summary
826  
827 I<summary> (string) A string of keywords defining the type of bug you are trying to report. B<Required>.
828  
829 =item product
830  
831 I<product> (array) One or more product names to narrow the duplicate search to. If omitted, all bugs are searched.
832  
833 =back
834  
835 =head3 Returns
836  
837 The same as L</get>.
838  
839 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.
840  
841 =head3 Errors
842  
843 =over 4
844  
845 =item 50 - Param Required
846  
847 You must specify a value for L</summary> containing a string of keywords to search for duplicates.
848  
849 =back
850  
851 =head1 FUNCTIONS FOR CREATING AND MODIFYING BUGS
852  
853 This section lists the class methods pertaining to the creation and modification of bugs.
854  
855 Listed here in order of what you most likely want to do... maybe?
856  
857 =head2 create
858  
859 my $id = BZ::Client::Bug->create( $client, \%params );
860  
861 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.
862  
863 You cannot currently set all the items here that you can set on enter_bug.cgi (i.e. the web page to enter bugs).
864  
865 The Bugzilla WebService API itself may allow you to set things other than those listed here, but realize that anything undocumented is B<UNSTABLE> and will very likely change in the future.
866  
867 =head3 History
868  
869 Before Bugzilla 3.0.4, parameters marked as B<Defaulted> were actually B<Required>, due to a bug in Bugzilla itself.
870  
871 The groups argument was added in Bugzilla B<4.0>. Before Bugzilla 4.0, bugs were only added into Mandatory groups by this method. Since Bugzilla B<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.
872  
873 The C<comment_is_private> argument was added in Bugzilla B<4.0>. Before Bugzilla 4.0, you had to use the undocumented C<commentprivacy> argument.
874  
875 Error C<116> was added in Bugzilla B<4.0>. Before that, dependency loop errors had a generic code of C<32000>.
876  
877 The ability to file new bugs with a C<resolution> was added in Bugzilla B<4.4>.
878  
879 =head3 Parameters
880  
881 Some params must be set, or an error will be thrown. These params are marked B<Required>.
882  
883 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 B<Defaulted>.
884  
885 Clients that want to be able to interact uniformly with multiple Bugzillas should always set both the params marked B<Required> and those marked B<Defaulted>, because some Bugzillas may not have defaults set for B<Defaulted> parameters, and then this method will throw an error if you don't specify them.
886  
887 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.
888  
889 =over 4
890  
891 =item product (string) B<Required> - The name of the product the bug is being filed against.
892  
893 I<product> (string) B<Required> - The name of the product the bug is being filed against.
894  
895 =item component
896  
897 I<component> (string) B<Required> - The name of a component in the product above.
898  
899 =item summary
900  
901 I<summary> (string) B<Required> - A brief description of the bug being filed.
902  
903 =item version
904  
905 I<version> (string) B<Required> - A version of the product above; the version the bug was found in.
906  
907 =item description
908  
909 I<description> (string) B<Defaulted> - The initial description for this bug. Some Bugzilla installations require this to not be blank.
910  
911 =item op_sys
912  
913 I<op_sys> (string) B<Defaulted> - The operating system the bug was discovered on.
914  
915 =item platform
916  
917 I<platform> (string) B<Defaulted> - What type of hardware the bug was experienced on.
918  
919 =item priority
920  
921 I<priority> (string) B<Defaulted> - What order the bug will be fixed in by the developer, compared to the developer's other bugs.
922  
923 =item severity
924  
925 I<severity> (string) B<Defaulted> - How severe the bug is.
926  
927 =item alias
928  
929 I<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.
930  
931 =item assigned_to
932  
933 I<assigned_to> (username) - A user to assign this bug to, if you don't want it to be assigned to the component owner.
934  
935 =item cc
936  
937 I<cc> (array) - An array of usernames to CC on this bug.
938  
939 =item comment_is_private
940  
941 I<comment_is_private> (boolean) - If set to true, the description is private, otherwise it is assumed to be public.
942  
943 =item groups
944  
945 I<groups> (array) - An array (ref) of group names to put this bug into. You can see valid group names on the I<Permissions tab> of the I<Preferences screen>, or, if you are an administrator, in the I<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 C<groups> as an empty array.)
946  
947 =item qa_contact
948  
949 I<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.
950  
951 =item status
952  
953 I<status> (string) - The status that this bug should start out as. Note that only certain statuses can be set on bug creation.
954  
955 =item resolution
956  
957 I<resolution> (string) - If you are filing a closed bug, then you will have to specify a resolution. You cannot currently specify a resolution of C<DUPLICATE> for new bugs, though. That must be done with L</update>.
958  
959 =item target_milestone
960  
961 I<target_milestone> (string) - A valid target milestone for this product.
962  
963 =item depends_on
964  
965 I<depends_on> (array) - An array of bug id's that this new bug should depend upon.
966  
967 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.
968  
969 =item blocks
970  
971 I<blocks> (array) - An array of bug id's that this new bug should block.
972  
973 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.
974  
975 =back
976  
977 B<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.
978  
979 =head3 Returns
980  
981 A hash with one element, C<id>. This is the id of the newly-filed bug.
982  
983 =head3 Errors
984  
985 =over 4
986  
987 =item 51 - Invalid Object
988  
989 You specified a field value that is invalid. The error message will have more details.
990  
991 =item 103 - Invalid Alias
992  
993 The alias you specified is invalid for some reason. See the error message for more details.
994  
995 =item 104 - Invalid Field
996  
997 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.
998  
999 =item 105 - Invalid Component
1000  
1001 You didn't specify a component.
1002  
1003 =item 106 - Invalid Product
1004  
1005 Either you didn't specify a product, this product doesn't exist, or you don't have permission to enter bugs in this product.
1006  
1007 =item 107 - Invalid Summary
1008  
1009 You didn't specify a summary for the bug.
1010  
1011 =item 116 - Dependency Loop
1012  
1013 You specified values in the blocks or depends_on fields that would cause a circular dependency between bugs.
1014  
1015 =item 120 - Group Restriction Denied
1016  
1017 You tried to restrict the bug to a group which does not exist, or which you cannot use with this product.
1018  
1019 =item 504 - Invalid User
1020  
1021 Either the QA Contact, Assignee, or CC lists have some invalid user in them. The error message will have more details.
1022  
1023 =back
1024  
1025 =head2 update
1026  
1027 my $id = BZ::Client::Bug->update( $client, \%params );
1028  
1029 Allows you to update the fields of a bug.
1030  
1031 (Your Bugzilla server may automatically sends emails out about the changes)
1032  
1033 =head3 History
1034  
1035 Added in Bugzilla B<4.0>.
1036  
1037 =head3 Parameters
1038  
1039 =over 4
1040  
1041 =item ids
1042  
1043 I<ids> (Array of C<int>s or C<string>s) - The ids or aliases of the bugs that you want to modify.
1044  
1045 B<Note:> All following fields specify the values you want to set on the bugs you are updating.
1046  
1047 =item alias
1048  
1049 I<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 C<ids>, passing in a value for C<alias> will cause an error to be thrown.
1050  
1051 =item assigned_to
1052  
1053 I<assigned_to> (string) - The full login name of the user this bug is assigned to.
1054  
1055 =item blocks
1056  
1057 I<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:
1058  
1059 =over 4
1060  
1061 =item add
1062  
1063 I<add> (Array of C<int>s) - Bug ids to add to this field.
1064  
1065 =item remove
1066  
1067 I<remove> (Array of C<int>s) - Bug ids to remove from this field. If the bug ids are not already in the field, they will be ignored.
1068  
1069 =item set
1070  
1071 I<set> (Array of C<int>s) - An exact set of bug ids to set this field to, overriding the current value. If you specify C<set>, then C<add> and C<remove> will be ignored.
1072  
1073 =back
1074  
1075 =item depends_on
1076  
1077 I<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:
1078  
1079 =over 4
1080  
1081 =item add
1082  
1083 I<add> (Array of C<int>s) - Bug ids to add to this field.
1084  
1085 =item remove
1086  
1087 I<remove> (Array of C<int>s) - Bug ids to remove from this field. If the bug ids are not already in the field, they will be ignored.
1088  
1089 =item set
1090  
1091 I<set> (Array of C<int>s) - An exact set of bug ids to set this field to, overriding the current value. If you specify C<set>, then C<add> and C<remove> will be ignored.
1092  
1093 =back
1094  
1095 =item cc
1096  
1097 I<cc> (hash) - The users on the cc list. To modify this field, pass a hash, which may have the following fields:
1098  
1099 =over 4
1100  
1101 =item add
1102  
1103 I<add> (Array of C<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.
1104  
1105 =item remove
1106  
1107 I<remove> (Array of C<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.
1108  
1109 =back
1110  
1111 =item is_cc_accessible
1112  
1113 I<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.
1114  
1115 =item comment
1116  
1117 I<comment> (hash) - A comment on the change. The hash may contain the following fields:
1118  
1119 =over 4
1120  
1121 =item body
1122  
1123 I<body> (string) - The actual text of the comment. B<Note:> For compatibility with the parameters to L</add_comment>, you can also call this field C<comment>, if you wish.
1124  
1125 =item is_private
1126  
1127 I<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.
1128  
1129 =back
1130  
1131 =item comment_is_private
1132  
1133 I<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 C<int> id of comments (not their count on a bug, like #1, #2, #3, but their globally-unique id, as returned by L</comments>) and the value is a C<boolean> which specifies whether that comment should become private (C<true>) or public (C<false>).
1134  
1135 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.
1136  
1137 =item component
1138 I<component> (string) - The Component the bug is in.
1139  
1140 =item deadline
1141  
1142 I<deadline> (string) - The Deadline field--a date specifying when the bug must be completed by, in the format C<YYYY-MM-DD>.
1143  
1144 =item dupe_of
1145  
1146 I<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 C<status> or C<resolution> fields. They will automatically be set by Bugzilla to the appropriate values for duplicate bugs.
1147  
1148 =item estimated_time
1149  
1150 I<estimated_time> (double) - The total estimate of time required to fix the bug, in hours. This is the I<total> estimate, not the amount of time remaining to fix it.
1151  
1152 =item groups
1153  
1154 I<groups> (hash) - The groups a bug is in. To modify this field, pass a hash, which may have the following fields:
1155  
1156 =over 4
1157  
1158 =item add
1159  
1160 I<add> (Array of C<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.
1161  
1162 =item remove
1163  
1164 I<remove> (Array of C<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.
1165  
1166 =back
1167  
1168 =item keywords
1169  
1170 I<keywords> (hash) - Keywords on the bug. To modify this field, pass a hash, which may have the following fields:
1171  
1172 =over 4
1173  
1174 =item add
1175  
1176 I<add> (An array of C<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.
1177  
1178 =item remove
1179  
1180 I<remove> (An array of C<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.
1181  
1182 =item set
1183  
1184 I<set> (An array of C<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. Specifying C<set> overrides C<add> and C<remove>.
1185  
1186 =back
1187  
1188 =item op_sys
1189  
1190 I<op_sys> (string) - The Operating System ("OS") field on the bug.
1191  
1192 =item platform
1193  
1194 I<platform> (string) - The Platform or "Hardware" field on the bug.
1195  
1196 =item priority
1197  
1198 I<priority> (string) - The Priority field on the bug.
1199  
1200 =item product
1201  
1202 I<product> (string) - The name of the product that the bug is in. If you change this, you will probably also want to change C<target_milestone>, C<version>, and C<component>, since those have different legal values in every product.
1203  
1204 If you cannot change the C<target_milestone> field, it will be reset to the default for the product, when you move a bug to a new product.
1205  
1206 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.
1207  
1208 B<Note:> that users can only move a bug into a product if they would normally have permission to file new bugs in that product.
1209  
1210 =item qa_contact
1211  
1212 I<qa_contact> (string) - The full login name of the bug's QA Contact.
1213  
1214 =item is_creator_accessible
1215  
1216 I<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.
1217  
1218 =item remaining_time
1219  
1220 I<remaining_time> (double) - How much work time is remaining to fix the bug, in hours. If you set C<work_time> but don't explicitly set C<remaining_time>, then the C<work_time> will be deducted from the bug's C<remaining_time>.
1221  
1222 =item reset_assigned_to
1223  
1224 I<reset_assigned_to> (boolean) - If true, the C<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.)
1225  
1226 =item reset_qa_contact
1227  
1228 I<reset_qa_contact> (boolean) - If true, the C<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.)
1229  
1230 =item resolution
1231  
1232 I<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 I<any> value (even an empty or null string) on an open bug will cause an error to be thrown.
1233  
1234 If you change the C<status> field to an open status, the resolution field will automatically be cleared, so you don't have to clear it manually.
1235  
1236 =item see_also
1237  
1238 I<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:
1239  
1240 =over 4
1241  
1242 =item add
1243  
1244 I<add> (An array of C<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.
1245  
1246 =item remove
1247  
1248 I<remove> (An array of C<string>s) - URLs to remove from the field. Invalid URLs will be ignored.
1249  
1250 =back
1251  
1252 =item severity
1253  
1254 I<severity> (string) - The Severity field of a bug.
1255  
1256 =item status
1257  
1258 I<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.
1259  
1260 =item summary
1261  
1262 I<summary> (string) - The Summary field of the bug.
1263  
1264 =item target_milestone
1265  
1266 I<target_milestone> (string) - The bug's Target Milestone.
1267  
1268 =item url
1269  
1270 I<url> (string) - The "URL" field of a bug.
1271  
1272 =item version
1273  
1274 I<version> (string) - The bug's Version field.
1275  
1276 =item whiteboard
1277  
1278 I<whiteboard> (string) - The Status Whiteboard field of a bug.
1279  
1280 =item work_time
1281  
1282 I<work_time> (double) - The number of hours worked on this bug as part of this change. If you set C<work_time> but don't explicitly set C<remaining_time>, then the C<work_time> will be deducted from the bug's remaining_time.
1283  
1284 =back
1285  
1286 B<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.
1287  
1288 =head3 Returns
1289  
1290 A C<hash> with a single field, "bugs". This points to an array of hashes with the following fields:
1291  
1292 =over 4
1293  
1294 =item id
1295  
1296 I<id> (int) - The id of the bug that was updated.
1297  
1298 =item alias
1299  
1300 I<alias> (string) - The alias of the bug that was updated, if this bug has an alias.
1301  
1302 =item last_change_time
1303  
1304 I<last_change_time> (L<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.
1305  
1306 =item changes
1307  
1308 I<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:
1309  
1310 =over 4
1311  
1312 =item added
1313  
1314 I<added> (string) - The values that were added to this field, possibly a comma-and-space-separated list if multiple values were added.
1315  
1316 =item removed
1317  
1318 I<removed> (string) - The values that were removed from this field, possibly a comma-and-space-separated list if multiple values were removed.
1319  
1320 =back
1321  
1322 =back
1323  
1324 Here's an example of what a return value might look like:
1325  
1326 {
1327 bugs => [
1328 {
1329 id => 123,
1330 alias => 'foo',
1331 last_change_time => '2010-01-01T12:34:56',
1332 changes => {
1333 status => {
1334 removed => 'NEW',
1335 added => 'ASSIGNED'
1336 },
1337 keywords => {
1338 removed => 'bar',
1339 added => 'qux, quo, qui',
1340 },
1341 },
1342 },
1343 ],
1344 }
1345  
1346 B<Note:> Currently, some fields are not tracked in changes: C<comment>, C<comment_is_private>, and C<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.
1347  
1348 =head3 Errors
1349  
1350 This function can throw all of the errors that L</get>, L</create>, and L</add_comment> can throw, plus:
1351  
1352 =over 4
1353  
1354 =item 50 - Empty Field
1355  
1356 You tried to set some field to be empty, but that field cannot be empty. The error message will have more details.
1357  
1358 =item 52 - Input Not A Number
1359  
1360 You tried to set a numeric field to a value that wasn't numeric.
1361  
1362 =item 54 - Number Too Large
1363  
1364 You tried to set a numeric field to a value larger than that field can accept.
1365  
1366 =item 55 - Number Too Small
1367  
1368 You tried to set a negative value in a numeric field that does not accept negative values.
1369  
1370 =item 56 - Bad Date/Time
1371  
1372 You specified an invalid date or time in a date/time field (such as the deadline field or a custom date/time field).
1373  
1374 =item 112 - See Also Invalid
1375  
1376 You attempted to add an invalid value to the see_also field.
1377  
1378 =item 115 - Permission Denied
1379  
1380 You don't have permission to change a particular field to a particular value. The error message will have more detail.
1381  
1382 =item 116 - Dependency Loop
1383  
1384 You specified a value in the blocks or depends_on fields that causes a dependency loop.
1385  
1386 =item 117 - Invalid Comment ID
1387  
1388 You specified a comment id in comment_is_private that isn't on this bug.
1389  
1390 =item 118 - Duplicate Loop
1391  
1392 You specified a value for dupe_of that causes an infinite loop of duplicates.
1393  
1394 =item 119 - dupe_of Required
1395  
1396 You changed the resolution to DUPLICATE but did not specify a value for the dupe_of field.
1397  
1398 =item 120 - Group Add/Remove Denied
1399  
1400 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.
1401  
1402 =item 121 - Resolution Required
1403  
1404 You tried to set the status field to a closed status, but you didn't specify a resolution.
1405  
1406 =item 122 - Resolution On Open Status
1407  
1408 This bug has an open status, but you specified a value for the resolution field.
1409  
1410 =item 123 - Invalid Status Transition
1411  
1412 You tried to change from one status to another, but the status workflow rules don't allow that change.
1413  
1414 =back
1415  
1416 =head2 update_see_also
1417  
1418 @changes = BZ::Client::Bug->update_see_also( $client, \%params );
1419 $changes = BZ::Client::Bug->update_see_also( $client, \%params );
1420  
1421 Adds or removes URLs for the I<See Also> field on bugs. These URLs must point to some valid bug in some Bugzilla installation or in Launchpad.
1422  
1423 =head3 History
1424  
1425 This is marked as B<EXPERIMENTAL> in Bugzilla 4.4
1426  
1427 Added in Bugzilla 3.4.
1428  
1429 =head3 Parameters
1430  
1431 =over 4
1432  
1433 =item ids
1434  
1435 An array of integers or strings. The IDs or aliases of bugs that you want to modify.
1436  
1437 =item add
1438  
1439 Array of strings. URLs to Bugzilla bugs. These URLs will be added to the I<See Also> field.
1440  
1441 If the URLs don't start with C<http://> or C<https://>, it will be assumed that C<http://> should be added to the beginning of the string.
1442  
1443 It is safe to specify URLs that are already in the I<See Also> field on a bug as they will just be silently ignored.
1444  
1445 =item remove
1446  
1447 An array of strings. These URLs will be removed from the I<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.
1448  
1449 If you specify a URL that is not in the I<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.
1450  
1451 =back
1452  
1453 B<Note:> If you specify the same URL in both L</add> and L</remove>, it will be added. (That is, L</add> overrides L</remove>.)
1454  
1455 =head3 Returns
1456  
1457 A hash or hashref where the keys are numeric bug ids and the contents are a hash with one key, C<see_also>.
1458  
1459 C<see_also> points to a hash, which contains two keys, C<added> and C<removed>.
1460  
1461 These are arrays of strings, representing the actual changes that were made to the bug.
1462  
1463 Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
1464  
1465 {
1466 1 => {
1467 see_also => {
1468 added => [(an array of bug URLs)],
1469 removed => [(an array of bug URLs)],
1470 }
1471 },
1472 2 => {
1473 see_also => {
1474 added => [(an array of bug URLs)],
1475 removed => [(an array of bug URLs)],
1476 }
1477 }
1478 }
1479  
1480 This return value allows you to tell what this method actually did.
1481  
1482 It is in this format to be compatible with the return value of a future L</update> method.
1483  
1484 =head3 Errors
1485  
1486 =over 4
1487  
1488 =item 100 - Invalid Bug Alias
1489  
1490 If you specified an alias and there is no bug with that alias.
1491  
1492 =item 101 - Invalid Bug ID
1493  
1494 The bug_id you specified doesn't exist in the database.
1495  
1496 =item 102 - Access Denied
1497  
1498 You do not have access to the bug_id you specified.
1499  
1500 =item 109 - Bug Edit Denied
1501  
1502 You did not have the necessary rights to edit the bug.
1503  
1504 =item 112 - Invalid Bug URL
1505  
1506 One of the URLs you provided did not look like a valid bug URL.
1507  
1508 =item 115 - See Also Edit Denied
1509  
1510 You did not have the necessary rights to edit the See Also field for this bug.
1511  
1512 Before Bugzilla 3.6, error 115 had a generic error code of 32000.
1513  
1514 =back
1515  
1516 =head2 update_tags
1517  
1518 @changes = BZ::Client::Bug->update_tags( $client, \%params );
1519 $changes = BZ::Client::Bug->update_tags( $client, \%params );
1520  
1521 Adds or removes tags on bugs.
1522  
1523 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.
1524  
1525 Bugzilla will lower case the text of the tags. This doesn't seem to be documented.
1526  
1527 B<Reminder:> to retrieve these tags, specify C<_extra> or the field name C<tags> in L</include_fields> when searching etc.
1528  
1529 =head3 History
1530  
1531 This is marked as B<UNSTABLE> in Bugzilla 4.4
1532  
1533 Added in Bugzilla 4.4.
1534  
1535 =head3 Parameters
1536  
1537 =over 4
1538  
1539 =item ids
1540  
1541 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.
1542  
1543 =item tags
1544  
1545 A hash representing tags to be added and/or removed. The hash has the following fields:
1546  
1547 =over 4
1548  
1549 =item add
1550  
1551 An array of strings representing tag names to be added to the bugs.
1552  
1553 It is safe to specify tags that are already associated with the bugs as they will just be silently ignored.
1554  
1555 =item remove
1556  
1557 An array of strings representing tag names to be removed from the bugs.
1558  
1559 It is safe to specify tags that are not associated with any bugs as they will just be silently ignored.
1560  
1561 =back
1562  
1563 =back
1564  
1565 =head3 Returns
1566  
1567 A hash or hashref where the keys are numeric bug ids and the contents are a hash with one key, C<tags>.
1568  
1569 C<tags> points to a hash, which contains two keys, C<added> and C<removed>.
1570  
1571 These are arrays of strings, representing the actual changes that were made to the bug.
1572  
1573 Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
1574  
1575 {
1576 1 => {
1577 tags => {
1578 added => [(an array of tags)],
1579 removed => [(an array of tags)],
1580 }
1581 },
1582 2 => {
1583 tags => {
1584 added => [(an array of tags)],
1585 removed => [(an array of tags)],
1586 }
1587 }
1588 }
1589  
1590 This return value allows you to tell what this method actually did.
1591  
1592 =head3 Errors
1593  
1594 =over 4
1595  
1596 =item 100 - Invalid Bug Alias
1597  
1598 If you specified an alias and there is no bug with that alias.
1599  
1600 =item 101 - Invalid Bug ID
1601  
1602 The bug_id you specified doesn't exist in the database.
1603  
1604 =item 102 - Access Denied
1605  
1606 You do not have access to the bug_id you specified.
1607  
1608 =back
1609  
1610 =head2 new
1611  
1612 my $bug = BZ::Client::Bug->new( id => $id );
1613  
1614 Creates a new bug object instance with the given ID.
1615  
1616 B<Note:> Doesn't actually touch your bugzilla server.
1617  
1618 See L</INSTANCE METHODS> for how to use it.
1619  
1620 =head1 INSTANCE METHODS
1621  
1622 This section lists the modules instance methods.
1623  
1624 Once you have a bug object, you can use these methods to inspect and manipulate the bug.
1625  
1626 =head2 id
1627  
1628 $id = $bug->id();
1629 $bug->id( $id );
1630  
1631 Gets or sets the bugs ID.
1632  
1633 =head2 alias
1634  
1635 $alias = $bug->alias();
1636 $bug->alias( $alias );
1637  
1638 Gets or sets the bugs alias. If there is no alias or aliases are disabled in Bugzilla,
1639 this will be an empty string.
1640  
1641 =head2 assigned_to
1642  
1643 $assigned_to = $bug->assigned_to();
1644 $bug->assigned_to( $assigned_to );
1645  
1646 Gets or sets the login name of the user to whom the bug is assigned.
1647  
1648 =head2 component
1649  
1650 $component = $bug->component();
1651 $bug->component( $component );
1652  
1653 Gets or sets the name of the current component of this bug.
1654  
1655 =head2 creation_time
1656  
1657 $dateTime = $bug->creation_time();
1658 $bug->creation_time( $dateTime );
1659  
1660 Gets or sets the date and time, when the bug was created.
1661  
1662 =head2 dupe_of
1663  
1664 $dupeOf = $bug->dupe_of();
1665 $bug->dupe_of( $dupeOf );
1666  
1667 Gets or sets the bug ID of the bug that this bug is a duplicate of. If this
1668 bug isn't a duplicate of any bug, this will be an empty int.
1669  
1670 =head2 is_open
1671  
1672 $isOpen = $bug->is_open();
1673 $bug->is_open( $isOpen );
1674  
1675 Gets or sets, whether this bug is closed. The return value, or parameter value
1676 is true (1) if this bug is open, false (0) if it is closed.
1677  
1678 =head2 last_change_time
1679  
1680 $lastChangeTime = $bug->last_change_time();
1681 $bug->last_change_time( $lastChangeTime );
1682  
1683 Gets or sets the date and time, when the bug was last changed.
1684  
1685 =head2 priority
1686  
1687 $priority = $bug->priority();
1688 $bug->priority( $priority );
1689  
1690 Gets or sets the priority of the bug.
1691  
1692 =head2 product
1693  
1694 $product = $bug->product();
1695 $bug->product( $product );
1696  
1697 Gets or sets the name of the product this bug is in.
1698  
1699 =head2 resolution
1700  
1701 $resolution = $bug->resolution();
1702 $bug->resolution( $resolution );
1703  
1704 Gets or sets the current resolution of the bug, or an empty string if the bug is open.
1705  
1706 =head2 severity
1707  
1708 $severity = $bug->severity();
1709 $bug->severity( $severity );
1710  
1711 Gets or sets the current severity of the bug.
1712  
1713 =head2 status
1714  
1715 $status = $bug->status();
1716 $bug->status( $status );
1717  
1718 Gets or sets the current status of the bug.
1719  
1720 =head2 summary
1721  
1722 $summary = $bug->summary();
1723 $bug->summary( $summary );
1724  
1725 Gets or sets the summary of this bug.
1726  
1727 =head1 ATTACHMENTS & COMMENTS
1728  
1729 These are implemented by other modules.
1730  
1731 See L<BZ::Client::Bug::Attachment> and L<BZ::Client::Bug::Comment>
1732  
1733 =head1 TODO
1734  
1735 Bugzilla 5.0. introduced the C<search_comment_tags> and C<update_comment_tags> methods,
1736 these are yet to be specifically implemented.
1737  
1738 =head1 SEE ALSO
1739  
1740 L<BZ::Client>, L<BZ::Client::Bug::Attachment>, L<BZ::Client::Bug::Comment>
1741  
1742 L<BZ::Client::API>,
1743 L<Bugzilla WebService 4.4 API|https://www.bugzilla.org/docs/4.4/en/html/api/Bugzilla/WebService/Bug.html>,
1744 L<Bugzilla WebService 5.0 API|https://www.bugzilla.org/docs/5.0/en/html/integrating/api/Bugzilla/WebService/Bug.html>
1745  
1746 =head1 AUTHORS
1747  
1748 =over 4
1749  
1750 =item *
1751  
1752 Dean Hamstead <dean@bytefoundry.com.au>
1753  
1754 =item *
1755  
1756 Jochen Wiedmann <jochen.wiedmann@gmail.com>
1757  
1758 =back
1759  
1760 =head1 COPYRIGHT AND LICENSE
1761  
1762 This software is copyright (c) 2017 by Dean Hamstad.
1763  
1764 This is free software; you can redistribute it and/or modify it under
1765 the same terms as the Perl 5 programming language system itself.
1766  
1767 =cut