* Task#3561
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE `zt_team` DROP PRIMARY KEY;
|
||||
ALTER TABLE `zt_team` CHANGE `project` `root` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `zt_team` DROP `task`;
|
||||
ALTER TABLE `zt_team` ADD `type` ENUM('project', 'task') NOT NULL DEFAULT 'project' AFTER `root`;
|
||||
@@ -34,7 +34,7 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
/**
|
||||
* Execute the converter.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -74,11 +74,11 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
$result['docs'] = self::$convertDocCount;
|
||||
$result['files'] = self::$convertFileCount;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set table names.
|
||||
*
|
||||
}
|
||||
|
||||
/**
|
||||
* Set table names.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -137,9 +137,9 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
|
||||
/**
|
||||
* Convert groups.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertGroup()
|
||||
{
|
||||
@@ -176,9 +176,9 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
|
||||
/**
|
||||
* Convert users.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertUser()
|
||||
{
|
||||
@@ -217,8 +217,8 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert relationship between user and group.
|
||||
*
|
||||
* convert relationship between user and group.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -255,10 +255,10 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert products.
|
||||
*
|
||||
* convert products.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertProduct()
|
||||
{
|
||||
@@ -280,9 +280,9 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
|
||||
/**
|
||||
* Convert projects.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertProject()
|
||||
{
|
||||
@@ -313,12 +313,12 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
$convertCount = count($projects) + count($this->map['projectOfProduct']);
|
||||
self::$convertProjectCount += $convertCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* convert builds and releases
|
||||
*
|
||||
* convert builds and releases
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertBuildAndRelease()
|
||||
{
|
||||
@@ -370,10 +370,10 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert productPlans
|
||||
*
|
||||
* convert productPlans
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertProductPlan()
|
||||
{
|
||||
@@ -401,11 +401,11 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
$convertCount = count($this->map['products']) + count($productPlans);
|
||||
self::$convertProductPlanCount += $convertCount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* convert relationship between project and product.
|
||||
*
|
||||
* convert relationship between project and product.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -424,8 +424,8 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert teams.
|
||||
*
|
||||
* convert teams.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -454,10 +454,10 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert docLibs.
|
||||
*
|
||||
* convert docLibs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertDocLib()
|
||||
{
|
||||
@@ -478,10 +478,10 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert docs.
|
||||
*
|
||||
* convert docs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertDoc()
|
||||
{
|
||||
@@ -507,10 +507,10 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert news.
|
||||
*
|
||||
* convert news.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertNews()
|
||||
{
|
||||
@@ -541,12 +541,12 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert issue
|
||||
*
|
||||
* convert issue
|
||||
*
|
||||
* @param array $aimTypes //aimTypes['issueTypeID'] = aimtype eg. aimTypes[1] = 'bug';
|
||||
* @param array $statusTypes //statusTypes['task']['statusTypeID'] = statusType eg. statusTypes['task'][1] = 'wait';
|
||||
* //statusTypes['bug']['statusTypeID'] = statusType eg. statusTypes['bug'][1] = 'active';
|
||||
* @param array $priTypes //priTypes['task']['priTypeID'] = priType; eg. priTypes['task'][1] = 1;
|
||||
* @param array $priTypes //priTypes['task']['priTypeID'] = priType; eg. priTypes['task'][1] = 1;
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -574,13 +574,13 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert story
|
||||
*
|
||||
* @param array $issueType
|
||||
* @param array $statusTypes
|
||||
* @param array $priTypes
|
||||
* convert story
|
||||
*
|
||||
* @param array $issueType
|
||||
* @param array $statusTypes
|
||||
* @param array $priTypes
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertStory($issueType, $statusTypes, $priTypes)
|
||||
{
|
||||
@@ -623,13 +623,13 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert task
|
||||
*
|
||||
* @param array $issueType
|
||||
* @param array $statusTypes
|
||||
* @param array $priTypes
|
||||
* convert task
|
||||
*
|
||||
* @param array $issueType
|
||||
* @param array $statusTypes
|
||||
* @param array $priTypes
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertTask($issueType, $statusTypes, $priTypes)
|
||||
{
|
||||
@@ -651,7 +651,7 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
$task->pri = $priTypes['task'][$task->pri];
|
||||
$task->status = $statusTypes['task'][$task->status];
|
||||
if($task->project == 0)
|
||||
{
|
||||
{
|
||||
$task->project = $this->map['projectOfProduct'][$task->product];
|
||||
}
|
||||
else
|
||||
@@ -668,13 +668,13 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
}
|
||||
|
||||
/**
|
||||
* convert bug
|
||||
*
|
||||
* @param array $issueType
|
||||
* @param array $statusTypes
|
||||
* @param array $priTypes
|
||||
* convert bug
|
||||
*
|
||||
* @param array $issueType
|
||||
* @param array $statusTypes
|
||||
* @param array $priTypes
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertBug($issueType, $statusTypes, $priTypes)
|
||||
{
|
||||
@@ -704,7 +704,7 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
$bug->caseVersion = 1;
|
||||
$bug->result = 0;
|
||||
if($bug->project == 0)
|
||||
{
|
||||
{
|
||||
$bug->project = $this->map['projectOfProduct'][$bug->product];
|
||||
}
|
||||
else
|
||||
@@ -712,7 +712,7 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
$bug->project = $this->map['project'][$bug->project];
|
||||
}
|
||||
unset($bug->id);
|
||||
$this->dao->dbh($this->dbh)->insert(TABLE_BUG)->data($bug)->exec();
|
||||
$this->dao->dbh($this->dbh)->insert(TABLE_BUG)->data($bug)->exec();
|
||||
$this->map['issueID'][$issueID] = $this->dao->lastInsertID();
|
||||
$this->map['issueType'][$issueID] = 'bug';
|
||||
}
|
||||
@@ -721,9 +721,9 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
|
||||
/**
|
||||
* Convert attachments.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function convertFile()
|
||||
{
|
||||
@@ -752,7 +752,7 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
/* Transform objectType and objectID */
|
||||
if($file->objectType == 'Issue')
|
||||
{
|
||||
$file->objectType = $this->map['issueType'][$file->objectID];
|
||||
$file->objectType = $this->map['issueType'][$file->objectID];
|
||||
$file->objectID = $this->map['issueID'][$file->objectID];
|
||||
}
|
||||
elseif($file->objectType == 'Document')
|
||||
@@ -808,7 +808,7 @@ class redmine11ConvertModel extends redmineConvertModel
|
||||
|
||||
/**
|
||||
* Clear the converted records.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
+61
-60
@@ -15,10 +15,10 @@ class docModel extends model
|
||||
{
|
||||
/**
|
||||
* Set menus
|
||||
*
|
||||
* @param array $libs
|
||||
* @param int $libID
|
||||
* @param string $moduleID
|
||||
*
|
||||
* @param array $libs
|
||||
* @param int $libID
|
||||
* @param string $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -80,8 +80,8 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get library by id.
|
||||
*
|
||||
* @param int $libID
|
||||
*
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
@@ -92,7 +92,7 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get libraries.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Create a library.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -151,8 +151,8 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Update a library.
|
||||
*
|
||||
* @param int $libID
|
||||
*
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -373,7 +373,7 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Create a doc.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -438,8 +438,8 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Update a doc.
|
||||
*
|
||||
* @param int $docID
|
||||
*
|
||||
* @param int $docID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -541,7 +541,7 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get pairs of project modules.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -556,9 +556,9 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get doc menu.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $parent
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $parent
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -576,8 +576,8 @@ class docModel extends model
|
||||
* Extract css styles for tables created in kindeditor.
|
||||
*
|
||||
* Like this: <table class="ke-table1" style="width:100%;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @param string $content
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -611,8 +611,8 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Check priv.
|
||||
*
|
||||
* @param object $object
|
||||
*
|
||||
* @param object $object
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
@@ -639,13 +639,13 @@ class docModel extends model
|
||||
if(strpos(",$object->groups,", ",$groupID,") !== false) return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(isset($object->lib))
|
||||
{
|
||||
static $libs;
|
||||
if(empty($libs)) $libs = $this->getLibs('all');
|
||||
if(!isset($libs[$object->lib])) return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($object->project)
|
||||
@@ -667,10 +667,10 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get all libs by type.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $pager
|
||||
* @param string $extra
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $pager
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -708,7 +708,7 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get all lib groups.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -792,9 +792,9 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get limit libs.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $limit
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $limit
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -836,11 +836,11 @@ class docModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project or product libs groups.
|
||||
*
|
||||
* @param string $type
|
||||
* @param array $idList
|
||||
* @param int $limit
|
||||
* Get project or product libs groups.
|
||||
*
|
||||
* @param string $type
|
||||
* @param array $idList
|
||||
* @param int $limit
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -879,10 +879,10 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get libs by object.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @param string $mode
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @param string $mode
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -983,8 +983,8 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get doc tree.
|
||||
*
|
||||
* @param int $libID
|
||||
*
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1003,9 +1003,9 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Fill docs in tree.
|
||||
*
|
||||
* @param object $node
|
||||
* @param int $libID
|
||||
*
|
||||
* @param object $node
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1063,11 +1063,11 @@ class docModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get crumbs.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param int $docID
|
||||
* Get crumbs.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param int $docID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
@@ -1076,7 +1076,7 @@ class docModel extends model
|
||||
if(empty($libID)) return '';
|
||||
|
||||
$lib = $this->getLibById($libID);
|
||||
if(!$this->checkPriv($lib))
|
||||
if(!$this->checkPriv($lib))
|
||||
{
|
||||
echo(js::alert($this->lang->doc->accessDenied));
|
||||
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
|
||||
@@ -1116,9 +1116,9 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Get product crumb.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
@@ -1147,9 +1147,9 @@ class docModel extends model
|
||||
|
||||
/**
|
||||
* Set lib users.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
@@ -1159,15 +1159,16 @@ class docModel extends model
|
||||
if($type == 'product')
|
||||
{
|
||||
$teams = $this->dao->select('t1.account')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.project=t2.project')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.project=t3.id')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.root=t2.project')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.root=t3.id')
|
||||
->where('t2.product')->eq($objectID)
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->andWhere('t3.deleted')->eq('0')
|
||||
->fetchPairs('account', 'account');
|
||||
}
|
||||
elseif($type == 'project')
|
||||
{
|
||||
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('project')->eq($objectID)->fetchPairs('account', 'account');
|
||||
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('root')->eq($objectID)->andWhere('type')->eq('project')->fetchPairs('account', 'account');
|
||||
}
|
||||
|
||||
return $teams;
|
||||
|
||||
+46
-46
@@ -13,7 +13,7 @@ class my extends control
|
||||
{
|
||||
/**
|
||||
* Construct function.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ class my extends control
|
||||
|
||||
/**
|
||||
* Index page, goto todo.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -63,14 +63,14 @@ class my extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* My todos.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $account
|
||||
* @param string $status
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* My todos.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $account
|
||||
* @param string $status
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -114,12 +114,12 @@ class my extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* My stories
|
||||
|
||||
* @param string $type
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* My stories
|
||||
|
||||
* @param string $type
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -153,11 +153,11 @@ class my extends control
|
||||
|
||||
/**
|
||||
* My tasks
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -195,12 +195,12 @@ class my extends control
|
||||
|
||||
/**
|
||||
* My bugs.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -209,7 +209,7 @@ class my extends control
|
||||
/* Save session. load Lang. */
|
||||
if($this->app->viewType != 'json') $this->session->set('bugList', $this->app->getURI(true));
|
||||
$this->app->loadLang('bug');
|
||||
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
@@ -239,7 +239,7 @@ class my extends control
|
||||
|
||||
/**
|
||||
* My test task.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -260,7 +260,7 @@ class my extends control
|
||||
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->testTask;
|
||||
$this->view->position[] = $this->lang->my->testTask;
|
||||
$this->view->tasks = $this->loadModel('testtask')->getByUser($this->app->user->account, $pager, $sort, $type);
|
||||
|
||||
|
||||
$this->view->recTotal = $recTotal;
|
||||
$this->view->recPerPage = $recPerPage;
|
||||
$this->view->pageID = $pageID;
|
||||
@@ -327,7 +327,7 @@ class my extends control
|
||||
|
||||
/**
|
||||
* My projects.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -344,8 +344,8 @@ class my extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit profile
|
||||
*
|
||||
* Edit profile
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -369,8 +369,8 @@ class my extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Change password
|
||||
*
|
||||
* Change password
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -495,7 +495,7 @@ class my extends control
|
||||
|
||||
/**
|
||||
* View my profile.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -509,18 +509,18 @@ class my extends control
|
||||
$this->view->position[] = $this->lang->my->profile;
|
||||
$this->view->user = $user;
|
||||
$this->view->groups = $this->loadModel('group')->getByAccount($this->app->user->account);
|
||||
$this->view->deptPath = $this->dept->getParents($user->dept);
|
||||
$this->view->deptPath = $this->dept->getParents($user->dept);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* My dynamic.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -562,9 +562,9 @@ class my extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind ranzhi
|
||||
*
|
||||
* @param string $confirm
|
||||
* Unbind ranzhi
|
||||
*
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<tr class='text-center'>
|
||||
<th class='w-id'><?php echo $lang->idAB;?></th>
|
||||
<th class='w-160px'><?php echo $lang->project->code;?></th>
|
||||
<th><?php echo $lang->project->name;?></th>
|
||||
<th class="text-left"><?php echo $lang->project->name;?></th>
|
||||
<th class='w-date'><?php echo $lang->project->begin;?></th>
|
||||
<th class='w-date'><?php echo $lang->project->end;?></th>
|
||||
<th class='w-status'><?php echo $lang->statusAB;?></th>
|
||||
@@ -52,5 +52,5 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -614,10 +614,11 @@ class productModel extends model
|
||||
}
|
||||
if(empty($teams))
|
||||
{
|
||||
$teams = $this->dao->select('t1.project, t1.account')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
$teams = $this->dao->select('t1.root, t1.account')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')
|
||||
->where('t2.deleted')->eq(0)
|
||||
->fetchGroup('project', 'account');
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->fetchGroup('root', 'account');
|
||||
}
|
||||
|
||||
if(!isset($projects[$product->id])) return $members;
|
||||
@@ -788,7 +789,7 @@ class productModel extends model
|
||||
|
||||
$products = $this->dao->select('distinct t1.id')->from(TABLE_PRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id = t2.product')
|
||||
->leftJoin(TABLE_TEAM)->alias('t3')->on('t2.project = t3.project')
|
||||
->leftJoin(TABLE_TEAM)->alias('t3')->on('t2.project = t3.root')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t2.project = t4.id')
|
||||
->beginIF($this->app->user->admin)->where('t1.deleted')->eq(0)->fi()
|
||||
->beginIF(!$this->app->user->admin)
|
||||
@@ -800,6 +801,7 @@ class productModel extends model
|
||||
->orWhere('t1.createdBy')->eq($this->app->user->account)
|
||||
->orWhere('t3.account')->eq($this->app->user->account)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t3.type')->eq('project')
|
||||
->andWhere('t4.deleted')->eq(0)
|
||||
->fi()
|
||||
->fetchAll('id');
|
||||
|
||||
+232
-215
@@ -17,16 +17,16 @@ class projectModel extends model
|
||||
const LINK_MEMBERS_ONE_TIME = 20;
|
||||
|
||||
/**
|
||||
* Check the privilege.
|
||||
*
|
||||
* @param object $project
|
||||
* Check the privilege.
|
||||
*
|
||||
* @param object $project
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkPriv($project)
|
||||
{
|
||||
/* If is admin, return true. */
|
||||
if($this->app->user->admin) return true;
|
||||
if($this->app->user->admin) return true;
|
||||
|
||||
$acls = $this->app->user->rights['acls'];
|
||||
if(!empty($acls['projects']) and !in_array($project->id, $acls['projects'])) return false;
|
||||
@@ -36,7 +36,7 @@ class projectModel extends model
|
||||
|
||||
/* Get all teams of all projects and group by projects, save it as static. */
|
||||
static $teams;
|
||||
if(empty($teams)) $teams = $this->dao->select('project, account')->from(TABLE_TEAM)->fetchGroup('project', 'account');
|
||||
if(empty($teams)) $teams = $this->dao->select('root, account')->from(TABLE_TEAM)->where('type')->eq('project')->fetchGroup('root', 'account');
|
||||
$currentTeam = isset($teams[$project->id]) ? $teams[$project->id] : array();
|
||||
|
||||
/* If project is private, only members can access. */
|
||||
@@ -61,9 +61,9 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Set menu.
|
||||
*
|
||||
* @param array $projects
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param array $projects
|
||||
* @param int $projectID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -74,7 +74,7 @@ class projectModel extends model
|
||||
$project = $this->getById($projectID);
|
||||
|
||||
/* Unset story, bug, build and testtask if type is ops. */
|
||||
if($project and $project->type == 'ops')
|
||||
if($project and $project->type == 'ops')
|
||||
{
|
||||
unset($this->lang->project->menu->story);
|
||||
unset($this->lang->project->menu->bug);
|
||||
@@ -93,7 +93,7 @@ class projectModel extends model
|
||||
$moduleName = $this->app->getModuleName();
|
||||
$methodName = $this->app->getMethodName();
|
||||
|
||||
if($this->cookie->projectMode == 'noclosed' and $project->status == 'done')
|
||||
if($this->cookie->projectMode == 'noclosed' and $project->status == 'done')
|
||||
{
|
||||
setcookie('projectMode', 'all');
|
||||
$this->cookie->projectMode = 'all';
|
||||
@@ -108,12 +108,12 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the select code of projects.
|
||||
*
|
||||
* @param array $projects
|
||||
* @param int $projectID
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* Create the select code of projects.
|
||||
*
|
||||
* @param array $projects
|
||||
* @param int $projectID
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return string
|
||||
@@ -133,7 +133,7 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get project tree menu.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -150,7 +150,7 @@ class projectModel extends model
|
||||
$productName = isset($products[$productID]) ? $products[$productID] : $this->lang->project->noProduct;
|
||||
|
||||
$projectTree .= "<li>$productName<ul>";
|
||||
|
||||
|
||||
foreach($projects as $project)
|
||||
{
|
||||
if($project->status != 'done')
|
||||
@@ -160,9 +160,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
$hasDone = false;
|
||||
foreach($projects as $project)
|
||||
foreach($projects as $project)
|
||||
{
|
||||
if($project->status == 'done')
|
||||
if($project->status == 'done')
|
||||
{
|
||||
$hasDone = true;
|
||||
break;
|
||||
@@ -191,9 +191,9 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Save the project id user last visited to session.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $projects
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $projects
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
@@ -217,8 +217,8 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a project.
|
||||
*
|
||||
* Create a project.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -257,14 +257,15 @@ class projectModel extends model
|
||||
$this->file->updateObjectID($this->post->uid, $projectID, 'project');
|
||||
|
||||
/* Copy team of project. */
|
||||
if($copyProjectID != '')
|
||||
if($copyProjectID != '')
|
||||
{
|
||||
$members = $this->dao->select('*')->from(TABLE_TEAM)->where('project')->eq($copyProjectID)->fetchAll();
|
||||
$members = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->eq($copyProjectID)->andWhere('type')->eq('project')->fetchAll();
|
||||
foreach($members as $member)
|
||||
{
|
||||
$member->project = $projectID;
|
||||
$member->join = $today;
|
||||
$member->days = $project->days;
|
||||
$member->root = $projectID;
|
||||
$member->join = $today;
|
||||
$member->days = $project->days;
|
||||
$member->type = 'project';
|
||||
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
|
||||
if($member->account == $this->app->user->account) $creatorExists = true;
|
||||
}
|
||||
@@ -274,12 +275,13 @@ class projectModel extends model
|
||||
if($copyProjectID == '' or !$creatorExists)
|
||||
{
|
||||
$member = new stdclass();
|
||||
$member->project = $projectID;
|
||||
$member->account = $this->app->user->account;
|
||||
$member->role = $this->lang->user->roleList[$this->app->user->role];
|
||||
$member->join = $today;
|
||||
$member->days = $project->days;
|
||||
$member->hours = $this->config->project->defaultWorkhours;
|
||||
$member->root = $projectID;
|
||||
$member->account = $this->app->user->account;
|
||||
$member->role = $this->lang->user->roleList[$this->app->user->role];
|
||||
$member->join = $today;
|
||||
$member->type = 'project';
|
||||
$member->days = $project->days;
|
||||
$member->hours = $this->config->project->defaultWorkhours;
|
||||
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
|
||||
}
|
||||
|
||||
@@ -293,13 +295,13 @@ class projectModel extends model
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
if(!dao::isError()) $this->loadModel('score')->create('project', 'create', $projectID);
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -336,11 +338,12 @@ class projectModel extends model
|
||||
{
|
||||
if(!empty($value) and !isset($team[$value]))
|
||||
{
|
||||
$member->project = (int)$projectID;
|
||||
$member->root = (int)$projectID;
|
||||
$member->account = $value;
|
||||
$member->join = helper::today();
|
||||
$member->role = $this->lang->project->$fieldName;
|
||||
$member->days = $project->days;
|
||||
$member->type = 'project';
|
||||
$member->hours = $this->config->project->defaultWorkhours;
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
}
|
||||
@@ -356,8 +359,8 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update.
|
||||
*
|
||||
* Batch update.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -365,7 +368,7 @@ class projectModel extends model
|
||||
{
|
||||
$projects = array();
|
||||
$allChanges = array();
|
||||
$data = fixer::input('post')->get();
|
||||
$data = fixer::input('post')->get();
|
||||
$oldProjects = $this->getByIdList($this->post->projectIDList);
|
||||
foreach($data->projectIDList as $projectID)
|
||||
{
|
||||
@@ -410,7 +413,8 @@ class projectModel extends model
|
||||
if(!empty($value) and !isset($team[$value]))
|
||||
{
|
||||
$member = new stdClass();
|
||||
$member->project = (int)$projectID;
|
||||
$member->root = (int)$projectID;
|
||||
$member->type = 'project';
|
||||
$member->account = $value;
|
||||
$member->join = helper::today();
|
||||
$member->role = $this->lang->project->$fieldName;
|
||||
@@ -430,8 +434,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Start project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -453,8 +457,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Put project off.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -474,8 +478,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Suspend project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -497,8 +501,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Activate project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -561,8 +565,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Close project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -587,8 +591,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get project pairs.
|
||||
*
|
||||
* @param string $mode all|noclosed or empty
|
||||
*
|
||||
* @param string $mode all|noclosed or empty
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -624,8 +628,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get by idList.
|
||||
*
|
||||
* @param array $projectIDList
|
||||
*
|
||||
* @param array $projectIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -636,10 +640,10 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get project lists.
|
||||
*
|
||||
*
|
||||
* @param string $status all|undone|wait|running
|
||||
* @param int $limit
|
||||
* @param int $productID
|
||||
* @param int $limit
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -677,10 +681,10 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get project lists.
|
||||
*
|
||||
*
|
||||
* @param string $status involved
|
||||
* @param int $limit
|
||||
* @param int $productID
|
||||
* @param int $limit
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return array
|
||||
@@ -691,7 +695,7 @@ class projectModel extends model
|
||||
{
|
||||
return $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_TEAM)->alias('t3')->on('t3.project=t2.id')
|
||||
->leftJoin(TABLE_TEAM)->alias('t3')->on('t3.root=t2.id')
|
||||
->where('t1.product')->eq($productID)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('t2.iscat')->eq(0)
|
||||
@@ -699,6 +703,7 @@ class projectModel extends model
|
||||
->andWhere('t2.openedBy', true)->eq($this->app->user->account)
|
||||
->orWhere('t3.account')->eq($this->app->user->account)
|
||||
->markRight(1)
|
||||
->andWhere('t3.type')->eq('project')
|
||||
->orderBy('order_desc')
|
||||
->beginIF($limit)->limit($limit)->fi()
|
||||
->fetchAll('id');
|
||||
@@ -706,12 +711,13 @@ class projectModel extends model
|
||||
else
|
||||
{
|
||||
return $this->dao->select('t1.*, IF(INSTR(" done", t1.status) < 2, 0, 1) AS isDone')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_TEAM)->alias('t2')->on('t2.project=t1.id')
|
||||
->leftJoin(TABLE_TEAM)->alias('t2')->on('t2.root=t1.id')
|
||||
->where('t1.iscat')->eq(0)
|
||||
->andWhere('t1.openedBy', true)->eq($this->app->user->account)
|
||||
->orWhere('t2.account')->eq($this->app->user->account)
|
||||
->markRight(1)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.type')->eq('project')
|
||||
->orderBy('t1.order_desc')
|
||||
->beginIF($limit)->limit($limit)->fi()
|
||||
->fetchAll('id');
|
||||
@@ -720,7 +726,7 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get projects lists grouped by product.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -738,14 +744,14 @@ class projectModel extends model
|
||||
{
|
||||
foreach($product as $ID => $project)
|
||||
{
|
||||
if(!$this->checkPriv($projects[$project->id]))
|
||||
if(!$this->checkPriv($projects[$project->id]))
|
||||
{
|
||||
unset($list[$id][$ID]);
|
||||
}
|
||||
if(!$project->product)
|
||||
{
|
||||
if($this->checkPriv($projects[$project->id])) $noProducts[] = $project;
|
||||
unset($list[$id][$ID]);
|
||||
unset($list[$id][$ID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -757,12 +763,12 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get project stats.
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $productID
|
||||
* @param int $itemCounts
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $productID
|
||||
* @param int $itemCounts
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -949,8 +955,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get project by id.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param bool $setImgSize
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -970,8 +976,8 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
$total = $this->dao->select('
|
||||
SUM(estimate) AS totalEstimate,
|
||||
SUM(consumed) AS totalConsumed,
|
||||
SUM(estimate) AS totalEstimate,
|
||||
SUM(consumed) AS totalConsumed,
|
||||
SUM(`left`) AS totalLeft')
|
||||
->from(TABLE_TASK)
|
||||
->where('project')->eq((int)$projectID)
|
||||
@@ -980,7 +986,7 @@ class projectModel extends model
|
||||
->andWhere('parent')->eq(0)
|
||||
->fetch();
|
||||
$project->days = $project->days ? $project->days : '';
|
||||
$project->totalHours = $this->dao->select('sum(days * hours) AS totalHours')->from(TABLE_TEAM)->where('project')->eq($project->id)->fetch('totalHours');
|
||||
$project->totalHours = $this->dao->select('sum(days * hours) AS totalHours')->from(TABLE_TEAM)->where('root')->eq($project->id)->andWhere('type')->eq('project')->fetch('totalHours');
|
||||
$project->totalEstimate = round($total->totalEstimate, 1);
|
||||
$project->totalConsumed = round($total->totalConsumed, 1);
|
||||
$project->totalLeft = round($total->totalLeft, 1);
|
||||
@@ -992,9 +998,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default managers for a project from it's related products.
|
||||
*
|
||||
* @param int $projectID
|
||||
* Get the default managers for a project from it's related products.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
@@ -1015,8 +1021,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get products of a project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1039,12 +1045,12 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Build story search form.
|
||||
*
|
||||
* @param array $products
|
||||
* @param array $branchGroups
|
||||
* @param array $modules
|
||||
* @param int $queryID
|
||||
* @param string $actionURL
|
||||
*
|
||||
* @param array $products
|
||||
* @param array $branchGroups
|
||||
* @param array $modules
|
||||
* @param int $queryID
|
||||
* @param string $actionURL
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -1103,9 +1109,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projects to import
|
||||
* Get projects to import
|
||||
*
|
||||
* @param array $projectIds
|
||||
* @param array $projectIds
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1128,8 +1134,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Update products of a project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1166,9 +1172,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get related projects
|
||||
*
|
||||
* @param int $projectID
|
||||
* Get related projects
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1190,9 +1196,9 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get tasks can be imported.
|
||||
*
|
||||
*
|
||||
* @param int $toProject
|
||||
* @param array $branches
|
||||
* @param array $branches
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1217,8 +1223,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Import tasks.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1257,9 +1263,14 @@ class projectModel extends model
|
||||
{
|
||||
if(!isset($teamMembers[$account]))
|
||||
{
|
||||
$role = $this->dao->select('*')->from(TABLE_TEAM)->where('project')->eq($preProjectID)->andWhere('account')->eq($account)->fetch();
|
||||
$role->project = $projectID;
|
||||
$role->join = helper::today();
|
||||
$role = $this->dao->select('*')->from(TABLE_TEAM)
|
||||
->where('root')->eq($preProjectID)
|
||||
->andWhere('account')->eq($account)
|
||||
->andWhere('type')->eq('project')
|
||||
->fetch();
|
||||
|
||||
$role->root = $projectID;
|
||||
$role->join = helper::today();
|
||||
$this->dao->insert(TABLE_TEAM)->data($role)->exec();
|
||||
}
|
||||
}
|
||||
@@ -1279,9 +1290,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Import task from Bug.
|
||||
*
|
||||
* @param int $projectID
|
||||
* Import task from Bug.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1326,7 +1337,7 @@ class projectModel extends model
|
||||
if(!$bug->confirmed) $this->dao->update(TABLE_BUG)->set('confirmed')->eq(1)->where('id')->eq($bug->id)->exec();
|
||||
$this->dao->insert(TABLE_TASK)->data($task)->checkIF($bugToTasks->estimate[$key] != '', 'estimate', 'float')->exec();
|
||||
|
||||
if(dao::isError())
|
||||
if(dao::isError())
|
||||
{
|
||||
echo js::error(dao::getError());
|
||||
die(js::reload('parent'));
|
||||
@@ -1387,8 +1398,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get child projects.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1399,8 +1410,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Update childs.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1419,8 +1430,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Link story.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1444,14 +1455,14 @@ class projectModel extends model
|
||||
$this->dao->insert(TABLE_PROJECTSTORY)->data($data)->exec();
|
||||
$this->story->setStage($storyID);
|
||||
$this->action->create('story', $storyID, 'linked2project', '', $projectID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink story.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $storyID
|
||||
* Unlink story.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1481,9 +1492,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get team members.
|
||||
*
|
||||
* @param int $projectID
|
||||
* Get team members.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1492,15 +1503,16 @@ class projectModel extends model
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getTeamMembers();
|
||||
return $this->dao->select("t1.*, t1.hours * t1.days AS totalHours, if(t2.deleted='0', t2.realname, t1.account) as realname")->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->where('t1.root')->eq((int)$projectID)
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->fetchAll('account');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get team members in pair.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $params
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1509,7 +1521,8 @@ class projectModel extends model
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getTeamMembersPairs();
|
||||
$users = $this->dao->select('t1.account, t2.realname')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->where('t1.root')->eq((int)$projectID)
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->beginIF($params == 'nodeleted' or empty($this->config->user->showDeleted))
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->fi()
|
||||
@@ -1525,29 +1538,30 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get teams which can be imported.
|
||||
*
|
||||
* @param string $account
|
||||
* @param int $currentProject
|
||||
*
|
||||
* @param string $account
|
||||
* @param int $currentProject
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTeams2Import($account, $currentProject)
|
||||
{
|
||||
return $this->dao->select('t1.project, t2.name as projectName')
|
||||
return $this->dao->select('t1.root, t2.name as projectName')
|
||||
->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')
|
||||
->where('t1.account')->eq($account)
|
||||
->andWhere('t1.project')->ne($currentProject)
|
||||
->groupBy('t1.project')
|
||||
->orderBy('t1.project DESC')
|
||||
->andWhere('t1.root')->ne($currentProject)
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->groupBy('t1.root')
|
||||
->orderBy('t1.root DESC')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get members of a project who can be imported.
|
||||
*
|
||||
* @param int $project
|
||||
* @param array $currentMembers
|
||||
*
|
||||
* @param int $project
|
||||
* @param array $currentMembers
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1557,8 +1571,9 @@ class projectModel extends model
|
||||
|
||||
return $this->dao->select('account, role, hours')
|
||||
->from(TABLE_TEAM)
|
||||
->where('project')->eq($project)
|
||||
->where('root')->eq($project)
|
||||
->andWhere('account')->notIN($currentMembers)
|
||||
->andWhere('type')->eq('project')
|
||||
->fetchAll('account');
|
||||
}
|
||||
|
||||
@@ -1590,15 +1605,17 @@ class projectModel extends model
|
||||
{
|
||||
$this->dao->update(TABLE_TEAM)
|
||||
->data($member)
|
||||
->where('project')->eq((int)$projectID)
|
||||
->where('root')->eq((int)$projectID)
|
||||
->andWhere('account')->eq($account)
|
||||
->andWhere('type')->eq('project')
|
||||
->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
$member->project = (int)$projectID;
|
||||
$member->root = (int)$projectID;
|
||||
$member->account = $account;
|
||||
$member->join = helper::today();
|
||||
$member->type = 'project';
|
||||
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
|
||||
}
|
||||
}
|
||||
@@ -1606,20 +1623,20 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Unlink a member.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $account
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function unlinkMember($projectID, $account)
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_TEAM)->where('project')->eq((int)$projectID)->andWhere('account')->eq($account)->exec();
|
||||
$this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('account')->eq($account)->andWhere('type')->eq('project')->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute burn of a project.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1654,8 +1671,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Fix burn for first day.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1678,9 +1695,9 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get burn data for flot
|
||||
*
|
||||
* @param int $projectID
|
||||
* Get burn data for flot
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1694,7 +1711,7 @@ class projectModel extends model
|
||||
|
||||
$count = 0;
|
||||
$burnData = array();
|
||||
foreach($sets as $date => $set)
|
||||
foreach($sets as $date => $set)
|
||||
{
|
||||
if($date < $project->begin) continue;
|
||||
if($date > $project->end) continue;
|
||||
@@ -1709,12 +1726,12 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Process burndown datas when the sets is smaller than the itemCounts.
|
||||
*
|
||||
* @param array $sets
|
||||
* @param int $itemCounts
|
||||
* @param date $begin
|
||||
* @param date $end
|
||||
* @param string $mode
|
||||
*
|
||||
* @param array $sets
|
||||
* @param int $itemCounts
|
||||
* @param date $begin
|
||||
* @param date $end
|
||||
* @param string $mode
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1772,10 +1789,10 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get taskes by search.
|
||||
*
|
||||
* @param string $condition
|
||||
* @param object $pager
|
||||
* @param string $orderBy
|
||||
*
|
||||
* @param string $condition
|
||||
* @param object $pager
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1802,13 +1819,13 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bugs by search in project.
|
||||
*
|
||||
* @param int $products
|
||||
* @param int $projectID
|
||||
* @param int $sql
|
||||
* @param int $pager
|
||||
* @param int $orderBy
|
||||
* Get bugs by search in project.
|
||||
*
|
||||
* @param int $products
|
||||
* @param int $projectID
|
||||
* @param int $sql
|
||||
* @param int $pager
|
||||
* @param int $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1829,8 +1846,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get the summary of project.
|
||||
*
|
||||
* @param array $tasks
|
||||
*
|
||||
* @param array $tasks
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
@@ -1862,9 +1879,9 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Judge an action is clickable or not.
|
||||
*
|
||||
*
|
||||
* @param object $project
|
||||
* @param string $action
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
@@ -1883,10 +1900,10 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Create the link from module,method,extra
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @param mix $extra
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @param mix $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1897,12 +1914,12 @@ class projectModel extends model
|
||||
{
|
||||
$module = 'project';
|
||||
$method = 'task';
|
||||
}
|
||||
}
|
||||
if($module == 'build' and ($method == 'edit' || $method= 'view'))
|
||||
{
|
||||
{
|
||||
$module = 'project';
|
||||
$method = 'build';
|
||||
}
|
||||
}
|
||||
|
||||
if($module == 'project' and $method == 'create') return;
|
||||
if($extra != '')
|
||||
@@ -1923,12 +1940,12 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get no weekend date
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @param string $type
|
||||
* @param string|int $interval
|
||||
* Get no weekend date
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @param string $type
|
||||
* @param string|int $interval
|
||||
* @param string $format
|
||||
* @access public
|
||||
* @return array
|
||||
@@ -1978,8 +1995,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get total estimate.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return float
|
||||
*/
|
||||
@@ -2002,7 +2019,7 @@ class projectModel extends model
|
||||
if($this->app->user->admin) return true;
|
||||
|
||||
/* Get all teams of all projects and group by projects, save it as static. */
|
||||
$projects = $this->dao->select('project, limited')->from(TABLE_TEAM)->where('account')->eq($this->app->user->account)->andWhere('limited')->eq('yes')->orderBy('project asc')->fetchPairs('project', 'project');
|
||||
$projects = $this->dao->select('root, limited')->from(TABLE_TEAM)->where('account')->eq($this->app->user->account)->andWhere('limited')->eq('yes')->andWhere('type')->eq('project')->orderBy('root asc')->fetchPairs('root', 'root');
|
||||
$_SESSION['limitedProjects'] = join(',', $projects);
|
||||
}
|
||||
|
||||
@@ -2028,8 +2045,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get branches of project.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -2146,11 +2163,11 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Kanban tasks
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* Get Kanban tasks
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -2173,10 +2190,10 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get kanban group data.
|
||||
*
|
||||
* @param array $tasks
|
||||
* @param array $bugs
|
||||
* Get kanban group data.
|
||||
*
|
||||
* @param array $tasks
|
||||
* @param array $bugs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -2227,9 +2244,9 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Save Kanban Data.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $kanbanDatas
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $kanbanDatas
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -2243,8 +2260,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get Prev Kanban.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -2256,8 +2273,8 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Get kanban setting.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
@@ -2282,10 +2299,10 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Build burn data.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $dateList
|
||||
* @param string $type
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $dateList
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -2449,9 +2466,9 @@ class projectModel extends model
|
||||
|
||||
/**
|
||||
* Format tasks for tree.
|
||||
*
|
||||
* @param array $tasks
|
||||
* @param object $story
|
||||
*
|
||||
* @param array $tasks
|
||||
* @param object $story
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -143,7 +143,7 @@ class scoreModel extends model
|
||||
}
|
||||
|
||||
/* Project team user. */
|
||||
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('project')->eq($param->id)->fetchPairs();
|
||||
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('root')->eq($param->id)->andWhere('type')->eq('project')->fetchPairs();
|
||||
if(!empty($teams))
|
||||
{
|
||||
$rule['score'] = $extended['member']['close'];
|
||||
@@ -159,7 +159,7 @@ class scoreModel extends model
|
||||
}
|
||||
|
||||
/* When the project is closed, no more user get score. */
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'search':
|
||||
@@ -295,7 +295,7 @@ class scoreModel extends model
|
||||
|
||||
$notice = sprintf($this->lang->score->tips, $score, $this->app->user->score);
|
||||
$fullNotice = <<<EOT
|
||||
<div id='noticeAttend' class='alert alert-success with-icon alert-dismissable' style='width:280px; position:fixed; bottom:25px; right:15px; z-index: 9999;' id='planInfo'>
|
||||
<div id='noticeAttend' class='alert alert-success with-icon alert-dismissable' style='width:280px; position:fixed; bottom:25px; right:15px; z-index: 9999;' id='planInfo'>
|
||||
<i class='icon icon-diamond'> </i>
|
||||
<div class='content'>{$notice}</div>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
|
||||
@@ -115,10 +115,11 @@ class storyModel extends model
|
||||
/* Get team members. */
|
||||
if($story->projects)
|
||||
{
|
||||
$story->teams = $this->dao->select('account, project')
|
||||
$story->teams = $this->dao->select('account, root')
|
||||
->from(TABLE_TEAM)
|
||||
->where('project')->in(array_keys($story->projects))
|
||||
->fetchGroup('project');
|
||||
->where('root')->in(array_keys($story->projects))
|
||||
->andWhere('type')->eq('project')
|
||||
->fetchGroup('root');
|
||||
}
|
||||
|
||||
/* Get affected bugs. */
|
||||
@@ -1834,7 +1835,7 @@ class storyModel extends model
|
||||
->andWhere('t2.status')->eq('doing')
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->fetchPairs();
|
||||
if($projects) return($this->dao->select('account')->from(TABLE_TEAM)->where('project')->in($projects)->fetchPairs('account'));
|
||||
if($projects) return($this->dao->select('account')->from(TABLE_TEAM)->where('root')->in($projects)->andWhere('type')->eq('project')->fetchPairs('account'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -788,7 +788,11 @@ class task extends control
|
||||
$teams = array_keys($task->team);
|
||||
|
||||
$task->nextBy = $this->task->getNextUser($teams, $task->assignedTo);
|
||||
$task->myConsumed = $this->dao->select('consumed')->from(TABLE_TEAM)->where('task')->eq($taskID)->andWhere('account')->eq($task->assignedTo)->fetch('consumed');
|
||||
$task->myConsumed = $this->dao->select('consumed')->from(TABLE_TEAM)
|
||||
->where('root')->eq($taskID)
|
||||
->andWhere('account')->eq($task->assignedTo)
|
||||
->andWhere('type')->eq('task')
|
||||
->fetch('consumed');
|
||||
|
||||
$lastAccount = end($teams);
|
||||
if($lastAccount != $task->assignedTo)
|
||||
@@ -1243,7 +1247,10 @@ class task extends control
|
||||
foreach($tasks as $task) $relatedStoryIdList[$task->story] = $task->story;
|
||||
|
||||
/* Get team for multiple task. */
|
||||
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)->where('task')->in(array_keys($tasks))->fetchGroup('task');
|
||||
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)
|
||||
->where('root')->in(array_keys($tasks))
|
||||
->andWhere('type')->eq('task')
|
||||
->fetchGroup('root');
|
||||
if(!empty($taskTeam))
|
||||
{
|
||||
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
|
||||
|
||||
+54
-21
@@ -59,7 +59,7 @@ class taskModel extends model
|
||||
{
|
||||
if(empty($account) or isset($team[$account])) continue;
|
||||
$member = new stdClass();
|
||||
$member->project = 0;
|
||||
$member->root = 0;
|
||||
$member->account = $account;
|
||||
$member->role = $assignedTo;
|
||||
$member->join = helper::today();
|
||||
@@ -125,7 +125,8 @@ class taskModel extends model
|
||||
{
|
||||
foreach($teams as $team)
|
||||
{
|
||||
$team->task = $taskID;
|
||||
$team->root = $taskID;
|
||||
$team->type = 'task';
|
||||
$this->dao->insert(TABLE_TEAM)->data($team)->autoCheck()->exec();
|
||||
}
|
||||
}
|
||||
@@ -358,11 +359,11 @@ class taskModel extends model
|
||||
if(empty($account) or isset($team[$account])) continue;
|
||||
|
||||
$member = new stdClass();
|
||||
$member->project = 0;
|
||||
$member->account = $account;
|
||||
$member->role = $task->assignedTo;
|
||||
$member->join = helper::today();
|
||||
$member->task = $taskID;
|
||||
$member->root = $taskID;
|
||||
$member->type = 'task';
|
||||
$member->estimate = $this->post->teamEstimate[$row] ? $this->post->teamEstimate[$row] : 0;
|
||||
$member->consumed = $this->post->teamConsumed[$row] ? $this->post->teamConsumed[$row] : 0;
|
||||
$member->left = $member->estimate - $member->consumed;
|
||||
@@ -403,8 +404,11 @@ class taskModel extends model
|
||||
$this->computeWorkingHours($oldTask->parent);
|
||||
|
||||
/* Save team. */
|
||||
$this->dao->delete()->from(TABLE_TEAM)->where('task')->eq($taskID)->exec();
|
||||
if(!empty($teams)) foreach($teams as $member) $this->dao->insert(TABLE_TEAM)->data($member)->autoCheck()->exec();
|
||||
$this->dao->delete()->from(TABLE_TEAM)->where('root')->eq($taskID)->andWhere('type')->eq('task')->exec();
|
||||
if(!empty($teams))
|
||||
{
|
||||
foreach($teams as $member) $this->dao->insert(TABLE_TEAM)->data($member)->autoCheck()->exec();
|
||||
}
|
||||
|
||||
if($this->post->story != false) $this->loadModel('story')->setStage($this->post->story);
|
||||
if(!dao::isError())
|
||||
@@ -692,7 +696,11 @@ class taskModel extends model
|
||||
$newTeamInfo = new stdClass();
|
||||
$newTeamInfo->consumed = $task->consumed;
|
||||
$newTeamInfo->left = 0;
|
||||
$this->dao->update(TABLE_TEAM)->data($newTeamInfo)->where('task')->eq($taskID)->andWhere('account')->eq($oldTask->assignedTo)->exec();
|
||||
$this->dao->update(TABLE_TEAM)->data($newTeamInfo)
|
||||
->where('root')->eq($taskID)
|
||||
->andWhere('account')->eq($oldTask->assignedTo)
|
||||
->andWhere('type')->eq('task')
|
||||
->exec();
|
||||
|
||||
$newTask = new stdClass();
|
||||
$newTask->left = 0;
|
||||
@@ -829,14 +837,26 @@ class taskModel extends model
|
||||
{
|
||||
$teams = array_keys($task->team);
|
||||
|
||||
$myConsumed = $this->dao->select('`consumed`')->from(TABLE_TEAM)->where('task')->eq($taskID)->andWhere('account')->eq($task->assignedTo)->fetch('consumed');
|
||||
$myConsumed = $this->dao->select('`consumed`')->from(TABLE_TEAM)
|
||||
->where('root')->eq($taskID)
|
||||
->andWhere('account')->eq($task->assignedTo)
|
||||
->andWhere('type')->eq('task')
|
||||
->fetch('consumed');
|
||||
|
||||
$newTeamInfo = new stdClass();
|
||||
$newTeamInfo->consumed = $myConsumed + $consumed;
|
||||
$newTeamInfo->left = $left;
|
||||
$this->dao->update(TABLE_TEAM)->data($newTeamInfo)->where('task')->eq($taskID)->andWhere('account')->eq($task->assignedTo)->exec();
|
||||
$this->dao->update(TABLE_TEAM)->data($newTeamInfo)
|
||||
->where('root')->eq($taskID)
|
||||
->andWhere('account')->eq($task->assignedTo)
|
||||
->andWhere('type')->eq('task')
|
||||
->exec();
|
||||
|
||||
$teamTime = $this->dao->select("sum(`consumed`) as consumed,sum(`left`) as leftTime")->from(TABLE_TEAM)->where('task')->eq((int)$taskID)->andWhere('account')->in($teams)->fetch();
|
||||
$teamTime = $this->dao->select("sum(`consumed`) as consumed,sum(`left`) as leftTime")->from(TABLE_TEAM)
|
||||
->where('root')->eq((int)$taskID)
|
||||
->andWhere('account')->in($teams)
|
||||
->andWhere('type')->eq('task')
|
||||
->fetch();
|
||||
$data->consumed = $teamTime->consumed;
|
||||
$data->left = $teamTime->leftTime;
|
||||
|
||||
@@ -918,15 +938,27 @@ class taskModel extends model
|
||||
{
|
||||
$teams = array_keys($oldTask->team);
|
||||
|
||||
$myConsumed = $this->dao->select("`consumed`")->from(TABLE_TEAM)->where('task')->eq((int)$taskID)->andWhere('account')->eq($oldTask->assignedTo)->fetch('consumed');
|
||||
$myConsumed = $this->dao->select("`consumed`")->from(TABLE_TEAM)
|
||||
->where('root')->eq((int)$taskID)
|
||||
->andWhere('account')->eq($oldTask->assignedTo)
|
||||
->andWhere('type')->eq('task')
|
||||
->fetch('consumed');
|
||||
if($task->consumed < $myConsumed) die(js::error($this->lang->task->error->consumedSmall));
|
||||
|
||||
$data = new stdClass();
|
||||
$data->left = 0;
|
||||
$data->consumed = $task->consumed;
|
||||
$this->dao->update(TABLE_TEAM)->data($data)->where('task')->eq((int)$taskID)->andWhere('account')->eq($oldTask->assignedTo)->exec();
|
||||
$this->dao->update(TABLE_TEAM)->data($data)
|
||||
->where('root')->eq((int)$taskID)
|
||||
->andWhere('account')->eq($oldTask->assignedTo)
|
||||
->andWhere('type')->eq('task')
|
||||
->exec();
|
||||
|
||||
$myTime = $this->dao->select("sum(`left`) as leftTime,sum(`consumed`) as consumed")->from(TABLE_TEAM)->where('task')->eq((int)$taskID)->andWhere('account')->in($teams)->fetch();
|
||||
$myTime = $this->dao->select("sum(`left`) as leftTime,sum(`consumed`) as consumed")->from(TABLE_TEAM)
|
||||
->where('root')->eq((int)$taskID)
|
||||
->andWhere('account')->in($teams)
|
||||
->andWhere('type')->eq('task')
|
||||
->fetch();
|
||||
|
||||
$newTask = new stdClass();
|
||||
$newTask->left = $myTime->leftTime;
|
||||
@@ -1131,8 +1163,11 @@ class taskModel extends model
|
||||
/* Check parent Task. */
|
||||
if(!empty($task->parent)) $task->parentName = $this->dao->findById($task->parent)->from(TABLE_TASK)->fetch('name');
|
||||
|
||||
$teams = $this->dao->select('*')->from(TABLE_TEAM)->where('task')->eq($taskID)->orderBy('order_desc')->fetchGroup('task', 'account');
|
||||
foreach($teams as $key => $team) $teams[$key] = array_reverse($team, true);
|
||||
$teams = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->eq($taskID)->andWhere('type')->eq('task')->orderBy('order_desc')->fetchGroup('root', 'account');
|
||||
if(!empty($teams))
|
||||
{
|
||||
foreach($teams as $key => $team) $teams[$key] = array_reverse($team, true);
|
||||
}
|
||||
$task->team = isset($teams[$taskID]) ? $teams[$taskID] : array();
|
||||
foreach($children as $child) $child->team = isset($teams[$child->id]) ? $teams[$child->id] : array();
|
||||
|
||||
@@ -1217,15 +1252,13 @@ class taskModel extends model
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
|
||||
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
|
||||
->leftJoin(TABLE_TEAM)->alias('t4')->on('t1.id = t4.task')
|
||||
->leftJoin(TABLE_TEAM)->alias('t4')->on('t4.root = t1.id')
|
||||
->leftJoin(TABLE_MODULE)->alias('t5')->on('t1.module = t5.id')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->beginIF(!in_array($type, array('assignedtome', 'myinvolved')))->andWhere('t1.parent')->eq(0)->fi()
|
||||
->beginIF($type == 'myinvolved')
|
||||
->andWhere('t4.account', true)->eq($this->app->user->account)
|
||||
->orWhere('t1.assignedTo')->eq($this->app->user->account)
|
||||
->orWhere('t1.finishedby')->eq($this->app->user->account)
|
||||
->markRight(1)->fi()
|
||||
->andWhere("((t4.`account` = '{$this->app->user->account}' AND t4.`type` = 'task') OR t1.`assignedTo` = '{$this->app->user->account}' OR t1.`finishedby` = '{$this->app->user->account}')")
|
||||
->fi()
|
||||
->beginIF($productID)->andWhere("((t5.root=" . (int)$productID . " and t5.type='story') OR t2.product=" . (int)$productID . ")")->fi()
|
||||
->beginIF($type == 'undone')->andWhere("(t1.status = 'wait' or t1.status ='doing')")->fi()
|
||||
->beginIF($type == 'needconfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi()
|
||||
@@ -1244,7 +1277,7 @@ class taskModel extends model
|
||||
if(empty($tasks)) return array();
|
||||
|
||||
$taskList = array_keys($tasks);
|
||||
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)->where('task')->in($taskList)->fetchGroup('task');
|
||||
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->in($taskList)->andWhere('type')->eq('task')->fetchGroup('root');
|
||||
if(!empty($taskTeam))
|
||||
{
|
||||
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
|
||||
|
||||
+74
-73
@@ -15,7 +15,7 @@ class userModel extends model
|
||||
{
|
||||
/**
|
||||
* Set the menu.
|
||||
*
|
||||
*
|
||||
* @param array $users user pairs
|
||||
* @param string $account current account
|
||||
* @access public
|
||||
@@ -34,11 +34,11 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Set users list.
|
||||
*
|
||||
* @param array $users
|
||||
* @param string $account
|
||||
*
|
||||
* @param array $users
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return html
|
||||
* @return html
|
||||
*/
|
||||
public function setUserList($users, $account)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get users list of current company.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -112,9 +112,9 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get commiters from the user table.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public function getCommiters()
|
||||
{
|
||||
@@ -133,11 +133,11 @@ class userModel extends model
|
||||
|
||||
return $commiters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get user list with email and real name.
|
||||
*
|
||||
* @param string|array $users
|
||||
*
|
||||
* @param string|array $users
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -151,8 +151,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get roles for some users.
|
||||
*
|
||||
* @param string $users
|
||||
*
|
||||
* @param string $users
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -167,8 +167,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get user info by ID.
|
||||
*
|
||||
* @param int $userID
|
||||
*
|
||||
* @param int $userID
|
||||
* @access public
|
||||
* @return object|bool
|
||||
*/
|
||||
@@ -182,9 +182,9 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get users by sql.
|
||||
*
|
||||
* @param int $query
|
||||
* @param int $pager
|
||||
*
|
||||
* @param int $query
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -287,7 +287,7 @@ class userModel extends model
|
||||
$data[$i]->group = $users->group[$i] == 'ditto' ? (isset($prev['group']) ? $prev['group'] : '') : $users->group[$i];
|
||||
$data[$i]->email = $users->email[$i];
|
||||
$data[$i]->gender = $users->gender[$i];
|
||||
$data[$i]->password = md5($users->password[$i]);
|
||||
$data[$i]->password = md5($users->password[$i]);
|
||||
$data[$i]->commiter = $users->commiter[$i];
|
||||
$data[$i]->join = empty($users->join[$i]) ? '0000-00-00' : ($user->join[$i]);
|
||||
$data[$i]->skype = $users->skype[$i];
|
||||
@@ -333,7 +333,7 @@ class userModel extends model
|
||||
}
|
||||
unset($user->group);
|
||||
$this->dao->insert(TABLE_USER)->data($user)->autoCheck()->exec();
|
||||
if(dao::isError())
|
||||
if(dao::isError())
|
||||
{
|
||||
echo js::error(dao::getError());
|
||||
die(js::reload('parent'));
|
||||
@@ -347,8 +347,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Update a user.
|
||||
*
|
||||
* @param int $userID
|
||||
*
|
||||
* @param int $userID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -523,9 +523,9 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Update password
|
||||
*
|
||||
* @param string $userID
|
||||
* Update password
|
||||
*
|
||||
* @param string $userID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -560,14 +560,14 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Reset password.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function resetPassword()
|
||||
{
|
||||
if(!$this->checkPassword()) return;
|
||||
|
||||
|
||||
$user = $this->getById($this->post->account);
|
||||
if(!$user) return false;
|
||||
|
||||
@@ -584,7 +584,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Check the passwds posted.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
@@ -601,7 +601,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Identify a user.
|
||||
*
|
||||
*
|
||||
* @param string $account the user account
|
||||
* @param string $password the user password or auth hash
|
||||
* @access public
|
||||
@@ -663,7 +663,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Identify user by PHP_AUTH_USER.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -684,7 +684,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Identify user by cookie.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -707,7 +707,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Authorize a user.
|
||||
*
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array the user rights.
|
||||
@@ -795,7 +795,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Judge a user is logon or not.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
@@ -806,8 +806,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get groups a user belongs to.
|
||||
*
|
||||
* @param string $account
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -817,17 +817,18 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projects a user participated.
|
||||
*
|
||||
* @param string $account
|
||||
* Get projects a user participated.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjects($account)
|
||||
{
|
||||
$projects = $this->dao->select('t1.*,t2.*')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')
|
||||
->where('t1.account')->eq($account)
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->fetchAll();
|
||||
|
||||
@@ -846,8 +847,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Plus the fail times.
|
||||
*
|
||||
* @param int $account
|
||||
*
|
||||
* @param int $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -857,8 +858,8 @@ class userModel extends model
|
||||
if(empty($user)) return 0;
|
||||
|
||||
$fails = $user->fails;
|
||||
$fails ++;
|
||||
if($fails < $this->config->user->failTimes)
|
||||
$fails ++;
|
||||
if($fails < $this->config->user->failTimes)
|
||||
{
|
||||
$locked = '0000-00-00 00:00:00';
|
||||
$failTimes = $fails;
|
||||
@@ -873,15 +874,15 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the user is locked.
|
||||
*
|
||||
* @param int $account
|
||||
* Check whether the user is locked.
|
||||
*
|
||||
* @param int $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkLocked($account)
|
||||
{
|
||||
$user = $this->dao->select('locked')->from(TABLE_USER)->where('account')->eq($account)->fetch();
|
||||
$user = $this->dao->select('locked')->from(TABLE_USER)->where('account')->eq($account)->fetch();
|
||||
if(empty($user)) return false;
|
||||
|
||||
if((strtotime(date('Y-m-d H:i:s')) - strtotime($user->locked)) > $this->config->user->lockMinutes * 60) return false;
|
||||
@@ -889,9 +890,9 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock the locked user.
|
||||
*
|
||||
* @param int $account
|
||||
* Unlock the locked user.
|
||||
*
|
||||
* @param int $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -901,9 +902,9 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind Ranzhi
|
||||
*
|
||||
* @param string $account
|
||||
* Unbind Ranzhi
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -914,7 +915,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get contact list of a user.
|
||||
*
|
||||
*
|
||||
* @param string $account
|
||||
* @param string $params withempty|withnote
|
||||
*
|
||||
@@ -960,8 +961,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get a contact list by id.
|
||||
*
|
||||
* @param int $listID
|
||||
*
|
||||
* @param int $listID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
@@ -972,8 +973,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get user account and realname pairs from a contact list.
|
||||
*
|
||||
* @param string $accountList
|
||||
*
|
||||
* @param string $accountList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -984,9 +985,9 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Create a contact list.
|
||||
*
|
||||
* @param string $listName
|
||||
* @param string $userList
|
||||
*
|
||||
* @param string $listName
|
||||
* @param string $userList
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
@@ -1013,10 +1014,10 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Update a contact list.
|
||||
*
|
||||
* @param int $listID
|
||||
* @param string $listName
|
||||
* @param string $userList
|
||||
*
|
||||
* @param int $listID
|
||||
* @param string $listName
|
||||
* @param string $userList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1065,8 +1066,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Delete a contact list.
|
||||
*
|
||||
* @param int $listID
|
||||
*
|
||||
* @param int $listID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1077,8 +1078,8 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get data in JSON.
|
||||
*
|
||||
* @param object $user
|
||||
*
|
||||
* @param object $user
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1094,7 +1095,7 @@ class userModel extends model
|
||||
|
||||
/**
|
||||
* Get weak users.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1142,9 +1143,9 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute password strength.
|
||||
*
|
||||
* @param string $password
|
||||
* Compute password strength.
|
||||
*
|
||||
* @param string $password
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'><?php echo $lang->idAB;?></th>
|
||||
<th class='w-100px'><?php echo $lang->project->code;?></th>
|
||||
<th><?php echo $lang->project->name;?></th>
|
||||
<th class="text-left"><?php echo $lang->project->name;?></th>
|
||||
<th class='w-date'><?php echo $lang->project->begin;?></th>
|
||||
<th class='w-date'><?php echo $lang->project->end;?></th>
|
||||
<th class='w-status'><?php echo $lang->statusAB;?></th>
|
||||
@@ -33,7 +33,7 @@
|
||||
<tr class='text-center'>
|
||||
<td><?php echo html::a($projectLink, $project->id);?></td>
|
||||
<td><?php echo $project->code;?></td>
|
||||
<td><?php echo html::a($projectLink, $project->name);?></td>
|
||||
<td class="text-left"><?php echo html::a($projectLink, $project->name);?></td>
|
||||
<td><?php echo $project->begin;?></td>
|
||||
<td><?php echo $project->end;?></td>
|
||||
<?php if(isset($project->delay)):?>
|
||||
@@ -47,5 +47,5 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user