* Finish task #8479.
This commit is contained in:
@@ -1084,6 +1084,8 @@ class project extends control
|
||||
public function create($productID = '', $projectID = '', $copyProjectID = '', $planID = 0, $confirm = 'no')
|
||||
{
|
||||
$this->app->loadLang('program');
|
||||
$this->app->loadLang('stage');
|
||||
$this->app->loadLang('programplan');
|
||||
if($projectID)
|
||||
{
|
||||
if(!empty($planID))
|
||||
@@ -1204,6 +1206,7 @@ class project extends control
|
||||
$this->view->copyProjectID = $copyProjectID;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
|
||||
$this->view->isStage = $project->model == 'waterfall' ? true : false;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1220,6 +1223,8 @@ class project extends control
|
||||
public function edit($projectID, $action = 'edit', $extra = '')
|
||||
{
|
||||
$this->app->loadLang('program');
|
||||
$this->app->loadLang('stage');
|
||||
$this->app->loadLang('programplan');
|
||||
$browseProjectLink = $this->createLink('project', 'browse', "projectID=$projectID");
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -1323,6 +1328,7 @@ class project extends control
|
||||
$this->view->linkedProducts = $linkedProducts;
|
||||
$this->view->productPlans = $productPlans;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
|
||||
$this->view->isStage = $PRJData->model == 'waterfall' ? true : false;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1335,6 +1341,8 @@ class project extends control
|
||||
*/
|
||||
public function batchEdit($projectID = 0)
|
||||
{
|
||||
$this->app->loadLang('stage');
|
||||
|
||||
if($this->post->names)
|
||||
{
|
||||
$allChanges = $this->project->batchUpdate();
|
||||
@@ -1383,6 +1391,8 @@ class project extends control
|
||||
$rdUsers = $this->user->getPairs('noclosed|nodeleted|devfirst', $appendRdUsers, $this->config->maxCount);
|
||||
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
|
||||
|
||||
$PRJData = $this->project->getById($this->session->PRJ);
|
||||
|
||||
$this->view->title = $this->lang->project->batchEdit;
|
||||
$this->view->position[] = $this->lang->project->batchEdit;
|
||||
$this->view->projectIDList = $projectIDList;
|
||||
@@ -1391,6 +1401,7 @@ class project extends control
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->isStage = $PRJData->model == 'waterfall' ? true : false;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
+51
-14
@@ -332,6 +332,24 @@ class projectModel extends model
|
||||
->remove('products, workDays, delta, branch, uid, plans')
|
||||
->get();
|
||||
|
||||
/* Check the workload format and total. */
|
||||
if(!empty($sprint->percent))
|
||||
{
|
||||
if(!preg_match("/^[0-9]+(.[0-9]{1,3})?$/", $sprint->percent))
|
||||
{
|
||||
dao::$errors['percent'] = $this->lang->programplan->error->percentNumber;
|
||||
return false;
|
||||
}
|
||||
|
||||
$percentTotal = $this->dao->select('SUM(percent) as percent')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('type')->eq('stage')->andWhere('deleted')->eq('0')->fetch('percent');
|
||||
$percentTotal += $sprint->percent;
|
||||
if($percentTotal > 100) return dao::$errors['percent'] = $this->lang->programplan->error->percentOver;
|
||||
}
|
||||
|
||||
/* Set planDuration and realDuration. */
|
||||
$sprint->planDuration = $this->loadModel('programplan')->getDuration($sprint->begin, $sprint->end);
|
||||
if(!empty($sprint->realBegan) and !empty($sprint->realEnd)) $sprint->realDuration = $this->loadModel('programplan')->getDuration($sprint->realBegan, $sprint->realEnd);
|
||||
|
||||
$sprint = $this->loadModel('file')->processImgURL($sprint, $this->config->project->editor->create['id'], $this->post->uid);
|
||||
$this->dao->insert(TABLE_PROJECT)->data($sprint)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
@@ -433,6 +451,24 @@ class projectModel extends model
|
||||
->get();
|
||||
|
||||
$project = $this->loadModel('file')->processImgURL($project, $this->config->project->editor->edit['id'], $this->post->uid);
|
||||
|
||||
/* Check the workload format and total. */
|
||||
if(!empty($project->percent))
|
||||
{
|
||||
if(!preg_match("/^[0-9]+(.[0-9]{1,3})?$/", $project->percent))
|
||||
{
|
||||
dao::$errors['percent'] = $this->lang->programplan->error->percentNumber;
|
||||
return false;
|
||||
}
|
||||
|
||||
$percentTotal = $this->dao->select('SUM(percent) as percent')->from(TABLE_PROJECT)->where('project')->eq($this->session->PRJ)->andWhere('type')->eq('stage')->andWhere('deleted')->eq('0')->fetch('percent');
|
||||
if($percentTotal > 100) return dao::$errors['percent'] = $this->lang->programplan->error->percentOver;
|
||||
}
|
||||
|
||||
/* Set planDuration and realDuration. */
|
||||
$project->planDuration = $this->loadModel('programplan')->getDuration($project->begin, $project->end);
|
||||
if(!empty($project->realBegan) and !empty($project->realEnd)) $project->realDuration = $this->loadModel('programplan')->getDuration($project->realBegan, $project->realEnd);
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)->data($project)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
->batchcheck($this->config->project->edit->requiredFields, 'notempty')
|
||||
@@ -502,20 +538,21 @@ class projectModel extends model
|
||||
|
||||
$projectID = (int)$projectID;
|
||||
$projects[$projectID] = new stdClass();
|
||||
$projects[$projectID]->name = $projectName;
|
||||
$projects[$projectID]->code = $projectCode;
|
||||
$projects[$projectID]->PM = $data->PMs[$projectID];
|
||||
$projects[$projectID]->PO = $data->POs[$projectID];
|
||||
$projects[$projectID]->QD = $data->QDs[$projectID];
|
||||
$projects[$projectID]->RD = $data->RDs[$projectID];
|
||||
$projects[$projectID]->lifetime = $data->lifetimes[$projectID];
|
||||
$projects[$projectID]->status = $data->statuses[$projectID];
|
||||
$projects[$projectID]->begin = $data->begins[$projectID];
|
||||
$projects[$projectID]->end = $data->ends[$projectID];
|
||||
$projects[$projectID]->team = $data->teams[$projectID];
|
||||
$projects[$projectID]->desc = htmlspecialchars_decode($data->descs[$projectID]);
|
||||
$projects[$projectID]->days = $data->dayses[$projectID];
|
||||
$projects[$projectID]->order = $data->orders[$projectID];
|
||||
$projects[$projectID]->name = $projectName;
|
||||
$projects[$projectID]->code = $projectCode;
|
||||
$projects[$projectID]->PM = $data->PMs[$projectID];
|
||||
$projects[$projectID]->PO = $data->POs[$projectID];
|
||||
$projects[$projectID]->QD = $data->QDs[$projectID];
|
||||
$projects[$projectID]->RD = $data->RDs[$projectID];
|
||||
$projects[$projectID]->lifetime = $data->lifetimes[$projectID];
|
||||
$projects[$projectID]->attribute = $data->attributes[$projectID];
|
||||
$projects[$projectID]->status = $data->statuses[$projectID];
|
||||
$projects[$projectID]->begin = $data->begins[$projectID];
|
||||
$projects[$projectID]->end = $data->ends[$projectID];
|
||||
$projects[$projectID]->team = $data->teams[$projectID];
|
||||
$projects[$projectID]->desc = htmlspecialchars_decode($data->descs[$projectID]);
|
||||
$projects[$projectID]->days = $data->dayses[$projectID];
|
||||
$projects[$projectID]->order = $data->orders[$projectID];
|
||||
|
||||
/* Check unique name for edited projects. */
|
||||
if(isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->project->name, $projectName);
|
||||
|
||||
@@ -74,7 +74,18 @@
|
||||
<td class='text-left<?php echo zget($visibleFields, 'PO', ' hidden')?>' style='overflow:visible'><?php echo html::select("POs[$projectID]", $poUsers, $projects[$projectID]->PO, "class='form-control chosen'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'QD', ' hidden')?>' style='overflow:visible'><?php echo html::select("QDs[$projectID]", $qdUsers, $projects[$projectID]->QD, "class='form-control chosen'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'RD', ' hidden')?>' style='overflow:visible'><?php echo html::select("RDs[$projectID]", $rdUsers, $projects[$projectID]->RD, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'type', 'hidden')?>'><?php echo html::select("lifetimes[$projectID]", $lang->program->PRJLifeTimeList, $projects[$projectID]->type, 'class=form-control');?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'type', 'hidden')?>'>
|
||||
<?php
|
||||
if($isStage)
|
||||
{
|
||||
echo html::select("attributes[$projectID]", $lang->stage->typeList, $projects[$projectID]->attribute, 'class=form-control');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::select("lifetimes[$projectID]", $lang->program->PRJLifeTimeList, $projects[$projectID]->lifetime, 'class=form-control');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class='<?php echo zget($visibleFields, 'status', 'hidden')?>'><?php echo html::select("statuses[$projectID]", $lang->project->statusList, $projects[$projectID]->status, 'class=form-control');?></td>
|
||||
<td><?php echo html::input("begins[$projectID]", $projects[$projectID]->begin, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?></td>
|
||||
<td><?php echo html::input("ends[$projectID]", $projects[$projectID]->end, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?></td>
|
||||
|
||||
@@ -81,10 +81,32 @@
|
||||
<?php if(!$isSprint):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->project->type;?></th>
|
||||
<td><?php echo html::select('lifetime', $lang->program->PRJLifeTimeList, '', "class='form-control' onchange='showLifeTimeTips()'");?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($isStage)
|
||||
{
|
||||
echo html::select('attribute', $lang->stage->typeList, '', "class='form-control'");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::select('lifetime', $lang->program->PRJLifeTimeList, '', "class='form-control' onchange='showLifeTimeTips()'");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class='muted' colspan='2'><div id='lifeTimeTips'><?php echo $lang->project->typeDesc;?></div></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($isStage):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->programplan->percent;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('percent', '', "class='form-control'");?>
|
||||
<span class='input-group-addon'>%</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr class='hide'>
|
||||
<th><?php echo $lang->project->status;?></th>
|
||||
<td><?php echo html::hidden('status', 'wait');?></td>
|
||||
|
||||
@@ -63,7 +63,29 @@
|
||||
<?php if(!$isSprint):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->project->type;?></th>
|
||||
<td><?php echo html::select('lifetime', $lang->program->PRJLifeTimeList, $project->type, "class='form-control'");?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($isStage)
|
||||
{
|
||||
echo html::select('attribute', $lang->stage->typeList, $project->attribute, "class='form-control'");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::select('lifetime', $lang->program->PRJLifeTimeList, $project->lifetime, "class='form-control' onchange='showLifeTimeTips()'");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($isStage):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->programplan->percent;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('percent', $project->percent, "class='form-control'");?>
|
||||
<span class='input-group-addon'>%</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user