Atualizando

This commit is contained in:
Kenio 2025-08-05 10:45:22 -03:00
parent a71ff4f035
commit da3929a3cf
2 changed files with 28 additions and 15 deletions

View file

@ -78,7 +78,13 @@ try{
if($result->financial_movements_id > 0){
/** Salva as informações do arquivo */
if( $Documents->Save(0, 0, $result->description, $FinancialMovementsValidate->getArchive(), $FinancialMovementsValidate->getExt(), (object)$markings, $result->financial_movements_id) ){
if( $Documents->Save(0,
0,
$result->description,
$FinancialMovementsValidate->getArchive(),
$FinancialMovementsValidate->getExt(),
(object)$markings,
$result->financial_movements_id) ){
/** Informa o resultado positivo **/
$result = [

View file

@ -35,7 +35,7 @@ class Documents
private $and = null;
private $financialMovementsId = null;
private $markings = null;
private $clientsId = null;
private $companyId = null;
private $field = null;
/** Construtor da classe */
@ -107,13 +107,13 @@ class Documents
}
/** Lista todos os egistros do banco com ou sem paginação*/
public function All(? int $start, ? int $max, ? int $documentsCategorysId, ? string $tag, ? string $label, ? int $clientsId)
public function All(? int $start, ? int $max, ? int $documentsCategorysId, ? string $tag, ? string $label, ? int $companyId)
{
/** Parametros de entrada */
$this->start = $start;
$this->max = $max;
$this->documentsCategorysId = $documentsCategorysId;
$this->clientsId = $clientsId;
$this->companyId = $companyId;
$this->tag = $tag;
$this->label = $label;
$this->and = "";
@ -131,9 +131,9 @@ class Documents
}
/** Se houver um cliente informado, crio o filtro de consulta */
if($this->clientsId > 0){
if($this->companyId > 0){
$this->and = " and d.clients_id = {$this->clientsId}";
$this->and = " and d.clients_id = {$this->companyId}";
}
/** Consulta SQL */
@ -175,13 +175,13 @@ class Documents
}
/** Conta a quantidades de registros */
public function Count(? int $documentsCategorysId, ? string $tag, ? string $label, ? int $clientsId)
public function Count(? int $documentsCategorysId, ? string $tag, ? string $label, ? int $companyId)
{
/** Parametros de entraa */
$this->documentsCategorysId = $documentsCategorysId;
$this->tag = $tag;
$this->label = $label;
$this->clientsId = $clientsId;
$this->companyId = $companyId;
$this->and = "";
/** Se houver categoria informada, crio o filtro de consulta*/
@ -192,9 +192,9 @@ class Documents
}
/** Se houver um cliente informado, crio o filtro de consulta */
if($this->clientsId > 0){
if($this->companyId > 0){
$this->and = " and clients_id = {$this->clientsId}";
$this->and = " and clients_id = {$this->companyId}";
}
/** Consulta SQL */
@ -218,14 +218,21 @@ class Documents
}
/** Insere um novo registro no banco */
public function Save(int $documentsId, int $documentsCategorysId, string $description, string $archive, string $extension, object $tag, int $financialMovementsId, int $clientsId)
public function Save(int $documentsId,
int $documentsCategorysId,
string $description,
string $archive,
string $extension,
object $tag,
int $financialMovementsId,
? int $companyId)
{
/** Parametros */
$this->documentsId = $documentsId;
$this->documentsCategorysId = $documentsCategorysId;
$this->clientsId = $clientsId;
$this->companyId = $companyId;
$this->description = $description;
$this->archive = $archive;
$this->extension = $extension;
@ -247,7 +254,7 @@ class Documents
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('documents_id', $this->documentsId);
$this->stmt->bindParam('clients_id', $this->clientsId);
$this->stmt->bindParam('clients_id', $this->companyId);
$this->stmt->bindParam('description', $this->description);
$this->stmt->bindParam('tag', $this->tag);
@ -281,7 +288,7 @@ class Documents
$this->stmt->bindParam('archive', $this->archive);
$this->stmt->bindParam('extension', $this->extension);
$this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);
$this->stmt->bindParam('clients_id', $this->clientsId);
$this->stmt->bindParam('clients_id', $this->companyId);
$this->stmt->bindParam('tag', $this->tag);
}else{//Se o ID não foi informado, grava-se um novo registro
@ -316,7 +323,7 @@ class Documents
$this->stmt->bindParam('documents_categorys_id', $this->documentsCategorysId);
$this->stmt->bindParam('users_id', $_SESSION['USERSID']);/** Informa o usuário responsável pelo novo arquivo cadastrado */
$this->stmt->bindParam('company_id', $_SESSION['USERSCOMPANYID']);/** Grava o ID da empresa responsável pelo arquivo */
$this->stmt->bindParam('clients_id', $this->clientsId);
$this->stmt->bindParam('clients_id', $this->companyId);
$this->stmt->bindParam('description', $this->description);
$this->stmt->bindParam('archive', $this->archive);
$this->stmt->bindParam('extension', $this->extension);