/** * * @param type $userId * @return type */ public function getEnterpriseData($userId) { $User = new Model_User(); $President = new Model_President(); $Enterprise = new Model_Enterprise(); $UserLocality = new Model_UserLocality(); $AddressEnterprise = new Model_AddressEnterprise(); //$userId = 81; $userRow = $User->getUserById($userId); $userLocalityRow = $UserLocality->getUserLocalityByUserId($userRow->getId()); $enterpriseRow = $Enterprise->getEnterpriseById($userLocalityRow->getEnterpriseId()); $presidentRow = $President->getPresidentByEnterpriseId($enterpriseRow->getId()); $addressEnterpriseRow = $AddressEnterprise->getAddressEnterpriseByEnterpriseId($enterpriseRow->getId()); $arrAnnualRevenue = Vtx_Util_Array::annualRevenue(); $neighborhood = $addressEnterpriseRow->findParentNeighborhood(); $arrEnterprise = array('Registro OCB' => $enterpriseRow->getOcbRegister() != '' ? $enterpriseRow->getOcbRegister() : '', 'Razão Social' => $enterpriseRow->getSocialName() != '' ? $enterpriseRow->getSocialName() : '', 'E-mail' => $enterpriseRow->getEmailDefault() != '' ? $enterpriseRow->getEmailDefault() : '', 'Nome Fantasia' => $enterpriseRow->getFantasyName() != '' ? $enterpriseRow->getFantasyName() : '', 'Ramo de Atividade' => $enterpriseRow->getMetierId() ? DbTable_Metier::getInstance()->getById($enterpriseRow->getMetierId())->getDescription() : '', 'Atividade Econômica(CNAE)' => $enterpriseRow->getCnae() != '' ? $enterpriseRow->getCnae() : '', 'CPF/CNPJ' => $enterpriseRow->getCnpj() != '' ? Vtx_Util_Formatting::maskFormat($enterpriseRow->getCnpj(), '##.###.###/####-##') : '', 'Porte da Empresa' => $enterpriseRow->getAnnualRevenue() != '' && isset($arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()]) ? $arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()] : '', 'Número de Colaboradores' => $enterpriseRow->getEmployeesQuantity() != '' ? $enterpriseRow->getEmployeesQuantity() : '', 'Data de Abertura' => $enterpriseRow->getCreationDate() != '' ? Vtx_Util_Date::format_dma($enterpriseRow->getCreationDate()) : '', 'Endereço' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNameFull() : '', 'Número' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNumber() : '', 'Complemento' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetCompletion() : '', 'Bairro' => $neighborhood ? $addressEnterpriseRow->findParentNeighborhood()->getName() : '', 'Cidade/Estado' => is_object($addressEnterpriseRow) ? DbTable_City::getInstance()->getById($addressEnterpriseRow->getCityId())->getName() . "/" . DbTable_State::getInstance()->getById($addressEnterpriseRow->getStateId())->getUf() : '', 'CEP' => is_object($addressEnterpriseRow) ? Vtx_Util_Formatting::maskFormat($addressEnterpriseRow->getCep(), '#####-###') : ''); $arrContact = array('Nome' => is_object($presidentRow) ? $presidentRow->getName() : '', 'Cargo' => is_object($presidentRow) ? 'Presidente' : '', 'Telefone' => is_object($presidentRow) ? $presidentRow->getPhone() : '', 'E-mail' => is_object($presidentRow) ? $presidentRow->getEmail() : '', 'Cpf' => Vtx_Util_Formatting::maskFormat($presidentRow->getCpf(), '###.###.###-##')); $arrIssues = array('0' => array('Q' => '1. É uma Matriz?', 'R' => $enterpriseRow->getHeadOfficeStatus() == '1' ? 'Sim' : 'Não'), '1' => array('Q' => '2. É uma Singular?', 'R' => $enterpriseRow->getSingularStatus() == '1' ? 'Sim' : 'Não'), '2' => array('Q' => '3. A empresa está vinculada a alguma Central?', 'R' => $enterpriseRow->getCentralName() != '' ? $enterpriseRow->getCentralName() : 'Não'), '3' => array('Q' => '4. A empresa está vinculada a alguma Federação?', 'R' => $enterpriseRow->getFederationName() != '' ? $enterpriseRow->getFederationName() : 'Não'), '4' => array('Q' => '5. A empresa está vinculada a alguma Confederação?', 'R' => $enterpriseRow->getConfederationName() != '' ? $enterpriseRow->getConfederationName() : 'Não')); return array($arrEnterprise, $arrContact, $arrIssues); }
public function updateEnterpriseTransaction($ficha, $enterpriseRow, $addressEnterpriseRow, $presidentRow, $addressPresidentRow, $userRow) { $User = new Model_User(); $President = new Model_President(); $PresidentProgram = new Model_PresidentProgram(); //$Eligibility = new Model_Eligibility(); $AddressEnterprise = new Model_AddressEnterprise(); $AddressPresident = new Model_AddressPresident(); $modelEntCatAwardCompetition = new Model_EnterpriseCategoryAwardCompetition(); $modelLogCadastroEmpresa = new Model_LogCadastroEmpresa(); // dados Empresa $registerEnterpriseData = $ficha['enterprise']; // dados endereço da empresa $registerAddressEnterpriseData = $ficha['addressEnterprise']; $registerAddressPresidentData = $ficha['addressPresident']; $registerAddressEnterpriseData['enterprise_id'] = $enterpriseRow->getId(); $registerAddressPresidentData['president_id'] = $presidentRow->getId(); // dados do presidente da empresa $registerPresidentData = $ficha['president']; $registerPresidentData['enterprise_id'] = $enterpriseRow->getId(); $registerPresidentData['hasnt_email'] = isset($ficha['enterprise']['hasnt_email']) ? $ficha['enterprise']['hasnt_email'] : 0; // dados do programa do presidente da empresa $registerPresidentProgramData = isset($ficha['presidentProgram']) ? $ficha['presidentProgram'] : null; // dados do usuário $registerUserData = isset($ficha['user']) ? $ficha['user'] : array(); $registerUserData['first_name'] = $registerPresidentData['name']; $registerUserData['surname'] = $registerPresidentData['nick_name']; $registerUserData['email'] = $registerPresidentData['email']; $registerUserData['login'] = $registerPresidentData['cpf']; $registerLogCadastro = $ficha['log_empresa']; $presidentId = $presidentRow->getId(); // start transaction externo Zend_Registry::get('db')->beginTransaction(); try { $hasntEmail = $registerPresidentData['hasnt_email']; $enterpriseEmail = isset($ficha['enterprise']['email_default']) ? $ficha['enterprise']['email_default'] : ''; $this->validateEmail($enterpriseRow->getId(), $enterpriseEmail, $hasntEmail); $this->validateLandline($ficha['enterprise']['phone']); $programaId = Zend_Registry::get('configDb')->competitionId; // Validação Categoria do Premio $updateCategoryAward = $this->validCategoryAward($registerEnterpriseData); if (!$updateCategoryAward['status']) { throw new Vtx_UserException($updateCategoryAward['messageError'], 10); } // 1.1 Empresa $updateEnterprise = $this->updateEnterprise($enterpriseRow, $registerEnterpriseData); if (!$updateEnterprise['status']) { throw new Vtx_UserException($updateEnterprise['messageError'], 10); } // elegibilidade para questionario de diagnostico //$Eligibility->doDiagnosticoEligibility($updateEnterprise['row']); // 1.2 Endereço da Empresa $updateAddressEnterprise = $AddressEnterprise->updateAddressEnterprise($addressEnterpriseRow, $registerAddressEnterpriseData); if (!$updateAddressEnterprise['status']) { throw new Vtx_UserException($updateAddressEnterprise['messageError'], 10); } // validação dos campos NewsLetter da Candidata (President) $newsLetterValid = $President->isValidNewsletter($ficha['newsletter'], $registerPresidentData); if (!$newsLetterValid['status']) { throw new Vtx_UserException($newsLetterValid['messageError']); } // 2.1 Presidente da Empresa $registerPresidentData['agree'] = $presidentRow->getAgree(); $updatePresident = $President->updatePresident($presidentRow, $registerPresidentData); if (!$updatePresident['status']) { throw new Vtx_UserException($updatePresident['messageError']); } // 2.2 Endereço da Presidente (candidata) $updateAddressPresident = $AddressPresident->updateAddressPresident($addressPresidentRow, $registerAddressPresidentData); if (!$updateAddressPresident['status']) { throw new Vtx_UserException($updateAddressPresident['messageError']); } // 2.3 Programa do Presidente da Empresa if ($registerPresidentProgramData) { $PresidentProgram->deleteAllPresidentProgramByPresidentId($presidentId); $createPresidentProgram = $PresidentProgram->createPresidentProgramByPresidentId($registerPresidentProgramData, $presidentId); if (!$createPresidentProgram['status']) { throw new Vtx_UserException($createPresidentProgram['messageError']); } } $enterpriseId = $enterpriseRow->getId(); $hasCurrentECAC = $modelEntCatAwardCompetition->hasECAC($enterpriseId, $programaId); if (!$hasCurrentECAC) { $registerECAC = array(); $registerECAC['enterprise_id'] = $enterpriseId; $registerECAC['competition_id'] = $programaId; $registerECAC['category_award_id'] = $registerEnterpriseData['category_award_id']; $insertECAC = $modelEntCatAwardCompetition->createECAC($registerECAC); if (!$insertECAC['status']) { throw new Vtx_UserException($insertECAC['messageError']); } // Log Cadastro da Empresa - ACEITE $logCadastroEmpresa['user_id_log'] = $registerLogCadastro['user_id_log']; $logCadastroEmpresa['enterprise_id'] = $enterpriseId; $logCadastroEmpresa['programa_id'] = $programaId; $logCadastroEmpresa['acao'] = 'aceite'; $insertlogCadastroEmpresa = $modelLogCadastroEmpresa->createLogCadastroEmpresa($logCadastroEmpresa); if (!$insertlogCadastroEmpresa['status']) { throw new Vtx_UserException($insertlogCadastroEmpresa['messageError']); } } // 3.1 Usuário (nome + sobrenome) $updateUser = $User->updateUser($userRow, $registerUserData); if (!$updateUser['status']) { throw new Vtx_UserException($updateUser['messageError']); } // Envia email com login/senha pro responsavel pelo cadastro $pass = isset($registerUserData['keypass']) ? $registerUserData['keypass'] : null; $enterpriseEmail = $registerEnterpriseData['email_default']; $presidentEmail = $registerPresidentData['email']; if ($enterpriseEmail != '') { $this->sendMailEdit($enterpriseEmail, $registerUserData['first_name'], $registerUserData['login'], $pass, $enterpriseId); if ($enterpriseEmail != $presidentEmail) { $this->sendMailEdit($presidentEmail, $registerPresidentData['name'], $registerPresidentData['cpf'], $pass, $enterpriseId); } } // Log Cadastro da Empresa - EDICAO CADASTRO $logCadastroEmpresa['user_id_log'] = $registerLogCadastro['user_id_log']; $logCadastroEmpresa['enterprise_id'] = $enterpriseId; $logCadastroEmpresa['programa_id'] = $programaId; $logCadastroEmpresa['acao'] = 'edicao_cadastro'; $insertlogCadastroEmpresaCad = $modelLogCadastroEmpresa->createLogCadastroEmpresa($logCadastroEmpresa); if (!$insertlogCadastroEmpresaCad['status']) { throw new Vtx_UserException($insertlogCadastroEmpresaCad['messageError']); } // update // end transaction externo Zend_Registry::get('db')->commit(); return array('status' => true); } catch (Vtx_UserException $e) { Zend_Registry::get('db')->rollBack(); return array('status' => false, 'messageError' => $e->getMessage(), 'errorCode' => $e->getCode()); } catch (Exception $e) { Zend_Registry::get('db')->rollBack(); throw new Exception($e); } }
/** * dados da empresa * * @param type $userId * @return type */ public function getEnterpriseData($userId) { $User = new Model_User(); //$President = new Model_President(); $Enterprise = new Model_Enterprise(); $UserLocality = new Model_UserLocality(); $AddressEnterprise = new Model_AddressEnterprise(); $Position = new Model_Position(); $userRow = $User->getUserById($userId); $userLocalityRow = $UserLocality->getUserLocalityByUserId($userRow->getId()); $enterpriseRow = $Enterprise->getEnterpriseById($userLocalityRow->getEnterpriseId()); //var_dump('EnterpriseId: ',$enterpriseRow->getId()); //$presidentRow = $President->getPresidentByEnterpriseId($enterpriseRow->getId()); $addressEnterpriseRow = $AddressEnterprise->getAddressEnterpriseByEnterpriseId($enterpriseRow->getId()); $arrAnnualRevenue = Vtx_Util_Array::annualRevenue(); $arrCategoria = Vtx_Util_Array::categoriaMpe(); $idCategoria = $enterpriseRow->getCategoriaId(); $nomeCategoria = ""; if (is_int($idCategoria)) { $nomeCategoria = $arrCategoria[$idCategoria]; } $arrTipoEmpresa = Vtx_Util_Array::tipoEmpresaMPE(); $idTipoEmpresa = $enterpriseRow->getEnterpriseTypeId(); $tipoEmpresa = ""; if (is_int($idTipoEmpresa)) { $tipoEmpresa = $arrTipoEmpresa[$idTipoEmpresa]; } // var_dump('addressEnterpriseRow: ',$addressEnterpriseRow); // exit; $neighborhood = $addressEnterpriseRow->findParentNeighborhood(); //var_dump('neighborhood: ',$neighborhood); $idUf = $addressEnterpriseRow->getStateId(); $idCidade = $addressEnterpriseRow->getCityId(); //var_dump($idCidade); //var_dump($idUf); if (is_int($idUf)) { $uf = DbTable_State::getInstance()->getById($idUf)->getUf(); } else { $uf = ""; } if (is_int($idCidade)) { $cidade = DbTable_City::getInstance()->getById($idCidade)->getName(); } else { $cidade = ""; } $cidadeEstado = $cidade . "/" . $uf; //var_dump ($cidadeEstado); exit; //var_dump($cidadeEstado); //exit; $cnpj = $enterpriseRow->getCnpj(); if (is_string($cnpj)) { $cpfCnpj = $cnpj; } else { $cpfCnpj = ""; } //$cnpjMask = Vtx_Util_Formatting::maskFormat($getcnpj,'##.###.###/####-##'); //$cnpj = null; //var_dump($cnpj); //exit; $arrEnterprise = array('Razão Social' => $enterpriseRow->getSocialName() != '' ? $enterpriseRow->getSocialName() : '', 'E-mail' => $enterpriseRow->getEmailDefault() != '' ? $enterpriseRow->getEmailDefault() : '', 'Nome Fantasia' => $enterpriseRow->getFantasyName() != '' ? $enterpriseRow->getFantasyName() : '', 'Atividade Econômica(CNAE)' => $enterpriseRow->getCnae() != '' ? $enterpriseRow->getCnae() : '', 'CPF/CNPJ' => $cpfCnpj, 'Faturamento Anual' => $enterpriseRow->getAnnualRevenue() != '' && isset($arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()]) ? $arrAnnualRevenue[$enterpriseRow->getAnnualRevenue()] : '', 'Número de Colaboradores' => $enterpriseRow->getEmployeesQuantity() != '' ? $enterpriseRow->getEmployeesQuantity() : '0', 'Data de Abertura' => $enterpriseRow->getCreationDate() != '' ? Vtx_Util_Date::format_dma($enterpriseRow->getCreationDate()) : '', 'Endereço' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNameFull() : '', 'Número' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetNumber() : '', 'Complemento' => is_object($addressEnterpriseRow) ? $addressEnterpriseRow->getStreetCompletion() : '', 'Bairro' => $neighborhood ? $addressEnterpriseRow->findParentNeighborhood()->getName() : '', 'Cidade/Estado' => $cidadeEstado, 'CEP' => is_object($addressEnterpriseRow) ? Vtx_Util_Formatting::maskFormat($addressEnterpriseRow->getCep(), '#####-###') : '', 'Categoria' => $nomeCategoria, 'Tipo Empresa' => $tipoEmpresa); $idPosition = $userRow->getPositionId(); $cargo = ""; if (is_int($idPosition)) { $posicao = $Position->getPosition($idPosition); $cargo = $posicao ? $posicao->getDescription() : ''; } $arrContact = array('Nome' => is_object($userRow) ? $userRow->getNomeCompleto() : '', 'Cargo' => is_object($userRow) ? $cargo : '', 'Telefone' => is_object($userRow) ? $userRow->getTelefone() : '', 'Celular' => is_object($userRow) ? $userRow->getCelular() : '', 'E-mail' => is_object($userRow) ? $userRow->getEmail() : ''); $arrIssues = array(); return array($arrEnterprise, $arrContact, $arrIssues); }
public function editAction() { $Acl = Zend_Registry::get('acl'); $auth = Zend_Auth::getInstance(); $User = new Model_User(); $President = new Model_President(); $PresidentProgram = new Model_PresidentProgram(); $modelLogCadastroEmpresa = new Model_LogCadastroEmpresa(); $UserLocality = new Model_UserLocality(); $AddressEnterprise = new Model_AddressEnterprise(); $AddressPresident = new Model_AddressPresident(); $this->_helper->viewRenderer->setRender('index'); $this->view->editStatus = false; $this->view->editByAdmin = false; if ($this->_getParam('id_key') and ($Acl->isAllowed($this->userLogged->getRole(), 'questionnaire:register', 'publisher') or $Acl->isAllowed($this->userLogged->getRole(), 'questionnaire:register', 'acompanhacadastro'))) { $enterpriseIdKey = $this->_getParam('id_key'); $enterpriseRow = $this->Enterprise->getEnterpriseByIdKey($enterpriseIdKey); $userLocalityGetEnterprise = $UserLocality->getUserLocalityByEnterpriseId($enterpriseRow->getId()); if (!$userLocalityGetEnterprise) { throw new Exception('Nenhum usuário relacionado nesta empresa.'); } $this->view->editStatus = true; $this->view->enterpriseIdKey = $enterpriseIdKey; $userId = $userLocalityGetEnterprise->getUserId(); $this->view->editByAdmin = true; } else { $userId = $this->userLogged->getUserId(); } $userRow = $User->getUserById($userId); $userLocalityRow = $UserLocality->getUserLocalityByUserId($userRow->getId()); $enterpriseRow = $this->Enterprise->getEnterpriseById($userLocalityRow->getEnterpriseId()); $presidentRow = $President->getPresidentByEnterpriseId($enterpriseRow->getId()); $addressPresidentRow = $AddressPresident->getAddressPresidentByPresidentId($presidentRow->getId()); $presidentProgramRow = $PresidentProgram->getAllPresidentProgramByPresidentId($presidentRow->getId()); $addressEnterpriseRow = $AddressEnterprise->getAddressEnterpriseByEnterpriseId($enterpriseRow->getId()); $logCadastradoPor = $modelLogCadastroEmpresa->getLogCadastroEmpresaByEnterpriseId($enterpriseRow->getId()); $cadastroNome = 'Site'; $cadastroCriadoEm = '00:00:00'; if ($logCadastradoPor) { if ($logCadastradoPor->getUserIdLog() != $userLocalityRow->getUserId()) { $cadastroNome = $User->getUserById($logCadastradoPor->getUserIdLog())->getFirstName(); } $cadastroCriadoEm = $logCadastradoPor->getCriadoEm(); } $this->view->logCadastroEmpresa = array('NomeCadastro' => $cadastroNome, 'CriadoEm' => $cadastroCriadoEm); if (!$enterpriseRow || !$presidentRow) { throw new Exception('Usuário inválido, não encontrado.'); } $this->view->userIdview = $userId; $this->view->enterpriseIdview = $enterpriseRow->getId(); // $modelQuest = new Model_Questionnaire(); // // $arrTerminoEtapas = $modelQuest->terminoEtapas($enterpriseRow, $userId); // // var_dump($arrTerminoEtapas); $this->view->getAllStates = $this->State->getAll(); if ($addressEnterpriseRow) { $this->view->getAllCities = $this->City->getAllCityByStateId($addressEnterpriseRow->getStateId()); //$this->view->getAllNeighborhoods = $this->Neighborhood->getAllNeighborhoodByCityId($addressEnterpriseRow->getCityId()); $this->view->getAllNeighborhoods = $addressEnterpriseRow->getCityId() ? $this->Neighborhood->getAllNeighborhoodByCityId($addressEnterpriseRow->getCityId()) : null; } if ($addressPresidentRow) { $this->view->getAllCitiesPresident = $this->City->getAllCityByStateId($addressPresidentRow->getStateId()); //$this->view->getAllNeighborhoodsPresident = $this->Neighborhood->getAllNeighborhoodByCityId($addressPresidentRow->getCityId()); $this->view->getAllNeighborhoodsPresident = $addressPresidentRow->getCityId() ? $this->Neighborhood->getAllNeighborhoodByCityId($addressPresidentRow->getCityId()) : null; } $this->view->getAllPositions = $this->Position->getAll(); $this->view->getAllEducations = $this->Education->getAll(); $this->view->getAllMetier = $this->Metier->getAll(); $this->view->getAllPresidentProgramType = $this->modelPresidentProgramType->getAll(); $this->view->hasECAC = $this->modelEnterpriseCategoryAwardCompetition->hasECAC($enterpriseRow->getId(), Zend_Registry::get('configDb')->competitionId); $hasntEmail = $enterpriseRow->getHasntEmail(); $hasntEmail = isset($hasntEmail) ? $hasntEmail : 1; $this->view->registerEnterpriseData = array('cnpj' => $enterpriseRow->getCnpj(), 'category_award_id' => $enterpriseRow->getCategoryAwardId(), 'category_sector_id' => $enterpriseRow->getCategorySectorId(), 'state_registration' => $enterpriseRow->getStateRegistration(), 'dap' => $enterpriseRow->getDap(), 'register_ministry_fisher' => $enterpriseRow->getRegisterMinistryFisher(), 'company_history' => $enterpriseRow->getCompanyHistory(), 'site' => $enterpriseRow->getSite(), 'status' => $enterpriseRow->getStatus(), 'social_name' => $enterpriseRow->getSocialName(), 'fantasy_name' => $enterpriseRow->getFantasyName(), 'creation_date' => $enterpriseRow->getCreationDate(), 'employees_quantity' => $enterpriseRow->getEmployeesQuantity(), 'phone' => $enterpriseRow->getPhone(), 'email_default' => $enterpriseRow->getEmailDefault(), 'annual_revenue' => $enterpriseRow->getAnnualRevenue(), 'cnae' => $enterpriseRow->getCnae(), 'nirf' => $enterpriseRow->getNirf(), 'farm_size' => $enterpriseRow->getFarmSize(), 'hasnt_email' => $hasntEmail); if ($addressEnterpriseRow) { $this->view->registerAddressEnterpriseData = array('cep' => $addressEnterpriseRow->getCep(), 'state_id' => $addressEnterpriseRow->getStateId(), 'city_id' => $addressEnterpriseRow->getCityId(), 'name_full_log' => $addressEnterpriseRow->getStreetNameFull(), 'street_number' => $addressEnterpriseRow->getStreetNumber(), 'street_completion' => $addressEnterpriseRow->getStreetCompletion(), 'neighborhood_id' => $addressEnterpriseRow->getNeighborhoodId()); } $this->view->registerPresidentData = array('enterprise_id' => $presidentRow->getEnterpriseId(), 'education_id' => $presidentRow->getEducationId(), 'position_id' => $presidentRow->getPositionId(), 'find_us_id' => $presidentRow->getFindUsId(), 'nick_name' => $presidentRow->getNickName(), 'cellphone' => $presidentRow->getCellphone(), 'newsletter_email' => $presidentRow->getNewsletterEmail(), 'newsletter_mail' => $presidentRow->getNewsletterMail(), 'newsletter_sms' => $presidentRow->getNewsletterSms(), 'agree' => $presidentRow->getAgree(), 'name' => $presidentRow->getName(), 'cpf' => $presidentRow->getCpf(), 'email' => $presidentRow->getEmail(), 'phone' => $presidentRow->getPhone(), 'born_date' => $presidentRow->getBornDate(), 'gender' => $presidentRow->getGender()); if ($addressPresidentRow) { $this->view->registerAddressPresidentData = array('cep' => $addressPresidentRow->getCep(), 'state_id' => $addressPresidentRow->getStateId(), 'city_id' => $addressPresidentRow->getCityId(), 'name_full_log' => $addressPresidentRow->getStreetNameFull(), 'street_number' => $addressPresidentRow->getStreetNumber(), 'street_completion' => $addressPresidentRow->getStreetCompletion(), 'neighborhood_id' => $addressPresidentRow->getNeighborhoodId()); } $this->view->registerPresidentProgramData = $presidentProgramRow; $this->view->registerUserData = array('first_name' => $userRow->getFirstName(), 'surname' => $userRow->getSurname(), 'password_hint' => $userRow->getPasswordHint()); $this->view->hasEligibility = $hasEligibility = $this->Enterprise->hasEligibilityRules($enterpriseRow->getIdKey()); if ($this->_getParam('forward', null) == true) { return; } if (!$this->getRequest()->isPost()) { return; } $ficha = $this->_getAllParams(); $ficha['log_empresa']['user_id_log'] = $this->userLogged->getUserId(); unset($this->view->editStatus); unset($this->view->getAllStates); unset($this->view->getAllCities); unset($this->view->getAllNeighborhoods); unset($this->view->getAllCitiesPresident); unset($this->view->getAllNeighborhoodsPresident); unset($this->view->getAllPositions); unset($this->view->getAllEducations); unset($this->view->getAllMetier); unset($this->view->getAllPresidentProgramType); unset($this->view->hasECAC); unset($this->view->registerEnterpriseData); unset($this->view->registerAddressEnterpriseData); unset($this->view->registerPresidentData); unset($this->view->registerAddressPresidentData); unset($this->view->registerPresidentProgramData); unset($this->view->registerUserData); unset($this->view->editByAdmin); // $this->view->registerData = $ficha; $updateEnterpriseTransaction = $this->Enterprise->updateEnterpriseTransaction($ficha, $enterpriseRow, $addressEnterpriseRow, $presidentRow, $addressPresidentRow, $userRow); if (!$updateEnterpriseTransaction['status']) { $this->view->messageError = $updateEnterpriseTransaction['messageError']; $this->view->errorCode = $updateEnterpriseTransaction['errorCode']; return; } $this->view->itemSuccess = true; $emailEnterprise = isset($ficha['enterprise']['email_default']) ? $ficha['enterprise']['email_default'] : ''; $socialName = $ficha['enterprise']['social_name']; $cnpj = $ficha['enterprise']['cnpj']; if ($this->view->itemSuccess && ($emailEnterprise == null || $emailEnterprise == '')) { $stateId = $ficha['addressEnterprise']['state_id']; $this->sendWhiteListMail($stateId, $socialName, $cnpj); } $hasEligibility = $this->Enterprise->hasEligibilityRules($enterpriseRow->getIdKey()); if ($Acl->isAllowed($auth->getIdentity()->getRole(), 'questionnaire:register', 'publisher')) { $this->view->loadUrlRegister = $this->view->baseUrl('/management/enterprise/success/itemEditSuccess/true/social_name/' . urlencode($ficha['enterprise']['social_name']) . '/enterpriseIdKey/' . $enterpriseIdKey . '/hasEligibility/' . $hasEligibility); return; } if ($Acl->isAllowed($auth->getIdentity()->getRole(), 'questionnaire:register', 'index')) { $this->view->loadUrlRegister = $this->view->baseUrl('/questionnaire/register/success/itemEditSuccess/true/hasEligibility/' . $hasEligibility); return; } }