fix(): Ajsute na atualização de movimentação financeira

This commit is contained in:
Kenio 2025-12-17 05:48:25 -03:00
parent ade2a8021a
commit 130643ff59
3 changed files with 71 additions and 23 deletions

View file

@ -14,14 +14,15 @@ try{
$FinancialMovementsValidate = new FinancialMovementsValidate();
/** Parametros de entrada */
$movementDatePaid = isset($_POST['movement_date_paid']) ? (string)filter_input(INPUT_POST,'movement_date_paid', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$note = isset($_POST['note']) ? (string)filter_input(INPUT_POST,'note', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$movementValuePaid = isset($_POST['movement_value_paid']) ? (string)filter_input(INPUT_POST,'movement_value_paid', FILTER_SANITIZE_SPECIAL_CHARS) : '0';
$movementValueFees = isset($_POST['movement_value_fees']) ? (string)filter_input(INPUT_POST,'movement_value_fees', FILTER_SANITIZE_SPECIAL_CHARS) : '0';
$financialMovementsId = isset($_POST['financial_movements_id']) ? (int)filter_input(INPUT_POST,'financial_movements_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
$financialOutputsId = isset($_POST['financial_outputs_id']) ? (int)filter_input(INPUT_POST,'financial_outputs_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
$financialEntriesId = isset($_POST['financial_entries_id']) ? (int)filter_input(INPUT_POST,'financial_entries_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
$updateValue = isset($_POST['updateValue']) ? (string)filter_input(INPUT_POST,'updateValue', FILTER_SANITIZE_SPECIAL_CHARS) : 'N';
$movementDatePaid = isset($_POST['movement_date_paid']) ? (string)filter_input(INPUT_POST,'movement_date_paid', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$note = isset($_POST['note']) ? (string)filter_input(INPUT_POST,'note', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$movementValuePaid = isset($_POST['movement_value_paid']) ? (string)filter_input(INPUT_POST,'movement_value_paid', FILTER_SANITIZE_SPECIAL_CHARS) : '0';
$movementValueFees = isset($_POST['movement_value_fees']) ? (string)filter_input(INPUT_POST,'movement_value_fees', FILTER_SANITIZE_SPECIAL_CHARS) : '0';
$financialMovementsId = isset($_POST['financial_movements_id']) ? (int)filter_input(INPUT_POST,'financial_movements_id', FILTER_SANITIZE_NUMBER_INT) : 0;
$financialOutputsId = isset($_POST['financial_outputs_id']) ? (int)filter_input(INPUT_POST,'financial_outputs_id', FILTER_SANITIZE_NUMBER_INT) : 0;
$financialEntriesId = isset($_POST['financial_entries_id']) ? (int)filter_input(INPUT_POST,'financial_entries_id', FILTER_SANITIZE_NUMBER_INT) : 0;
$movementUserConfirmed = isset($_POST['movement_user_confirmed']) ? (int)filter_input(INPUT_POST,'movement_user_confirmed', FILTER_SANITIZE_NUMBER_INT) : 0;
$updateValue = isset($_POST['updateValue']) ? (string)filter_input(INPUT_POST,'updateValue', FILTER_SANITIZE_SPECIAL_CHARS) : 'N';
/** Verifica se é somente atualização de valor */
if($updateValue == 'S'){
@ -39,6 +40,7 @@ try{
$FinancialMovementsValidate->setNote($note);
$FinancialMovementsValidate->setMovementValuePaid($movementValuePaid);
$FinancialMovementsValidate->setMovementValueFees($movementValueFees);
$FinancialMovementsValidate->setMovementMovementUserConfirmed($movementUserConfirmed);
}
/** Verifica se não existem erros a serem informados */
@ -98,7 +100,8 @@ try{
$FinancialMovementsValidate->getNote(),
$FinancialMovementsValidate->getMovementValueFees(),
null,
null )){
null,
$FinancialMovementsValidate->getMovementMovementUserConfirmed() )){
/** Informa o resultado positivo **/
$result = [

View file

@ -181,7 +181,7 @@ class FinancialMovementsValidate
{
/** Trata a entrada da informação */
$this->companyId = isset($companyId) ? $this->Main->antiInjection($companyId) : null;
$this->companyId = isset($companyId) ? (int)$this->Main->antiInjection($companyId) : null;
/** Verifica se a informação foi informada */
// if(empty($this->companyId))
@ -751,6 +751,14 @@ class FinancialMovementsValidate
}
}
/** Método trata campo movement_user_confirmed */
public function setMovementMovementUserConfirmed(int $movementMovementUserConfirmed){
/** Trata a entrada da informação */
$this->movementMovementUserConfirmed = isset($movementMovementUserConfirmed) ? (int)$this->Main->antiInjection($movementMovementUserConfirmed) : 0;
}
/** Sanitiza array */
public function setSanitizeArray(array $input)
@ -773,6 +781,14 @@ class FinancialMovementsValidate
/** Retorna a array tratada */
return $this->input;
}
/** Método retorna campo movement_user_confirmed */
public function getMovementUserConfirmed() : ? int
{
/** Retorno da informação */
return (int)$this->movementUserConfirmed;
}
/** Método retorna campo financial_movements_id */

View file

@ -1246,7 +1246,8 @@ class FinancialMovements
string $note,
? float $movementValueFees,
? float $movementValueRegistrationTariff,
? float $movementValueSettlementTariff)
? float $movementValueSettlementTariff,
int $movementUserConfirmed)
{
/** Parametros de entrada */
$this->financialMovementsId = $financialMovementsId;
@ -1258,18 +1259,39 @@ class FinancialMovements
$this->movementValueFees = $movementValueFees;
$this->movementValueRegistrationTariff = $movementValueRegistrationTariff;
$this->movementValueSettlementTariff = $movementValueSettlementTariff;
$this->movementUserConfirmed = $movementUserConfirmed;
/** se o movement_user_confirmed foi informado */
if($this->movementUserConfirmed > 0){
/** Consulta SQL */
$this->sql = "update financial_movements set movement_date_paid = :movement_date_paid,
movement_value_paid = :movement_value_paid,
note = :note,
movement_value_fees = :movement_value_fees,
movement_value_registration_tariff = :movement_value_registration_tariff,
movement_value_settlement_tariff = :movement_value_settlement_tariff,
movement_date_update = CURRENT_TIMESTAMP,
user_id_update = :user_id_update
where financial_movements_id = :financial_movements_id ";
/** Consulta SQL */
$this->sql = "update financial_movements set movement_date_paid = :movement_date_paid,
movement_value_paid = :movement_value_paid,
note = :note,
movement_user_confirmed = :movement_user_confirmed,
movement_value_fees = :movement_value_fees,
movement_value_registration_tariff = :movement_value_registration_tariff,
movement_value_settlement_tariff = :movement_value_settlement_tariff,
status = 2
where financial_movements_id = :financial_movements_id ";
} else {
/** Consulta SQL */
$this->sql = "update financial_movements set movement_date_paid = :movement_date_paid,
movement_value_paid = :movement_value_paid,
note = :note,
movement_user_confirmed = :movement_user_confirmed,
movement_value_fees = :movement_value_fees,
movement_value_registration_tariff = :movement_value_registration_tariff,
movement_value_settlement_tariff = :movement_value_settlement_tariff,
status = 2,
movement_date_update = CURRENT_TIMESTAMP,
user_id_update = :user_id_update
where financial_movements_id = :financial_movements_id ";
}
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
@ -1292,8 +1314,15 @@ class FinancialMovements
$this->stmt->bindParam('movement_value_fees', $this->movementValueFees);
$this->stmt->bindParam('movement_value_registration_tariff', $this->movementValueRegistrationTariff);
$this->stmt->bindParam('movement_value_settlement_tariff', $this->movementValueSettlementTariff);
$this->stmt->bindParam('note', $this->note);
$this->stmt->bindParam('movement_user_confirmed', $_SESSION['USERSID']);/** Informa o usuário responsável pela movimentação cadastrada */
$this->stmt->bindParam('note', $this->note);
/** se o movement_user_confirmed foi informado */
if($this->movementUserConfirmed > 0){
$this->stmt->bindParam('movement_user_confirmed', $_SESSION['USERSID']);/** Informa o usuário responsável pela movimentação cadastrada */
}
$this->stmt->bindParam('user_id_update', $_SESSION['USERSID']);
$this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);
/** Verifica se é uma entrada*/