public function executeEditCurrent(\Library\HttpRequest $rq) { // Init result $result = $this->InitResponseWS(); $dataPost = $this->dataPost(); $user = $this->app->user()->getAttribute(\Library\Enums\SessionKeys::UserConnected); $dataPost['user_login'] = $user->user_login(); $changePassword = $dataPost['user_password'] != '' ? true : false; $user->setUser_hint($dataPost['user_hint']); if ($changePassword) { $protect = new \Library\BL\Core\Encryption(); $user->setUser_password($protect->Encrypt($this->app->config->get("encryption_key"), $dataPost['user_password'])); } $manager = $this->managers->getManagerOf('User'); $result_insert = $manager->edit($user, "user_id"); //Init PDO if ($result_insert) { $this->app->user()->setAttribute(\Library\Enums\SessionKeys::UserConnected, $user); if ($this->app->user()->getUserType() == "pm_id") { $pmSession = \Applications\PMTool\Helpers\PmHelper::GetCurrentSessionPm($this->user()); $this->dataPost["pm_id"] = $pmSession === NULL ? NULL : $pmSession[\Library\Enums\SessionKeys::PmObject]->pm_id(); $pm = \Applications\PMTool\Helpers\UserHelper::PreparePmObject($this->dataPost()); $result["data"] = $pm; $manager = $this->managers->getManagerOf($this->module); $result_insert = $manager->edit($pm, "pm_id"); if ($result_insert) { $pmSession[\Library\Enums\SessionKeys::PmObject] = $pm; \Applications\PMTool\Helpers\PmHelper::UpdateSessionPm($this->app->user(), $pmSession, true); } } else { if ($this->app->user()->getUserType() == "technician_id") { $technicianObject = $this->user()->getAttribute(\Library\Enums\SessionKeys::UserTypeObject); $technician = \Applications\PMTool\Helpers\UserHelper::PrepareTechnicianObject($this->dataPost(), $technicianObject); $result["data"] = $technician; $manager = $this->managers->getManagerOf("Technician"); $result_insert = $manager->edit($technician, 'technician_id'); if ($result_insert) { $this->user->setAttribute(\Library\Enums\SessionKeys::UserTypeObject, $technician); } } } } $this->SendResponseWS($result, array("resx_file" => \Applications\PMTool\Resources\Enums\ResxFileNameKeys::User, "resx_key" => $this->action(), "step" => $result_insert ? "success" : "error")); }