/
Extension.pm
736 lines (639 loc) · 36.5 KB
/
Extension.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Scrums Bugzilla Extension.
#
# The Initial Developer of the Original Code is "Nokia corporation"
# Portions created by the Initial Developer are Copyright (C) 2011 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Visa Korhonen <visa.korhonen@symbio.com>
# Stephen Jayna <ext-stephen.jayna@nokia.com>
package Bugzilla::Extension::Scrums;
use strict;
use base qw(Bugzilla::Extension);
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Group;
use Bugzilla::User;
use Bugzilla::Extension::Scrums::Teams;
use Bugzilla::Extension::Scrums::Releases;
use Bugzilla::Extension::Scrums::Sprintslib;
use Bugzilla::Extension::Scrums::LoadTestData;
use Bugzilla::Extension::Scrums::DebugLibrary;
use Bugzilla::Util qw(trick_taint);
our $VERSION = '1.0';
use constant CONST_FEATURE => "feature";
use constant CONST_TASK => "task";
sub bug_end_of_update {
my ($self, $args) = @_;
my ($bug, $old_bug, $timestamp, $changes) = @$args{qw(bug old_bug timestamp changes)};
if (my $status_change = $changes->{'bug_status'} and ($bug->bug_severity() eq CONST_FEATURE or $bug->bug_severity() eq CONST_TASK)) {
my $old_status = new Bugzilla::Status({ name => $status_change->[0] });
my $new_status = new Bugzilla::Status({ name => $status_change->[1] });
if (!$new_status->is_open && $old_status->is_open) {
# close ! It seems, that remaining time can not be tested because it is set zero while closing.
my $estimated_time = $bug->estimated_time();
my $actual_time = $bug->actual_time();
my $filling_forced = 0;
my $precondition_enabled_severity = Bugzilla->params->{"scrums_precondition_enabled_severity"};
foreach my $enabled_severity (@$precondition_enabled_severity) {
if ($enabled_severity eq $bug->bug_severity()) {
$filling_forced = 1;
}
}
if ($filling_forced) {
if ($estimated_time == 0) {
ThrowUserError("scrums_estimated_time_required");
}
elsif ($actual_time == 0) {
ThrowUserError("scrums_actual_time_required");
}
}
}
}
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
# If the initial description has been updated we need
# to take care of updated the database to reflect this.
# Find out whether the user is a member of the group
# that can change the initial description.
# This ensures we only apply this change to the bug that
# is being updated. Not, for example, a bug that is having
# duplicate notation added to it.
if ($bug->bug_id eq $cgi->param('id')) {
if (Bugzilla->user->in_group('setfeature')) {
# Current bug description
my $description = ${ @{ $bug->comments }[0] }{'thetext'};
# Current bug descriptions comment id (in longdescs table)
my $comment_id = ${ @{ $bug->comments }[0] }{'comment_id'};
# Possibly new description
my $thetext = $cgi->param('comment_text_0');
if ($thetext) {
trick_taint($thetext);
# Taken from Bug (_check_comment) ~ Line 1152
$thetext =~ s/\s*$//s;
$thetext =~ s/\r\n?/\n/g; # Get rid of \r.
if ($description ne $thetext) {
# There has been a change, update the description.
$dbh->do('UPDATE longdescs SET thetext = ? WHERE bug_id = ? and comment_id = ?', undef, $thetext, $bug->bug_id, $comment_id);
# Append a comment to the end of the bug stating that
# the description has been updated.
$thetext = "The feature's description has been updated.\n";
my $delta_ts = $dbh->selectrow_array("SELECT NOW()");
$dbh->do(
"INSERT INTO longdescs (bug_id, who, bug_when, thetext)
VALUES (?,?,?,?)", undef,
$bug->bug_id, Bugzilla->user->id, $delta_ts, $thetext
);
}
}
}
}
return;
}
sub buglist_supptables {
my ($self, $args) = @_;
my $supptables = $args->{'supptables'};
my $fields = $args->{'fields'};
# Add this table to what can be referenced in MySQL when displaying search results.
foreach my $field (@$fields) {
if (($field eq 'scrums_team_order') || ($field eq 'scrums_release_order') || ($field eq 'scrums_program_order')) {
push(@$supptables, 'LEFT JOIN scrums_bug_order ON scrums_bug_order.bug_id = bugs.bug_id');
}
elsif ($field eq 'scrums_blocked') {
push(@$supptables, 'LEFT JOIN dependencies ON dependencies.dependson = bugs.bug_id');
}
elsif ($field eq 'sprint_name') {
push(@$supptables, 'LEFT JOIN scrums_sprint_bug_map ON scrums_sprint_bug_map.bug_id = bugs.bug_id');
push(@$supptables, 'LEFT JOIN scrums_sprints ON scrums_sprints.id = scrums_sprint_bug_map.sprint_id ');
}
}
return;
}
sub buglist_columns {
my ($self, $args) = @_;
my $columns = $args->{'columns'};
# Describe how to access the extra columns described in colchange_columns()
$columns->{'scrums_team_order'} = { 'name' => 'scrums_bug_order.team', 'title' => 'Team Order' };
$columns->{'scrums_release_order'} = { 'name' => 'scrums_bug_order.rlease', 'title' => 'Release Order' };
$columns->{'scrums_program_order'} = { 'name' => 'scrums_bug_order.program', 'title' => 'Program Order' };
$columns->{'scrums_blocked'} = { 'name' => 'dependencies.blocked', 'title' => 'Parent' };
$columns->{'sprint_name'} = { 'name' => 'scrums_sprints.name', 'title' => 'Sprint' };
return;
}
sub colchange_columns {
my ($self, $args) = @_;
my $columns = $args->{'columns'};
# Make these columns available for diplaying in the colchange.cgi dialog
push(@$columns, "scrums_team_order");
push(@$columns, "scrums_release_order");
push(@$columns, "scrums_program_order");
push(@$columns, "scrums_blocked");
push(@$columns, "sprint_name");
return;
}
sub buglist_supp_legal_fields {
my ($self, $args) = @_;
my $fields = $args->{'fields'};
my $supp_fields = eval { Bugzilla::Field->match({ name => 'scrums_sprint_bug_map.sprint_id' }) } || [];
if (@{$supp_fields}) {
push(@{$fields}, @{$supp_fields}[0]);
}
else {
my $sprint = Bugzilla::Field->create({ name => 'scrums_sprint_bug_map.sprint_id', description => 'Sprint ID' });
push(@{$fields}, $sprint);
}
return;
}
sub db_schema_abstract_schema {
my ($self, $args) = @_;
my $schema = $args->{schema};
# extension table for 'bugs': includes order nr for programme, release, team
$schema->{'scrums_bug_order'} = {
FIELDS => [
bug_id => {
TYPE => 'INT3',
NOTNULL => 1,
PRIMARYKEY => 1,
REFERENCES => {
TABLE => 'bugs',
COLUMN => 'bug_id',
DELETE => 'CASCADE'
}
},
team => { TYPE => 'INT3' },
rlease => { TYPE => 'INT3' },
program => { TYPE => 'INT3' },
]
};
# "componentteam" indicates, that sub-component (component in database) has been assigned responsible team.
$schema->{'scrums_componentteam'} = {
FIELDS => [
component_id => {
TYPE => 'INT2',
NOTNULL => 1,
PRIMARYKEY => 1,
REFERENCES => {
TABLE => 'components',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
teamid => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'scrums_team',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
],
};
# "scrums_flagtype_release_map" maps allowed flag types into releases
$schema->{'scrums_flagtype_release_map'} = {
FIELDS => [
release_id => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'scrums_releases',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
flagtype_id => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'flagtypes',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
],
};
# "release" is managed unit, that contains tasks
$schema->{'scrums_releases'} = {
FIELDS => [
id => { TYPE => 'SMALLSERIAL', NOTNULL => 1, PRIMARYKEY => 1 },
name => { TYPE => 'varchar(255)', NOTNULL => 1 },
target_milestone_begin => { TYPE => 'varchar(20)' },
target_milestone_end => { TYPE => 'varchar(20)' },
capacity_algorithm => { TYPE => 'varchar(255)' },
original_capacity => { TYPE => 'INT3' },
remaining_capacity => { TYPE => 'INT3' },
],
};
$schema->{'scrums_sprints'} = {
FIELDS => [
id => { TYPE => 'SMALLSERIAL', NOTNULL => 1, PRIMARYKEY => 1 },
team_id => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'scrums_team',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
name => { TYPE => 'varchar(255)', NOTNULL => 1 },
status => { TYPE => 'varchar(20)', NOTNULL => 1 },
description => { TYPE => 'varchar(255)' },
item_type => { TYPE => 'INT2', NOTNULL => 1, DEFAULT => '1' },
start_date => { TYPE => 'DATE' },
end_date => { TYPE => 'DATE' },
estimated_capacity => { TYPE => 'decimal(7,2)' },
]
};
# "team" is unit, which is reponsible for sub-component (component in database).
$schema->{'scrums_team'} = {
FIELDS => [
id => {
TYPE => 'SMALLSERIAL',
NOTNULL => 1,
PRIMARYKEY => 1
},
name => { TYPE => 'varchar(50)', NOTNULL => 1 },
owner => {
TYPE => 'INT3',
NOTNULL => 1,
REFERENCES => {
TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'
}
},
scrum_master => {
TYPE => 'INT3',
REFERENCES => {
TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'
}
},
weekly_velocity_value => { TYPE => 'decimal(7,2)' },
weekly_velocity_start => { TYPE => 'DATE' },
weekly_velocity_end => { TYPE => 'DATE' },
],
};
# "teammember" is user, who belongs to team.
$schema->{'scrums_teammember'} = {
FIELDS => [
teamid => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'scrums_team',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
userid => {
TYPE => 'INT3',
NOTNULL => 1,
REFERENCES => {
TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'
}
},
],
INDEXES => [
scrums_teammember_value_unique_idx => {
FIELDS => [qw(teamid userid)],
TYPE => 'UNIQUE'
},
],
};
$schema->{'scrums_sprint_bug_map'} = {
FIELDS => [
bug_id => {
TYPE => 'INT3',
NOTNULL => 1,
REFERENCES => {
TABLE => 'bugs',
COLUMN => 'bug_id',
DELETE => 'CASCADE'
}
},
sprint_id => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'scrums_sprints',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
]
};
# "scrums_sprint_estimate" is sprint capacity of a user, who belongs to team.
$schema->{'scrums_sprint_estimate'} = {
FIELDS => [
sprintid => {
TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {
TABLE => 'scrums_sprints',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
userid => {
TYPE => 'INT3',
NOTNULL => 1,
REFERENCES => {
TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'
}
},
estimated_capacity => { TYPE => 'decimal(4,2)', NOTNULL => 1, DEFAULT => '0.00' },
],
INDEXES => [
scrums_sprint_estimate_unique_idx => {
FIELDS => [qw(sprintid userid)],
TYPE => 'UNIQUE'
},
],
};
$schema->{'scrums_item_list_history'} = {
FIELDS => [
bug_id => {
TYPE => 'INT3',
NOTNULL => 1,
REFERENCES => {
TABLE => 'bugs',
COLUMN => 'bug_id',
DELETE => 'CASCADE'
}
},
from_sprint_id => {
TYPE => 'INT2',
REFERENCES => {
TABLE => 'scrums_sprints',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
to_sprint_id => {
TYPE => 'INT2',
REFERENCES => {
TABLE => 'scrums_sprints',
COLUMN => 'id',
DELETE => 'CASCADE'
}
},
from_team_order => { TYPE => 'INT3' },
to_team_order => { TYPE => 'INT3' },
userid => {
TYPE => 'INT3',
NOTNULL => 1,
REFERENCES => {
TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'
}
},
update_ts => { TYPE => 'DATETIME', NOTNULL => 1 },
]
};
}
sub install_update_db {
use constant WV_VALUE_DEFINITION => { TYPE => 'decimal(7,2)' };
use constant WV_START_DEFINITION => { TYPE => 'DATE' };
use constant WV_END_DEFINITION => { TYPE => 'DATE' };
Bugzilla->dbh->bz_add_column("scrums_team", "weekly_velocity_value", WV_VALUE_DEFINITION, undef);
Bugzilla->dbh->bz_add_column("scrums_team", "weekly_velocity_start", WV_START_DEFINITION, undef);
Bugzilla->dbh->bz_add_column("scrums_team", "weekly_velocity_end", WV_END_DEFINITION, undef);
use constant SPRINT_TYPE_DEFINITION => { TYPE => 'INT2', NOTNULL => 1, DEFAULT => '1' };
use constant SPRINT_START_DATE_DEFINITION => { TYPE => 'DATE' };
use constant SPRINT_END_DATE_DEFINITION => { TYPE => 'DATE' };
Bugzilla->dbh->bz_add_column("scrums_sprints", "item_type", SPRINT_TYPE_DEFINITION, undef);
Bugzilla->dbh->bz_add_column("scrums_sprints", "start_date", SPRINT_START_DATE_DEFINITION, undef);
Bugzilla->dbh->bz_add_column("scrums_sprints", "end_date", SPRINT_END_DATE_DEFINITION, undef);
use constant TEAM_SCRUM_MASTER => {
TYPE => 'INT3',
REFERENCES => {
TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'
}
};
Bugzilla->dbh->bz_add_column("scrums_team", "scrum_master", TEAM_SCRUM_MASTER, undef);
use constant CAPACITY_DEFINITION => { TYPE => 'decimal(7,2)' };
Bugzilla->dbh->bz_add_column("scrums_sprints", "estimated_capacity", CAPACITY_DEFINITION, undef);
Bugzilla->dbh->bz_drop_column("scrums_sprints", "nominal_schedule");
Bugzilla->dbh->bz_drop_column("scrums_sprints", "is_active");
return;
}
sub install_before_final_checks {
my ($self, $args) = @_;
my $name = "scrums_editteams";
my $description = "Can edit responsible teams";
my $isbuggroup = 1;
my $isactive = 0;
my $group = new Bugzilla::Group({ name => $name });
if (!$group) {
my $old_name = "editteams";
$group = new Bugzilla::Group({ name => $old_name, description => $description });
if ($group) {
$group->set_name($name);
$group->update();
}
else {
$group = Bugzilla::Group->create({ name => $name, description => $description, isbuggroup => $isbuggroup, isactive => $isactive });
}
}
}
sub page_before_template {
my ($self, $args) = @_;
my ($vars, $page) = @$args{qw(vars page_id)};
# User is stored as variable for user authorization
$vars->{'user'} = Bugzilla->user;
# Loading Test Data
if ($page eq 'scrums/loadtestdata.html') {
load_test_data($vars);
}
if ($page eq 'scrums/testing_utility.html') {
my $cgi = Bugzilla->cgi;
my $action = $cgi->param('action');
if ($action eq "add") {
debug_function1($vars);
}
elsif ($action eq "remove") {
debug_function2($vars);
}
elsif ($action eq "add_n_move") {
debug_function3($vars);
}
elsif ($action eq "move2") {
debug_function4($vars);
}
}
# Teams
elsif ($page eq 'scrums/scrums.html') {
my $teams = Bugzilla::Extension::Scrums::Team->user_teams(Bugzilla->user->id());
$vars->{'teams'} = $teams;
my @sprints;
for my $team (@{$teams}) {
my $sprint = $team->get_team_current_sprint();
# When there is no active sprint, undef is pushed.
push(@sprints, $sprint);
}
$vars->{'sprints'} = \@sprints;
}
elsif ($page eq 'scrums/allteams.html') {
show_all_teams($vars);
}
elsif ($page eq 'scrums/createteam.html') {
show_create_team($vars);
}
elsif ($page eq 'scrums/addintoteam.html') {
if (not Bugzilla->user->in_group('scrums_editteams')) {
ThrowUserError('auth_failure', { group => "scrums_editteams", action => "edit", object => "team" });
}
add_into_team($vars);
}
elsif ($page eq 'scrums/searchperson.html') {
search_person($vars);
}
elsif ($page eq 'scrums/newteam.html') {
edit_team($vars);
}
elsif ($page eq 'scrums/ajaxsprintbugs.html') {
my $cgi = Bugzilla->cgi;
my $schema = $cgi->param('schema');
if ($schema eq "newsprint") {
$vars->{'editsprint'} = 1;
#$cgi->param('editsprint') = 1;
$cgi->param(-name => 'editsprint', -value => 'true');
my $sprintid = _new_sprint($vars);
#my $sprintid = edit_sprint($vars);
$cgi->param(-name => 'sprintid', -value => $sprintid);
#$vars->{'sprintid'} = $sprintid;
#$cgi->param('sprintid') = 1;
ajax_sprint_bugs($vars);
#show_team_and_sprints($vars);
}
elsif ($schema eq "editsprint") {
$vars->{'editsprint'} = 1;
show_team_and_sprints($vars);
ajax_sprint_bugs($vars);
}
else {
ajax_sprint_bugs($vars);
}
}
elsif ($page eq 'scrums/teambugs.html') {
show_team_and_sprints($vars);
}
elsif ($page eq 'scrums/teambugs.html' || $page eq 'scrums/dailysprint.html') {
show_team_and_sprints($vars);
}
elsif ($page eq 'scrums/backlogplanning.html') {
show_backlog_and_items($vars);
}
elsif ($page eq 'scrums/archivedsprints.html') {
show_archived_sprints($vars);
}
elsif ($page eq "scrums/ajax.html") {
my $cgi = Bugzilla->cgi;
my $schema = $cgi->param('schema');
if ($schema eq "personcapacity") {
my $data = $cgi->param('data');
handle_person_capacity($data, $vars);
}
elsif ($schema eq "release") {
handle_release_bug_data($vars);
}
elsif ($schema eq "backlog") {
update_team_bugs($vars, 1); # backlog => must by owner to edit
}
elsif ($schema eq "team") {
update_team_bugs($vars, 0); # team => must be member to edit
}
elsif ($schema eq "bugmove") {
move_bug_in_sprint($vars);
}
else {
$vars->{'errors'} = "Unknown schema";
}
}
elsif ($page eq 'scrums/newsprint.html') {
edit_sprint($vars);
}
# Releases
if ($page eq 'scrums/allreleases.html') {
all_releases($vars);
}
elsif ($page eq 'scrums/createrelease.html') {
create_release($vars);
}
elsif ($page eq 'scrums/newrelease.html') {
edit_release($vars);
}
elsif ($page eq 'scrums/releasebugs.html') {
show_release_bugs($vars);
}
elsif ($page eq 'scrums/choose-classification.html') {
my $cgi = Bugzilla->cgi;
my $team_id = $cgi->param('teamid');
my @classifications = Bugzilla::Classification->get_all();
$vars->{'classifications'} = \@classifications;
$vars->{'target'} = "page.cgi?id=scrums/choose-product.html&teamid=" . $team_id;
}
elsif ($page eq 'scrums/choose-product.html') {
my $cgi = Bugzilla->cgi;
my $team_id = $cgi->param('teamid');
my $class_name = $cgi->param('classification');
my $classification_list = Bugzilla::Classification->match({ name => $class_name });
my $classification = @$classification_list[0];
my $enterable_products = $classification->products();
my @classifications = ({ object => $classification, products => $enterable_products });
$vars->{'classifications'} = \@classifications;
$vars->{'target'} = "page.cgi?id=scrums/choose-component.html&teamid=" . $team_id;
}
elsif ($page eq 'scrums/choose-component.html') {
my $cgi = Bugzilla->cgi;
my $team_id = $cgi->param('teamid');
my $product_name = $cgi->param('product');
my $products = Bugzilla::Product->match({ name => $product_name });
if (scalar @{$products} > 0) {
$vars->{'product'} = @$products[0];
}
$vars->{'target'} = "page.cgi?id=scrums/createteam.html&teamid=" . $team_id;
}
elsif ($page eq 'scrums/sprintburndown.html') {
my $cgi = Bugzilla->cgi;
my $sprint_id = $cgi->param('sprintid');
sprint_summary($vars, $sprint_id);
}
return;
}
sub config {
my ($self, $args) = @_;
my $config = $args->{config};
$config->{Scrums} = "Bugzilla::Extension::Scrums::ConfigScrums";
return;
}
sub config_add_panels {
my ($self, $args) = @_;
my $modules = $args->{panel_modules};
$modules->{Scrums} = "Bugzilla::Extension::Scrums::ConfigScrums";
return;
}
# This must be the last line of your extension.
__PACKAGE__->NAME;