Merge branch 'zentaopms_9.8' of github.com:easysoft/zentaopms into zentaopms_9.8

This commit is contained in:
wumo
2018-03-30 14:38:39 +08:00
9 changed files with 72 additions and 11 deletions
+1
View File
@@ -1,2 +1,3 @@
ALTER TABLE `zt_team` DROP PRIMARY KEY;
ALTER TABLE `zt_team` ADD PRIMARY KEY (`root`, `type`, `account`);
ALTER TABLE `zt_team` CHANGE `team` `team` varchar(90) NOT NULL;
+1 -1
View File
@@ -486,7 +486,7 @@ CREATE TABLE IF NOT EXISTS `zt_project` (
`PM` varchar(30) NOT NULL default '',
`QD` varchar(30) NOT NULL default '',
`RD` varchar(30) NOT NULL default '',
`team` varchar(30) NOT NULL,
`team` varchar(90) NOT NULL,
`acl` enum('open','private','custom') NOT NULL default 'open',
`whitelist` text NOT NULL,
`order` mediumint(8) unsigned NOT NULL,
+1 -1
View File
@@ -90,7 +90,7 @@ class bugModel extends model
empty($bug->case) ? $this->loadModel('score')->create('bug', 'create', $bugID) : $this->loadModel('score')->create('bug', 'createFormCase', $bug->case);
/* Callback the callable method to process the related data for object that is transfered to bug. */
if(is_callable(array($this, $this->config->bug->fromObjects[$from]['callback']))) call_user_func(array($this, $this->config->bug->fromObjects[$from]['callback']), $bugID);
if($from && is_callable(array($this, $this->config->bug->fromObjects[$from]['callback']))) call_user_func(array($this, $this->config->bug->fromObjects[$from]['callback']), $bugID);
return array('status' => 'created', 'id' => $bugID);
}
-1
View File
@@ -523,7 +523,6 @@ class productplan extends control
$this->view->planBugs = $this->bug->getPlanBugs($planID);
$this->view->products = $products;
$this->view->plan = $plan;
$this->view->plans = $this->dao->select('id, end')->from(TABLE_PRODUCTPLAN)->fetchPairs();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->browseType = $browseType;
$this->view->param = $param;
+58 -4
View File
@@ -38,17 +38,43 @@ class story extends control
* @param int $bugID
* @param int $planID
* @param int $todoID
* @param string $extra for example feedbackID=0
* @access public
* @return void
*/
public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0, $planID = 0, $todoID = 0)
public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0, $planID = 0, $todoID = 0, $extra = '')
{
/* Whether there is a object to transfer story, for example feedback. */
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
foreach($output as $paramKey => $paramValue)
{
if(isset($this->config->story->fromObjects[$paramKey]))
{
$fromObjectIDKey = $paramKey;
$fromObjectID = $paramValue;
$fromObjectName = $this->config->story->fromObjects[$fromObjectIDKey]['name'];
$fromObjectAction = $this->config->story->fromObjects[$fromObjectIDKey]['action'];
break;
}
}
/* If there is a object to transfer story, get it by getById function and set objectID,object in views. */
if(isset($fromObjectID))
{
$fromObject = $this->loadModel($fromObjectName)->getById($fromObjectID);
if(!$fromObject) die(js::error($this->lang->notFound) . js::locate('back', 'parent'));
$this->view->$fromObjectIDKey = $fromObjectID;
$this->view->$fromObjectName = $fromObject;
}
if(!empty($_POST))
{
$response['result'] = 'success';
$response['message'] = '';
$storyResult = $this->story->create($projectID, $bugID);
$storyResult = $this->story->create($projectID, $bugID, $from = isset($fromObjectIDKey) ? $fromObjectIDKey : '');
if(!$storyResult or dao::isError())
{
$response['result'] = 'fail';
@@ -71,8 +97,14 @@ class story extends control
$this->send($response);
}
$action = $bugID == 0 ? 'Opened' : 'Frombug';
$extra = $bugID == 0 ? '' : $bugID;
$action = $bugID == 0 ? 'Opened' : 'Frombug';
$extra = $bugID == 0 ? '' : $bugID;
/* Record related action, for example FromFeedback. */
if($fromObjectID)
{
$action = $fromObjectAction;
$extra = $fromObjectID;
}
$actionID = $this->action->create('story', $storyID, $action, '', $extra);
if($todoID > 0)
@@ -171,6 +203,28 @@ class story extends control
$pri = $todo->pri;
}
/* Replace the value of story that needs to be replaced with the value of the object that is transferred to story. */
if(isset($fromObject))
{
if(isset($this->config->story->fromObjects[$fromObjectIDKey]['source']))
{
$sourceField = $this->config->story->fromObjects[$fromObjectIDKey]['source'];
$sourceUser = $this->loadModel('user')->getById($fromObject->{$sourceField});
$source = $sourceUser->role;
$sourceNote = $sourceUser->realname;
}
else
{
$source = $fromObjectName;
$sourceNote = $fromObjectID;
}
foreach($this->config->story->fromObjects[$fromObjectIDKey]['fields'] as $storyField => $fromObjectField)
{
$$storyField = $fromObject->{$fromObjectField};
}
}
/* Set Custom*/
foreach(explode(',', $this->config->story->list->customCreateFields) as $field) $customFields[$field] = $this->lang->story->$field;
$this->view->customFields = $customFields;
+5 -1
View File
@@ -140,7 +140,7 @@ class storyModel extends model
* @access public
* @return int|bool the id of the created story or false when error.
*/
public function create($projectID = 0, $bugID = 0)
public function create($projectID = 0, $bugID = 0, $from = '')
{
$now = helper::now();
$story = fixer::input('post')
@@ -232,6 +232,10 @@ class storyModel extends model
}
$this->setStage($storyID);
if(!dao::isError()) $this->loadModel('score')->create('story', 'create',$storyID);
/* Callback the callable method to process the related data for object that is transfered to story. */
if($from && is_callable(array($this, $this->config->story->fromObjects[$from]['callback']))) call_user_func(array($this, $this->config->story->fromObjects[$from]['callback']), $storyID);
return array('status' => 'created', 'id' => $storyID);
}
return false;
+1 -1
View File
@@ -13,7 +13,7 @@ function setStories(moduleID, projectID, num)
var storyID = $('#story' + num).val();
if(!stories) stories = '<select id="story' + num + '" name="story[' + num + ']" class="form-control"></select>';
$('#story' + num).replaceWith(stories);
if(moduleID == 0) $('#story' + num).append("<option value='ditto'>" + ditto + "</option>");
if(moduleID == 0 || moduleID == 'ditto') $('#story' + num).append("<option value='ditto'>" + ditto + "</option>");
$('#story' + num).val(storyID);
if($('#zeroTaskStory').hasClass('zeroTask'))
{
+2 -2
View File
@@ -973,15 +973,15 @@ class taskModel extends model
if($left != 0 || $task->assignedTo != $teams[count($teams) - 1])
{
$newTask->status = 'doing';
if($task->assignedTo != $teams[count($teams) - 1] && $left == 0)
if($left == 0)
{
$newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo);
$newTask->assignedDate = $now;
}
$task->status = $oldStatus;
$this->dao->update(TABLE_TASK)->data($newTask)->where('id')->eq((int)$taskID)->exec();
$task->status = $oldStatus;
$changes = common::createChanges($task, $newTask);
if(!empty($actionID)) $this->action->logHistory($actionID, $changes);
return $changes;
+3
View File
@@ -212,6 +212,8 @@ class upgradeModel extends model
$this->fixTaskAssignedTo();
$this->fixProjectClosedInfo();
$this->resetProductLine();
case '9_8_2':
$this->execSQL($this->getUpgradeFile('9.8.2'));
}
$this->deletePatch();
@@ -317,6 +319,7 @@ class upgradeModel extends model
case '9_7': $confirmContent .= file_get_contents($this->getUpgradeFile('9.7'));
case '9_8':
case '9_8_1': $confirmContent .= file_get_contents($this->getUpgradeFile('9.8.1'));
case '9_8_2': $confirmContent .= file_get_contents($this->getUpgradeFile('9.8.2'));
}
return str_replace('zt_', $this->config->db->prefix, $confirmContent);
}