diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-06-08 14:01:13 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-12-06 11:30:11 +0100 |
commit | 8a4c2433edc19ca110339004d658ed54586c76d0 (patch) | |
tree | b67c7642309bb91d53f4055ec868853c36cb6915 | |
parent | 2580ee8590332b1bc9aee8ce1becf890686ddbc1 (diff) | |
download | bugzilla-8a4c2433edc19ca110339004d658ed54586c76d0.tar.gz bugzilla-8a4c2433edc19ca110339004d658ed54586c76d0.tar.xz |
Flyspray: Add multiple asignees as CC
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | Bugzilla/Migrate/Flyspray.pm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 9317d1a36..1de8fbf43 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -302,17 +302,14 @@ sub _read_bugs { t.date_opened, t.last_edited_time, t.mark_private, - a.user_id assigned_to, ls.status_name, t.is_closed, lr.resolution_name, lv.version_name FROM $fsdb.${fsprfx}tasks t - LEFT OUTER JOIN $fsdb.${fsprfx}assigned a ON a.task_id = t.task_id LEFT OUTER JOIN $fsdb.${fsprfx}list_status ls ON ls.status_id = t.item_status LEFT OUTER JOIN $fsdb.${fsprfx}list_resolution lr ON lr.resolution_id = t.resolution_reason LEFT OUTER JOIN $fsdb.${fsprfx}list_version lv ON lv.version_id = t.product_version - GROUP BY t.task_id, a.task_id ORDER BY t.task_id "); $sth->execute(); @@ -369,15 +366,31 @@ sub _read_bugs { }; } + my %bug_cc; + +# assignee(s) +# a bug can be assigned to multiple people in FS. assign to one of them in BZ and add the rest to CC + my $assignee_sth = $self->{dbh}->prepare_cached(" + SELECT user_id + FROM $fsdb.${fsprfx}assigned WHERE task_id = ?"); + $assignee_sth->execute($row->{task_id}); + if (my $row = $assignee_sth->fetchrow_hashref()) { + $bug->{assigned_to} = $self->_get_username($row->{user_id}); + while (my $row = $assignee_sth->fetchrow_hashref()) { + $bug_cc{$self->_get_username($row->{user_id})} = 1; + } + } + # CC/bug watchers my $cc_sth = $self->{dbh}->prepare_cached(" SELECT user_id FROM $fsdb.${fsprfx}notifications WHERE task_id = ?"); $cc_sth->execute($row->{task_id}); while (my $row = $cc_sth->fetchrow_hashref()) { - push @{$bug->{cc}}, $self->_get_username($row->{user_id}); + $bug_cc{$self->_get_username($row->{user_id})} = 1; } + $bug->{cc} = [keys %bug_cc]; # fetch comments my $comments_sth = $self->{dbh}->prepare_cached(" |