| 1 | #!/bin/false | ||
| 2 | # PODNAME: BZ::Client::Product | ||
| 3 | # ABSTRACT: Client side representation of a product in Bugzilla | ||
| 4 | # vim: softtabstop=4 tabstop=4 shiftwidth=4 ft=perl expandtab smarttab | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use warnings 'all'; | ||
| 8 | |||
| 9 | package BZ::Client::Product; | ||
| 10 | $BZ::Client::Product::VERSION = '4.9'; | ||
| 11 | |||
| 12 | use parent qw( BZ::Client::API ); | ||
| 13 | |||
| 14 | # See https://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html | ||
| 15 | |||
| 16 | ## functions | ||
| 17 | |||
| 18 | sub create { | ||
| 19 | my($class, $client, $params) = @_; | ||
| 20 | return $class->_create($client, 'Product.create', $params); | ||
| 21 | } | ||
| 22 | |||
| 23 | sub update { | ||
| 24 | my($class, $client, $params) = @_; | ||
| 25 | return $class->_returns_array($client, 'Product.update', $params, 'products'); | ||
| 26 | } | ||
| 27 | |||
| 28 | # convenience function | ||
| 29 | sub _get_list { | ||
| 30 | my($class, $methodName, $client) = @_; | ||
| 31 | my $result = $class->api_call($client, $methodName); | ||
| 32 | my $ids = $result->{'ids'}; | ||
| 33 | if (!$ids || 'ARRAY' ne ref($ids)) { | ||
| 34 | $class->error($client, 'Invalid reply by server, expected array of ids.'); | ||
| 35 | } | ||
| 36 | return $ids | ||
| 37 | } | ||
| 38 | |||
| 39 | sub get_selectable_products { | ||
| 40 | my($class, $client) = @_; | ||
| 41 | $client->log('debug', $class . '::get_selectable_products: Asking'); | ||
| 42 | my $result = $class->_get_list('Product.get_selectable_products', $client); | ||
| 43 | $client->log('debug', $class . '::get_selectable_products: Got ' . @$result); | ||
| 44 | return wantarray ? @$result : $result | ||
| 45 | } | ||
| 46 | |||
| 47 | sub get_enterable_products { | ||
| 48 | my($class, $client) = @_; | ||
| 49 | $client->log('debug', $class . '::get_enterable_products: Asking'); | ||
| 50 | my $result = $class->_get_list('Product.get_enterable_products', $client); | ||
| 51 | $client->log('debug', $class . '::get_enterable_products: Got ' . @$result); | ||
| 52 | return wantarray ? @$result : $result | ||
| 53 | } | ||
| 54 | |||
| 55 | sub get_accessible_products { | ||
| 56 | my($class, $client) = @_; | ||
| 57 | $client->log('debug', $class . '::get_accessible_products: Asking'); | ||
| 58 | my $result = $class->_get_list('Product.get_accessible_products', $client); | ||
| 59 | $client->log('debug', $class . '::get_accessible_products: Got ' . @$result); | ||
| 60 | return wantarray ? @$result : $result | ||
| 61 | } | ||
| 62 | |||
| 63 | # do everything in one place | ||
| 64 | sub _get { | ||
| 65 | my($class, $client, $result) = @_; | ||
| 66 | my $products = $result->{'products'}; | ||
| 67 | if (!$products or 'ARRAY' ne ref $products) { | ||
| 68 | $class->error($client, 'Invalid reply by server, expected array of products.'); | ||
| 69 | } | ||
| 70 | my @result; | ||
| 71 | for my $product (@$products) { | ||
| 72 | push @result, $class->new(%{$product}); | ||
| 73 | } | ||
| 74 | return wantarray ? @result : \@result | ||
| 75 | } | ||
| 76 | |||
| 77 | sub get_products { | ||
| 78 | my($class, $client, $params) = @_; | ||
| 79 | my $result = $class->api_call($client, 'Product.get_products', $params); | ||
| 80 | return $class->_get($client, $result) | ||
| 81 | } | ||
| 82 | |||
| 83 | sub get { | ||
| 84 | my($class, $client, $params) = @_; | ||
| 85 | my $result = $class->api_call($client, 'Product.get', $params); | ||
| 86 | return $class->_get($client, $result) | ||
| 87 | } | ||
| 88 | |||
| 89 | ## rw methods | ||
| 90 | |||
| 91 | sub name { | ||
| 92 | my $self = shift; | ||
| 93 | if (@_) { | ||
| 94 | $self->{'name'} = shift; | ||
| 95 | } | ||
| 96 | else { | ||
| 97 | return $self->{name}; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | sub description { | ||
| 102 | my $self = shift; | ||
| 103 | if (@_) { | ||
| 104 | $self->{'description'} = shift; | ||
| 105 | } | ||
| 106 | else { | ||
| 107 | return $self->{'description'}; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | |||
| 111 | sub version { | ||
| 112 | my $self = shift; | ||
| 113 | if (@_) { | ||
| 114 | $self->{'version'} = shift; | ||
| 115 | } | ||
| 116 | else { | ||
| 117 | return $self->{'version'}; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | ## boolean | ||
| 122 | sub has_unconfirmed { | ||
| 123 | my $self = shift; | ||
| 124 | if (@_) { | ||
| 125 | $self->{'has_unconfirmed'} = shift; | ||
| 126 | } | ||
| 127 | else { | ||
| 128 | return $self->{'has_unconfirmed'}; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | sub classification { | ||
| 133 | my $self = shift; | ||
| 134 | if (@_) { | ||
| 135 | $self->{'classification'} = shift; | ||
| 136 | } | ||
| 137 | else { | ||
| 138 | return $self->{'classification'}; | ||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 142 | sub default_milestone { | ||
| 143 | my $self = shift; | ||
| 144 | if (@_) { | ||
| 145 | $self->{'default_milestone'} = shift; | ||
| 146 | } | ||
| 147 | else { | ||
| 148 | return $self->{'default_milestone'}; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | ## boolean | ||
| 153 | sub is_open { | ||
| 154 | my $self = shift; | ||
| 155 | if (@_) { | ||
| 156 | $self->{'is_open'} = shift; | ||
| 157 | } | ||
| 158 | else { | ||
| 159 | return $self->{'is_open'}; | ||
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 | sub create_series { | ||
| 164 | my $self = shift; | ||
| 165 | if (@_) { | ||
| 166 | $self->{'create_series'} = shift; | ||
| 167 | } | ||
| 168 | else { | ||
| 169 | return $self->{'create_series'}; | ||
| 170 | } | ||
| 171 | } | ||
| 172 | |||
| 173 | ## ro methods | ||
| 174 | |||
| 175 | sub id { my $self = shift; return $self->{'id'} } | ||
| 176 | |||
| 177 | sub internals { my $self = shift; return $self->{'internals'} } | ||
| 178 | |||
| 179 | sub components { | ||
| 180 | my $self = shift; | ||
| 181 | return unless $self->{'components'}; | ||
| 182 | |||
| 183 | return wantarray ? @{$self->{'components'}} | ||
| 184 | : $self->{'components'} | ||
| 185 | } | ||
| 186 | |||
| 187 | |||
| 188 | sub versions { | ||
| 189 | my $self = shift; | ||
| 190 | return unless $self->{'versions'}; | ||
| 191 | |||
| 192 | return wantarray ? @{$self->{'versions'}} | ||
| 193 | : $self->{'versions'} | ||
| 194 | } | ||
| 195 | |||
| 196 | |||
| 197 | sub milestones { | ||
| 198 | my $self = shift; | ||
| 199 | return unless $self->{'milestones'}; | ||
| 200 | |||
| 201 | return wantarray ? @{$self->{'milestones'}} | ||
| 202 | : $self->{'milestones'} | ||
| 203 | } | ||
| 204 | |||
| 205 | 1; | ||
| 206 | |||
| 207 | __END__ | ||
| 208 | |||
| 209 | =pod | ||
| 210 | |||
| 211 | =encoding UTF-8 | ||
| 212 | |||
| 213 | =head1 NAME | ||
| 214 | |||
| 215 | BZ::Client::Product - Client side representation of a product in Bugzilla | ||
| 216 | |||
| 217 | =head1 VERSION | ||
| 218 | |||
| 219 | version 4.9 | ||
| 220 | |||
| 221 | =head1 SYNOPSIS | ||
| 222 | |||
| 223 | This class provides methods for accessing and managing products in Bugzilla. Instances | ||
| 224 | of this class are returned by L<BZ::Client::Product::get>. | ||
| 225 | |||
| 226 | my $client = BZ::Client->new( url => $url, | ||
| 227 | user => $user, | ||
| 228 | password => $password ); | ||
| 229 | |||
| 230 | my $ids = BZ::Client::Product->get_accessible_products( $client ); | ||
| 231 | my $products = BZ::Client::Product->get( $client, \%params ); | ||
| 232 | |||
| 233 | =head1 CLASS METHODS | ||
| 234 | |||
| 235 | This section lists the class methods, which are available in this module. | ||
| 236 | |||
| 237 | =head2 create | ||
| 238 | |||
| 239 | $id = BZ::Client::Product->create( $client, \%params ); | ||
| 240 | |||
| 241 | This allows you to create a new Product in Bugzilla. | ||
| 242 | |||
| 243 | =head3 History | ||
| 244 | |||
| 245 | Marked as experimental as of Bugzilla 5.0. | ||
| 246 | |||
| 247 | =head3 Parameters | ||
| 248 | |||
| 249 | Some params must be set, or an error will be thrown. These params are noted as Required. | ||
| 250 | |||
| 251 | =over 4 | ||
| 252 | |||
| 253 | =item name | ||
| 254 | |||
| 255 | I<name> (string) The name of this product. Must be globally unique within Bugzilla. | ||
| 256 | |||
| 257 | B<Required>. | ||
| 258 | |||
| 259 | =item description | ||
| 260 | |||
| 261 | I<description> (string) A description for this product. Allows some simple HTML. | ||
| 262 | |||
| 263 | B<Required>. | ||
| 264 | |||
| 265 | =item version | ||
| 266 | |||
| 267 | I<version> (string) The default version for this product. | ||
| 268 | |||
| 269 | B<Required>. | ||
| 270 | |||
| 271 | =item has_unconfirmed | ||
| 272 | |||
| 273 | I<has_unconfirmed> (boolean) Allow the UNCONFIRMED status to be set on bugs in this product. Default: true. | ||
| 274 | |||
| 275 | =item classification | ||
| 276 | |||
| 277 | I<classification> (string) The name of the Classification which contains this product. | ||
| 278 | |||
| 279 | =item default_milestone | ||
| 280 | |||
| 281 | I<default_milestone> (string) The default milestone for this product. Default '---'. | ||
| 282 | |||
| 283 | =item is_open | ||
| 284 | |||
| 285 | I<is_open> (boolean) True if the product is currently allowing bugs to be entered into it. Default: true. | ||
| 286 | |||
| 287 | =item create_series | ||
| 288 | |||
| 289 | I<create_series> (boolean) True if you want series for New Charts to be created for this new product. Default: true. | ||
| 290 | |||
| 291 | =back | ||
| 292 | |||
| 293 | =head3 Returns | ||
| 294 | |||
| 295 | The ID of the newly-filed product. | ||
| 296 | |||
| 297 | =head3 Errors | ||
| 298 | |||
| 299 | =over 4 | ||
| 300 | |||
| 301 | =item 51 - Classification does not exist | ||
| 302 | |||
| 303 | You must specify an existing classification name. | ||
| 304 | |||
| 305 | =item 700 - Product blank name | ||
| 306 | |||
| 307 | You must specify a non-blank name for this product. | ||
| 308 | |||
| 309 | =item 701 - Product name too long | ||
| 310 | |||
| 311 | The name specified for this product was longer than the maximum allowed length. | ||
| 312 | |||
| 313 | =item 702 - Product name already exists | ||
| 314 | |||
| 315 | You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.) | ||
| 316 | |||
| 317 | =item 703 - Product must have description | ||
| 318 | |||
| 319 | You must specify a description for this product. | ||
| 320 | |||
| 321 | =item 704 - Product must have version | ||
| 322 | |||
| 323 | You must specify a version for this product. | ||
| 324 | |||
| 325 | =back | ||
| 326 | |||
| 327 | =head2 update | ||
| 328 | |||
| 329 | $id = BZ::Client::Product->update( $client, \%params ); | ||
| 330 | |||
| 331 | This allows you to update a Group in Bugzilla. | ||
| 332 | |||
| 333 | =head3 History | ||
| 334 | |||
| 335 | As of Bugzilla 5.0. this is marked as experimental. | ||
| 336 | |||
| 337 | Added in Bugzilla 4.4. | ||
| 338 | |||
| 339 | =head3 Parameters | ||
| 340 | |||
| 341 | Either L</ids> or L</names> is required to select the bugs you want to update. | ||
| 342 | |||
| 343 | All other values change or set something in the product. | ||
| 344 | |||
| 345 | =over 4 | ||
| 346 | |||
| 347 | =item ids | ||
| 348 | |||
| 349 | I<ids> (array) Numeric ID's of the products you wish to update. | ||
| 350 | |||
| 351 | =item names | ||
| 352 | |||
| 353 | I<names> (array) Text names of the products that you wish to update. | ||
| 354 | |||
| 355 | =item default_milestone | ||
| 356 | |||
| 357 | I<default_milestone> (string) When a new bug is filed, what milestone does it | ||
| 358 | get by default if the user does not choose one? Must represent a milestone that | ||
| 359 | is valid for this product. | ||
| 360 | |||
| 361 | =item description | ||
| 362 | |||
| 363 | I<description> (string) Update the long description for these products to this value. | ||
| 364 | |||
| 365 | =item has_unconfirmed | ||
| 366 | |||
| 367 | I<has_unconfirmed> (boolean) Allow the UNCONFIRMED status to be set on bugs in this products. | ||
| 368 | |||
| 369 | =item is_open | ||
| 370 | |||
| 371 | I<is_open> (boolean) True if the product is currently allowing bugs to be entered into it. | ||
| 372 | Otherwise false. | ||
| 373 | |||
| 374 | =back | ||
| 375 | |||
| 376 | =head3 Returns | ||
| 377 | |||
| 378 | An array or arrayref of hashes containing the following: | ||
| 379 | |||
| 380 | =over 4 | ||
| 381 | |||
| 382 | =item id | ||
| 383 | |||
| 384 | I<id> (int) The ID of the product that was updated. | ||
| 385 | |||
| 386 | =item changes | ||
| 387 | |||
| 388 | The changes that were actually done on this product. The keys are the names of the | ||
| 389 | fields that were changed, and the values are a hash with two keys: | ||
| 390 | |||
| 391 | =over 4 | ||
| 392 | |||
| 393 | =item added | ||
| 394 | |||
| 395 | I<added> (string) The value that this field was changed to. | ||
| 396 | |||
| 397 | =item removed | ||
| 398 | |||
| 399 | I<removed> (string) The value that was previously set in this field. | ||
| 400 | |||
| 401 | =back | ||
| 402 | |||
| 403 | Note that booleans will be represented with the strings '1' and '0'. | ||
| 404 | |||
| 405 | Here's an example of what a return value might look like: | ||
| 406 | |||
| 407 | [ | ||
| 408 | { | ||
| 409 | id => 123, | ||
| 410 | changes => { | ||
| 411 | name => { | ||
| 412 | removed => 'FooName', | ||
| 413 | added => 'BarName' | ||
| 414 | }, | ||
| 415 | has_unconfirmed => { | ||
| 416 | removed => '1', | ||
| 417 | added => '0', | ||
| 418 | } | ||
| 419 | } | ||
| 420 | }, | ||
| 421 | \%etc | ||
| 422 | ], | ||
| 423 | |||
| 424 | =back | ||
| 425 | |||
| 426 | =head3 Errors | ||
| 427 | |||
| 428 | =over 4 | ||
| 429 | |||
| 430 | =item 700 - Product blank name | ||
| 431 | |||
| 432 | You must specify a non-blank name for this product. | ||
| 433 | |||
| 434 | =item 701 - Product name too long | ||
| 435 | |||
| 436 | The name specified for this product was longer than the maximum allowed length. | ||
| 437 | |||
| 438 | =item 702 - Product name already exists | ||
| 439 | |||
| 440 | You specified the name of a product that already exists. (Product names must be globally unique in Bugzilla.) | ||
| 441 | |||
| 442 | =item 703 - Product must have description | ||
| 443 | |||
| 444 | You must specify a description for this product. | ||
| 445 | |||
| 446 | =item 705 - Product must define a default milestone | ||
| 447 | |||
| 448 | You must define a default milestone. | ||
| 449 | |||
| 450 | =back | ||
| 451 | |||
| 452 | =head2 get_selectable_products | ||
| 453 | |||
| 454 | @products = BZ::Client::Product->get_selectable_products( $client ); | ||
| 455 | $products = BZ::Client::Product->get_selectable_products( $client ); | ||
| 456 | |||
| 457 | Returns a list of the ID's of the products the user can search on. | ||
| 458 | |||
| 459 | =head3 History | ||
| 460 | |||
| 461 | Marked as experimental as of Bugzilla 5.0. | ||
| 462 | |||
| 463 | =head3 Parameters | ||
| 464 | |||
| 465 | (none) | ||
| 466 | |||
| 467 | =head3 Returns | ||
| 468 | |||
| 469 | An array of product ID's | ||
| 470 | |||
| 471 | =head3 Errors | ||
| 472 | |||
| 473 | (none) | ||
| 474 | |||
| 475 | =head2 get_enterable_products | ||
| 476 | |||
| 477 | @products = BZ::Client::Product->get_enterable_products( $client ); | ||
| 478 | $products = BZ::Client::Product->get_enterable_products( $client ); | ||
| 479 | |||
| 480 | Returns a list of the ID's of the products the user can enter bugs against. | ||
| 481 | |||
| 482 | =head3 History | ||
| 483 | |||
| 484 | Marked as experimental as of Bugzilla 5.0. | ||
| 485 | |||
| 486 | =head3 Parameters | ||
| 487 | |||
| 488 | (none) | ||
| 489 | |||
| 490 | =head3 Returns | ||
| 491 | |||
| 492 | An array of product ID's | ||
| 493 | |||
| 494 | =head3 Errors | ||
| 495 | |||
| 496 | (none) | ||
| 497 | |||
| 498 | =head2 get_accessible_products | ||
| 499 | |||
| 500 | @products = BZ::Client::Product->get_selectable_products( $client ); | ||
| 501 | $products = BZ::Client::Product->get_selectable_products( $client ); | ||
| 502 | |||
| 503 | Returns a list of the ID's of the products the user can search or enter bugs against. | ||
| 504 | |||
| 505 | =head3 History | ||
| 506 | |||
| 507 | Marked as unstable as of Bugzilla 5.0. | ||
| 508 | |||
| 509 | =head3 Parameters | ||
| 510 | |||
| 511 | (none) | ||
| 512 | |||
| 513 | =head3 Returns | ||
| 514 | |||
| 515 | An array of product ID's | ||
| 516 | |||
| 517 | =head3 Errors | ||
| 518 | |||
| 519 | (none) | ||
| 520 | |||
| 521 | =head2 get | ||
| 522 | |||
| 523 | @products = BZ::Client::Product->get( $client, \%params ); | ||
| 524 | $products = BZ::Client::Product->get( $client, \%params ); | ||
| 525 | |||
| 526 | Returns a list of BZ::Client::Product instances based on the given parameters. | ||
| 527 | |||
| 528 | Note, that if the user tries to access a product that is not in the list of | ||
| 529 | accessible products for the user, or a product that does not exist, that is | ||
| 530 | silently ignored, and no information about that product is returned. | ||
| 531 | |||
| 532 | =head3 Parameters | ||
| 533 | |||
| 534 | In addition to the parameters below, this method also accepts the standard | ||
| 535 | L<BZ::Client::Bug/include_fields> and L<BZ::Client::Bug/exclude_fields> arguments. | ||
| 536 | |||
| 537 | Note: You must at least specify one of L</ids> or L</names>. | ||
| 538 | |||
| 539 | =over 4 | ||
| 540 | |||
| 541 | =item ids | ||
| 542 | |||
| 543 | I<ids> (array) An array of product ID's. | ||
| 544 | |||
| 545 | =item names | ||
| 546 | |||
| 547 | I<names> (array) An array of product names. | ||
| 548 | |||
| 549 | Added in Bugzilla 4.2. | ||
| 550 | |||
| 551 | =item type | ||
| 552 | |||
| 553 | The group of products to return. Valid values are: C<accessible> (default), | ||
| 554 | C<selectable>, and C<enterable>. L</type> can be a single value or an array | ||
| 555 | of values if more than one group is needed with duplicates removed. | ||
| 556 | |||
| 557 | =back | ||
| 558 | |||
| 559 | =head3 Returns | ||
| 560 | |||
| 561 | An array or arrayref of bug instance objects with the given ID's. | ||
| 562 | |||
| 563 | See L</INSTANCE METHODS> for how to use them. | ||
| 564 | |||
| 565 | =head3 Errors | ||
| 566 | |||
| 567 | (none) | ||
| 568 | |||
| 569 | =head2 get_products | ||
| 570 | |||
| 571 | Compatibilty with Bugzilla 3.0 API. Exactly equivalent to L</get>. | ||
| 572 | |||
| 573 | =head2 new | ||
| 574 | |||
| 575 | my $product = BZ::Client::Product->new( id => $id, | ||
| 576 | name => $name, | ||
| 577 | description => $description ); | ||
| 578 | |||
| 579 | Creates a new instance with the given ID, name, and description. | ||
| 580 | |||
| 581 | =head1 INSTANCE METHODS | ||
| 582 | |||
| 583 | This section lists the modules instance methods. | ||
| 584 | |||
| 585 | =head2 id | ||
| 586 | |||
| 587 | $id = $product->id(); | ||
| 588 | |||
| 589 | Gets the products ID. | ||
| 590 | |||
| 591 | Read only. | ||
| 592 | |||
| 593 | =head2 name | ||
| 594 | |||
| 595 | $name = $product->name(); | ||
| 596 | $product->name( $name ); | ||
| 597 | |||
| 598 | Gets or sets the products name. | ||
| 599 | |||
| 600 | =head2 description | ||
| 601 | |||
| 602 | $description = $product->description(); | ||
| 603 | $product->description( $description ); | ||
| 604 | |||
| 605 | Gets or sets the products description. | ||
| 606 | |||
| 607 | =head2 version | ||
| 608 | |||
| 609 | $version = $product->version(); | ||
| 610 | $product->version( $version ); | ||
| 611 | |||
| 612 | Gets or sets the products version. | ||
| 613 | |||
| 614 | (Set only works for new products, not updates) | ||
| 615 | |||
| 616 | =head2 has_unconfirmed | ||
| 617 | |||
| 618 | $bool = $product->has_unconfirmed(); | ||
| 619 | $product->has_unconfirmed( $bool ); | ||
| 620 | |||
| 621 | Gets or sets the products has_unconfirmed setting. | ||
| 622 | |||
| 623 | Added in Bugzilla 4.2 as a replacement for L</internals>. | ||
| 624 | |||
| 625 | =head2 classification | ||
| 626 | |||
| 627 | $classification = $product->classification(); | ||
| 628 | $product->classification( $classification ); | ||
| 629 | |||
| 630 | Gets or sets the products classification. | ||
| 631 | |||
| 632 | Added in Bugzilla 4.2 as a replacement for L</internals>. | ||
| 633 | |||
| 634 | =head2 default_milestone | ||
| 635 | |||
| 636 | $milestone = $product->default_milestone(); | ||
| 637 | $product->default_milestone( $milestone ); | ||
| 638 | |||
| 639 | Gets or sets the products default milestone. | ||
| 640 | |||
| 641 | Added in Bugzilla 4.2 as a replacement for L</internals>. | ||
| 642 | |||
| 643 | =head2 is_open | ||
| 644 | |||
| 645 | $bool = $product->is_open(); | ||
| 646 | $product->is_open( $bool ); | ||
| 647 | |||
| 648 | Gets or sets the products is_open setting. | ||
| 649 | |||
| 650 | =head2 create_series | ||
| 651 | |||
| 652 | $series = $product->create_series(); | ||
| 653 | $product->create_series( $series ); | ||
| 654 | |||
| 655 | Gets or sets the products is_open setting. | ||
| 656 | |||
| 657 | =head2 components | ||
| 658 | |||
| 659 | @components = $product->components(); | ||
| 660 | $components = $product->components(); | ||
| 661 | |||
| 662 | An array of hashes, where each hash describes a component, and has the following items: | ||
| 663 | |||
| 664 | =over 4 | ||
| 665 | |||
| 666 | =item id | ||
| 667 | |||
| 668 | I<id> (int) An integer ID uniquely identifying the component in this installation only. | ||
| 669 | |||
| 670 | =item name | ||
| 671 | |||
| 672 | I<name> (string) The name of the component. This is a unique identifier for this component. | ||
| 673 | |||
| 674 | =item description | ||
| 675 | |||
| 676 | I<description> (string) A description of the component, which may contain HTML. | ||
| 677 | |||
| 678 | =item default_assigned_to | ||
| 679 | |||
| 680 | I<default_assigned_to> (string) The login name of the user to whom new bugs will be assigned | ||
| 681 | by default. | ||
| 682 | |||
| 683 | =item default_qa_contact | ||
| 684 | |||
| 685 | I<default_qa_contact> (string) The login name of the user who will be set as the QA Contact | ||
| 686 | for new bugs by default. Empty string if the QA contact is not defined. | ||
| 687 | |||
| 688 | =item sort_key | ||
| 689 | |||
| 690 | I<sort_key> (int) Components, when displayed in a list, are sorted first by this integer and | ||
| 691 | then secondly by their name. | ||
| 692 | |||
| 693 | =item is_active | ||
| 694 | |||
| 695 | I<is_active> (boolean) A boolean indicating if the component is active. Inactive components | ||
| 696 | are not enabled for new bugs. | ||
| 697 | |||
| 698 | =item flag_types | ||
| 699 | |||
| 700 | Added in Bugzilla 4.4. | ||
| 701 | |||
| 702 | A hash containing the two items bug and attachment that each contains an array of hashes, where | ||
| 703 | each hash describes a flagtype, and has the following items: | ||
| 704 | |||
| 705 | =over 4 | ||
| 706 | |||
| 707 | =item id | ||
| 708 | |||
| 709 | I<id> (int) Returns the ID of the flagtype. | ||
| 710 | |||
| 711 | =item name | ||
| 712 | |||
| 713 | I<name> (string) Returns the name of the flagtype. | ||
| 714 | |||
| 715 | =item description | ||
| 716 | |||
| 717 | I<description> (string) Returns the description of the flagtype. | ||
| 718 | |||
| 719 | =item cc_list | ||
| 720 | |||
| 721 | I<cc_list> (string) Returns the concatenated CC list for the flagtype, as a single string. | ||
| 722 | |||
| 723 | =item sort_key | ||
| 724 | |||
| 725 | I<sort_key> (int) Returns the sortkey of the flagtype. | ||
| 726 | |||
| 727 | =item is_active | ||
| 728 | |||
| 729 | I<is_active> (boolean) Returns whether the flagtype is active or disabled. Flags being in a | ||
| 730 | disabled flagtype are not deleted. It only prevents you from adding new flags to it. | ||
| 731 | |||
| 732 | =item is_requestable | ||
| 733 | |||
| 734 | I<is_requestable> (boolean) Returns whether you can request for the given flagtype (i.e. | ||
| 735 | whether the '?' flag is available or not). | ||
| 736 | |||
| 737 | =item is_requesteeble | ||
| 738 | |||
| 739 | I<is_requesteeble> (boolean) Returns whether you can ask someone specifically or not. | ||
| 740 | |||
| 741 | =item is_multiplicable | ||
| 742 | |||
| 743 | I<is_multiplicable> (boolean) Returns whether you can have more than one flag for the given | ||
| 744 | flagtype in a given bug/attachment. | ||
| 745 | |||
| 746 | =item grant_group | ||
| 747 | |||
| 748 | I<grant_group> (int) the group ID that is allowed to grant/deny flags of this type. If the | ||
| 749 | item is not included all users are allowed to grant/deny this flagtype. | ||
| 750 | |||
| 751 | =item request_group | ||
| 752 | |||
| 753 | I<request_group> (int) the group ID that is allowed to request the flag if the flag is of | ||
| 754 | the type requestable. If the item is not included all users are allowed request this flagtype. | ||
| 755 | |||
| 756 | =back | ||
| 757 | |||
| 758 | =back | ||
| 759 | |||
| 760 | Added in Bugzilla 4.2 as a replacement for L</internals>. | ||
| 761 | |||
| 762 | =head2 versions | ||
| 763 | |||
| 764 | $versions = $product->versions(); | ||
| 765 | |||
| 766 | Added in Bugzilla 4.2 as a replacement for L</internals>. | ||
| 767 | |||
| 768 | Returns an array of hashes, where each hash describes a version, and has the | ||
| 769 | following items: C<name>, C<sort_key> and C<is_active>. | ||
| 770 | |||
| 771 | =head2 milestones | ||
| 772 | |||
| 773 | $milestones = $product->milestones(); | ||
| 774 | |||
| 775 | Returns an array of hashes, where each hash describes a milestones, and has the | ||
| 776 | following items: C<name>, C<sort_key> and C<is_active>. | ||
| 777 | |||
| 778 | Added in Bugzilla 4.2 as a replacement for L</internals>. | ||
| 779 | |||
| 780 | =head2 internals | ||
| 781 | |||
| 782 | Returned by L</get> until version 4.2, at which point it was dropped. | ||
| 783 | Remains for compatibility. Please move away from using it asap. | ||
| 784 | |||
| 785 | =head1 EXCEPTION HANDLING | ||
| 786 | |||
| 787 | See L<BZ::Client::Exception> | ||
| 788 | |||
| 789 | =head1 SEE ALSO | ||
| 790 | |||
| 791 | L<BZ::Client>, L<BZ::Client::API>, L<Bugzilla API|https://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html> | ||
| 792 | |||
| 793 | =head1 AUTHORS | ||
| 794 | |||
| 795 | =over 4 | ||
| 796 | |||
| 797 | =item * | ||
| 798 | |||
| 799 | Dean Hamstead <dean@bytefoundry.com.au> | ||
| 800 | |||
| 801 | =item * | ||
| 802 | |||
| 803 | Jochen Wiedmann <jochen.wiedmann@gmail.com> | ||
| 804 | |||
| 805 | =back | ||
| 806 | |||
| 807 | =head1 COPYRIGHT AND LICENSE | ||
| 808 | |||
| 809 | This software is copyright (c) 2026 by Dean Hamstad. | ||
| 810 | |||
| 811 | This is free software; you can redistribute it and/or modify it under | ||
| 812 | the same terms as the Perl 5 programming language system itself. | ||
| 813 | |||
| 814 | =cut |