Atualizando o arquivo clients_save.php para companies_save.php

This commit is contained in:
Kenio 2025-07-16 10:39:44 -03:00
parent 7218346018
commit 256ae3e6e5

View file

@ -16,7 +16,7 @@ try{
/** Parametros de entrada */
$type = isset($_POST['type']) ? (string)filter_input(INPUT_POST, 'type', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$student = isset($_POST['student']) ? (string)filter_input(INPUT_POST, 'student', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$companiesId = isset($_POST['companies_id']) ? (int)filter_input(INPUT_POST, 'companies_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
$companyId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_NUMBER_INT) : 0;
$clientName = isset($_POST['client_name']) ? (string)filter_input(INPUT_POST, 'client_name', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$fantasyName = isset($_POST['fantasy_name']) ? (string)filter_input(INPUT_POST, 'fantasy_name', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$document = isset($_POST['document']) ? (string)filter_input(INPUT_POST, 'document', FILTER_SANITIZE_SPECIAL_CHARS) : '';
@ -39,7 +39,7 @@ try{
/** Validando os campos de entrada */
$CompaniesValidate->setType($type);
$CompaniesValidate->setStudent($student);
$CompaniesValidate->setCompanyId($CompaniesId);
$CompaniesValidate->setCompanyId($CompanyId);
$CompaniesValidate->setClientName($clientName);
$CompaniesValidate->setFantasyName($fantasyName);
$CompaniesValidate->setDocument($document);
@ -101,7 +101,7 @@ try{
'cod' => 200,
'title' => 'Atenção',
'message' => '<div class="alert alert-success" role="alert">' . ($CompaniesValidate->getCompaniesId() > 0 ? 'Cliente atualizado com sucesso!' : 'Cliente cadastrado com sucesso!') .'</div>',
'message' => '<div class="alert alert-success" role="alert">' . ($CompaniesValidate->getCompanyId() > 0 ? 'Cliente atualizado com sucesso!' : 'Cliente cadastrado com sucesso!') .'</div>',
];
@ -113,7 +113,7 @@ try{
}else{//Caso ocorra algum erro, informo
throw new InvalidArgumentException(($CompaniesValidate->getCompaniesId() > 0 ? 'Não foi possível atualizar o cadastro da empresa' : 'Não foi possível cadastrar a nova empresa'), 0);
throw new InvalidArgumentException(($CompaniesValidate->getCompanyId() > 0 ? 'Não foi possível atualizar o cadastro da empresa' : 'Não foi possível cadastrar a nova empresa'), 0);
}
}