* Fix bug #46524, adjust xml xmind import.

This commit is contained in:
caoyanyi
2024-03-05 14:17:41 +08:00
parent cf342d28fc
commit dd7b240965
2 changed files with 7 additions and 8 deletions
+4 -5
View File
@@ -1646,7 +1646,7 @@ class testcase extends control
$configList = $this->testcaseZen->buildXmindConfig();
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$configResult = $this->testcase->saveXmindConfig($configList);
$this->testcase->saveXmindConfig($configList);
$imoduleID = $this->post->imodule ? $this->post->imodule : 0;
$context = $this->testcaseZen->getXmindExport($productID, (int)$imoduleID, $branch);
@@ -1673,7 +1673,7 @@ class testcase extends control
$this->view->settings = $this->testcase->getXmindConfig();
$this->view->productName = $product->name;
$this->view->moduleID = $moduleID;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, ($branch === 'all' || !isset($branches[$branch])) ? '0' : $branch);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, 'case', 0, ($branch === 'all' || !isset($branches[$branch])) ? '0' : $branch);
$this->display();
}
@@ -1735,7 +1735,7 @@ class testcase extends control
/* Sav xmind config. */
$configList = $this->testcaseZen->buildXmindConfig();
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$configResult = $this->testcase->saveXmindConfig($configList);
$this->testcase->saveXmindConfig($configList);
/* 检查扩展名。*/
/* Check extension name of file. */
@@ -1795,7 +1795,6 @@ class testcase extends control
$product = $this->product->getByID($productID);
$branches = (isset($product->type) && $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
$folder = $this->session->xmindImport;
if($this->session->xmindImportType == 'xml')
{
$xmlPath = $this->session->xmindImport . '/content.xml';
@@ -1817,7 +1816,7 @@ class testcase extends control
$this->view->productID = $productID;
$this->view->branch = $branch;
$this->view->scenes = $scenes;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, ($branch === 'all' or !isset($branches[$branch])) ? '0' : $branch);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, 'case', 0, ($branch === 'all' or !isset($branches[$branch])) ? '0' : $branch);
$this->display();
}
+3 -3
View File
@@ -3117,6 +3117,7 @@ class testcaseZen extends testcase
$this->classFile->removeFile($tmpFile);
$this->classXmind = $this->app->loadClass('xmind');
if(file_exists($filePath . '/content.json'))
{
$fetchResult = $this->fetchByJSON($filePath, $productID, $branch);
@@ -3146,7 +3147,7 @@ class testcaseZen extends testcase
{
$file = $filePath . '/content.xml';
$xmlNode = simplexml_load_file($file);
$title = $xmlNode->sheet->topic->title;
$title = (string)$xmlNode->sheet->topic->title;
if(!is_string($title) || strlen($title) == 0) return array('result' => 'fail', 'message' => $this->lang->testcase->errorXmindUpload);
$pID = $productID;
@@ -3155,7 +3156,7 @@ class testcaseZen extends testcase
$tmpID = $this->classXmind->getBetween($title, '[', ']');
if(!empty($tmpID))
{
$product = $this->loadModel('product')->getByID($tmpID);
$product = $this->loadModel('product')->getByID((int)$tmpID);
if(!$product || $product->deleted) return array('result' => 'fail', 'message' => $this->lang->testcase->errorImportBadProduct);
$pID = $tmpID;
@@ -3184,7 +3185,6 @@ class testcaseZen extends testcase
if(strlen($title) == 0) return array('result' => 'fail', 'message' => $this->lang->testcase->errorXmindUpload);
$pID = $productID;
$this->classXmind = $this->app->loadClass('xmind');
if($this->classXmind->endsWith($title, ']'))
{
$tmpID = $this->classXmind->getBetween($title, '[', ']');