Repository: Nitrate/Nitrate

Issue:
What do following options mean when clone cases?
- Copy the component to new product you specific (Unchecking will remove component of copied test case)
- Copy the attachments to new product you specific (Unchecking will remove attachments of copied test case)

@jianchen2580 

What do following options mean when clone cases?
- Copy the component to new product you specific (Unchecking will remove component of copied test case)
- Copy the attachments to new product you specific (Unchecking will remove attachments of copied test case)

@jianchen2580 



Discussion:
If "Copy component" checked, the components which belong to origin testcase(s) will add to new testcase(s).
If "Copy attacments" checked, the attachments will cloned (create new TestCaseAttachment record here) and attached to new testcase(s).

>  If "Copy attacments" checked, the attachments will cloned (create new TestCaseAttachment record here) and attached to new testcase(s).

do not make a copy of the attachment file, right?

If "Copy component" checked, the components which belong to origin testcase(s) will add to new testcase(s).
If "Copy attacments" checked, the attachments will cloned (create new TestCaseAttachment record here) and attached to new testcase(s).

>  If "Copy attacments" checked, the attachments will cloned (create new TestCaseAttachment record here) and attached to new testcase(s).

do not make a copy of the attachment file, right?


Resolving patch:
diff --git a/tcms/testcases/forms.py b/tcms/testcases/forms.py
--- a/tcms/testcases/forms.py
+++ b/tcms/testcases/forms.py
@@ -471,7 +471,7 @@ class CloneCaseForm(forms.Form):
     )
     copy_case = forms.BooleanField(
         label='Create a copy',
-        help_text='Create a Copy (Unchecking will create a link to selected '
+        help_text='Create a copy (Unchecking will create a link to selected '
                   'case)',
         required=False
     )
@@ -488,14 +488,14 @@ class CloneCaseForm(forms.Form):
         required=False
     )
     copy_component = forms.BooleanField(
-        label='Copy the component to new product you specific',
-        help_text='Copy the component to new product you specific ('
-                  'Unchecking will remove component of copied test case)',
+        label='Copy test case components to the product of selected Test Plan',
+        help_text='Copy test case components to the product of selected Test Plan ('
+                  'Unchecking will remove components from copied test case)',
         required=False
     )
     copy_attachment = forms.BooleanField(
         label='Copy the attachments',
-        help_text='Copy the attachments to new product you specific ('
+        help_text='Copy test case attachments ('
                   'Unchecking will remove attachments of copied test case)',
         required=False
     )
diff --git a/tcms/testplans/views.py b/tcms/testplans/views.py
--- a/tcms/testplans/views.py
+++ b/tcms/testplans/views.py
@@ -10,6 +10,7 @@
 from django.contrib.auth.decorators import user_passes_test
 from django.core.exceptions import ObjectDoesNotExist
 from django.core.urlresolvers import reverse
+from django.core import serializers
 from django.db.models import Count
 from django.db.models import Q
 from django.http import HttpResponse, HttpResponseRedirect
@@ -241,6 +242,21 @@ def all(request, template_name='plan/all.html'):
         # But it does not seem to work
         search_form = SearchPlanForm(initial={'is_active': True})
 
+    if request.GET.get('action') == 'clone_case':
+        template_name = 'case/clone_select_plan.html'
+        tps = tps.order_by('name')
+
+    if request.GET.get('t') == 'ajax':
+        return HttpResponse(serializers.serialize(
+            request.GET.get('f', 'json'),
+            tps,
+            extras=('num_cases', 'num_runs', 'num_children', 'get_url_path')
+        ))
+
+    if request.GET.get('t') == 'html':
+        if request.GET.get('f') == 'preview':
+            template_name = 'plan/preview.html'
+
     query_url = remove_from_request_path(request, 'order_by')
     if asc:
         query_url = remove_from_request_path(query_url, 'asc')


Test patch: