* Finish task #9021.
This commit is contained in:
+12
-10
@@ -333,6 +333,8 @@ class custom extends control
|
||||
*/
|
||||
public function estimate()
|
||||
{
|
||||
/* Load config and set menu. */
|
||||
$this->app->loadConfig('project');
|
||||
$this->lang->custom->menu = $this->lang->subject->menu;
|
||||
$this->lang->navGroup->custom = 'system';
|
||||
$key = array_search('custom', $this->lang->noMenuModule);
|
||||
@@ -340,9 +342,12 @@ class custom extends control
|
||||
|
||||
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();
|
||||
if(isset($_POST['scaleFactor']) and empty($this->post->scaleFactor))
|
||||
|
||||
/* Judgment of required items. */
|
||||
if(isset($_POST['scaleFactor']) and empty($_POST['scaleFactor']))
|
||||
{
|
||||
dao::$errors['scaleFactor'] = sprintf($this->lang->error->notempty, $this->lang->custom->convertRelations);
|
||||
$this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
@@ -354,15 +359,13 @@ class custom extends control
|
||||
$this->setting->setItem('system.custom.days', $data->days);
|
||||
$this->setting->setItem('system.project.defaultWorkhours', $data->defaultWorkhours);
|
||||
|
||||
/* Update story estimate field. */
|
||||
if(isset($_POST['scaleFactor']))
|
||||
{
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->fetchAll();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$this->dao->update(TABLE_STORY)
|
||||
->set('estimate')->eq($story->estimate * $this->post->scaleFactor)
|
||||
->where('id')->eq($story->id)
|
||||
->exec();
|
||||
$this->dao->update(TABLE_STORY)->set('estimate')->eq($story->estimate * $this->post->scaleFactor)->where('id')->eq($story->id)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,17 +373,16 @@ class custom extends control
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'estimate')));
|
||||
}
|
||||
|
||||
$this->app->loadConfig('project');
|
||||
|
||||
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->estimateConfig;
|
||||
$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->cost = zget($this->config->custom, 'cost', '');
|
||||
$this->view->efficiency = zget($this->config->custom, 'efficiency', '');
|
||||
$this->view->hours = zget($this->config->project, 'defaultWorkhours', '');
|
||||
$this->view->days = zget($this->config->custom, 'days', '');
|
||||
|
||||
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->estimateConfig;
|
||||
$this->view->position[] = $this->lang->custom->common;
|
||||
$this->view->position[] = $this->lang->custom->estimateConfig;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user