Atualizando Users.class.php
This commit is contained in:
parent
bbab8bfaeb
commit
4f70defd31
3 changed files with 7 additions and 10 deletions
12
vendor/action/users/users_save.php
vendored
12
vendor/action/users/users_save.php
vendored
|
|
@ -16,7 +16,7 @@ try{
|
|||
$UsersValidate = new UsersValidate();
|
||||
|
||||
/** Parametros de entrada */
|
||||
$usersId = isset($_POST['users_id']) ? (int)filter_input(INPUT_POST, 'users_id', FILTER_SANITIZE_NUMBER_INT) : 0 ;
|
||||
$userId = isset($_POST['user_id']) ? (int)filter_input(INPUT_POST, 'user_id', FILTER_SANITIZE_NUMBER_INT) : 0 ;
|
||||
$clientsId = isset($_POST['clients_id']) ? (int)filter_input(INPUT_POST, 'clients_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$companyId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
|
||||
$nameFirst = isset($_POST['name_first']) ? (string)filter_input(INPUT_POST, 'name_first', FILTER_SANITIZE_SPECIAL_CHARS) : '';
|
||||
|
|
@ -31,7 +31,7 @@ try{
|
|||
$passwordTemp = isset($_POST['password_temp']) ? (string)filter_input(INPUT_POST, 'password_temp', FILTER_SANITIZE_SPECIAL_CHARS) : '';
|
||||
|
||||
/** Validando os campos de entrada */
|
||||
$UsersValidate->setUsersId($usersId);
|
||||
$UsersValidate->setUserId($userId);
|
||||
$UsersValidate->setClientsId($clientsId);
|
||||
$UsersValidate->setCompanyId($companyId);
|
||||
$UsersValidate->setNameFirst($nameFirst);
|
||||
|
|
@ -60,7 +60,7 @@ try{
|
|||
} else {
|
||||
|
||||
/** Verifica se o usuário já se encontra cadastrado */
|
||||
if($Users->CheckEmail($UsersValidate->getUsersId(), $UsersValidate->getClientsId(), $UsersValidate->getEmail()) > 0){
|
||||
if($Users->CheckEmail($UsersValidate->getUserId(), $UsersValidate->getClientsId(), $UsersValidate->getEmail()) > 0){
|
||||
|
||||
/** Informo */
|
||||
throw new InvalidArgumentException('O e-mail informado já está sendo utilizado', 0);
|
||||
|
|
@ -68,7 +68,7 @@ try{
|
|||
|
||||
|
||||
/** Efetua um novo cadastro ou salva os novos dados */
|
||||
if ($Users->Save($UsersValidate->getUsersId(), $UsersValidate->getClientsId(), $UsersValidate->getCompanyId(), $UsersValidate->getNameFirst(), $UsersValidate->getNameLast(), $UsersValidate->getEmail(), $UsersValidate->getBirthDate(), $UsersValidate->getGenre(), $UsersValidate->getActive(), $UsersValidate->getAdministrator(), $UsersValidate->getPassword(), $UsersValidate->getPasswordTemp(), $UsersValidate->getPasswordTempConfirm())){
|
||||
if ($Users->Save($UsersValidate->getUserId(), $UsersValidate->getClientsId(), $UsersValidate->getCompanyId(), $UsersValidate->getNameFirst(), $UsersValidate->getNameLast(), $UsersValidate->getEmail(), $UsersValidate->getBirthDate(), $UsersValidate->getGenre(), $UsersValidate->getActive(), $UsersValidate->getAdministrator(), $UsersValidate->getPassword(), $UsersValidate->getPasswordTemp(), $UsersValidate->getPasswordTempConfirm())){
|
||||
|
||||
|
||||
/** Verifica se é para enviar e-mail de acesso ao usuário */
|
||||
|
|
@ -93,7 +93,7 @@ try{
|
|||
}
|
||||
|
||||
/** Adição de elementos na array */
|
||||
$message = '<div class="alert alert-success" role="alert">'.($UsersValidate->getUsersId() > 0 ? 'Cadastro atualizado com sucesso' : 'Cadastro efetuado com sucesso').'</div>';
|
||||
$message = '<div class="alert alert-success" role="alert">'.($UsersValidate->getUserId() > 0 ? 'Cadastro atualizado com sucesso' : 'Cadastro efetuado com sucesso').'</div>';
|
||||
|
||||
/** Result **/
|
||||
$result = [
|
||||
|
|
@ -108,7 +108,7 @@ try{
|
|||
} else {
|
||||
|
||||
/** Adição de elementos na array */
|
||||
$message = '<div class="alert alert-success" role="alert">' . ($UsersValidate->getUsersId() > 0 ? 'Não foi possível atualizar o cadastro' : 'Não foi possível efetuar o cadastro') .'</div>';
|
||||
$message = '<div class="alert alert-success" role="alert">' . ($UsersValidate->getUserId() > 0 ? 'Não foi possível atualizar o cadastro' : 'Não foi possível efetuar o cadastro') .'</div>';
|
||||
|
||||
/** Result **/
|
||||
$result = [
|
||||
|
|
|
|||
3
vendor/model/Users.class.php
vendored
3
vendor/model/Users.class.php
vendored
|
|
@ -462,7 +462,6 @@ class Users
|
|||
/** Consulta SQL */
|
||||
$this->sql = 'insert into users(company_id,
|
||||
user_id,
|
||||
company_id,
|
||||
name_first,
|
||||
name_last,
|
||||
email,
|
||||
|
|
@ -476,7 +475,6 @@ class Users
|
|||
password_temp_confirm
|
||||
) values (:company_id,
|
||||
:user_id,
|
||||
:company_id,
|
||||
:name_first,
|
||||
:name_last,
|
||||
:email,
|
||||
|
|
@ -494,7 +492,6 @@ class Users
|
|||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('user_id', $this->usersId);
|
||||
$this->stmt->bindParam('company_id', $this->clientsId);
|
||||
$this->stmt->bindParam('company_id', $this->companyId);
|
||||
$this->stmt->bindParam('name_first', $this->nameFirst);
|
||||
$this->stmt->bindParam('name_last', $this->nameLast);
|
||||
|
|
|
|||
2
vendor/view/users/users_form.php
vendored
2
vendor/view/users/users_form.php
vendored
|
|
@ -257,7 +257,7 @@ if($Main->verifyToken()){
|
|||
<input type="hidden" name="TABLE" value="users" />
|
||||
<input type="hidden" name="ACTION" value="users_save" />
|
||||
<input type="hidden" name="FOLDER" value="action" />
|
||||
<input type="hidden" name="users_id" value="<?php echo $UsersValidate->getUserId();?>" />
|
||||
<input type="hidden" name="user_id" value="<?php echo $UsersValidate->getUserId();?>" />
|
||||
<input type="hidden" name="company_id" value="<?php echo ( $CompaniesValidate->getCompanyId() > 0 ? $CompaniesValidate->getCompanyId() : (isset($_SESSION['USERSCOMPANYID']) ? $_SESSION['USERSCOMPANYID'] : 0) );?>" />
|
||||
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue