diff --git a/webtools/testopia/Bugzilla/Testopia/Attachment.pm b/webtools/testopia/Bugzilla/Testopia/Attachment.pm index 23a8e31e682..ca33238bd87 100644 --- a/webtools/testopia/Bugzilla/Testopia/Attachment.pm +++ b/webtools/testopia/Bugzilla/Testopia/Attachment.pm @@ -374,7 +374,7 @@ sub link_case { return; } - $dbh->do("INSERT INTO test_case_attachments (attachment_id, plan_id) + $dbh->do("INSERT INTO test_case_attachments (attachment_id, case_id) VALUES (?,?)", undef, ($self->id, $case_id)); $dbh->bz_unlock_tables(); diff --git a/webtools/testopia/template/en/default/testopia/case/clone.html.tmpl b/webtools/testopia/template/en/default/testopia/case/clone.html.tmpl index 7cb1124a494..4300fac36e6 100644 --- a/webtools/testopia/template/en/default/testopia/case/clone.html.tmpl +++ b/webtools/testopia/template/en/default/testopia/case/clone.html.tmpl @@ -75,6 +75,10 @@ Copy Document Yes No + + Copy Attachments + Yes No + Copy Tags Yes No diff --git a/webtools/testopia/tr_show_case.cgi b/webtools/testopia/tr_show_case.cgi index 7e240a076f3..dbdb3b69d9e 100755 --- a/webtools/testopia/tr_show_case.cgi +++ b/webtools/testopia/tr_show_case.cgi @@ -117,6 +117,12 @@ elsif ($action eq 'do_clone'){ my $newcaseid = $case->copy($pid, $author, $cgi->param('copy_doc')); $case->link_plan($pid, $newcaseid); $newcase = Bugzilla::Testopia::TestCase->new($newcaseid); + + if($cgi->param('copy_attachments')){ + foreach my $att (@{$case->attachments}){ + $att->link_case($newcaseid); + } + } if ($cgi->param('copy_tags')){ foreach my $tag (@{$case->tags}){ # Doing it this way avoids collisions