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

This commit is contained in:
JackWuLieHao
2018-03-28 20:42:42 +08:00
20 changed files with 141 additions and 101 deletions
+1 -1
View File
@@ -414,7 +414,7 @@ $lang->menugroup->message = 'admin';
/* 错误提示信息。*/
$lang->error = new stdclass();
$lang->error->companyNotFound = "您访问的域名 %s 没有对应的公司。";
$lang->error->length = array("『%s』长度错误,应当为『%s』", "『%s』长度应当不超过『%s』,且不小于『%s』。");
$lang->error->length = array("『%s』长度错误,应当为『%s』", "『%s』长度应当小于『%s』,且大于『%s』。");
$lang->error->reg = "『%s』不符合格式,应当为:『%s』。";
$lang->error->unique = "『%s』已经有『%s』这条记录了。如果您确定该记录已删除,请到后台管理-回收站还原。。";
$lang->error->gt = "『%s』应当大于『%s』。";
+4 -4
View File
@@ -123,22 +123,22 @@ class custom extends control
}
if(!empty($key) and $key != 'n/a' and !validater::checkREG($key, '/^[a-z_0-9]+$/')) die(js::alert($this->lang->custom->notice->invalidStringKey));
/* The length of role is 10, check it when saved. */
/* The length of roleList in user module and typeList in todo module is less than 10. check it when saved. */
if($field == 'roleList' or $module == 'todo' and $field == 'typeList')
{
if(strlen($key) > 10) die(js::alert($this->lang->custom->notice->invalidStrlen['ten']));
}
/* The length of these string is litter than 20, check it when saved. */
/* The length of sourceList in story module and typeList in task module is less than 20, check it when saved. */
if($field == 'sourceList' or $module == 'task' and $field == 'typeList')
{
if(strlen($key) > 20) die(js::alert($this->lang->custom->notice->invalidStrlen['twenty']));
}
/* The length of stageList is 255, check it when saved. */
/* The length of stageList in testcase module is less than 255, check it when saved. */
if($module == 'testcase' and $field == 'stageList' and strlen($key) > 255) die(js::alert($this->lang->custom->notice->invalidStrlen['twoHundred']));
/* The length of these string is litter than 30, check it when saved. */
/* The length of field that in bug and testcase module and reasonList in story and task module is less than 30, check it when saved. */
if($module == 'bug' or $field == 'reasonList' or $module == 'testcase')
{
if(strlen($key) > 30) die(js::alert($this->lang->custom->notice->invalidStrlen['thirty']));
+2 -2
View File
@@ -82,8 +82,8 @@ $config->product->search['params']['lastEditedDate'] = array('operator' => '=',
$config->product->create = new stdclass();
$config->product->edit = new stdclass();
$config->product->create->requiredFields = 'name,code';
$config->product->edit->requiredFields = 'name,code';
$config->product->create->requiredFields = 'name';
$config->product->edit->requiredFields = 'name';
$config->product->editor = new stdclass();
$config->product->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
+3
View File
@@ -309,6 +309,7 @@ class productModel extends model
$product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck()
->batchCheck($this->config->product->create->requiredFields, 'notempty')
->checkIF(strlen($product->code) == 0, 'code', 'notempty') //the value of product code can be 0 or 00.00
->check('name', 'unique', "deleted = '0'")
->check('code', 'unique', "deleted = '0'")
->exec();
@@ -349,6 +350,7 @@ class productModel extends model
$product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()
->batchCheck($this->config->product->edit->requiredFields, 'notempty')
->checkIF(strlen($product->code) == 0, 'code', 'notempty') //the value of product code can be 0 or 00.0
->check('name', 'unique', "id != $productID and deleted = '0'")
->check('code', 'unique', "id != $productID and deleted = '0'")
->where('id')->eq($productID)
@@ -396,6 +398,7 @@ class productModel extends model
->data($product)
->autoCheck()
->batchCheck($this->config->product->edit->requiredFields , 'notempty')
->checkIF(strlen($product->code) == 0, 'code', 'notempty') //the value of product code can be 0 or 00.0
->check('name', 'unique', "id != $productID and deleted = '0'")
->check('code', 'unique', "id != $productID and deleted = '0'")
->where('id')->eq($productID)
+1 -1
View File
@@ -28,7 +28,7 @@
</tr>
<tr>
<th><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', '', "class='form-control' autocomplete='off'");?></td><td></td>
<td><div class='required required-wrapper'></div><?php echo html::input('code', '', "class='form-control' autocomplete='off'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->product->line;?></th>
+1 -1
View File
@@ -29,7 +29,7 @@
</tr>
<tr>
<th><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', $product->code, "class='form-control' autocomplete='off'");?></td><td></td>
<td><div class='required required-wrapper'></div><?php echo html::input('code', $product->code, "class='form-control' autocomplete='off'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->product->line;?></th>
+1 -4
View File
@@ -31,10 +31,7 @@ include '../../common/view/tablesorter.html.php';
</thead>
<tbody>
<?php foreach($allBugs as $bug):?>
<?php
if(isset($planBugs[$bug->id])) continue;
if($bug->plan and helper::diffDate($plans[$bug->plan], helper::today()) > 0) continue;
?>
<?php if(isset($planBugs[$bug->id])) continue;?>
<tr>
<td class='cell-id'>
<input type='checkbox' name='bugs[]' value='<?php echo $bug->id;?>'/>
+34 -34
View File
@@ -28,40 +28,40 @@
<?php endif; ?>
</div>
<div class='actions'>
<?php
$browseLink = $this->session->productPlanList ? $this->session->productPlanList : inlink('browse', "planID=$plan->id");
if(!$plan->deleted)
{
ob_start();
echo "<div class='btn-group'>";
echo "<div class='btn-group' id='createActionMenu'>";
common::printIcon('story', 'create', "productID=$plan->product&branch=$plan->branch&moduleID=0&storyID=0&projectID=0&bugID=0&planID=$plan->id", $plan, 'button', 'plus');
$batchMisc = common::hasPriv('story', 'batchCreate') ? '' : "disabled";
$batchLink = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$plan->product&branch=$plan->branch&moduleID=0&story=0&project=0&plan={$plan->id}") : '#';
echo "<button type='button' class='btn dropdown-toggle {$batchMisc}' data-toggle='dropdown'><span class='caret'></span></button>";
echo "<ul class='dropdown-menu pull-right'>";
echo "<li>" . html::a($batchLink, $lang->story->batchCreate, '', "class='$batchMisc'") . "</li>";
echo '</ul>';
echo '</div>';
if(common::hasPriv('productplan', 'linkStory'))
{
echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '<i class="icon-link"></i> ' . $lang->productplan->linkStory, '', "class='btn'");
}
if(common::hasPriv('productplan', 'linkBug') and $config->global->flow != 'onlyStory')
{
echo html::a(inlink('view', "planID=$plan->id&type=bug&orderBy=id_desc&link=true"), '<i class="icon-bug"></i> ' . $lang->productplan->linkBug, '', "class='btn'");
}
echo '</div>';
echo "<div class='btn-group'>";
common::printIcon('productplan', 'edit', "planID=$plan->id", $plan);
common::printIcon('productplan', 'delete', "planID=$plan->id", $plan, 'button', '', 'hiddenwin');
echo '</div>';
$actionLinks = ob_get_contents();
ob_end_clean();
echo $actionLinks;
}
common::printRPN($browseLink);
?>
<?php
$browseLink = $this->session->productPlanList ? $this->session->productPlanList : inlink('browse', "planID=$plan->id");
if(!$plan->deleted)
{
ob_start();
echo "<div class='btn-group'>";
echo "<div class='btn-group' id='createActionMenu'>";
common::printIcon('story', 'create', "productID=$plan->product&branch=$plan->branch&moduleID=0&storyID=0&projectID=0&bugID=0&planID=$plan->id", $plan, 'button', 'plus');
$batchMisc = common::hasPriv('story', 'batchCreate') ? '' : "disabled";
$batchLink = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$plan->product&branch=$plan->branch&moduleID=0&story=0&project=0&plan={$plan->id}") : '#';
echo "<button type='button' class='btn dropdown-toggle {$batchMisc}' data-toggle='dropdown'><span class='caret'></span></button>";
echo "<ul class='dropdown-menu pull-right'>";
echo "<li>" . html::a($batchLink, $lang->story->batchCreate, '', "class='$batchMisc'") . "</li>";
echo '</ul>';
echo '</div>';
if(common::hasPriv('productplan', 'linkStory'))
{
echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '<i class="icon-link"></i> ' . $lang->productplan->linkStory, '', "class='btn'");
}
if(common::hasPriv('productplan', 'linkBug') and $config->global->flow != 'onlyStory')
{
echo html::a(inlink('view', "planID=$plan->id&type=bug&orderBy=id_desc&link=true"), '<i class="icon-bug"></i> ' . $lang->productplan->linkBug, '', "class='btn'");
}
echo '</div>';
echo "<div class='btn-group'>";
common::printIcon('productplan', 'edit', "planID=$plan->id", $plan);
common::printIcon('productplan', 'delete', "planID=$plan->id", $plan, 'button', '', 'hiddenwin');
echo '</div>';
$actionLinks = ob_get_contents();
ob_end_clean();
echo $actionLinks;
}
common::printRPN($browseLink);
?>
</div>
</div>
<div class='row-table'>
+2 -2
View File
@@ -915,7 +915,7 @@ class project extends control
$whitelist = '';
$acl = 'open';
$plan = new stdClass();
$productPlan = new stdClass();
$productPlan = array();
if($copyProjectID)
{
@@ -969,7 +969,7 @@ class project extends control
$this->view->code = $code;
$this->view->team = $team;
$this->view->products = $products;
$this->view->productPlan = $productPlan;
$this->view->productPlan = array(0 => '') + $productPlan;
$this->view->whitelist = $whitelist;
$this->view->copyProjectID = $copyProjectID;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
+2
View File
@@ -908,6 +908,8 @@ class projectModel extends model
if(($this->session->taskBrowseType) and ($this->session->taskBrowseType != 'bysearch')) $browseType = $this->session->taskBrowseType;
}
$this->session->set('taskWithChildren', in_array($browseType, array('unclosed', 'byproject', 'all')) ? false : true);
/* Get tasks. */
$tasks = array();
if($browseType != "bysearch")
+1 -1
View File
@@ -17,7 +17,7 @@
<?php if($build) echo ' <span class="label label-danger">Build:' . $build->name . '</span>'; ?>
</div>
<div class='actions'>
<?php common::printIcon('bug', 'export', "productID=$productID&orderBy=$orderBy", '', 'button', '', '', "export iframe");?>
<?php common::printIcon('bug', 'export', "productID=$productID&orderBy=$orderBy", '', 'button', '', '', "export");?>
<?php common::printIcon('bug', 'create', "productID=$productID&branch=$branchID&extra=projectID=$project->id");?>
</div>
<div id='querybox' class='show'></div>
+6 -1
View File
@@ -121,7 +121,12 @@
<?php echo html::select("plans[" . $plan->product . "]", $productPlan, $plan->id, "class='form-control'");?>
<?php js::set('currentPlanID', $plan->id)?>
</div>
<?php endif;?>
<?php else:?>
<div class="col-sm-3" id="plan0">
<?php echo html::select("plans[]", $productPlan, '', "class='form-control'");?>
<?php js::set('currentPlanID', '')?>
</div>
<?php endif?>
</div>
</td>
</tr>
+1 -1
View File
@@ -97,7 +97,7 @@
</button>
<ul class='dropdown-menu' id='exportActionMenu'>
<?php
$misc = common::hasPriv('task', 'export') ? "class='export iframe'" : "class=disabled";
$misc = common::hasPriv('task', 'export') ? "class='export'" : "class=disabled";
$link = common::hasPriv('task', 'export') ? $this->createLink('task', 'export', "project=$projectID&orderBy=$orderBy&type=$browseType") : '#';
echo "<li>" . html::a($link, $lang->task->export, '', $misc) . "</li>";
?>
+5 -2
View File
@@ -185,10 +185,13 @@
<td><?php echo html::input('duplicateStory', $story->duplicateStory, "class='form-control' autocomplete='off'");?></td>
</tr>
<?php endif;?>
<tr class='text-top'>
<tr>
<th class='w-70px'><?php echo $lang->story->linkStories;?></th>
<td><?php echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&type=linkStories", '', true), $lang->story->linkStory, '', "data-toggle='modal' data-type='iframe' data-width='95%'");?></td>
</tr>
<tr>
<th></th>
<td>
<?php echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&type=linkStories", '', true), $lang->story->linkStory, '', "data-toggle='modal' data-type='iframe' data-width='95%'");?>
<ul class='list-unstyled' id='linkStoriesBox'>
<?php
$linkStories = explode(',', $story->linkStories);
+31 -28
View File
@@ -1272,42 +1272,45 @@ class task extends control
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->in(@array_keys($tasks))->andWhere('extra')->ne('editor')->fetchGroup('objectID');
$relatedModules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
$children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)
->andWhere('parent')->in(array_keys($tasks))
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($sort)
->fetchGroup('parent', 'id');
if(!empty($children))
if(!$this->session->taskWithChildren)
{
foreach($children as $parent => $childTasks)
$children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)
->andWhere('parent')->in(array_keys($tasks))
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($sort)
->fetchGroup('parent', 'id');
if(!empty($children))
{
foreach($childTasks as $task)
foreach($children as $parent => $childTasks)
{
/* Compute task progress. */
if($task->consumed == 0 and $task->left == 0)
foreach($childTasks as $task)
{
$task->progress = 0;
/* Compute task progress. */
if($task->consumed == 0 and $task->left == 0)
{
$task->progress = 0;
}
elseif($task->consumed != 0 and $task->left == 0)
{
$task->progress = 100;
}
else
{
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
}
$task->progress .= '%';
}
elseif($task->consumed != 0 and $task->left == 0)
{
$task->progress = 100;
}
else
{
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
}
$task->progress .= '%';
}
}
$position = 0;
foreach($tasks as $task)
{
$position ++;
if(isset($children[$task->id]))
$position = 0;
foreach($tasks as $task)
{
array_splice($tasks, $position, 0, $children[$task->id]);
$position += count($children[$task->id]);
$position ++;
if(isset($children[$task->id]))
{
array_splice($tasks, $position, 0, $children[$task->id]);
$position += count($children[$task->id]);
}
}
}
}
+1
View File
@@ -165,6 +165,7 @@ $lang->task->remindBug = "This Task is converted from a Bug. Do you
$lang->task->confirmChangeProject = "If you change {$lang->projectCommon}, the related Module, Story and Assignor will be changed. Do you want to do it?";
$lang->task->confirmFinish = '"Left Hour" is 0. Do you want to change the Status to "Done"?';
$lang->task->confirmRecord = '"Left Hour" is 0. Do you want to set Task as "Done"?';
$lang->task->confirmTransfer = '"Left Hour" is 0,Do you want to transfer task?';
$lang->task->noticeLinkStory = "No story has been linked. You can %s for this project, then %s.";
$lang->task->noticeSaveRecord = 'Your Hour is not saved. Please save it first.';
$lang->task->commentActions = '%s. %s, commented by <strong>%s</strong>.';
+2 -1
View File
@@ -108,7 +108,7 @@ $lang->task->parent = '父任务';
$lang->task->parentAB = '父';
$lang->task->lblPri = 'P';
$lang->task->lblHour = '(h)';
$lang->task->deniedNotice = '此任务只允许由团队第一人开始。';
$lang->task->deniedNotice = '当前用户无【%s】权限';
$lang->task->ditto = '同上';
$lang->task->dittoNotice = "该任务与上一任务不属于同一项目!";
@@ -165,6 +165,7 @@ $lang->task->remindBug = "该任务为Bug转化得到,是否更新
$lang->task->confirmChangeProject = "修改{$lang->projectCommon}会导致相应的所属模块、相关需求和指派人发生变化,确定吗?";
$lang->task->confirmFinish = '"预计剩余"为0,确认将任务状态改为"已完成"吗?';
$lang->task->confirmRecord = '"剩余"为0,任务将标记为"已完成",您确定吗?';
$lang->task->confirmTransfer = '"当前剩余"为0,任务将被转交,您确定吗?';
$lang->task->noticeLinkStory = "没有可关联的相关需求,您可以为当前项目%s,然后%s";
$lang->task->noticeSaveRecord = '您有尚未保存的工时记录,请先将其保存。';
$lang->task->commentActions = '%s. %s, 由 <strong>%s</strong> 添加备注。';
+38 -15
View File
@@ -445,6 +445,9 @@ class taskModel extends model
$teams = array();
if($this->post->multiple)
{
$consumed = 0;
$estimate = 0;
$left = 0;
foreach($this->post->team as $row => $account)
{
if(empty($account) or isset($team[$account])) continue;
@@ -457,15 +460,26 @@ class taskModel extends model
$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;
$member->left = $this->post->teamLeft[$row] ? $this->post->teamLeft[$row] : ($member->estimate - $member->consumed);
$member->order = $row;
$teams[$account] = $member;
}
if(!empty($teams) and !isset($task->assignedTo))
$consumed += (float)$member->consumed;
$estimate += (float)$member->estimate;
$left += (float)$member->left;
}
if(!empty($teams))
{
$firstMember = reset($teams);
$task->assignedTo = $firstMember->account;
$task->consumed = $consumed;
$task->estimate = $estimate;
$task->left = $left;
if(!isset($task->assignedTo))
{
$firstMember = reset($teams);
$task->assignedTo = $firstMember->account;
}
}
}
@@ -945,19 +959,28 @@ class taskModel extends model
$data->consumed = $teamTime->consumed;
$data->left = $teamTime->leftTime;
if($task->status == 'done')
$newTask = new stdClass();
$newTask->left = $data->left;
$newTask->consumed = $data->consumed;
if($left != 0 || $task->assignedTo != $teams[count($teams) - 1])
{
$newTask = new stdClass();
$newTask->left = $data->left;
$newTask->consumed = $data->consumed;
$newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo);
$newTask->assignedDate = $now;
$newTask->status = 'doing';
if($task->assignedTo != $teams[count($teams) - 1] && $left == 0)
{
$newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo);
$newTask->assignedDate = $now;
}
$task->status = $oldStatus;
$this->dao->update(TABLE_TASK)->data($newTask)->where('id')->eq((int)$taskID)->exec();
if($task->assignedTo != $teams[count($teams) - 1]) return common::createChanges($task, $newTask);
$data->assignedTo = $task->openedBy; // Fix bug#1345
$changes = common::createChanges($task, $newTask);
if(!empty($actionID)) $this->action->logHistory($actionID, $changes);
return $changes;
}
$data->assignedTo = $task->openedBy;
}
$this->dao->update(TABLE_TASK)->data($data)->where('id')->eq($taskID)->exec();
@@ -1343,7 +1366,7 @@ class taskModel extends model
->page($pager, 't1.id')
->fetchAll('id');
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or in_array($type, array('assignedtome', 'myinvolved', 'needconfirm'))) ? false : true);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or in_array($type, array('myinvolved', 'needconfirm'))) ? false : true);
if(empty($tasks)) return array();
+2 -1
View File
@@ -12,7 +12,8 @@
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::set('confirmRecord', $lang->task->confirmRecord);?>
<?php $team = array_keys($task->team);?>
<?php js::set('confirmRecord', (!empty($team) && $task->assignedTo != end($team)) ? $lang->task->confirmTransfer : $lang->task->confirmRecord);?>
<?php js::set('noticeSaveRecord', $lang->task->noticeSaveRecord);?>
<div id='titlebar'>
<div class='heading'>
+3 -2
View File
@@ -14,11 +14,12 @@
<?php include '../../common/view/kindeditor.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::set('confirmFinish', $lang->task->confirmFinish);?>
<?php if(!empty($task->team) && key($task->team) != $this->app->user->account):?>
<!-- IF it is multi-task, the suspened can only be restarted by the current user who it is assigned to.-->
<?php if(!empty($task->team) && $task->assignedTo != $this->app->user->account):?>
<div class="alert with-icon">
<i class="icon-info-sign"></i>
<div class="content">
<p><?php echo $lang->task->deniedNotice;?></p>
<p><?php echo sprintf($lang->task->deniedNotice, $lang->task->start);?></p>
</div>
</div>
<?php else:?>