This commit is contained in:
holan20180123
2021-01-14 14:45:41 +08:00
132 changed files with 720 additions and 914 deletions
+14 -4
View File
@@ -353,18 +353,28 @@ class custom extends control
$key = array_search('custom', $this->lang->noMenuModule);
unset($this->lang->noMenuModule[$key]);
$unit = zget($this->config->custom, 'hourPoint', '1');
if(strtolower($this->server->request_method) == "post")
{
/* Load module and get the data from the post. */
$this->loadModel('setting');
$data = fixer::input('post')->setIF(!isset($_POST['efficiency']), 'efficiency', 1)->get();
$data = fixer::input('post')
->setIF(!isset($_POST['efficiency']), 'efficiency', 1)
->remove('scaleFactor')
->get();
/* Judgment of required items. */
if(isset($_POST['scaleFactor']) and empty($_POST['scaleFactor']))
if(($unit != $_POST['hourPoint']) and empty($_POST['scaleFactor']))
{
dao::$errors['scaleFactor'] = sprintf($this->lang->error->notempty, $this->lang->custom->convertRelations);
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
elseif(($unit != $_POST['hourPoint']) and !is_numeric($_POST['scaleFactor']))
{
dao::$errors['scaleFactor'] = sprintf($this->lang->error->float, $this->lang->custom->convertRelations);
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$this->setting->setItem('system.custom.hourPoint', $data->hourPoint);
$this->setting->setItem('system.custom.cost', $data->cost);
@@ -373,7 +383,7 @@ class custom extends control
$this->setting->setItem('system.project.defaultWorkhours', $data->defaultWorkhours);
/* Update story estimate field. */
if(isset($_POST['scaleFactor']))
if($unit != $_POST['hourPoint'])
{
$stories = $this->dao->select('*')->from(TABLE_STORY)->fetchAll();
foreach($stories as $story)
@@ -391,7 +401,7 @@ class custom extends control
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->lang->custom->estimateConfig;
$this->view->unit = zget($this->config->custom, 'hourPoint', '1');
$this->view->unit = $unit;
$this->view->cost = zget($this->config->custom, 'cost', '');
$this->view->efficiency = zget($this->config->custom, 'efficiency', '');
$this->view->hours = zget($this->config->project, 'defaultWorkhours', '');