Merge branch 'branch/workflow' into 'master'
#Do task # 53548 and task #53550. See merge request easycorp/zentaopms!3296
This commit is contained in:
+105
-57
@@ -42,8 +42,6 @@ class control extends baseControl
|
||||
/* Code for task #9224. Set requiredFields for workflow. */
|
||||
if($this->dbh and (defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api')))
|
||||
{
|
||||
$this->checkRequireFlowField();
|
||||
|
||||
if(isset($this->config->{$this->moduleName}) and strpos($this->methodName, 'export') !== false)
|
||||
{
|
||||
if(isset($this->config->{$this->moduleName}->exportFields) or isset($this->config->{$this->moduleName}->list->exportFields))
|
||||
@@ -82,31 +80,49 @@ class control extends baseControl
|
||||
}
|
||||
|
||||
/* If workflow is created by a normal user, set priv. */
|
||||
if(isset($this->app->user) and !$this->app->user->admin)
|
||||
{
|
||||
$actions = $this->dao->select('module, action')->from(TABLE_WORKFLOWACTION)->where('createdBy')->eq($this->app->user->account)->andWhere('buildin')->eq('0')->fetchGroup('module');
|
||||
$labels = $this->dao->select('module, code')->from(TABLE_WORKFLOWLABEL)->where('createdBy')->eq($this->app->user->account)->andWhere('buildin')->eq('0')->fetchGroup('module');
|
||||
if(!empty($actions))
|
||||
{
|
||||
foreach($actions as $module => $actionObj)
|
||||
{
|
||||
foreach($actionObj as $action) $this->app->user->rights['rights'][$module][$action->action] = 1;
|
||||
}
|
||||
}
|
||||
if(isset($this->app->user) and !$this->app->user->admin) $this->setDefaultPrivByWorkflow();
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($labels))
|
||||
/**
|
||||
* Det default priv by workflow.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function setDefaultPrivByWorkflow()
|
||||
{
|
||||
$actionList = $this->dao->select('module, action')->from(TABLE_WORKFLOWACTION)
|
||||
->where('createdBy')->eq($this->app->user->account)
|
||||
->andWhere('buildin')->eq('0')
|
||||
->fetchGroup('module');
|
||||
|
||||
if($actionList)
|
||||
{
|
||||
foreach($actionList as $module => $actions)
|
||||
{
|
||||
foreach($actions as $action) $this->app->user->rights['rights'][$module][$action->action] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$labelList = $this->dao->select('module, code')->from(TABLE_WORKFLOWLABEL)
|
||||
->where('createdBy')->eq($this->app->user->account)
|
||||
->andWhere('buildin')->eq('0')
|
||||
->fetchGroup('module');
|
||||
|
||||
if($labelList)
|
||||
{
|
||||
foreach($labelList as $module => $labels)
|
||||
{
|
||||
foreach($labels as $label)
|
||||
{
|
||||
foreach($labels as $module => $codeObj)
|
||||
{
|
||||
foreach($codeObj as $code)
|
||||
{
|
||||
$code = str_replace('browse', '', $code->code);
|
||||
$this->app->user->rights['rights'][$module][$code] = 1;
|
||||
}
|
||||
}
|
||||
$code = str_replace('browse', '', $label->code);
|
||||
$this->app->user->rights['rights'][$module][$code] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,6 +307,25 @@ class control extends baseControl
|
||||
chdir($currentPWD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build operate menu of a method.
|
||||
*
|
||||
* @param object $object product|project|productplan|release|build|story|task|bug|testtask|testcase|testsuite
|
||||
* @param string $displayOn view|browse
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildOperateMenu($object, $type = 'view')
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
|
||||
$moduleName = $this->moduleName;
|
||||
if($moduleName == 'bug' || $moduleName == 'feedback') return $this->$moduleName->buildOperateMenu($object, $type);
|
||||
|
||||
$flow = $this->loadModel('workflow')->getByModule($moduleName);
|
||||
return $this->loadModel('flow')->buildOperateMenu($flow, $object, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute hooks of a method.
|
||||
*
|
||||
@@ -307,19 +342,18 @@ class control extends baseControl
|
||||
}
|
||||
|
||||
/**
|
||||
* Build operate menu of a method.
|
||||
*
|
||||
* @param object $object product|project|productplan|release|build|story|task|bug|testtask|testcase|testsuite
|
||||
* @param string $displayOn view|browse
|
||||
* Set workflow export fields
|
||||
*
|
||||
* @param array $fields
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function buildOperateMenu($object, $displayOn = 'view')
|
||||
public function getFlowExportFields()
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
if(!isset($this->config->bizVersion)) return array();
|
||||
|
||||
$flow = $this->loadModel('workflow')->getByModule($this->moduleName);
|
||||
return $this->loadModel('flow')->buildOperateMenu($flow, $object, $displayOn);
|
||||
$moduleName = $this->moduleName;
|
||||
return $this->$moduleName->getFlowExportFields();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,14 +366,27 @@ class control extends baseControl
|
||||
* position=left|right The position which the fields displayed in a page.
|
||||
* inForm=0|1 The fields displayed in a form or not. The default is 1.
|
||||
* inCell=0|1 The fields displayed in a div with class cell or not. The default is 0.
|
||||
* @param bool $print
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printExtendFields($object, $type, $extras = '')
|
||||
public function printExtendFields($object, $type, $extras = '', $print = false)
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
|
||||
echo $this->loadModel('flow')->printFields($this->moduleName, $this->methodName, $object, $type, $extras);
|
||||
$moduleName = $this->app->getModuleName();
|
||||
$methodName = $this->app->getMethodName();
|
||||
$fields = $this->loadModel('flow')->printFields($moduleName, $methodName, $object, $type, $extras);
|
||||
if(!$print) return $fields;
|
||||
|
||||
$jsRoot = $this->config->webRoot . "js/";
|
||||
$picker = file_get_contents($this->app->getBasePath() . 'app/sys/common/view/picker.html.php');
|
||||
$picker = substr($picker, strpos($picker, '<style>'));
|
||||
|
||||
js::import($jsRoot . 'picker/min.js');
|
||||
css::import($jsRoot . 'picker/min.css');
|
||||
|
||||
echo $picker . $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,6 +404,31 @@ class control extends baseControl
|
||||
return $this->$moduleName->processStatus($module, $record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print view file.
|
||||
*
|
||||
* @param string $viewFile
|
||||
* @access public
|
||||
* @return bool|string
|
||||
*/
|
||||
public function printViewFile($viewFile)
|
||||
{
|
||||
if(!file_exists($viewFile)) return false;
|
||||
|
||||
$currentPWD = getcwd();
|
||||
chdir(dirname($viewFile));
|
||||
|
||||
extract((array)$this->view);
|
||||
ob_start();
|
||||
include $viewFile;
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
chdir($currentPWD);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check require with flow field when post data.
|
||||
*
|
||||
@@ -464,28 +536,4 @@ class control extends baseControl
|
||||
if($message) $this->send(array('result' => 'fail', 'message' => $message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print view file.
|
||||
*
|
||||
* @param string $viewFile
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printViewFile($viewFile)
|
||||
{
|
||||
if(!file_exists($viewFile)) return false;
|
||||
|
||||
$currentPWD = getcwd();
|
||||
chdir(dirname($viewFile));
|
||||
|
||||
extract((array)$this->view);
|
||||
ob_start();
|
||||
include $viewFile;
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
chdir($currentPWD);
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
+171
-7
@@ -53,6 +53,119 @@ class model extends baseModel
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build menu of a module.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @param string $methodName
|
||||
* @param string $params
|
||||
* @param object $data
|
||||
* @param string $type
|
||||
* @param string $icon
|
||||
* @param string $target
|
||||
* @param string $misc
|
||||
* @param bool $onlyBody
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function buildMenu($moduleName, $methodName, $params, $data, $type = 'view', $icon = '', $target = '', $class = '', $onlyBody = false, $misc = '' , $title = '')
|
||||
{
|
||||
if(strpos($moduleName, '.') !== false) list($appName, $moduleName) = explode('.', $moduleName);
|
||||
|
||||
if(strpos($methodName, '_') !== false && strpos($methodName, '_') > 0) list($module, $method) = explode('_', $methodName);
|
||||
|
||||
if(empty($module)) $module = $moduleName;
|
||||
if(empty($method)) $method = $methodName;
|
||||
|
||||
if(!common::hasPriv($module, $method)) return '';
|
||||
|
||||
if(isset($this->config->bizVersion))
|
||||
{
|
||||
static $actions;
|
||||
if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION)->where('module')->eq($moduleName)->andWhere('buildin')->eq('1')->andWhere('status')->eq('enable')->fetchAll('action');
|
||||
}
|
||||
|
||||
$enabled = true;
|
||||
if(isset($actions[$methodName]))
|
||||
{
|
||||
$action = $actions[$methodName];
|
||||
|
||||
if($action->extensionType == 'override') return $this->loadModel('flow')->buildActionMenu($moduleName, $action, $data, $type);
|
||||
|
||||
$conditions = json_decode($action->conditions);
|
||||
if($action->extensionType == 'extend' && $conditions)
|
||||
{
|
||||
$enabled = $this->loadModel('flow')->checkConditions($conditions, $data);
|
||||
$label = $action->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(method_exists($this, 'isClickable')) $enabled = $this->isClickable($data, $method, $module);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(method_exists($this, 'isClickable')) $enabled = $this->isClickable($data, $method, $module);
|
||||
}
|
||||
|
||||
$html = '';
|
||||
$type = $type == 'browse' ? 'list' : 'button';
|
||||
$html = common::buildIconButton($module, $method, $params, $data, $type, $icon, $target, $class, $onlyBody, $misc, $title, '', $enabled);
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build menu of actions created by workflow action.
|
||||
*
|
||||
* @param string $module
|
||||
* @param int $data
|
||||
* @param string $type browse | view
|
||||
* @param string $show direct | dropdownlist
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildFlowMenu($module, $data, $type = 'browse', $show = '')
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return '';
|
||||
|
||||
$moduleName = $module;
|
||||
if(strpos($module, '.') !== false) list($appName, $moduleName) = explode('.', $module);
|
||||
|
||||
static $actions;
|
||||
if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION)->where('module')->eq($moduleName)->andWhere('buildin')->eq('0')->andWhere('status')->eq('enable')->orderBy('order_asc')->fetchAll();
|
||||
|
||||
$menu = '';
|
||||
if($show)
|
||||
{
|
||||
foreach($actions as $action)
|
||||
{
|
||||
if(strpos($action->position, $type) === false || $action->show != $show) continue;
|
||||
|
||||
$menu .= $this->loadModel('flow')->buildActionMenu($moduleName, $action, $data, $type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$dropdownMenu = '';
|
||||
foreach($actions as $action)
|
||||
{
|
||||
if(strpos($action->position, $type) === false) continue;
|
||||
|
||||
if($type == 'view' || $action->show == 'direct') $menu .= $this->loadModel('flow')->buildActionMenu($moduleName, $action, $data, $type);
|
||||
if($type == 'browse' && $action->show == 'dropdownlist') $dropdownMenu .= $this->loadModel('flow')->buildActionMenu($moduleName, $action, $data, $type);
|
||||
}
|
||||
|
||||
if($type == 'browse' && $dropdownMenu)
|
||||
{
|
||||
$menu .= "<div class='dropdown'><a href='javascript:;' data-toggle='dropdown'>{$this->lang->more}<span class='caret'> </span></a>";
|
||||
$menu .= "<ul class='dropdown-menu pull-right'>{$dropdownMenu}</ul></div>";
|
||||
}
|
||||
}
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process status of an object according to its subStatus.
|
||||
*
|
||||
@@ -68,6 +181,48 @@ class model extends baseModel
|
||||
return $this->loadModel('workflowfield')->processSubStatus($module, $record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process workflow export data.
|
||||
*
|
||||
* @param object $data
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function processExportData($data)
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return $data;
|
||||
|
||||
return $this->loadModel('workflowfield')->processExportData($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process workflow export options.
|
||||
*
|
||||
* @param object $data
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function processExportOptions($data)
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return $data;
|
||||
|
||||
return $this->loadModel('workflowfield')->processExportOptions($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process workflow import data.
|
||||
*
|
||||
* @param object $data
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function processImportData($data)
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return $data;
|
||||
|
||||
return $this->loadModel('workflowfield')->processImportData($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flow extend fields.
|
||||
*
|
||||
@@ -82,18 +237,16 @@ class model extends baseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Check flow rule.
|
||||
* Set workflow export fields.
|
||||
*
|
||||
* @param object $field
|
||||
* @param string $value
|
||||
* @access public
|
||||
* @return bool|string
|
||||
* @return string
|
||||
*/
|
||||
public function checkFlowRule($field, $value)
|
||||
public function getFlowExportFields()
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
if(!isset($this->config->bizVersion)) return array();
|
||||
|
||||
return $this->loadModel('flow')->checkRule($field, $value);
|
||||
return $this->loadModel('workflowfield')->getExportFields($this->app->getModuleName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,6 +266,17 @@ class model extends baseModel
|
||||
$action = $this->loadModel('workflowaction')->getByModuleAndAction($moduleName, $methodName);
|
||||
if(empty($action) or $action->extensionType == 'none') return false;
|
||||
|
||||
$this->loadModel('file');
|
||||
if($this->post->uid) $this->file->updateObjectID($this->post->uid, $objectID, $moduleName);
|
||||
$fields = $this->workflowaction->getFields($moduleName, $action->action, false);
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if($field->control == 'file' && $field->show && !$field->readonly)
|
||||
{
|
||||
$this->file->saveUpload($moduleName, $objectID, $field->field, $field->field, $field->field);
|
||||
}
|
||||
}
|
||||
|
||||
$flow = $this->loadModel('workflow')->getByModule($moduleName);
|
||||
if($flow && $action) $this->loadModel('workflowhook')->execute($flow, $action, $objectID);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,149 @@ class dao extends baseDAO
|
||||
$skipFields .= ',uid';
|
||||
return parent::data($data, $skipFields);
|
||||
}
|
||||
|
||||
/**
|
||||
* check workflow field rule.
|
||||
*
|
||||
* @access public
|
||||
* @return object the dao object self.
|
||||
*/
|
||||
public function checkflow()
|
||||
{
|
||||
global $app, $config;
|
||||
|
||||
if(!isset($config->bizVersion)) return $this;
|
||||
|
||||
$module = $app->getmodulename();
|
||||
$method = $app->getmethodname();
|
||||
|
||||
$flowaction = $this->dbh->query("select * from " . TABLE_WORKFLOWACTION . " where `module` = '{$module}' and `action` = '{$method}' and `buildin` = '1' and `extensiontype` = 'extend'")->fetch(PDO::FETCH_OBJ);
|
||||
if(!$flowaction) return $this;
|
||||
|
||||
$flowfields = $this->dbh->query("select t2.name,t2.rules,t2.control,t2.field,t1.layoutrules from " . TABLE_WORKFLOWLAYOUT . " as t1 left join " . TABLE_WORKFLOWFIELD . " as t2 on t1.module = t2.module and t1.field = t2.field where t1.module = '{$module}' and t1.action = '{$method}' and t1.readonly = '0'")->fetchall();
|
||||
if(!$flowfields) return $this;
|
||||
|
||||
$rules = array();
|
||||
$rawrules = $this->dbh->query("select * from " . TABLE_WORKFLOWRULE)->fetchall();
|
||||
foreach($rawrules as $rule) $rules[$rule->id] = $rule;
|
||||
|
||||
foreach($flowfields as $key => $field)
|
||||
{
|
||||
if(!$field)
|
||||
{
|
||||
unset($flowfields[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$ruleids = explode(',', trim($field->rules, ',') . ',' . trim($field->layoutrules, ','));
|
||||
$ruleids = array_unique($ruleids);
|
||||
|
||||
$fieldrules = array();
|
||||
foreach($ruleids as $ruleid)
|
||||
{
|
||||
if(!$ruleid || !isset($rules[$ruleid])) continue;
|
||||
|
||||
$fieldrules[] = $rules[$ruleid];
|
||||
}
|
||||
|
||||
$field->ruledata = $fieldrules;
|
||||
$field->rules = join(',', $ruleids);
|
||||
}
|
||||
|
||||
return $this->checkextend($flowfields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查工作流扩展字段
|
||||
* check workflow extend field
|
||||
*
|
||||
* @param array $fields
|
||||
* @access public
|
||||
* @return object the dao object self
|
||||
*/
|
||||
public function checkextend($fields)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if(!$fields) return $this;
|
||||
foreach($fields as $field)
|
||||
{
|
||||
/* if the field don't have rule, don't check it. */
|
||||
if(empty($field->rules)) continue;
|
||||
|
||||
if($field->control == 'file')
|
||||
{
|
||||
foreach($field->ruledata as $rule)
|
||||
{
|
||||
if(empty($rule)) continue;
|
||||
if($rule->type != 'system' || $rule->rule != 'notempty') continue;
|
||||
|
||||
$files = !empty($_files[$field->field]) ? $_files[$field->field] : '';
|
||||
if(empty($files)) dao::$errors[$field->field][] = sprintf($lang->error->notempty, $field->name);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!isset($this->sqlobj->data->{$field->field})) $this->sqlobj->data->{$field->field} = false;
|
||||
|
||||
/* check rules of fields. */
|
||||
foreach($field->ruledata as $rule)
|
||||
{
|
||||
if(empty($rule)) continue;
|
||||
|
||||
if($rule->type == 'system')
|
||||
{
|
||||
if($rule->rule == 'unique')
|
||||
{
|
||||
if(empty($this->sqlobj->data->{$field->field})) continue;
|
||||
$condition = isset($this->sqlobj->data->id) ? '`id` != ' . $this->sqlobj->data->id : '';
|
||||
$this->check($field->field, $rule->rule, $condition);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_numeric($this->sqlobj->data->{$field->field}) && $this->sqlobj->data->{$field->field} == 0 && $rule->rule == 'notempty' && !in_array($field->control, array('select', 'multi-select'))) continue;
|
||||
$this->check($field->field, $rule->rule);
|
||||
}
|
||||
}
|
||||
elseif($rule->type == 'regex')
|
||||
{
|
||||
$this->check($field->field, 'reg', $rule->rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get param real value
|
||||
*
|
||||
* @param int $param
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getParamRealValue($param)
|
||||
{
|
||||
if(empty($this->deptManager))
|
||||
{
|
||||
$dept = zget($this->app->user, 'dept', '');
|
||||
$manager = $this->dbh->query("SELECT moderators FROM " . TABLE_CATEGORY . " WHERE `type` = 'dept' AND `id` = '{$dept}'")->fetch(PDO::FETCH_OBJ);
|
||||
$this->deptManager = $manager ? trim($manager->moderators, ',') : '';
|
||||
}
|
||||
|
||||
switch((string)$param)
|
||||
{
|
||||
case 'today' : return date('Y-m-d');
|
||||
case 'now' :
|
||||
case 'currentTime' : return date('Y-m-d H:i:s');
|
||||
case 'actor' :
|
||||
case 'currentUser' : return $this->app->user->account;
|
||||
case 'currentDept' : return $this->app->user->dept ? $this->app->user->dept : $param;
|
||||
case 'deptManager' : return $this->deptManager ? $this->deptManager : $param;
|
||||
default : return $param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+66
-26
@@ -94,6 +94,7 @@ class bugModel extends model
|
||||
->autoCheck()
|
||||
->checkIF($bug->notifyEmail, 'notifyEmail', 'email')
|
||||
->batchCheck($this->config->bug->create->requiredFields, 'notempty')
|
||||
->checkFlow()
|
||||
->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -225,8 +226,6 @@ class bugModel extends model
|
||||
if(is_array($bug->{$extendField->field})) $bug->{$extendField->field} = join(',', $bug->{$extendField->field});
|
||||
|
||||
$bug->{$extendField->field} = htmlSpecialString($bug->{$extendField->field});
|
||||
$message = $this->checkFlowRule($extendField, $bug->{$extendField->field});
|
||||
if($message) return print(js::alert($message));
|
||||
}
|
||||
|
||||
/* Required field check. */
|
||||
@@ -282,6 +281,7 @@ class bugModel extends model
|
||||
$this->dao->insert(TABLE_BUG)->data($bug)
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->bug->create->requiredFields, 'notempty')
|
||||
->checkFlow()
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
@@ -675,6 +675,7 @@ class bugModel extends model
|
||||
}
|
||||
$now = helper::now();
|
||||
$bug = fixer::input('post')
|
||||
->add('id', $bugID)
|
||||
->cleanInt('product,module,severity,project,execution,story,task,branch')
|
||||
->stripTags($this->config->bug->editor->edit['id'], $this->config->allowedTags)
|
||||
->setDefault('product,module,execution,story,task,duplicateBug,branch', 0)
|
||||
@@ -717,6 +718,7 @@ class bugModel extends model
|
||||
->checkIF($bug->notifyEmail, 'notifyEmail', 'email')
|
||||
->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty')
|
||||
->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty')
|
||||
->checkFlow()
|
||||
->where('id')->eq((int)$bugID)
|
||||
->exec();
|
||||
|
||||
@@ -788,6 +790,7 @@ class bugModel extends model
|
||||
$oldBug = $oldBugs[$bugID];
|
||||
|
||||
$bug = new stdclass();
|
||||
$bug->id = $bugID;
|
||||
$bug->lastEditedBy = $this->app->user->account;
|
||||
$bug->lastEditedDate = $now;
|
||||
$bug->type = $data->types[$bugID];
|
||||
@@ -827,8 +830,6 @@ class bugModel extends model
|
||||
if(is_array($bug->{$extendField->field})) $bug->{$extendField->field} = join(',', $bug->{$extendField->field});
|
||||
|
||||
$bug->{$extendField->field} = htmlSpecialString($bug->{$extendField->field});
|
||||
$message = $this->checkFlowRule($extendField, $bug->{$extendField->field});
|
||||
if($message) return print(js::alert($message));
|
||||
}
|
||||
|
||||
$bugs[$bugID] = $bug;
|
||||
@@ -845,6 +846,7 @@ class bugModel extends model
|
||||
->batchCheck($this->config->bug->edit->requiredFields, 'notempty')
|
||||
->checkIF($bug->resolvedBy, 'resolution', 'notempty')
|
||||
->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty')
|
||||
->checkFlow()
|
||||
->where('id')->eq((int)$bugID)
|
||||
->exec();
|
||||
|
||||
@@ -930,6 +932,7 @@ class bugModel extends model
|
||||
$now = helper::now();
|
||||
$oldBug = $this->getById($bugID);
|
||||
$bug = fixer::input('post')
|
||||
->add('id', $bugID)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->setDefault('assignedDate', $now)
|
||||
@@ -940,6 +943,7 @@ class bugModel extends model
|
||||
$this->dao->update(TABLE_BUG)
|
||||
->data($bug)
|
||||
->autoCheck()
|
||||
->checkFlow()
|
||||
->where('id')->eq($bugID)->exec();
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldBug, $bug);
|
||||
@@ -962,6 +966,7 @@ class bugModel extends model
|
||||
$oldBug = $this->getById($bugID);
|
||||
|
||||
$bug = fixer::input('post')
|
||||
->add('id', $bugID)
|
||||
->setDefault('confirmed', 1)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
@@ -970,7 +975,7 @@ class bugModel extends model
|
||||
->join('mailto', ',')
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec();
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq($bugID)->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
@@ -1027,6 +1032,7 @@ class bugModel extends model
|
||||
$now = helper::now();
|
||||
$oldBug = $this->getById($bugID);
|
||||
$bug = fixer::input('post')
|
||||
->add('id', $bugID)
|
||||
->add('status', 'resolved')
|
||||
->add('confirmed', 1)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
@@ -1100,6 +1106,7 @@ class bugModel extends model
|
||||
->batchCheck($this->config->bug->resolve->requiredFields, 'notempty')
|
||||
->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty')
|
||||
->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty')
|
||||
->checkFlow()
|
||||
->where('id')->eq((int)$bugID)
|
||||
->exec();
|
||||
|
||||
@@ -1310,6 +1317,7 @@ class bugModel extends model
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->setDefault('activatedDate', $now)
|
||||
->setDefault('activatedCount', (int)$oldBug->activatedCount)
|
||||
->add('id', $bugID)
|
||||
->add('resolution', '')
|
||||
->add('status', 'active')
|
||||
->add('resolvedDate', '0000-00-00')
|
||||
@@ -1324,7 +1332,7 @@ class bugModel extends model
|
||||
->remove('comment,files,labels')
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec();
|
||||
$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();
|
||||
|
||||
if($solveBuild)
|
||||
@@ -1361,6 +1369,7 @@ class bugModel extends model
|
||||
$now = helper::now();
|
||||
$oldBug = $this->getById($bugID);
|
||||
$bug = fixer::input('post')
|
||||
->add('id', $bugID)
|
||||
->add('assignedTo', 'closed')
|
||||
->add('status', 'closed')
|
||||
->add('confirmed', 1)
|
||||
@@ -1372,7 +1381,7 @@ class bugModel extends model
|
||||
->remove('comment')
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec();
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq((int)$bugID)->exec();
|
||||
if($oldBug->execution)
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
@@ -2784,18 +2793,19 @@ class bugModel extends model
|
||||
*
|
||||
* @param string $bug
|
||||
* @param string $action
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function isClickable($object, $action)
|
||||
public static function isClickable($object, $action, $module = 'bug')
|
||||
{
|
||||
$action = strtolower($action);
|
||||
|
||||
if($action == 'confirmbug') return $object->status == 'active' and $object->confirmed == 0;
|
||||
if($action == 'resolve') return $object->status == 'active';
|
||||
if($action == 'close') return $object->status == 'resolved';
|
||||
if($action == 'activate') return $object->status != 'active';
|
||||
if($action == 'tostory') return $object->status == 'active';
|
||||
if($module == 'bug' && $action == 'confirmbug') return $object->status == 'active' and $object->confirmed == 0;
|
||||
if($module == 'bug' && $action == 'resolve') return $object->status == 'active';
|
||||
if($module == 'bug' && $action == 'close') return $object->status == 'resolved';
|
||||
if($module == 'bug' && $action == 'activate') return $object->status != 'active';
|
||||
if($module == 'bug' && $action == 'tostory') return $object->status == 'active';
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3105,19 +3115,7 @@ class bugModel extends model
|
||||
echo substr($bug->lastEditedDate, 5, 11);
|
||||
break;
|
||||
case 'actions':
|
||||
$params = "bugID=$bug->id";
|
||||
if($canBeChanged)
|
||||
{
|
||||
common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'ok', '', 'iframe', true);
|
||||
common::printIcon('bug', 'resolve', $params, $bug, 'list', 'checked', '', 'iframe', true);
|
||||
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
|
||||
common::printIcon('bug', 'edit', $params, $bug, 'list');
|
||||
common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=$params", $bug, 'list', 'copy');
|
||||
}
|
||||
else
|
||||
{
|
||||
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
|
||||
}
|
||||
echo $this->buildOperateMenu($bug, 'browse');
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
@@ -3233,4 +3231,46 @@ class bugModel extends model
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build bug menu.
|
||||
*
|
||||
* @param object $bug
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildOperateMenu($bug, $type = 'view')
|
||||
{
|
||||
$menu = '';
|
||||
$params = "bugID=$bug->id";
|
||||
$extraParams = "extras=bugID=$bug->id";
|
||||
if($this->app->tab == 'project') $extraParams .= ",projectID={$bug->project}";
|
||||
if($this->app->tab == 'execution') $extraParams .= ",executionID={$bug->execution}";
|
||||
$copyParams = "productID=$bug->product&branch=$bug->branch&$extraParams";
|
||||
$convertParams = "productID=$bug->product&branch=$bug->branch&moduleID=0&from=bug&bugID=$bug->id";
|
||||
$toStoryParams = "product=$bug->product&branch=$bug->branch&module=0&story=0&execution=0&bugID=$bug->id";
|
||||
|
||||
$menu .= $this->buildMenu('bug', 'confirmBug', $params, $bug, $type, 'ok', '', "iframe", true);
|
||||
if($type == 'view') $menu .= $this->buildMenu('bug', 'assignTo', $params, $bug, $type, '', '', "iframe", true);
|
||||
$menu .= $this->buildMenu('bug', 'resolve', $params, $bug, $type, 'checked', '', "iframe", true);
|
||||
$menu .= $this->buildMenu('bug', 'close', $params, $bug, $type, '', '', "text-danger iframe showinonlybody", true);
|
||||
if($type == 'view') $menu .= $this->buildMenu('bug', 'activate', $params, $bug, $type, '', '', "text-success iframe showinonlybody", true);
|
||||
if($type == 'view' && $this->app->tab != 'product')
|
||||
{
|
||||
$menu .= $this->buildMenu('bug', 'toStory', $toStoryParams, $bug, $type, $this->lang->icons['story'], '', '', '', "data-app='product'", $this->lang->bug->toStory);
|
||||
$menu .= $this->buildMenu('bug', 'createCase', $convertParams, $bug, $type, 'sitemap');
|
||||
}
|
||||
if($type == 'view')
|
||||
{
|
||||
$menu .= "<div class='divider'></div>";
|
||||
$menu .= $this->buildFlowMenu('bug', $bug, $type, 'direct');
|
||||
$menu .= "<div class='divider'></div>";
|
||||
}
|
||||
$menu .= $this->buildMenu('bug', 'edit', $params, $bug, $type);
|
||||
if($this->app->tab != 'product') $menu .= $this->buildMenu('bug', 'create', $copyParams, $bug, $type, 'copy');
|
||||
if($type == 'view') $menu .= $this->buildMenu('bug', 'delete', $params, $bug, $type, 'trash', 'hiddenwin', "showinonlybody");
|
||||
|
||||
return $menu;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,29 +96,7 @@
|
||||
<?php common::printBack($browseLink);?>
|
||||
<?php if(!$bug->deleted):?>
|
||||
<div class='divider'></div>
|
||||
<?php
|
||||
common::printIcon('bug', 'confirmBug', $params, $bug, 'button', 'ok', '', 'iframe', true);
|
||||
common::printIcon('bug', 'assignTo', $params, $bug, 'button', '', '', 'iframe', true);
|
||||
common::printIcon('bug', 'resolve', $params, $bug, 'button', 'checked', '', 'iframe showinonlybody', true);
|
||||
common::printIcon('bug', 'close', $params, $bug, 'button', '', '', 'text-danger iframe showinonlybody', true);
|
||||
common::printIcon('bug', 'activate', $params, $bug, 'button', '', '', 'text-success iframe showinonlybody', true);
|
||||
|
||||
if($this->app->tab != 'product')
|
||||
{
|
||||
common::printIcon('bug', 'toStory', "product=$bug->product&branch=$bug->branch&module=0&story=0&execution=0&bugID=$bug->id", $bug, 'button', $lang->icons['story'], '', '', '', "data-app='product'", $lang->bug->toStory);
|
||||
common::printIcon('bug', 'createCase', $convertParams, $bug, 'button', 'sitemap');
|
||||
}
|
||||
|
||||
echo $this->buildOperateMenu($bug, 'view');
|
||||
|
||||
echo "<div class='divider'></div>";
|
||||
common::printIcon('bug', 'edit', $params, $bug);
|
||||
if($this->app->tab != 'product')
|
||||
{
|
||||
common::printIcon('bug', 'create', $copyParams, $bug, 'button', 'copy');
|
||||
}
|
||||
common::printIcon('bug', 'delete', $params, $bug, 'button', 'trash', 'hiddenwin', 'showinonlybody');
|
||||
?>
|
||||
<?php echo $this->buildOperateMenu($bug, 'view');?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -300,6 +300,7 @@ class buildModel extends model
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->build->create->requiredFields, 'notempty')
|
||||
->check('name', 'unique', "product = {$build->product} AND branch = {$build->branch} AND deleted = '0'")
|
||||
->checkFlow()
|
||||
->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -324,6 +325,7 @@ class buildModel extends model
|
||||
$buildID = (int)$buildID;
|
||||
$oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch();
|
||||
$build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags)
|
||||
->add('id', $buildID)
|
||||
->setIF(!isset($_POST['branch']), 'branch', $oldBuild->branch)
|
||||
->setDefault('product', $oldBuild->product)
|
||||
->cleanInt('product,branch,execution')
|
||||
@@ -336,6 +338,7 @@ class buildModel extends model
|
||||
->batchCheck($this->config->build->edit->requiredFields, 'notempty')
|
||||
->where('id')->eq($buildID)
|
||||
->check('name', 'unique', "id != $buildID AND product = {$build->product} AND branch = {$build->branch} AND deleted = '0'")
|
||||
->checkFlow()
|
||||
->exec();
|
||||
if(isset($build->branch) and $oldBuild->branch != $build->branch) $this->dao->update(TABLE_RELEASE)->set('branch')->eq($build->branch)->where('build')->eq($buildID)->exec();
|
||||
if(!dao::isError())
|
||||
|
||||
@@ -94,6 +94,7 @@ class caselibModel extends model
|
||||
$oldLib = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$libID)->fetch();
|
||||
$lib = fixer::input('post')
|
||||
->stripTags($this->config->caselib->editor->edit['id'], $this->config->allowedTags)
|
||||
->add('id', $libID)
|
||||
->add('lastEditedBy', $this->app->user->account)
|
||||
->add('lastEditedDate', helper::now())
|
||||
->remove('uid')
|
||||
@@ -103,6 +104,7 @@ class caselibModel extends model
|
||||
->autoCheck()
|
||||
->batchcheck($this->config->caselib->edit->requiredFields, 'notempty')
|
||||
->where('id')->eq($libID)
|
||||
->checkFlow()
|
||||
->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
@@ -186,6 +188,7 @@ class caselibModel extends model
|
||||
$this->dao->insert(TABLE_TESTSUITE)->data($lib)
|
||||
->batchcheck($this->config->caselib->create->requiredFields, 'notempty')
|
||||
->check('name', 'unique', "deleted = '0'")
|
||||
->checkFlow()
|
||||
->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
|
||||
@@ -1560,11 +1560,12 @@ EOD;
|
||||
* @param string $extraClass
|
||||
* @param bool $onlyBody
|
||||
* @param string $misc
|
||||
* @Param bool $extraEnabled
|
||||
* @static
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function buildIconButton($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '', $title = '', $programID = 0)
|
||||
public static function buildIconButton($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '', $title = '', $programID = 0, $extraEnabled = '')
|
||||
{
|
||||
if(isonlybody() and strpos($extraClass, 'showinonlybody') === false) return false;
|
||||
|
||||
@@ -1578,7 +1579,11 @@ EOD;
|
||||
|
||||
/* Judge the $method of $module clickable or not, default is clickable. */
|
||||
$clickable = true;
|
||||
if(is_object($object))
|
||||
if(is_bool($extraEnabled))
|
||||
{
|
||||
$clickable = $extraEnabled;
|
||||
}
|
||||
else if(is_object($object))
|
||||
{
|
||||
if($app->getModuleName() != $module) $app->control->loadModel($module);
|
||||
$modelClass = class_exists("ext{$module}Model") ? "ext{$module}Model" : $module . "Model";
|
||||
@@ -1623,7 +1628,6 @@ EOD;
|
||||
if(!$clickable) $class .= ' disabled';
|
||||
if($icon) $class .= ' icon-' . $icon;
|
||||
|
||||
|
||||
/* Create the icon link. */
|
||||
if($clickable)
|
||||
{
|
||||
|
||||
@@ -378,6 +378,7 @@ class executionModel extends model
|
||||
->checkIF($sprint->begin != '', 'begin', 'date')
|
||||
->checkIF($sprint->end != '', 'end', 'date')
|
||||
->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin)
|
||||
->checkFlow()
|
||||
->exec();
|
||||
|
||||
/* Add the creater to the team. */
|
||||
@@ -468,6 +469,7 @@ class executionModel extends model
|
||||
|
||||
/* Get the data from the post. */
|
||||
$execution = fixer::input('post')
|
||||
->add('id', $executionID)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', helper::now())
|
||||
->setIF(helper::isZeroDate($this->post->begin), 'begin', '')
|
||||
@@ -515,6 +517,7 @@ class executionModel extends model
|
||||
->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $executionProject")
|
||||
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
|
||||
->where('id')->eq($executionID)
|
||||
->checkFlow()
|
||||
->limit(1)
|
||||
->exec();
|
||||
|
||||
@@ -619,6 +622,7 @@ class executionModel extends model
|
||||
|
||||
$executionID = (int)$executionID;
|
||||
$executions[$executionID] = new stdClass();
|
||||
$executions[$executionID]->id = $executionID;
|
||||
$executions[$executionID]->name = $executionName;
|
||||
$executions[$executionID]->code = $executionCode;
|
||||
$executions[$executionID]->PM = $data->PMs[$executionID];
|
||||
@@ -757,6 +761,7 @@ class executionModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$execution = fixer::input('post')
|
||||
->add('id', $executionID)
|
||||
->setDefault('status', 'doing')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
@@ -789,6 +794,7 @@ class executionModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$execution = fixer::input('post')
|
||||
->add('id', $executionID)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->remove('comment')
|
||||
@@ -818,6 +824,7 @@ class executionModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$execution = fixer::input('post')
|
||||
->add('id', $executionID)
|
||||
->setDefault('status', 'suspended')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
@@ -844,6 +851,7 @@ class executionModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$execution = fixer::input('post')
|
||||
->add('id', $executionID)
|
||||
->setDefault('realEnd', '')
|
||||
->setDefault('status', 'doing')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
@@ -913,6 +921,7 @@ class executionModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$execution = fixer::input('post')
|
||||
->add('id', $executionID)
|
||||
->setDefault('status', 'closed')
|
||||
->setDefault('closedBy', $this->app->user->account)
|
||||
->setDefault('closedDate', $now)
|
||||
|
||||
@@ -683,6 +683,7 @@ class productModel extends model
|
||||
if($oldProduct->bind) $this->config->product->edit->requiredFields = 'name';
|
||||
|
||||
$product = fixer::input('post')
|
||||
->add('id', $productID)
|
||||
->callFunc('name', 'trim')
|
||||
->setDefault('line', 0)
|
||||
->setIF(!isset($_POST['whitelist']), 'whitelist', '')
|
||||
@@ -764,6 +765,7 @@ class productModel extends model
|
||||
$products[$productID]->status = $data->statuses[$productID];
|
||||
$products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags);
|
||||
$products[$productID]->acl = $data->acls[$productID];
|
||||
$products[$productID]->id = $productID;
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
@@ -820,6 +822,7 @@ class productModel extends model
|
||||
$oldProduct = $this->getById($productID);
|
||||
$now = helper::now();
|
||||
$product= fixer::input('post')
|
||||
->add('id', $productID)
|
||||
->setDefault('status', 'closed')
|
||||
->remove('comment')->get();
|
||||
|
||||
|
||||
@@ -475,6 +475,7 @@ class productplanModel extends model
|
||||
$plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags)
|
||||
->setIF($this->post->future or empty($_POST['begin']), 'begin', $this->config->productplan->future)
|
||||
->setIF($this->post->future or empty($_POST['end']), 'end', $this->config->productplan->future)
|
||||
->add('id', $planID)
|
||||
->remove('delta,uid,future')
|
||||
->get();
|
||||
|
||||
@@ -638,6 +639,7 @@ class productplanModel extends model
|
||||
$plan->end = isset($data->end[$planID]) ? $data->end[$planID] : '';
|
||||
$plan->status = isset($data->status[$planID]) ? $data->status[$planID] : $oldPlans[$planID]->status;
|
||||
$plan->parent = $oldPlans[$planID]->parent;
|
||||
$plan->id = $planID;
|
||||
|
||||
if(empty($plan->title)) return print(js::alter(sprintf($this->lang->productplan->errorNoTitle, $planID)));
|
||||
if($plan->begin > $plan->end and !empty($plan->end)) return print(js::alert(sprintf($this->lang->productplan->beginGeEnd, $planID)));
|
||||
|
||||
@@ -689,6 +689,7 @@ class programModel extends model
|
||||
$oldProgram = $this->dao->findById($programID)->from(TABLE_PROGRAM)->fetch();
|
||||
|
||||
$program = fixer::input('post')
|
||||
->add('id', $programID)
|
||||
->setDefault('team', $this->post->name)
|
||||
->setDefault('end', '')
|
||||
->setIF($this->post->begin == '0000-00-00', 'begin', '')
|
||||
|
||||
@@ -1066,6 +1066,7 @@ class projectModel extends model
|
||||
$_POST['products'] = isset($_POST['products']) ? array_filter($_POST['products']) : $linkedProducts;
|
||||
|
||||
$project = fixer::input('post')
|
||||
->add('id', $projectID)
|
||||
->callFunc('name', 'trim')
|
||||
->setDefault('team', substr($this->post->name, 0, 30))
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
@@ -1237,6 +1238,7 @@ class projectModel extends model
|
||||
|
||||
$projects[$projectID] = new stdClass();
|
||||
if(isset($data->parents[$projectID])) $projects[$projectID]->parent = $data->parents[$projectID];
|
||||
$projects[$projectID]->id = $projectID;
|
||||
$projects[$projectID]->name = $projectName;
|
||||
$projects[$projectID]->PM = $data->PMs[$projectID];
|
||||
$projects[$projectID]->begin = $data->begins[$projectID];
|
||||
@@ -1319,6 +1321,7 @@ class projectModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$project = fixer::input('post')
|
||||
->add('id', $projectID)
|
||||
->setDefault('status', 'doing')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
@@ -1350,6 +1353,7 @@ class projectModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$project = fixer::input('post')
|
||||
->add('id', $projectID)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->remove('comment')
|
||||
@@ -1374,6 +1378,7 @@ class projectModel extends model
|
||||
{
|
||||
$oldProject = $this->getById($projectID);
|
||||
$project = fixer::input('post')
|
||||
->add('id', $projectID)
|
||||
->setDefault('status', 'suspended')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', helper::now())
|
||||
@@ -1401,6 +1406,7 @@ class projectModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$project = fixer::input('post')
|
||||
->add('id', $projectID)
|
||||
->setDefault('realEnd','')
|
||||
->setDefault('status', 'doing')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
@@ -1471,6 +1477,7 @@ class projectModel extends model
|
||||
$now = helper::now();
|
||||
|
||||
$project = fixer::input('post')
|
||||
->add('id', $projectID)
|
||||
->setDefault('status', 'closed')
|
||||
->setDefault('closedBy', $this->app->user->account)
|
||||
->setDefault('closedDate', $now)
|
||||
|
||||
@@ -192,6 +192,7 @@ class releaseModel extends model
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->release->create->requiredFields, 'notempty')
|
||||
->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'");
|
||||
->checkFlow()
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
@@ -248,6 +249,7 @@ class releaseModel extends model
|
||||
$branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq((int)$this->post->build)->fetch('branch');
|
||||
|
||||
$release = fixer::input('post')->stripTags($this->config->release->editor->edit['id'], $this->config->allowedTags)
|
||||
->add('id', $releaseID)
|
||||
->add('branch', (int)$branch)
|
||||
->join('mailto', ',')
|
||||
->setIF(!$this->post->marker, 'marker', 0)
|
||||
@@ -269,6 +271,7 @@ class releaseModel extends model
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->release->edit->requiredFields, 'notempty')
|
||||
->check('name', 'unique', "id != '$releaseID' AND product = '{$release->product}' AND branch = '$branch' AND deleted = '0'")
|
||||
->checkFlow()
|
||||
->where('id')->eq((int)$releaseID)
|
||||
->exec();
|
||||
if(!dao::isError())
|
||||
|
||||
@@ -676,6 +676,7 @@ class storyModel extends model
|
||||
$story = fixer::input('post')
|
||||
->callFunc('title', 'trim')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->add('id', $storyID)
|
||||
->add('lastEditedDate', $now)
|
||||
->setIF($specChanged, 'version', $oldStory->version + 1)
|
||||
->setIF($specChanged and $oldStory->status == 'active' and $this->post->needNotReview == false, 'status', 'changed')
|
||||
@@ -772,6 +773,7 @@ class storyModel extends model
|
||||
->cleanFloat('estimate')
|
||||
->setDefault('assignedDate', $oldStory->assignedDate)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->add('id', $storyID)
|
||||
->add('lastEditedDate', $now)
|
||||
->setDefault('plan,notifyEmail', '')
|
||||
->setDefault('status', $oldStory->status)
|
||||
@@ -1209,6 +1211,7 @@ class storyModel extends model
|
||||
$oldStory = $oldStories[$storyID];
|
||||
|
||||
$story = new stdclass();
|
||||
$story->id = $storyID;
|
||||
$story->lastEditedBy = $this->app->user->account;
|
||||
$story->lastEditedDate = $now;
|
||||
$story->status = $oldStory->status;
|
||||
@@ -1330,6 +1333,7 @@ class storyModel extends model
|
||||
->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'duplicate', 'duplicateStory')
|
||||
->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'subdivided', 'childStories')
|
||||
->add('reviewedBy', $oldStory->reviewedBy . ',' . $this->app->user->account)
|
||||
->add('id', $storyID)
|
||||
->remove('result,preVersion,comment')
|
||||
->get();
|
||||
|
||||
@@ -1549,6 +1553,7 @@ class storyModel extends model
|
||||
$oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
|
||||
$now = helper::now();
|
||||
$story = fixer::input('post')
|
||||
->add('id', $storyID)
|
||||
->add('assignedTo', 'closed')
|
||||
->add('status', 'closed')
|
||||
->add('stage', 'closed')
|
||||
@@ -1981,6 +1986,13 @@ class storyModel extends model
|
||||
$story->assignedTo = $assignedTo;
|
||||
$story->assignedDate = $now;
|
||||
|
||||
$story = fixer::input('post')
|
||||
->add('id', $storyID)
|
||||
->add('lastEditedBy', $this->app->user->account)
|
||||
->add('lastEditedDate', $now)
|
||||
->add('assignedDate', $now)
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec();
|
||||
if(!dao::isError()) return common::createChanges($oldStory, $story);
|
||||
return false;
|
||||
@@ -2029,6 +2041,7 @@ class storyModel extends model
|
||||
$oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
|
||||
$now = helper::now();
|
||||
$story = fixer::input('post')
|
||||
->add('id', $storyID)
|
||||
->add('closedBy', '')
|
||||
->add('closedReason', '')
|
||||
->add('closedDate', '0000-00-00')
|
||||
|
||||
@@ -908,6 +908,7 @@ class taskModel extends model
|
||||
|
||||
$now = helper::now();
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('story, estimate, left, consumed', 0)
|
||||
->setDefault('realStarted', '0000-00-00 00:00:00')
|
||||
->setIF(is_numeric($this->post->estimate), 'estimate', (float)$this->post->estimate)
|
||||
@@ -1170,6 +1171,7 @@ class taskModel extends model
|
||||
$oldTask = $oldTasks[$taskID];
|
||||
|
||||
$task = new stdclass();
|
||||
$task->id = $taskID;
|
||||
$task->color = $data->colors[$taskID];
|
||||
$task->name = $data->names[$taskID];
|
||||
$task->module = isset($data->modules[$taskID]) ? $data->modules[$taskID] : 0;
|
||||
@@ -1437,6 +1439,7 @@ class taskModel extends model
|
||||
|
||||
$now = helper::now();
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->cleanFloat('left')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
@@ -1502,6 +1505,7 @@ class taskModel extends model
|
||||
|
||||
$now = helper::now();
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->setDefault('status', 'doing')
|
||||
@@ -1727,6 +1731,7 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setIF(is_numeric($this->post->consumed), 'consumed', (float)$this->post->consumed)
|
||||
->setIF(!$this->post->realStarted and helper::isZeroDate($oldTask->realStarted), 'realStarted', $now)
|
||||
->setDefault('left', 0)
|
||||
@@ -1857,6 +1862,7 @@ class taskModel extends model
|
||||
$oldTask = $this->getById($taskID);
|
||||
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('status', 'pause')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', helper::now())
|
||||
@@ -1890,6 +1896,7 @@ class taskModel extends model
|
||||
|
||||
$now = helper::now();
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('status', 'closed')
|
||||
->setDefault('assignedTo', 'closed')
|
||||
->setDefault('assignedDate', $now)
|
||||
@@ -1935,6 +1942,7 @@ class taskModel extends model
|
||||
|
||||
$now = helper::now();
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('status', 'cancel')
|
||||
->setDefault('assignedTo', $oldTask->openedBy)
|
||||
->setDefault('assignedDate', $now)
|
||||
@@ -1995,6 +2003,7 @@ class taskModel extends model
|
||||
$oldTask = $this->getById($taskID);
|
||||
if($oldTask->parent == '-1') $this->config->task->activate->requiredFields = '';
|
||||
$task = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setIF(is_numeric($this->post->left), 'left', (float)$this->post->left)
|
||||
->setDefault('left', 0)
|
||||
->setDefault('status', 'doing')
|
||||
|
||||
@@ -715,6 +715,7 @@ class testcaseModel extends model
|
||||
$version = $stepChanged ? $oldCase->version + 1 : $oldCase->version;
|
||||
|
||||
$case = fixer::input('post')
|
||||
->add('id', $caseID)
|
||||
->add('version', $version)
|
||||
->setIF($this->post->story != false and $this->post->story != $oldCase->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
|
||||
->setIF(!$this->post->linkCase, 'linkCase', '')
|
||||
@@ -835,6 +836,7 @@ class testcaseModel extends model
|
||||
$now = helper::now();
|
||||
$status = $this->getStatus('review', $oldCase);
|
||||
$case = fixer::input('post')
|
||||
->add('id', $caseID)
|
||||
->remove('result,comment')
|
||||
->setDefault('reviewedDate', substr($now, 0, 10))
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
@@ -947,6 +949,7 @@ class testcaseModel extends model
|
||||
foreach($caseIDList as $caseID)
|
||||
{
|
||||
$case = new stdclass();
|
||||
$case->id = $caseID;
|
||||
$case->lastEditedBy = $this->app->user->account;
|
||||
$case->lastEditedDate = $now;
|
||||
$case->pri = $data->pris[$caseID];
|
||||
|
||||
@@ -149,6 +149,7 @@ class testsuiteModel extends model
|
||||
$oldSuite = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$suiteID)->fetch();
|
||||
$suite = fixer::input('post')
|
||||
->stripTags($this->config->testsuite->editor->edit['id'], $this->config->allowedTags)
|
||||
->add('id', $suiteID)
|
||||
->add('lastEditedBy', $this->app->user->account)
|
||||
->add('lastEditedDate', helper::now())
|
||||
->remove('uid')
|
||||
|
||||
@@ -733,14 +733,22 @@ class testtaskModel extends model
|
||||
public function update($taskID)
|
||||
{
|
||||
$oldTask = $this->dao->select("*")->from(TABLE_TESTTASK)->where('id')->eq((int)$taskID)->fetch();
|
||||
$task = fixer::input('post')->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags)->join('mailto', ',')->join('type', ',')->remove('files,labels,uid,comment,contactListMenu')->get();
|
||||
$task = fixer::input('post')
|
||||
->add('id')
|
||||
->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags)
|
||||
->join('mailto', ',')
|
||||
->join('type', ',')
|
||||
->remove('files,labels,uid,comment,contactListMenu')
|
||||
->get();
|
||||
$task = $this->loadModel('file')->processImgURL($task, $this->config->testtask->editor->edit['id'], $this->post->uid);
|
||||
|
||||
$this->dao->update(TABLE_TESTTASK)->data($task)
|
||||
->autoCheck()
|
||||
->batchcheck($this->config->testtask->edit->requiredFields, 'notempty')
|
||||
->checkIF($task->end != '', 'end', 'ge', $task->begin)
|
||||
->where('id')->eq($taskID)
|
||||
->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->file->updateObjectID($this->post->uid, $taskID, 'testtask');
|
||||
@@ -760,6 +768,7 @@ class testtaskModel extends model
|
||||
{
|
||||
$oldTesttask = $this->getById($taskID);
|
||||
$testtask = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('status', 'doing')
|
||||
->remove('comment')->get();
|
||||
|
||||
@@ -781,6 +790,7 @@ class testtaskModel extends model
|
||||
{
|
||||
$oldTesttask = $this->getById($taskID);
|
||||
$testtask = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('status', 'done')
|
||||
->stripTags($this->config->testtask->editor->close['id'], $this->config->allowedTags)
|
||||
->join('mailto', ',')
|
||||
@@ -822,6 +832,7 @@ class testtaskModel extends model
|
||||
{
|
||||
$oldTesttask = $this->getById($taskID);
|
||||
$testtask = fixer::input('post')
|
||||
->add('id', $taskID)
|
||||
->setDefault('status', 'blocked')
|
||||
->remove('comment')->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user