Last Comment Bug 455055 - "Copy category to new product" is not working

git-svn-id: svn://10.0.0.236/trunk@255352 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ghendricks%novell.com 2008-12-05 00:30:21 +00:00
parent 6f9d0dea0a
commit 2ba0820f5a
2 changed files with 13 additions and 8 deletions

View File

@ -1159,6 +1159,7 @@ CaseClonePanel = function(product_id, cases){
id: 'case_clone_frm',
border: false,
frame: true,
autoScroll: true,
bodyStyle: 'padding: 10px',
labelWidth: 250,
height: 280,
@ -1231,11 +1232,11 @@ CaseClonePanel = function(product_id, cases){
Ext.getCmp('case_copy_plan_ids').setValue(getSelectedObjects(Ext.getCmp('plan_clone_grid'), 'plan_id'));
var form = Ext.getCmp('case_clone_frm').getForm();
var params = form.getValues();
params.action = 'clone';
params.ids = cases;
form.baseParams = {};
form.baseParams.action = 'clone';
form.baseParams.ids = cases;
form.submit({
url: 'tr_list_cases.cgi',
params: params,
success: function(form, data){
if (params.copy_cases){
if (data.result.tclist.length ==1){
@ -1269,7 +1270,11 @@ CaseClonePanel = function(product_id, cases){
});
}
Ext.getCmp('case-clone-win').close();
Ext.getCmp('case_plan_grid').store.reload();
try{
Ext.getCmp('case_plan_grid').store.reload();
}
catch (err){};
},
failure: testopiaError
});

View File

@ -30,6 +30,7 @@ use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Category;
use Bugzilla::Testopia::TestCase;
use Bugzilla::Testopia::TestCaseRun;
use Bugzilla::Testopia::TestPlan;
@ -147,7 +148,7 @@ elsif ($action eq 'clone'){
my $product = Bugzilla::Testopia::Product->new($cgi->param('product_id'));
ThrowUserError('invalid-test-id-non-existent', {type => 'Product', id => $cgi->param('product_id')}) unless $product;
if ($cgi->param('copy_categories')){
if ($cgi->param('copy_category')){
ThrowUserError('testopia-read-only', {'object' => $product}) unless $product->canedit;
}
@ -163,7 +164,7 @@ elsif ($action eq 'clone'){
my $case_author = $cgi->param('keep_author') ? $case->author->id : Bugzilla->user->id;
my $case_tester = $cgi->param('keep_tester') ? $case->default_tester->id : Bugzilla->user->id;
my $category;
if ($cgi->param('copy_categories')){
if ($cgi->param('copy_category')){
my $category_id = check_case_category($case->category->name, $product);
if (! $category_id){
$category = Bugzilla::Testopia::Category->create({
@ -175,7 +176,6 @@ elsif ($action eq 'clone'){
else {
$category = Bugzilla::Testopia::Category->new($category_id);
}
}
else {
if ($product->id == $case->category->product_id){
@ -196,7 +196,7 @@ elsif ($action eq 'clone'){
}
}
}
my $caseid = $case->copy($case_author, $case_tester, $cgi->param('copy_doc') eq 'on' ? 1 : 0, $category->id);
my $newcase = Bugzilla::Testopia::TestCase->new($caseid);
push @newcases, $newcase->id;