fix(): Ajuste na função de atualizar movimentação

This commit is contained in:
Kenio 2025-12-17 08:37:45 -03:00
parent c2e5365041
commit 5d7993cc27

View file

@ -1273,8 +1273,46 @@ class FinancialMovements
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 ";
where financial_movements_id = :financial_movements_id ";
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
$this->sql .= " and financial_entries_id = :financial_entries_id";
/** Verifica se é uma saída */
}elseif($this->financialOutputsId > 0){
$this->sql .= " and financial_outputs_id = :financial_outputs_id";
}
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('movement_date_paid', $this->movementDatePaid);
$this->stmt->bindParam('movement_value_paid', $this->movementValuePaid);
$this->stmt->bindParam('note', $this->note);
$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('user_id_update', $_SESSION['USERSID']);
$this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
/** Adiciona o id da entrada */
$this->stmt->bindParam('financial_entries_id', $this->financialEntriesId);
/** Verifica se é uma saída */
}elseif($this->financialOutputsId > 0){
/** Adiciona o id da saída */
$this->stmt->bindParam('financial_outputs_id', $this->financialOutputsId);
}
} else {
@ -1291,62 +1329,49 @@ class FinancialMovements
user_id_update = :user_id_update
where financial_movements_id = :financial_movements_id ";
}
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
$this->sql .= " and financial_entries_id = :financial_entries_id";
/** Verifica se é uma saída */
}elseif($this->financialOutputsId > 0){
$this->sql .= " and financial_entries_id = :financial_entries_id";
/** Verifica se é uma saída */
}elseif($this->financialOutputsId > 0){
echo $this->sql .= " and financial_outputs_id = :financial_outputs_id";
}
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('movement_date_paid', $this->movementDatePaid);
$this->stmt->bindParam('movement_value_paid', $this->movementValuePaid);
$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);
/** se o movement_user_confirmed foi informado */
if($this->movementUserConfirmed > 0){
$this->sql .= " and financial_outputs_id = :financial_outputs_id";
}
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('movement_date_paid', $this->movementDatePaid);
$this->stmt->bindParam('movement_value_paid', $this->movementValuePaid);
$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('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('user_id_update', $_SESSION['USERSID']);
$this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
$this->stmt->bindParam('user_id_update', $_SESSION['USERSID']);
$this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);
/** Verifica se é uma entrada*/
if($this->financialEntriesId > 0){
/** Adiciona o id da entrada */
$this->stmt->bindParam('financial_entries_id', $this->financialEntriesId);
/** Adiciona o id da entrada */
$this->stmt->bindParam('financial_entries_id', $this->financialEntriesId);
/** Verifica se é uma saída */
}elseif($this->financialOutputsId > 0){
/** Verifica se é uma saída */
}elseif($this->financialOutputsId > 0){
/** Adiciona o id da saída */
$this->stmt->bindParam('financial_outputs_id', $this->financialOutputsId);
/** Adiciona o id da saída */
$this->stmt->bindParam('financial_outputs_id', $this->financialOutputsId);
}
}
/** Executo o SQL */
return $this->stmt->execute();
preg_match_all('/:\w+/', $sql, $matches);
$placeholders = array_unique($matches[0]);
print_r($placeholders);
return $this->stmt->execute();
}