Merge branch 'zdoo18'

This commit is contained in:
wangyidong
2022-06-08 17:06:07 +08:00
17 changed files with 242 additions and 64 deletions
+3
View File
@@ -0,0 +1,3 @@
DELETE FROM `zt_workflowaction` WHERE `module`='story' AND `action`='browse';
DELETE FROM `zt_workflowaction` WHERE `module`='task' AND `action`='browse';
DELETE FROM `zt_workflowaction` WHERE `module`='build' AND `action`='browse';
+1 -1
View File
@@ -285,7 +285,7 @@ function formatTime($time, $format = '')
{
$time = str_replace('0000-00-00', '', $time);
$time = str_replace('00:00:00', '', $time);
if(trim($time) == '') return ;
if(trim($time) == '') return '';
if($format) return date($format, strtotime($time));
return trim($time);
}
+3 -3
View File
@@ -103,10 +103,10 @@ class model extends baseModel
if($action->extensionType == 'override') return $this->loadModel('flow')->buildActionMenu($moduleName, $action, $data, $type);
$conditions = json_decode($action->conditions);
if($action->extensionType == 'extend' && $conditions)
if($action->extensionType == 'extend')
{
$enabled = $this->loadModel('flow')->checkConditions($conditions, $data);
$label = $action->name;
$title = $action->name;
if($conditions) $enabled = $this->loadModel('flow')->checkConditions($conditions, $data);
}
else
{
+14 -1
View File
@@ -91,7 +91,7 @@ class html extends baseHTML
$string .= "<input type='checkbox' name='{$name}[]' value='$key' ";
$string .= (strpos($checked, ",$key,") !== false) ? " checked ='checked'" : "";
$string .= $attrib;
$string .= " id='$name$key' /> ";
$string .= " id='$name$key' title='{$value}'/> ";
$string .= "<label for='$name$key'>" . $value . '</label></div>';
}
return $string;
@@ -391,6 +391,19 @@ class html extends baseHTML
*/
class js extends baseJS
{
/**
* Open a new app window.
*
* @param string $app
* @param string $url
* @static
* @access public
* @return string
*/
static public function openEntry($app, $url)
{
return self::start() . "$.apps.open('$url', '$app')" . self::end();
}
}
/**
+10
View File
@@ -938,10 +938,12 @@ class bugModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->stripTags($this->config->bug->editor->assignto['id'], $this->config->allowedTags)
->remove('comment,showModule')
->join('mailto', ',')
->get();
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->assignto['id'], $this->post->uid);
$this->dao->update(TABLE_BUG)
->data($bug)
->autoCheck()
@@ -973,10 +975,12 @@ class bugModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->stripTags($this->config->bug->editor->confirmbug['id'], $this->config->allowedTags)
->remove('comment')
->join('mailto', ',')
->get();
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->confirmbug['id'], $this->post->uid);
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq($bugID)->exec();
if(!dao::isError())
@@ -1044,8 +1048,10 @@ class bugModel extends model
->setDefault('resolvedDate', $now)
->setDefault('assignedTo', $oldBug->openedBy)
->removeIF($this->post->resolution != 'duplicate', 'duplicateBug')
->stripTags($this->config->bug->editor->resolve['id'], $this->config->allowedTags)
->remove('files,labels')
->get();
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->resolve['id'], $this->post->uid);
/* Set comment lang for alert error. */
$this->lang->bug->comment = $this->lang->comment;
@@ -1319,6 +1325,7 @@ class bugModel extends model
->setDefault('lastEditedDate', $now)
->setDefault('activatedDate', $now)
->setDefault('activatedCount', (int)$oldBug->activatedCount)
->stripTags($this->config->bug->editor->activate['id'], $this->config->allowedTags)
->add('id', $bugID)
->add('resolution', '')
->add('status', 'active')
@@ -1334,6 +1341,7 @@ class bugModel extends model
->remove('comment,files,labels')
->get();
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->activate['id'], $this->post->uid);
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq((int)$bugID)->exec();
$this->dao->update(TABLE_BUG)->set('activatedCount = activatedCount + 1')->where('id')->eq((int)$bugID)->exec();
@@ -1380,9 +1388,11 @@ class bugModel extends model
->setDefault('lastEditedDate', $now)
->setDefault('closedBy', $this->app->user->account)
->setDefault('closedDate', $now)
->stripTags($this->config->bug->editor->close['id'], $this->config->allowedTags)
->remove('comment')
->get();
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->close['id'], $this->post->uid);
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq((int)$bugID)->exec();
if($oldBug->execution)
{
+1 -1
View File
@@ -1920,7 +1920,7 @@ EOD;
if(strtolower($key) == 'closeddate' && $value == '') continue;
if(strtolower($key) == 'actualcloseddate' && $value == '') continue;
if(isset($old->$key) and $value != stripslashes($old->$key))
if(array_key_exists($key, $old) and $value != stripslashes($old->$key))
{
$diff = '';
if(substr_count($value, "\n") > 1 or
+10
View File
@@ -818,9 +818,11 @@ class executionModel extends model
->setDefault('status', 'doing')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->stripTags($this->config->execution->editor->start['id'], $this->config->allowedTags)
->remove('comment')
->get();
$execution = $this->loadModel('file')->processImgURL($execution, $this->config->execution->editor->start['id'], $this->post->uid);
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->check($this->config->execution->start->requiredFields, 'notempty')
@@ -849,6 +851,7 @@ class executionModel extends model
$execution = fixer::input('post')
->add('id', $executionID)
->stripTags($this->config->execution->editor->putoff['id'], $this->config->allowedTags)
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment')
@@ -857,6 +860,7 @@ class executionModel extends model
if($this->config->systemMode == 'new') $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end);
if(dao::isError()) return false;
$execution = $this->loadModel('file')->processImgURL($execution, $this->config->execution->editor->putoff['id'], $this->post->uid);
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->checkFlow()
@@ -884,8 +888,10 @@ class executionModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('suspendedDate', helper::today())
->stripTags($this->config->execution->editor->suspend['id'], $this->config->allowedTags)
->remove('comment')->get();
$execution = $this->loadModel('file')->processImgURL($execution, $this->config->execution->editor->suspend['id'], $this->post->uid);
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->checkFlow()
@@ -913,6 +919,7 @@ class executionModel extends model
->setDefault('status', 'doing')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->stripTags($this->config->execution->editor->activate['id'], $this->config->allowedTags)
->remove('comment,readjustTime,readjustTask')
->get();
@@ -922,6 +929,7 @@ class executionModel extends model
unset($execution->end);
}
$execution = $this->loadModel('file')->processImgURL($execution, $this->config->execution->editor->activate['id'], $this->post->uid);
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->checkFlow()
@@ -995,11 +1003,13 @@ class executionModel extends model
->setDefault('closedDate', $now)
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->stripTags($this->config->execution->editor->close['id'], $this->config->allowedTags)
->remove('comment')
->get();
$this->lang->error->ge = $this->lang->execution->ge;
$execution = $this->loadModel('file')->processImgURL($execution, $this->config->execution->editor->close['id'], $this->post->uid);
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->check($this->config->execution->close->requiredFields,'notempty')
+5 -2
View File
@@ -872,11 +872,14 @@ class productModel extends model
{
$oldProduct = $this->getById($productID);
$now = helper::now();
$product= fixer::input('post')
$product = fixer::input('post')
->add('id', $productID)
->setDefault('status', 'closed')
->remove('comment')->get();
->stripTags($this->config->product->editor->close['id'], $this->config->allowedTags)
->remove('comment')
->get();
$product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->close['id'], $this->post->uid);
$this->dao->update(TABLE_PRODUCT)->data($product)
->autoCheck()
->checkFlow()
+22 -1
View File
@@ -1582,13 +1582,18 @@ class projectModel extends model
$oldProject = $this->getById($projectID, $type);
$now = helper::now();
$editorIdList = $this->config->project->editor->start['id'];
if($this->app->rawModule == 'program') $editorIdList = $this->config->program->editor->start['id'];
$project = fixer::input('post')
->add('id', $projectID)
->setDefault('status', 'doing')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->stripTags($editorIdList, $this->config->allowedTags)
->remove('comment')->get();
$project = $this->loadModel('file')->processImgURL($project, $editorIdList, $this->post->uid);
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->check($this->config->project->start->requiredFields, 'notempty')
@@ -1640,15 +1645,20 @@ class projectModel extends model
*/
public function suspend($projectID)
{
$editorIdList = $this->config->project->editor->suspend['id'];
if($this->app->rawModule == 'program') $editorIdList = $this->config->program->editor->suspend['id'];
$oldProject = $this->getById($projectID);
$project = fixer::input('post')
$project = fixer::input('post')
->add('id', $projectID)
->setDefault('status', 'suspended')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', helper::now())
->setDefault('suspendedDate', helper::today())
->stripTags($editorIdList, $this->config->allowedTags)
->remove('comment')->get();
$project = $this->loadModel('file')->processImgURL($project, $editorIdList, $this->post->uid);
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->checkFlow()
@@ -1670,6 +1680,9 @@ class projectModel extends model
$oldProject = $this->getById($projectID);
$now = helper::now();
$editorIdList = $this->config->project->editor->activate['id'];
if($this->app->rawModule == 'program') $editorIdList = $this->config->program->editor->activate['id'];
$project = fixer::input('post')
->add('id', $projectID)
->setDefault('realEnd','')
@@ -1677,6 +1690,7 @@ class projectModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setIF($oldProject->realBegan == '0000-00-00', 'realBegan', helper::today())
->stripTags($editorIdList, $this->config->allowedTags)
->remove('comment,readjustTime,readjustTask')
->get();
@@ -1686,6 +1700,7 @@ class projectModel extends model
unset($project->end);
}
$project = $this->loadModel('file')->processImgURL($project, $editorIdList, $this->post->uid);
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->checkFlow()
@@ -1742,6 +1757,9 @@ class projectModel extends model
$oldProject = $this->getById($projectID);
$now = helper::now();
$editorIdList = $this->config->project->editor->close['id'];
if($this->app->rawModule == 'program') $editorIdList = $this->config->program->editor->close['id'];
$project = fixer::input('post')
->add('id', $projectID)
->setDefault('status', 'closed')
@@ -1749,11 +1767,14 @@ class projectModel extends model
->setDefault('closedDate', $now)
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->stripTags($editorIdList, $this->config->allowedTags)
->remove('comment')
->get();
$this->lang->error->ge = $this->lang->project->ge;
$project = $this->loadModel('file')->processImgURL($project, $editorIdList, $this->post->uid);
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->check($this->config->project->close->requiredFields, 'notempty')
+8 -1
View File
@@ -830,7 +830,6 @@ class storyModel extends model
if(isset($story->stage) and $oldStory->stage != $story->stage) $story->stagedBy = (strpos('tested|verified|released|closed', $story->stage) !== false) ? $this->app->user->account : '';
$story = $this->loadModel('file')->processImgURL($story, $this->config->story->editor->edit['id'], $this->post->uid);
if(isset($_POST['reviewer']))
{
$_POST['reviewer'] = array_filter($_POST['reviewer']);
@@ -1327,6 +1326,7 @@ class storyModel extends model
->setDefault('lastEditedDate', $now)
->setDefault('status', $oldStory->status)
->setDefault('reviewedDate', $date)
->stripTags($this->config->story->editor->review['id'], $this->config->allowedTags)
->setIF($this->post->result == 'revert', 'version', $this->post->preVersion)
->setIF($this->post->result == 'clarify', 'assignedTo', $oldStory->lastEditedBy ? $oldStory->lastEditedBy : $oldStory->openedBy)
->removeIF($this->post->result != 'reject', 'closedReason, duplicateStory, childStories')
@@ -1336,6 +1336,7 @@ class storyModel extends model
->add('id', $storyID)
->remove('result,preVersion,comment')
->get();
$story = $this->loadModel('file')->processImgURL($story, $this->config->story->editor->review['id'], $this->post->uid);
/* Fix bug #671. */
$this->lang->story->closedReason = $this->lang->story->rejectedReason;
@@ -1563,6 +1564,7 @@ class storyModel extends model
->setDefault('closedDate', $now)
->setDefault('closedBy', $this->app->user->account)
->setDefault('assignedDate', $now)
->stripTags($this->config->story->editor->close['id'], $this->config->allowedTags)
->removeIF($this->post->closedReason != 'duplicate', 'duplicateStory')
->removeIF($this->post->closedReason != 'subdivided', 'childStories')
->get();
@@ -1578,6 +1580,7 @@ class storyModel extends model
}
$this->lang->story->comment = $this->lang->comment;
$story = $this->loadModel('file')->processImgURL($story, $this->config->story->editor->close['id'], $this->post->uid);
$this->dao->update(TABLE_STORY)->data($story, 'comment')
->autoCheck()
->batchCheck($this->config->story->close->requiredFields, 'notempty')
@@ -1991,9 +1994,11 @@ class storyModel extends model
->add('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->add('assignedDate', $now)
->stripTags($this->config->story->editor->assignto['id'], $this->config->allowedTags)
->remove('comment')
->get();
$story = $this->loadModel('file')->processImgURL($story, $this->config->story->editor->assignto['id'], $this->post->uid);
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->checkFlow()->where('id')->eq((int)$storyID)->exec();
if(!dao::isError()) return common::createChanges($oldStory, $story);
return false;
@@ -2054,8 +2059,10 @@ class storyModel extends model
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->setDefault('activatedDate', $now)
->stripTags($this->config->story->editor->activate['id'], $this->config->allowedTags)
->remove('comment')
->get();
$story = $this->loadModel('file')->processImgURL($story, $this->config->story->editor->activate['id'], $this->post->uid);
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->checkFlow()->where('id')->eq($storyID)->exec();
if($this->post->status == 'active') $this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->exec();
+17 -1
View File
@@ -113,7 +113,7 @@ class taskModel extends model
}
}
$task = $this->file->processImgURL($task, $this->config->task->editor->create['id'], $this->post->uid);
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->create['id'], $this->post->uid);
/* Fix Bug #1525 */
$executionType = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch('type');
@@ -1465,6 +1465,7 @@ class taskModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->stripTags($this->config->task->editor->assignto['id'], $this->config->allowedTags)
->remove('comment,showModule')
->get();
if($oldTask->status != 'done' and $oldTask->status != 'closed' and isset($task->left) and $task->left == 0)
@@ -1489,6 +1490,7 @@ class taskModel extends model
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->assignto['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)
->data($task)
->autoCheck()
@@ -1525,6 +1527,8 @@ class taskModel extends model
}
if(dao::isError()) return false;
$editorIdList = $this->config->task->editor->start['id'];
if($this->app->getMethodName() == 'restart') $editorIdList = $this->config->task->editor->restart['id'];
$now = helper::now();
$task = fixer::input('post')
->add('id', $taskID)
@@ -1532,9 +1536,11 @@ class taskModel extends model
->setDefault('lastEditedDate', $now)
->setDefault('status', 'doing')
->setIF($oldTask->assignedTo != $this->app->user->account, 'assignedDate', $now)
->stripTags($editorIdList, $this->config->allowedTags)
->removeIF(!empty($oldTask->team), 'consumed,left')
->remove('comment')->get();
$task = $this->loadModel('file')->processImgURL($task, $editorIdList, $this->post->uid);
if($this->post->left == 0)
{
if(isset($task->consumed) and $task->consumed == 0)
@@ -1763,6 +1769,7 @@ class taskModel extends model
->setDefault('status', 'done')
->setDefault('finishedBy, lastEditedBy', $this->app->user->account)
->setDefault('finishedDate, lastEditedDate', $now)
->stripTags($this->config->task->editor->finish['id'], $this->config->allowedTags)
->removeIF(!empty($oldTask->team), 'finishedBy,status,left')
->remove('comment,files,labels,currentConsumed')
->get();
@@ -1857,6 +1864,7 @@ class taskModel extends model
if($task->finishedDate == substr($now, 0, 10)) $task->finishedDate = $now;
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->finish['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)->data($task)
->autoCheck()
->checkFlow()
@@ -1896,9 +1904,11 @@ class taskModel extends model
->setDefault('status', 'pause')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', helper::now())
->stripTags($this->config->task->editor->pause['id'], $this->config->allowedTags)
->remove('comment')
->get();
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->pause['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->checkFlow()->where('id')->eq((int)$taskID)->exec();
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
@@ -1932,12 +1942,14 @@ class taskModel extends model
->setDefault('assignedDate', $now)
->setDefault('closedBy, lastEditedBy', $this->app->user->account)
->setDefault('closedDate, lastEditedDate', $now)
->stripTags($this->config->task->editor->close['id'], $this->config->allowedTags)
->setIF($oldTask->status == 'done', 'closedReason', 'done')
->setIF($oldTask->status == 'cancel', 'closedReason', 'cancel')
->remove('_recPerPage')
->remove('comment')
->get();
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->close['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->checkFlow()->where('id')->eq((int)$taskID)->exec();
if(!dao::isError())
@@ -1980,9 +1992,11 @@ class taskModel extends model
->setDefault('finishedDate', '0000-00-00')
->setDefault('canceledBy, lastEditedBy', $this->app->user->account)
->setDefault('canceledDate, lastEditedDate', $now)
->stripTags($this->config->task->editor->cancel['id'], $this->config->allowedTags)
->remove('comment')
->get();
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->cancel['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->checkFlow()->where('id')->eq((int)$taskID)->exec();
if($oldTask->fromBug) $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->eq($oldTask->fromBug)->exec();
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
@@ -2044,6 +2058,7 @@ class taskModel extends model
->setDefault('lastEditedDate', helper::now())
->setDefault('assignedDate', helper::now())
->setDefault('activatedDate', helper::now())
->stripTags($this->config->task->editor->activate['id'], $this->config->allowedTags)
->remove('comment')
->get();
@@ -2064,6 +2079,7 @@ class taskModel extends model
$task = $this->computeHours4Multiple($oldTask, $task);
}
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->activate['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)->data($task)
->autoCheck()
->batchCheck($this->config->task->activate->requiredFields, 'notempty')
+78 -40
View File
@@ -61,6 +61,7 @@ class testcaseModel extends model
->setIF($this->config->systemMode == 'new' and $this->app->tab == 'project', 'project', $this->session->project)
->setIF($this->app->tab == 'execution', 'execution', $this->session->execution)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story))
->stripTags($this->config->testcase->editor->create['id'], $this->config->allowedTags)
->remove('steps,expects,files,labels,stepType,forceNotReview')
->setDefault('story', 0)
->cleanInt('story,product,branch,module')
@@ -77,6 +78,7 @@ class testcaseModel extends model
/* Value of story may be showmore. */
$case->story = (int)$case->story;
$case = $this->loadModel('file')->processImgURL($case, $this->config->testcase->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->create->requiredFields, 'notempty')->checkFlow()->exec();
if(!$this->dao->isError())
{
@@ -768,6 +770,7 @@ class testcaseModel extends model
->join('linkCase', ',')
->setForce('status', $status)
->cleanInt('story,product,branch,module')
->stripTags($this->config->testcase->editor->edit['id'], $this->config->allowedTags)
->remove('comment,steps,expects,files,labels,stepType')
->get();
@@ -780,6 +783,7 @@ class testcaseModel extends model
array_splice($requiredFieldsArr, $fieldIndex, 1);
$requiredFields = implode(',', $requiredFieldsArr);
}
$case = $this->loadModel('file')->processImgURL($case, $this->config->testcase->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($requiredFields, 'notempty')->checkFlow()->where('id')->eq((int)$caseID)->exec();
if(!$this->dao->isError())
{
@@ -883,10 +887,12 @@ class testcaseModel extends model
->setDefault('reviewedDate', substr($now, 0, 10))
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->stripTags($this->config->testcase->editor->review['id'], $this->config->allowedTags)
->setForce('status', $status)
->join('reviewedBy', ',')
->get();
$case = $this->loadModel('file')->processImgURL($case, $this->config->testcase->editor->review['id'], $this->post->uid);
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->checkFlow()->where('id')->eq($caseID)->exec();
if(dao::isError()) return false;
@@ -1268,11 +1274,26 @@ class testcaseModel extends model
->fetchGroup('case');
$oldCases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($_POST['id'])->fetchAll('id');
}
$cases = array();
$line = 1;
$fieldNames = array();
$storyVersionPairs = $this->story->getVersions($data->story);
$cases = array();
$line = 1;
$fieldNames = array();
if($this->config->edition != 'open')
{
$extendFields = $this->getFlowExtendFields();
$notEmptyRule = $this->loadModel('workflowrule')->getByTypeAndRule('system', 'notempty');
foreach($extendFields as $extendField)
{
if(strpos(",$extendField->rules,", ",$notEmptyRule->id,") !== false)
{
$this->config->testcase->create->requiredFields .= ',' . $extendField->field;
}
}
}
foreach($data->product as $key => $product)
{
$caseData = new stdclass();
@@ -1289,6 +1310,18 @@ class testcaseModel extends model
$caseData->frequency = 1;
$caseData->precondition = $data->precondition[$key];
if($this->config->edition != 'open')
{
foreach($extendFields as $extendField)
{
$dataArray = $_POST[$extendField->field];
$caseData->{$extendField->field} = $dataArray[$key];
if(is_array($caseData->{$extendField->field})) $caseData->{$extendField->field} = join(',', $caseData->{$extendField->field});
$caseData->{$extendField->field} = htmlSpecialString($caseData->{$extendField->field});
}
}
if(isset($this->config->testcase->create->requiredFields))
{
$requiredFields = explode(',', $this->config->testcase->create->requiredFields);
@@ -1300,16 +1333,6 @@ class testcaseModel extends model
}
}
if(isset($this->config->testcase->appendFields))
{
foreach(explode(',', $this->config->testcase->appendFields) as $appendField)
{
if(empty($appendField)) continue;
$caseData->$appendField = zget($_POST[$appendField], $key, '');
if(is_array($caseData->$appendField)) $caseData->$appendField = join(',', $caseData->$appendField);
}
}
$cases[$key] = $caseData;
$line++;
}
@@ -1382,34 +1405,38 @@ class testcaseModel extends model
$caseData->lastEditedBy = $this->app->user->account;
$caseData->lastEditedDate = $now;
if($stepChanged and !$forceNotReview) $caseData->status = 'wait';
$this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec();
if($stepChanged)
$this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->checkFlow()->exec();
if(!dao::isError())
{
$parentStepID = 0;
foreach($steps as $id => $step)
if($stepChanged)
{
$step = (array)$step;
if(empty($step['desc'])) continue;
$stepData = new stdclass();
$stepData->type = ($step['type'] == 'item' and $parentStepID == 0) ? 'step' : $step['type'];
$stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0;
$stepData->case = $caseID;
$stepData->version = $version;
$stepData->desc = $step['desc'];
$stepData->expect = $step['expect'];
$this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'step') $parentStepID = 0;
$parentStepID = 0;
foreach($steps as $id => $step)
{
$step = (array)$step;
if(empty($step['desc'])) continue;
$stepData = new stdclass();
$stepData->type = ($step['type'] == 'item' and $parentStepID == 0) ? 'step' : $step['type'];
$stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0;
$stepData->case = $caseID;
$stepData->version = $version;
$stepData->desc = $step['desc'];
$stepData->expect = $step['expect'];
$this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'step') $parentStepID = 0;
}
}
$oldCase->steps = $this->joinStep($oldStep);
$caseData->steps = $this->joinStep($steps);
$changes = common::createChanges($oldCase, $caseData);
$this->updateCase2Project($oldCase, $caseData, $caseID);
$actionID = $this->action->create('case', $caseID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
$oldCase->steps = $this->joinStep($oldStep);
$caseData->steps = $this->joinStep($steps);
$changes = common::createChanges($oldCase, $caseData);
$this->updateCase2Project($oldCase, $caseData, $caseID);
$actionID = $this->action->create('case', $caseID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
}
else
@@ -1421,7 +1448,7 @@ class testcaseModel extends model
$caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch;
if($caseData->story) $caseData->storyVersion = zget($storyVersionPairs, $caseData->story, 1);
$caseData->status = !$forceNotReview ? 'wait' : 'normal';
$this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec();
$this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->checkFlow()->exec();
if(!dao::isError())
{
@@ -2123,7 +2150,13 @@ class testcaseModel extends model
if(!$case->needconfirm)
{
if(!isonlybody()) $menu .= $this->buildMenu('testcase', 'edit', $params, $case, 'view', '', '', 'showinonlybody');
if(!isonlybody())
{
$editParams = $params;
if($this->app->tab == 'project') $editParams .= "&comment=false&projectID={$this->session->project}";
if($this->app->tab == 'execution') $editParams .= "&comment=false&executionID={$this->session->execution}";
$menu .= $this->buildMenu('testcase', 'edit', $editParams, $case, 'view', '', '', 'showinonlybody');
}
if(!$case->isLibCase && $case->auto != 'unit')
{
$menu .= $this->buildMenu('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase&param=$case->id", $case, 'view', 'copy');
@@ -2161,7 +2194,12 @@ class testcaseModel extends model
$menu .= $this->buildMenu('testtask', 'results', "runID=0&$params", $case, 'browse', '', '', 'iframe', true, "data-width='95%'");
$menu .= $this->buildMenu('testtask', 'runCase', "runID=0&$params&version=$case->version", $case, 'browse', 'play', '', 'runCase iframe', false, "data-width='95%'");
$menu .= $this->buildMenu('testcase', 'edit', "caseID=$case->id", $case, 'browse');
$editParams = $params;
if($this->app->tab == 'project') $editParams .= "&comment=false&projectID={$this->session->project}";
if($this->app->tab == 'execution') $editParams .= "&comment=false&executionID={$this->session->execution}";
$menu .= $this->buildMenu('testcase', 'edit', $editParams, $case, 'browse');
if($this->config->testcase->needReview || !empty($this->config->testcase->forceReview))
{
common::printIcon('testcase', 'review', $params, $case, 'browse', 'glasses', '', 'iframe');
+25 -11
View File
@@ -45,11 +45,19 @@ $(function()
<th class='c-stage <?php if(strpos(",$requiredFields,", ',stage,') !== false) echo 'required';?>'><?php echo $lang->testcase->stage?></th>
<th class='c-condition <?php if(strpos(",$requiredFields,", ',precondition,') !== false) echo 'required';?>'><?php echo $lang->testcase->precondition?></th>
<th class='c-keywords <?php if(strpos(",$requiredFields,", ',keywords,') !== false) echo 'required';?>'><?php echo $lang->testcase->keywords?></th>
<?php if(!empty($appendFields)):?>
<?php foreach($appendFields as $appendField):?>
<th class='c-extend'><?php echo $lang->testcase->{$appendField->field}?></th>
<?php endforeach;?>
<?php endif;?>
<?php
if(!empty($appendFields))
{
foreach($appendFields as $field)
{
if(!$field->show) continue;
$width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto');
$required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : '';
echo "<th class='$required c-extend' style='width: $width'>$field->name</th>";
}
}
?>
<th class='c-step'>
<table class='w-p100 table-borderless'>
<tr>
@@ -106,12 +114,18 @@ $(function()
<td style='overflow:visible'><?php echo html::select("stage[$key][]", $lang->testcase->stageList, !empty($case->stage) ? $case->stage : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->stage : ''), "multiple='multiple' class='form-control chosen'")?></td>
<td><?php echo html::textarea("precondition[$key]", isset($case->precondition) ? htmlSpecialString($case->precondition) : "", "class='form-control'")?></td>
<td><?php echo html::input("keywords[$key]", isset($case->keywords) ? $case->keywords : '', "class='form-control'")?></td>
<?php if(!empty($appendFields)):?>
<?php $this->loadModel('flow');?>
<?php foreach($appendFields as $appendField):?>
<td><?php echo $this->flow->buildControl($appendField, zget($case, $appendField->field, ''), "{$appendField->field}[$key]");?></td>
<?php endforeach;?>
<?php endif;?>
<?php
if(!empty($appendFields))
{
$this->loadModel('flow');
foreach($appendFields as $field)
{
if(!$field->show) continue;
$value = $field->defaultValue ? $field->defaultValue : zget($case, $field->field, '');
echo '<td>' . $this->flow->buildControl($field, $value, "$field->field[$key]", true) . '</td>';
}
}
?>
<td>
<?php if(isset($stepData[$key]['desc'])):?>
<table class='w-p100 bd-0'>
+6
View File
@@ -772,8 +772,10 @@ class testtaskModel extends model
$testtask = fixer::input('post')
->add('id', $taskID)
->setDefault('status', 'doing')
->stripTags($this->config->testtask->editor->start['id'], $this->config->allowedTags)
->remove('comment')->get();
$testtask = $this->loadModel('file')->processImgURL($testtask, $this->config->testtask->editor->start['id'], $this->post->uid);
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->checkFlow()
@@ -838,8 +840,10 @@ class testtaskModel extends model
$testtask = fixer::input('post')
->add('id', $taskID)
->setDefault('status', 'blocked')
->stripTags($this->config->testtask->editor->block['id'], $this->config->allowedTags)
->remove('comment')->get();
$testtask = $this->loadModel('file')->processImgURL($testtask, $this->config->testtask->editor->block['id'], $this->post->uid);
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->checkFlow()
@@ -861,8 +865,10 @@ class testtaskModel extends model
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
->setDefault('status', 'doing')
->stripTags($this->config->testtask->editor->activate['id'], $this->config->allowedTags)
->remove('comment')->get();
$testtask = $this->loadModel('file')->processImgURL($testtask, $this->config->testtask->editor->activate['id'], $this->post->uid);
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->checkFlow()
+34
View File
@@ -229,6 +229,40 @@ class tree extends control
$title = $this->lang->tree->manageTrainpost;
$position[] = $this->lang->tree->manageTrainpost;
}
elseif(strpos($viewType, 'datasource') !== false)
{
$params = explode('_', $viewType);
if(count($params) == 2)
{
$datasourceID = $params[1];
$manageChild = 'manage' . ucfirst($viewType) . 'Child';
$datasource = $this->loadModel('workflowdatasource', 'flow')->getByID($datasourceID);
if($datasource)
{
$title = $datasource->name;
$position[] = $datasource->name;
$this->lang->tree->$manageChild = $title;
$root = new stdclass();
$root->name = $title;
$this->view->root = $root;
}
}
}
else
{
$manageChild = 'manage' . ucfirst($viewType) . 'Child';
$title = $this->lang->tree->common;
$position[] = $this->lang->tree->common;
$this->lang->tree->$manageChild = $title;
$root = new stdclass();
$root->name = $title;
$this->view->root = $root;
}
$parentModules = $this->tree->getParents($currentModuleID);
$this->view->title = $title;
+4 -2
View File
@@ -1187,19 +1187,21 @@ class user extends control
* @param int $contactListID
* @param string $dropdownName mailto|whitelist
* @param string $oldUsers
* @param string $extra
* @access public
* @return string
*/
public function ajaxGetContactUsers($contactListID, $dropdownName = 'mailto', $oldUsers = '')
public function ajaxGetContactUsers($contactListID, $dropdownName = 'mailto', $oldUsers = '', $extra = '')
{
$list = $contactListID ? $this->user->getContactListByID($contactListID) : '';
$attr = $dropdownName == 'mailto' ? "data-placeholder='{$this->lang->chooseUsersToMail}'" : '';
$users = $this->user->getPairs('devfirst|nodeleted|noclosed', $list ? $list->userList : '', $this->config->maxCount);
if(!empty($extra) && $extra == 'flow') $users = array_merge(array('deptManager' => $this->lang->workflowdatasource->options['deptManager']), $users);
if(isset($this->config->user->moreLink)) $this->config->moreLinks[$dropdownName . "[]"] = $this->config->user->moreLink;
$defaultUsers = empty($contactListID) ? '' : $list->userList . ',' . trim($oldUsers);
if($extra == 'flow' && empty($defaultUsers)) $defaultUsers = trim($oldUsers);
return print(html::select($dropdownName . "[]", $users, $defaultUsers, "class='form-control chosen' multiple $attr"));
}
+1
View File
@@ -91,3 +91,4 @@ a.showMoreImage:hover {opacity: 1;}
#headerActions .dropdown-menu:before, #headerActions .dropdown-menu:hover:before {position: absolute; top: -9px; right: 50%; width: 0; height: 0; content: ' '; border-color: transparent transparent #fff transparent; border-style: solid; border-width: 0 10px 10px 10px;}
.icon-size-width:before {content: "\e9c5"; transform: rotate(90deg); -ms-transform: rotate(90deg); -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); -o-transform: rotate(90deg);}
.checkbox-primary > label{overflow: hidden;}