diff --git a/module/file/model.php b/module/file/model.php index 108d01a361..6c37d6ca7c 100755 --- a/module/file/model.php +++ b/module/file/model.php @@ -463,7 +463,8 @@ class fileModel extends model */ public function setSavePath(): void { - $savePath = $this->app->getAppRoot() . "www/data/upload/{$this->app->company->id}/" . date('Ym/', $this->now); + $companyID = isset($this->app->company->id) ? $this->app->company->id : 1; + $savePath = $this->app->getAppRoot() . "www/data/upload/{$companyID}/" . date('Ym/', $this->now); if(!file_exists($savePath)) { mkdir($savePath, 0777, true); @@ -480,7 +481,8 @@ class fileModel extends model */ public function setWebPath(): void { - $this->webPath = $this->app->getWebRoot() . "data/upload/{$this->app->company->id}/"; + $companyID = isset($this->app->company->id) ? $this->app->company->id : 1; + $this->webPath = $this->app->getWebRoot() . "data/upload/{$companyID}/"; } /** diff --git a/module/program/config/form.php b/module/program/config/form.php index fd75a8d7f3..556ca7991c 100644 --- a/module/program/config/form.php +++ b/module/program/config/form.php @@ -2,7 +2,6 @@ $now = helper::now(); $today = helper::today(); -global $app; $config->program->form = new stdclass(); $config->program->form->create['parent'] = array('type' => 'int', 'control' => 'picker', 'required' => false, 'default' => 0); @@ -31,16 +30,16 @@ $config->program->form->edit['whitelist'] = array('type' => 'array', 'contro $config->program->form->close['realEnd'] = array('type' => 'date', 'required' => true, 'default' => $now, 'filter' => 'trim'); $config->program->form->close['status'] = array('type' => 'string', 'required' => false, 'default' => 'closed'); $config->program->form->close['closedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); -$config->program->form->close['closedBy'] = array('type' => 'string', 'required' => false, 'default' => $app->user->account); +$config->program->form->close['closedBy'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->program->form->close['lastEditedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); -$config->program->form->close['lastEditedBy'] = array('type' => 'string', 'required' => false, 'default' => $app->user->account); +$config->program->form->close['lastEditedBy'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->program->form->activate['begin'] = array('type' => 'date', 'required' => false, 'default' => null, 'filter' => 'trim'); $config->program->form->activate['end'] = array('type' => 'date', 'required' => false, 'default' => null, 'filter' => 'trim'); $config->program->form->activate['status'] = array('type' => 'string', 'required' => false, 'default' => 'doing'); $config->program->form->activate['realEnd'] = array('type' => 'date', 'required' => false, 'default' => null); $config->program->form->activate['lastEditedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); -$config->program->form->activate['lastEditedBy'] = array('type' => 'string', 'required' => false, 'default' => $app->user->account); +$config->program->form->activate['lastEditedBy'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->program->form->start['realBegan'] = array('type' => 'date', 'required' => true, 'default' => $today, 'filter' => 'trim'); $config->program->form->start['comment'] = array('type' => 'string', 'required' => false, 'default' => '', 'control' => 'editor'); diff --git a/module/program/control.php b/module/program/control.php index d613259dba..f1df7ef3ae 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -241,7 +241,11 @@ class program extends control $hasUnfinished = $this->program->hasUnfinishedChildren($program); if($hasUnfinished) return $this->send(array('result' => 'fail', 'callback' => "zui.Modal.alert('{$this->lang->program->closeErrorMessage}');")); - $programData = form::data(null, $programID)->get(); + $programData = form::data(null, $programID) + ->add('closedBy', $this->app->user->account) + ->add('lastEditedBy', $this->app->user->account) + ->get(); + $changes = $this->program->close($programData, $program); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); @@ -316,7 +320,7 @@ class program extends control if(!empty($_POST)) { - $programData = form::data(null, $programID)->get(); + $programData = form::data(null, $programID)->add('lastEditedBy', $this->app->user->account)->get(); $changes = $this->program->activate($programData, $program); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));