From 5d7993cc278295188e571fdc55c040104d27523b Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Wed, 17 Dec 2025 08:37:45 -0300 Subject: [PATCH] =?UTF-8?q?fix():=20Ajuste=20na=20fun=C3=A7=C3=A3o=20de=20?= =?UTF-8?q?atualizar=20movimenta=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/model/FinancialMovements.class.php | 115 +++++++++++++--------- 1 file changed, 70 insertions(+), 45 deletions(-) diff --git a/vendor/model/FinancialMovements.class.php b/vendor/model/FinancialMovements.class.php index be303a7..1c03ba9 100644 --- a/vendor/model/FinancialMovements.class.php +++ b/vendor/model/FinancialMovements.class.php @@ -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(); }