This commit is contained in:
reneeteng
2020-10-11 15:16:36 +08:00
14 changed files with 105 additions and 44 deletions
+3 -1
View File
@@ -37,7 +37,7 @@ INSERT INTO `zt_group` (`name`, `role`, `desc`) VALUES ('项目管理员', 'PRJa
ALTER TABLE `zt_usergroup` ADD `PRJ` text NOT NULL;
ALTER TABLE `zt_userview` ADD `PRJ` mediumtext COLLATE 'utf8_general_ci' NOT NULL AFTER `account`;
ALTER TABLE `zt_userview` ADD `programs` mediumtext NOT NULL AFTER `account`, ADD `stages` mediumtext NOT NULL AFTER `projects`, ADD `sprints` mediumtext NOT NULL AFTER `stages`;
ALTER TABLE `zt_user` ADD `type` char(30) NOT NULL default 'inside' AFTER `account`;
@@ -298,3 +298,5 @@ ALTER TABLE `zt_block` ADD UNIQUE `account_module_type_order` (`account`, `modul
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('1', '0', '*', '*', '*', 'moduleName=weekly&methodName=computeWeekly', '更新项目周报', 'system', 0, 'normal', '2020-08-27 10:07:53');
ALTER TABLE `zt_story` ADD `URChanged` enum('0','1') NOT NULL DEFAULT '0' AFTER `version`;
ALTER TABLE `zt_team` MODIFY `type` enum('project','task','stage','sprint') NOT NULL DEFAULT 'project' AFTER `root`;
+4 -2
View File
@@ -1032,7 +1032,7 @@ CREATE TABLE IF NOT EXISTS `zt_taskestimate` (
CREATE TABLE IF NOT EXISTS `zt_team` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`root` mediumint(8) unsigned NOT NULL default '0',
`type` enum('project','task') NOT NULL DEFAULT 'project',
`type` enum('project','task','stage','sprint') NOT NULL DEFAULT 'project',
`account` char(30) NOT NULL default '',
`role` char(30) NOT NULL default '',
`limited` char(8) NOT NULL default 'no',
@@ -1255,9 +1255,11 @@ CREATE TABLE IF NOT EXISTS `zt_usertpl` (
-- DROP TABLE IF EXISTS `zt_userview`;
CREATE TABLE IF NOT EXISTS `zt_userview` (
`account` char(30) NOT NULL,
`PRJ` mediumtext NOT NULL,
`programs` mediumtext NOT NULL,
`products` mediumtext NOT NULL,
`projects` mediumtext NOT NULL,
`stages` mediumtext NOT NULL,
`sprints` mediumtext NOT NULL,
UNIQUE KEY `account` (`account`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS `zt_entry`;
+13 -6
View File
@@ -102,7 +102,7 @@ class bugModel extends model
*
* @param string $from object that is transfered to bug.
* @access public
* @return int|bool
* @return array|bool
*/
public function create($from = '')
{
@@ -151,17 +151,19 @@ class bugModel extends model
* Batch create
*
* @param int $productID
* @param int $branch
* @access public
* @return void
*/
public function batchCreate($productID, $branch = 0)
{
/* Load module and init vars. */
$this->loadModel('action');
$branch = (int)$branch;
$productID = (int)$productID;
$now = helper::now();
$actions = array();
$data = fixer::input('post')->get();
$branch = (int)$branch;
$productID = (int)$productID;
$now = helper::now();
$actions = array();
$data = fixer::input('post')->get();
$result = $this->loadModel('common')->removeDuplicate('bug', $data, "product={$productID}");
$data = $result['data'];
@@ -196,6 +198,7 @@ class bugModel extends model
if(isset($data->uploadImage)) $this->loadModel('file');
$extendFields = $this->getFlowExtendFields();
$bugs = array();
foreach($data->title as $i => $title)
{
@@ -220,6 +223,7 @@ class bugModel extends model
$bug->browser = $data->browsers[$i];
$bug->keywords = $data->keywords[$i];
/* Assign the bug to the person in charge of the module. */
if(!empty($moduleOwners[$bug->module]))
{
$bug->assignedTo = $moduleOwners[$bug->module];
@@ -233,6 +237,7 @@ class bugModel extends model
if($message) die(js::alert($message));
}
/* Required field check. */
foreach(explode(',', $this->config->bug->create->requiredFields) as $field)
{
$field = trim($field);
@@ -242,6 +247,7 @@ class bugModel extends model
$bugs[$i] = $bug;
}
/* When the bug is created by uploading an image, add the image to the step of the bug. */
foreach($bugs as $i => $bug)
{
if(!empty($data->uploadImage[$i]))
@@ -280,6 +286,7 @@ class bugModel extends model
$this->executeHooks($bugID);
/* When the bug is created by uploading the image, add the image to the file of the bug. */
$this->loadModel('score')->create('bug', 'create', $bugID);
if(!empty($data->uploadImage[$i]) and !empty($file))
{
+6 -3
View File
@@ -138,9 +138,12 @@ $lang->program->menu->index = '主页|program|pgmindex|';
$lang->program->menu->browse = array('link' => '项目集|program|pgmbrowse|', 'alias' => 'pgmcreate,pgmedit,pgmgroup,pgmmanagepriv,pgmmanageview,pgmmanagemembers');
$lang->program->viewMenu = new stdclass();
$lang->program->viewMenu->view = '概况|program|pgmview|program=%s';
$lang->program->viewMenu->product = array('link' => '产品|program|pgmproduct|program=%s');
$lang->program->viewMenu->project = array('link' => "项目|program|pgmproject|program=%s");
$lang->program->viewMenu->view = '概况|program|pgmview|program=%s';
$lang->program->viewMenu->product = array('link' => '产品|program|pgmproduct|program=%s');
$lang->program->viewMenu->project = array('link' => "项目|program|pgmproject|program=%s");
$lang->program->viewMenu->plan = array('link' => "排期|program|pgmproject|program=%s");
$lang->program->viewMenu->personnel = array('link' => "人员|program|pgmproject|program=%s");
$lang->program->viewMenu->stakeholder = array('link' => "干系人|program|pgmproject|program=%s");
/* Scrum menu. */
$lang->product = new stdclass();
+1 -1
View File
@@ -384,7 +384,7 @@ class deptModel extends model
->orderBy('account')
->fetchPairs();
}
/**
* Delete a department.
*
+4 -1
View File
@@ -254,8 +254,10 @@ class programModel extends model
{
/* Child program begin cannot less than parent. */
if($program->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $parentProgram->begin);
/* When parent set end then child program end cannot greater than parent. */
if($parentProgram->end != '0000-00-00' and $program->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end);
/* When parent set end then child program cannot set longTime. */
if(empty($program->end) and $this->post->longTime and $parentProgram->end != '0000-00-00') dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end);
@@ -289,9 +291,10 @@ class programModel extends model
->where('t1.account')->eq($this->app->user->account)
->andWhere('t2.role')->eq('PRJadmin')
->fetch();
if(!empty($groupPriv))
{
$newProgram = $groupPriv->program . ",$programID";
$newProgram = $groupPriv->PRJ . ",$programID";
$this->dao->update(TABLE_USERGROUP)->set('PRJ')->eq($newProgram)->where('account')->eq($groupPriv->account)->andWhere('`group`')->eq($groupPriv->group)->exec();
}
else
-4
View File
@@ -99,10 +99,6 @@
<?php echo html::textarea('desc', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?>
</td>
</tr>
<tr>
<th><?php echo $lang->program->auth;?></th>
<td colspan='3'><?php echo html::radio('auth', $lang->program->PGMAuthList, 'extend', '', 'block');?></td>
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
<td colspan='3'><?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, 'open', "onclick='setWhite(this.value);'", 'block'));?></td>
-4
View File
@@ -68,10 +68,6 @@
<?php echo html::textarea('desc', $program->desc, "rows='6' class='form-control kindeditor' hidefocus='true'");?>
</td>
</tr>
<tr>
<th><?php echo $lang->program->auth;?></th>
<td colspan='3'><?php echo html::radio('auth', $lang->program->PGMAuthList, $program->auth, '', 'block');?></td>
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
<td colspan='3'><?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, $program->acl, "onclick='setWhite(this.value);'", 'block'));?></td>
+1 -1
View File
@@ -276,7 +276,7 @@ class programplanModel extends model
$start = $task->estStarted == '0000-00-00' ? '' : date('d-m-Y', strtotime($task->estStarted));
$end = $task->deadline == '0000-00-00' ? '' : $task->deadline;
$realBegan = $task->realBegan == '0000-00-00' ? '' : $task->realBegan;
$realBegan = $task->realStarted == '0000-00-00' ? '' : $task->realStarted;
$realEnd = $task->finishedDate == '0000-00-00 00:00:00' ? '' : substr($task->finishedDate, 5, 11);
$priIcon = sprintf($taskPri, $task->pri, $task->pri, $task->pri);
+3 -2
View File
@@ -1918,10 +1918,11 @@ class project extends control
*
* @param int $projectID
* @param int $team2Import the team to import.
* @param int $dept
* @access public
* @return void
*/
public function manageMembers($projectID = 0, $team2Import = 0, $dept = '')
public function manageMembers($projectID = 0, $team2Import = 0, $dept = 0)
{
if(!empty($_POST))
{
@@ -1936,7 +1937,7 @@ class project extends control
$project = $this->project->getById($projectID);
$users = $this->user->getPairs('noclosed|nodeleted|devfirst|nofeedback', '', $this->config->maxCount);
$roles = $this->user->getUserRoles(array_keys($users));
$deptUsers = $dept === '' ? array() : $this->dept->getDeptUserPairs($dept);
$deptUsers = empty($dept) ? array() : $this->dept->getDeptUserPairs($dept);
$currentMembers = $this->project->getTeamMembers($projectID);
$members2Import = $this->project->getMembers2Import($team2Import, array_keys($currentMembers));
$teams2Import = $this->project->getTeams2Import($this->app->user->account, $projectID);
+59 -11
View File
@@ -1823,10 +1823,14 @@ class projectModel extends model
public function getTeamMembers($projectID)
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getTeamMembers();
$project = $this->getByID($projectID);
if(empty($project)) return array();
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.root')->eq((int)$projectID)
->andWhere('t1.type')->eq('project')
->andWhere('t1.type')->eq($project->type)
->andWhere('t2.deleted')->eq('0')
->fetchAll('account');
}
@@ -1942,12 +1946,15 @@ class projectModel extends model
{
$project = $this->getByID($projectID);
$data = (array)fixer::input('post')->get();
extract($data);
$accounts = array_unique($accounts);
$limited = array_values($limited);
$oldJoin = $this->dao->select('`account`, `join`')->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq('project')->fetchPairs();
$this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq('project')->exec();
extract($data);
$projectType = $project->type;
$accounts = array_unique($accounts);
$limited = array_values($limited);
$oldJoin = $this->dao->select('`account`, `join`')->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq($projectType)->fetchPairs();
$this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq($projectType)->exec();
$projectMember = array();
foreach($accounts as $key => $account)
{
if(empty($account)) continue;
@@ -1961,8 +1968,49 @@ class projectModel extends model
$member->root = (int)$projectID;
$member->account = $account;
$member->join = isset($oldJoin[$account]) ? $oldJoin[$account] : helper::today();
$member->type = 'project';
$member->type = $projectType;
$projectMember[$account] = $member;
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
}
/* Add iteration or phase team members to the project team. */
if($projectType == 'stage' || $projectType == 'sprint') $this->addProjectMembers($project->parent, $projectMember);
/* Only changed account update userview. */
$oldAccounts = array_keys($oldJoin);
$changedAccounts = array_diff($accounts, $oldAccounts);
$changedAccounts = array_merge($changedAccounts, array_diff($oldAccounts, $accounts));
$changedAccounts = array_unique($changedAccounts);
$this->loadModel('user')->updateUserView($projectID, $projectType, $changedAccounts);
$products = $this->getProducts($projectID, false);
if($products) $this->user->updateUserView(array_keys($products), 'product', $changedAccounts);
}
/**
* Add iteration or phase team members to the project team.
*
* @param int $projectID
* @param array $members
* @access public
* @return void
*/
public function addProjectMembers($projectID, $members = array())
{
$project = $this->getByID($projectID);
$projectType = $project->type;
$oldJoin = $this->dao->select('`account`, `join`')->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq($projectType)->fetchPairs();
$accounts = array();
foreach($members as $account => $member)
{
if(isset($oldJoin[$account])) continue;
$accounts[] = $account;
$member->root = $projectID;
$member->type = $projectType;
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
}
@@ -1972,8 +2020,7 @@ class projectModel extends model
$changedAccounts = array_merge($changedAccounts, array_diff($oldAccounts, $accounts));
$changedAccounts = array_unique($changedAccounts);
$objectType = $project->model ? 'program' : 'project';
$this->loadModel('user')->updateUserView($projectID, $objectType, $changedAccounts);
$this->loadModel('user')->updateUserView($projectID, $projectType, $changedAccounts);
$products = $this->getProducts($projectID, false);
if($products) $this->user->updateUserView(array_keys($products), 'product', $changedAccounts);
@@ -1989,9 +2036,10 @@ class projectModel extends model
*/
public function unlinkMember($projectID, $account)
{
$this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq('project')->andWhere('account')->eq($account)->exec();
$project = $this->getByID($projectID);
$this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$projectID)->andWhere('type')->eq($project->type)->andWhere('account')->eq($account)->exec();
$this->loadModel('user')->updateUserView($projectID, 'project', array($account));
$this->loadModel('user')->updateUserView($projectID, $project->type, array($account));
$products = $this->getProducts($projectID, false);
if($products) $this->user->updateUserView(array_keys($products), 'product', array($account));
}
+2
View File
@@ -402,6 +402,7 @@ class testreportModel extends model
->leftJoin(TABLE_TESTRUN)->alias('t2')
->on('t1.run= t2.id')
->where('t2.task')->in(array_keys($tasks))
->andwhere('t1.date = t2.lastRunDate')
->andWhere('t1.`case`')->in(array_keys($cases))
->andWhere('t1.date')->ge($begin)
->andWhere('t1.date')->le($end . " 23:59:59")
@@ -433,6 +434,7 @@ class testreportModel extends model
->leftJoin(TABLE_TESTRUN)->alias('t2')
->on('t1.run= t2.id')
->where('t2.task')->in(array_keys($tasks))
->andwhere('t1.date = t2.lastRunDate')
->andWhere('t1.`case`')->in(array_keys($cases))
->andWhere('t1.date')->ge($begin)
->andWhere('t1.date')->le($end . " 23:59:59")
+7 -6
View File
@@ -1440,8 +1440,9 @@ class userModel extends model
/**
* Grant user view.
*
* @param string $account
* @param array $acls
* @param string $account
* @param array $acls
* @param string $programs
* @access public
* @return object
*/
@@ -1461,7 +1462,7 @@ class userModel extends model
->fetchAll('id');
$openedPrograms = join(',', array_keys($openedPrograms));
$userView->programs = rtrim($userView->PRJ, ',') . ',' . $openedPrograms;
$userView->programs = rtrim($userView->programs, ',') . ',' . $openedPrograms;
if(isset($_SESSION['user']->admin)) $isAdmin = $this->session->user->admin;
if(!isset($isAdmin)) $isAdmin = strpos($this->app->company->admins, ",{$account},") !== false;
@@ -1516,9 +1517,9 @@ class userModel extends model
/**
* Update user view.
*
* @param int|array $objectID
* @param string $objectType
* @param array $users
* @param int|array $objectID
* @param string $objectType
* @param array $users
* @access public
* @return void
*/
File diff suppressed because one or more lines are too long