* Finish task#8748.
This commit is contained in:
@@ -6,7 +6,7 @@ ALTER TABLE `zt_project` CHANGE `acl` `acl` char(30) NOT NULL DEFAULT 'open';
|
||||
ALTER TABLE `zt_project` ADD `product` varchar(20) NOT NULL DEFAULT 'single' AFTER `type`;
|
||||
ALTER TABLE `zt_project` ADD `lifetime` char(30) NOT NULL AFTER `product`;
|
||||
ALTER TABLE `zt_project` ADD `budget` varchar(30) NOT NULL DEFAULT '0' AFTER `lifetime`;
|
||||
ALTER TABLE `zt_project` ADD `budgetUnit` char(30) NOT NULL DEFAULT 'yuan' AFTER `budget`;
|
||||
ALTER TABLE `zt_project` ADD `budgetUnit` char(30) NOT NULL DEFAULT 'wanyuan' AFTER `budget`;
|
||||
ALTER TABLE `zt_project` ADD `percent` float unsigned NOT NULL DEFAULT '0' AFTER `budgetUnit`;
|
||||
ALTER TABLE `zt_project` ADD `path` varchar(255) NOT NULL AFTER `parent`;
|
||||
ALTER TABLE `zt_project` ADD `grade` tinyint unsigned NOT NULL AFTER `path`;
|
||||
|
||||
+1
-1
@@ -709,7 +709,7 @@ CREATE TABLE IF NOT EXISTS `zt_project` (
|
||||
`product` char(30) NOT NULL DEFAULT 'single',
|
||||
`lifetime` char(30) NOT NULL,
|
||||
`budget` varchar(30) NOT NULL DEFAULT '0',
|
||||
`budgetUnit` char(30) NOT NULL DEFAULT 'yuan',
|
||||
`budgetUnit` char(30) NOT NULL DEFAULT 'wanyuan',
|
||||
`attribute` varchar(30) NOT NULL DEFAULT '',
|
||||
`percent` float unsigned NOT NULL DEFAULT '0',
|
||||
`milestone` enum('0','1') NOT NULL DEFAULT '0',
|
||||
|
||||
@@ -93,9 +93,9 @@ $lang->program->future = 'TBD';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
$lang->program->existProductName = 'Product name already exists.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['wanyuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
|
||||
$lang->program->modelList['scrum'] = "Scrum";
|
||||
$lang->program->modelList['waterfall'] = "CMMI";
|
||||
|
||||
@@ -93,9 +93,9 @@ $lang->program->future = 'TBD';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
$lang->program->existProductName = 'Product name already exists.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['wanyuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
|
||||
$lang->program->modelList['scrum'] = "Scrum";
|
||||
$lang->program->modelList['waterfall'] = "CMMI";
|
||||
|
||||
@@ -93,9 +93,9 @@ $lang->program->future = 'TBD';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
$lang->program->existProductName = 'Product name already exists.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['wanyuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
|
||||
$lang->program->modelList['scrum'] = "Scrum";
|
||||
$lang->program->modelList['waterfall'] = "CMMI";
|
||||
|
||||
@@ -93,9 +93,9 @@ $lang->program->future = 'TBD';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
$lang->program->existProductName = 'Product name already exists.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['wanyuan'] = 'Wanyuan';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
|
||||
$lang->program->modelList['scrum'] = "Scrum";
|
||||
$lang->program->modelList['waterfall'] = "CMMI";
|
||||
|
||||
@@ -93,9 +93,9 @@ $lang->program->future = '待定';
|
||||
$lang->program->productNotEmpty = '请关联产品或创建产品。';
|
||||
$lang->program->existProductName = '产品名称已存在。';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = '万元';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['wanyuan'] = '万元';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
|
||||
$lang->program->modelList['scrum'] = "Scrum";
|
||||
$lang->program->modelList['waterfall'] = "瀑布";
|
||||
|
||||
@@ -95,9 +95,9 @@ $lang->program->future = '待定';
|
||||
$lang->program->productNotEmpty = '請關聯產品或創建產品。';
|
||||
$lang->program->existProductName = '產品名稱已存在。';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = '萬元';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['wanyuan'] = '萬元';
|
||||
$lang->program->unitList['dollar'] = 'Dollars';
|
||||
|
||||
$lang->program->modelList['scrum'] = "Scrum";
|
||||
$lang->program->modelList['waterfall'] = "瀑布";
|
||||
|
||||
@@ -122,6 +122,7 @@ class programModel extends model
|
||||
->setDefault('openedDate', helper::now())
|
||||
->setIF($this->post->acl == 'open', 'whitelist', '')
|
||||
->setIF($this->post->delta == 999, 'end', LONG_TIME)
|
||||
->setIF($this->post->budget != 0, 'budget', number_format($this->post->budget, 2))
|
||||
->add('type', 'program')
|
||||
->join('whitelist', ',')
|
||||
->cleanFloat('budget')
|
||||
@@ -223,6 +224,7 @@ class programModel extends model
|
||||
->setIF($this->post->acl == 'open', 'whitelist', '')
|
||||
->setIF($this->post->delta == 999, 'end', LONG_TIME)
|
||||
->setIF($this->post->future, 'budget', 0)
|
||||
->setIF($this->post->budget != 0, 'budget', number_format($this->post->budget, 2))
|
||||
->join('whitelist', ',')
|
||||
->stripTags($this->config->program->editor->pgmedit['id'], $this->config->allowedTags)
|
||||
->remove('uid,delta,future')
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td><?php echo zget($users, $program->PM);?></td>
|
||||
<td class='text-left'><?php echo $program->budget ? $program->budget . ' ' . zget($lang->program->unitList, $program->budgetUnit) : '';?></td>
|
||||
<td class='text-left'><?php echo $program->budget != 0 ? $program->budget . ' ' . zget($lang->program->unitList, $program->budgetUnit) : '';?></td>
|
||||
<td class='c-status'><span class="status-program status-<?php echo $program->status?>"><?php echo zget($lang->project->statusList, $program->status, '');?></span></td>
|
||||
<td><?php echo $program->begin;?></td>
|
||||
<td><?php echo $program->end == LONG_TIME ? $lang->program->PRJLongTime : $program->end;?></td>
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('budget', '', "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?>
|
||||
<span class='input-group-addon'></span>
|
||||
<?php echo html::select('budgetUnit', $lang->program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?>
|
||||
<?php echo html::select('budgetUnit', $lang->program->unitList, empty($parentProgram->budgetUnit) ? 'wanyuan' : $parentProgram->budgetUnit, "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<th><?php echo $lang->program->PGMBudget;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('budget', $program->budget ? $program->budget : '', "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : '') . ($program->budget == 0 ? 'disabled' : ''));?>
|
||||
<?php echo html::input('budget', $program->budget != 0 ? $program->budget : '', "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : '') . ($program->budget == 0 ? 'disabled' : ''));?>
|
||||
<span class='input-group-addon'></span>
|
||||
<?php echo html::select('budgetUnit', $lang->program->unitList, $program->budgetUnit, "class='form-control'");?>
|
||||
</div>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('budget', '', "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?>
|
||||
<span class='input-group-addon'></span>
|
||||
<?php echo html::select('budgetUnit', $lang->program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?>
|
||||
<?php echo html::select('budgetUnit', $lang->program->unitList, empty($parentProgram->budgetUnit) ? 'wanyuan' : $parentProgram->budgetUnit, "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='muted'></td>
|
||||
|
||||
@@ -655,6 +655,10 @@ class upgradeModel extends model
|
||||
$this->processBuildTable();
|
||||
$this->processSprintConcept();
|
||||
$this->appendExec('20_0_beta1');
|
||||
case '20_0_beta3':
|
||||
$this->saveLogs('Execute 20_0_beta3');
|
||||
$this->adjustBudget();
|
||||
$this->appendExec('20_0_beta3');
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
@@ -4405,4 +4409,31 @@ class upgradeModel extends model
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust budget units and values.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function adjustBudget()
|
||||
{
|
||||
$budgets = $this->dao->select('id,budget,budgetUnit')->from(TABLE_PROJECT)
|
||||
->where('type')->in('project,program')
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($budgets as $id => $budget)
|
||||
{
|
||||
$data = array();
|
||||
if($budget->budgetUnit == 'yuan')
|
||||
{
|
||||
$data['budget'] = number_format($budget->budget / 10000, 2);
|
||||
$data['budgetUnit'] = 'wanyuan';
|
||||
}
|
||||
|
||||
if($data) $this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($id)->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user