* change for pro.
This commit is contained in:
@@ -120,7 +120,7 @@ class custom extends control
|
||||
/* Fix bug #942. */
|
||||
if($field == 'priList' and !is_numeric($key)) die(js::alert($this->lang->custom->notice->priListKey));
|
||||
if($module == 'bug' and $field == 'severityList' and !is_numeric($key)) die(js::alert($this->lang->custom->notice->severityListKey));
|
||||
if(!empty($key) and $key != 'n/a' and !validater::checkCode($key)) die(js::alert($this->lang->custom->notice->keyList));
|
||||
if(!empty($key) and $key != 'n/a' and !validater::checkREG($key, '/^[a-zA-Z_0-9]+$/')) die(js::alert($this->lang->custom->notice->keyList));
|
||||
|
||||
/* the length of role is 20, check it when save. */
|
||||
if($module == 'user' and $field == 'roleList' and strlen($key) > 20) die(js::alert($this->lang->custom->notice->userRole));
|
||||
|
||||
+19
-31
@@ -89,45 +89,33 @@ class reportModel extends model
|
||||
*/
|
||||
public function getProjects($begin = 0, $end = 0)
|
||||
{
|
||||
$projects = array();
|
||||
|
||||
$tasks = $this->dao->select('t1.*')->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
$tasks = $this->dao->select('t1.*,t2.name as projectName')->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t1.status')->ne('cancel')
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('t2.status')->eq('done')
|
||||
->beginIF($begin)->andWhere('t2.begin')->ge($begin)->fi()
|
||||
->beginIF($end)->andWhere('t2.end')->le($end)->fi()
|
||||
->orderBy('t2.end_desc')
|
||||
->fetchAll();
|
||||
|
||||
$projects = array();
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if(!isset($projects[$task->project])) $projects[$task->project] = new stdclass();
|
||||
|
||||
$projects[$task->project]->estimate = isset($projects[$task->project]->estimate) ? $projects[$task->project]->estimate + $task->estimate : $task->estimate;
|
||||
$projects[$task->project]->consumed = isset($projects[$task->project]->consumed) ? $projects[$task->project]->consumed + $task->consumed : $task->consumed;
|
||||
}
|
||||
|
||||
$projectList = $this->dao->select('id, name, status')->from(TABLE_PROJECT)
|
||||
->where('1=1')
|
||||
->beginIF($begin)->andWhere('begin')->ge($begin)->fi()
|
||||
->beginIF($end)->andWhere('end')->le($end)->fi()
|
||||
->fetchAll();
|
||||
$projectPairs = array();
|
||||
foreach($projectList as $project)
|
||||
{
|
||||
$projectPairs[$project->id] = $project->name;
|
||||
if($project->status != 'done') unset($projects[$project->id]);
|
||||
}
|
||||
foreach($projects as $id => $project)
|
||||
{
|
||||
if(!isset($projectPairs[$id]))
|
||||
{
|
||||
unset($projects[$id]);
|
||||
continue;
|
||||
$projectID = $task->project;
|
||||
if(!isset($projects[$projectID]))
|
||||
{
|
||||
$projects[$projectID] = new stdclass();
|
||||
$projects[$projectID]->estimate = 0;
|
||||
$projects[$projectID]->consumed = 0;
|
||||
}
|
||||
if(!isset($project->consumed)) $projects[$id]->consumed = 0;
|
||||
if(!isset($project->estimate)) $projects[$id]->estimate = 0;
|
||||
$projects[$id]->name = $projectPairs[$id];
|
||||
|
||||
$projects[$projectID]->name = $task->projectName;
|
||||
$projects[$projectID]->estimate += $task->estimate;
|
||||
$projects[$projectID]->consumed += $task->consumed;
|
||||
}
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($projects as $id =>$project):?>
|
||||
<tr class="a-center">
|
||||
<tr class="text-center">
|
||||
<td><?php echo $id;?></td>
|
||||
<td align="left"><?php echo html::a($this->createLink('project', 'view', "projectID=$id"), $project->name);?></td>
|
||||
<td class="text-left"><?php echo html::a($this->createLink('project', 'view', "projectID=$id"), $project->name);?></td>
|
||||
<td><?php echo $project->estimate;?></td>
|
||||
<td><?php echo $project->consumed;?></td>
|
||||
<?php $deviation = $project->consumed - $project->estimate;?>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<tr>
|
||||
<th class='w-70px'><?php echo $lang->testcase->id?></th>
|
||||
<th><?php echo $lang->testcase->title?></th>
|
||||
<?php if($branches):?>
|
||||
<?php if(!empty($branches)):?>
|
||||
<th class='w-100px'><?php echo $lang->testcase->branch?></th>
|
||||
<?php endif;?>
|
||||
<th class='w-100px'><?php echo $lang->testcase->module?></th>
|
||||
@@ -51,7 +51,7 @@
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo html::input("title[$key]", htmlspecialchars($case->title, ENT_QUOTES), "class='form-control'")?></td>
|
||||
<?php if($branches):?>
|
||||
<?php if(!empty($branches)):?>
|
||||
<td class='text-left' style='overflow:visible'><?php echo html::select("branch[$key]", $branches, (isset($case->branch) and $case->branch !== '') ? $case->branch : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->branch : $branch), "class='form-control chosen'")?></td>
|
||||
<?php endif;?>
|
||||
<td class='text-left' style='overflow:visible'><?php echo html::select("module[$key]", $modules, isset($case->module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen'")?></td>
|
||||
|
||||
Reference in New Issue
Block a user