Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2018-01-04 09:47:01 +08:00
10 changed files with 138 additions and 67 deletions
+2 -2
View File
@@ -2,8 +2,8 @@
$config->productplan = new stdclass();
$config->productplan->create = new stdclass();
$config->productplan->edit = new stdclass();
$config->productplan->create->requiredFields = 'title,begin,end';
$config->productplan->edit->requiredFields = 'title,begin,end';
$config->productplan->create->requiredFields = 'title,begin';
$config->productplan->edit->requiredFields = 'title,begin';
$config->productplan->editor = new stdclass();
$config->productplan->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
+14 -6
View File
@@ -1,7 +1,7 @@
/**
* Convert a date string like 2011-11-11 to date object in js.
*
* @param string $date
*
* @param string $date
* @access public
* @return date
*/
@@ -9,14 +9,14 @@ function convertStringToDate(dateString)
{
dateString = dateString.split('-');
dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0];
return Date.parse(dateString);
}
/**
* Compute the end date for productplan.
*
* @param int $delta
*
* @param int $delta
* @access public
* @return void
*/
@@ -33,7 +33,15 @@ function computeEndDate(delta)
}
endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd');
$('#end').val(endDate);
if(delta == 9999)
{
$('#end').val('').attr("disabled","disabled");
}
else
{
$('#end').val(endDate).removeAttr('disabled');
}
}
$('#begin').on('change', function()
+13 -6
View File
@@ -1,7 +1,7 @@
/**
* Convert a date string like 2011-11-11 to date object in js.
*
* @param string $date
*
* @param string $date
* @access public
* @return date
*/
@@ -9,14 +9,14 @@ function convertStringToDate(dateString)
{
dateString = dateString.split('-');
dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0];
return Date.parse(dateString);
}
/**
* Compute the end date for productplan.
*
* @param int $delta
*
* @param int $delta
* @access public
* @return void
*/
@@ -33,5 +33,12 @@ function computeEndDate(delta)
}
endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd');
$('#end').val(endDate).datetimepicker('update')
if(delta == 9999)
{
$('#end').val('').attr("disabled","disabled");
}
else
{
$('#end').val(endDate).removeAttr('disabled').datetimepicker('update');
}
}
+9 -7
View File
@@ -46,14 +46,16 @@ $lang->productplan->desc = 'Description';
$lang->productplan->begin = 'Begin';
$lang->productplan->end = 'End';
$lang->productplan->last = 'Last plan';
$lang->productplan->future = 'Future';
$lang->productplan->endList[7] = '1 Week';
$lang->productplan->endList[14] = '2 Weeks';
$lang->productplan->endList[31] = '1 Month';
$lang->productplan->endList[62] = '2 Months';
$lang->productplan->endList[93] = '3 Months';
$lang->productplan->endList[186] = '6 Months';
$lang->productplan->endList[365] = '1 Year';
$lang->productplan->endList[7] = '1 Week';
$lang->productplan->endList[14] = '2 Weeks';
$lang->productplan->endList[31] = '1 Month';
$lang->productplan->endList[62] = '2 Months';
$lang->productplan->endList[93] = '3 Months';
$lang->productplan->endList[186] = '6 Months';
$lang->productplan->endList[365] = '1 Year';
$lang->productplan->endList[9999] = 'Future';
$lang->productplan->errorNoTitle = 'ID %s title should not be empty.';
$lang->productplan->errorNoBegin = 'ID %s begin time should not be empty.';
+9 -7
View File
@@ -46,14 +46,16 @@ $lang->productplan->desc = '描述';
$lang->productplan->begin = '开始日期';
$lang->productplan->end = '结束日期';
$lang->productplan->last = '上次计划';
$lang->productplan->future = '待定';
$lang->productplan->endList[7] = '一星期';
$lang->productplan->endList[14] = '两星期';
$lang->productplan->endList[31] = '一个月';
$lang->productplan->endList[62] = '两个月';
$lang->productplan->endList[93] = '三个月';
$lang->productplan->endList[186] = '半年';
$lang->productplan->endList[365] = '一年';
$lang->productplan->endList[7] = '一星期';
$lang->productplan->endList[14] = '两星期';
$lang->productplan->endList[31] = '一个月';
$lang->productplan->endList[62] = '两个月';
$lang->productplan->endList[93] = '三个月';
$lang->productplan->endList[186] = '半年';
$lang->productplan->endList[365] = '一年';
$lang->productplan->endList[9999] = '待定';
$lang->productplan->errorNoTitle = 'ID %s 标题不能为空';
$lang->productplan->errorNoBegin = 'ID %s 开始时间不能为空';
+36 -30
View File
@@ -15,8 +15,8 @@ class productplanModel extends model
{
/**
* Get plan by id.
*
* @param int $planID
*
* @param int $planID
* @param bool $setImgSize
* @access public
* @return object
@@ -30,9 +30,9 @@ class productplanModel extends model
}
/**
* Get plans by idList
*
* @param int $planIDList
* Get plans by idList
*
* @param int $planIDList
* @access public
* @return array
*/
@@ -43,8 +43,8 @@ class productplanModel extends model
/**
* Get last plan.
*
* @param int $productID
*
* @param int $productID
* @access public
* @return void
*/
@@ -60,9 +60,9 @@ class productplanModel extends model
}
/**
* Get list
*
* @param int $product
* Get list
*
* @param int $product
* @param int $branch
* @param string $browseType
* @param object $pager
@@ -85,9 +85,9 @@ class productplanModel extends model
/**
* Get plan pairs.
*
* @param array|int $product
* @param string $expired
*
* @param array|int $product
* @param string $expired
* @access public
* @return array
*/
@@ -117,9 +117,9 @@ class productplanModel extends model
}
/**
* Get plans for products
*
* @param int $products
* Get plans for products
*
* @param int $products
* @access public
* @return void
*/
@@ -133,13 +133,16 @@ class productplanModel extends model
/**
* Create a plan.
*
*
* @access public
* @return int
*/
public function create()
{
$plan = fixer::input('post')->stripTags($this->config->productplan->editor->create['id'], $this->config->allowedTags)->remove('delta,uid')->get();
$plan = fixer::input('post')->stripTags($this->config->productplan->editor->create['id'], $this->config->allowedTags)
->setIF($this->post->delta == 9999 || empty($this->post->end), 'end', '2030-01-01')
->remove('delta,uid')
->get();
$plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_PRODUCTPLAN)
->data($plan)
@@ -158,15 +161,18 @@ class productplanModel extends model
/**
* Update a plan
*
* @param int $planID
*
* @param int $planID
* @access public
* @return array
*/
public function update($planID)
{
$oldPlan = $this->dao->findByID((int)$planID)->from(TABLE_PRODUCTPLAN)->fetch();
$plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags)->remove('delta,uid')->get();
$plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags)
->setIF($this->post->delta == 9999 || empty($this->post->end), 'end', '2030-01-01')
->remove('delta,uid')
->get();
$plan = $this->loadModel('file')->processImgURL($plan, $this->config->productplan->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_PRODUCTPLAN)
->data($plan)
@@ -184,8 +190,8 @@ class productplanModel extends model
/**
* Batch update plan.
*
* @param int $productID
*
* @param int $productID
* @access public
* @return array
*/
@@ -233,8 +239,8 @@ class productplanModel extends model
/**
* Link stories.
*
* @param int $planID
*
* @param int $planID
* @access public
* @return void
*/
@@ -267,9 +273,9 @@ class productplanModel extends model
}
/**
* Unlink story
*
* @param int $storyID
* Unlink story
*
* @param int $storyID
* @access public
* @return void
*/
@@ -284,8 +290,8 @@ class productplanModel extends model
/**
* Link bugs.
*
* @param int $planID
*
* @param int $planID
* @access public
* @return void
*/
+11 -8
View File
@@ -24,28 +24,31 @@
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin' id='dataform'>
<table class='table table-form'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->productplan->product;?></th>
<td class='w-p25-f'><?php echo $product->name;?></td><td></td>
</tr>
</tr>
<?php if($product->type != 'normal'):?>
<tr>
<th><?php echo $lang->product->branch;?></th>
<td><?php echo html::select('branch', $branches, $plan->branch, 'class="form-control"');?></td>
</tr>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->productplan->title;?></th>
<td><?php echo html::input('title', $plan->title, "class='form-control' autocomplete='off'");?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->productplan->begin;?></th>
<td><?php echo html::input('begin', $plan->begin, "class='form-control form-date'");?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->productplan->end;?></th>
<td><?php echo html::input('end', $plan->end, 'class="form-control form-date"');?></td>
<td>
<?php $disabled = $plan->end == '2030-01-01' ? ' disabled="disabled"' : '';?>
<?php echo html::input('end', empty($disabled) ? $plan->end : '', 'class="form-control form-date"' . $disabled);?>
</td>
<td>
&nbsp; &nbsp; <?php echo html::radio('delta', $lang->productplan->endList , '', "onclick='computeEndDate(this.value)'");?>
</td>
@@ -53,11 +56,11 @@
<tr>
<th><?php echo $lang->productplan->desc;?></th>
<td colspan='2'><?php echo html::textarea('desc', htmlspecialchars($plan->desc), "rows='10' class='form-control'");?></td>
</tr>
</tr>
<tr>
<td></td>
<td colspan='2'>
<?php
<?php
echo html::submitButton();
echo html::backButton();
echo html::hidden('product', $product->id);
+1 -1
View File
@@ -413,7 +413,7 @@
</tr>
<tr>
<th><?php echo $lang->productplan->end;?></th>
<td><?php echo $plan->end;?></td>
<td><?php echo $plan->end == '2030-01-01' ? $lang->productplan->future : $plan->end;?></td>
</tr>
<tr>
<th><?php echo $lang->productplan->desc;?></th>
+34
View File
@@ -249,6 +249,40 @@ class reportModel extends model
$depts = array();
if($dept) $depts = $this->loadModel('dept')->getAllChildId($dept);
if($assign == 0)
{
$project = $this->dao->select('id')->from(TABLE_PROJECT)
->where('deleted')->eq(0)
->andWhere('status')->notin('cancel, closed, done, suspended')
->fetchPairs('id');
$members = $this->dao->select('t1.account')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t2.account = t1.account')
->where('t1.type')->eq('project')
->beginIF($dept)->andWhere('t2.dept')->in($depts)->fi()
->andWhere('t1.root')->in(array_keys($project))
->fetchPairs('account');
$taskAccounts = $this->dao->select('assignedTo')->from(TABLE_TASK)
->where('deleted')->eq(0)
->andWhere('project')->in(array_keys($project))
->andWhere('status')->notin('cancel, closed, done, pause')
->fetchPairs('assignedTo');
if(!empty($taskAccounts) && !empty($members))
{
foreach($members as $member)
{
if(!empty($member) && in_array($member, $taskAccounts))
{
unset($members[$member]);
}
}
}
return $members;
}
$tasks = $this->dao->select('t1.*, t2.name as projectName')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
+9
View File
@@ -70,6 +70,7 @@
<tr class="a-center">
<td rowspan="<?php echo count($load['task']);?>"><?php echo $users[$account];?></td>
<?php $id = 1;?>
<?php if(!empty($load['task'])):?>
<?php foreach($load['task'] as $project => $info):?>
<?php $class = $color ? 'rowcolor' : '';?>
<?php if($id != 1) echo '<tr class="a-center">';?>
@@ -90,6 +91,14 @@
<?php if($id != 1) echo '</tr>'; $id ++;?>
<?php $color = !$color;?>
<?php endforeach;?>
<?php else:?>
<td></td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>