summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-06-08 14:01:13 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-06-08 14:01:13 +0200
commit286e6789c1a6f59535e25e020ecbb45d0857ea11 (patch)
treea5dcd6d8af8454742afef4968aee451876690792 /Bugzilla
parent6ccafca0d69ab705f7d098ce3e0922ea2cea8ece (diff)
downloadbugzilla-286e6789c1a6f59535e25e020ecbb45d0857ea11.tar.gz
bugzilla-286e6789c1a6f59535e25e020ecbb45d0857ea11.tar.xz
Flyspray: Add multiple asignees as CC
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Migrate/Flyspray.pm21
1 files changed, 17 insertions, 4 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm
index 9063466cc..af1b3fa01 100644
--- a/Bugzilla/Migrate/Flyspray.pm
+++ b/Bugzilla/Migrate/Flyspray.pm
@@ -283,17 +283,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();
@@ -344,15 +341,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("