From 01b700ecfb7e8c2e611bc88f294769759bb6a7ef Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Thu, 17 Jul 2025 15:23:43 -0300 Subject: [PATCH] Debug --- vendor/action/products/products_save.php | 11 +++++++++-- vendor/model/Products.class.php | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/vendor/action/products/products_save.php b/vendor/action/products/products_save.php index b04dde6..1706866 100644 --- a/vendor/action/products/products_save.php +++ b/vendor/action/products/products_save.php @@ -19,7 +19,8 @@ try{ $version = isset($_POST['version']) ? (int)filter_input(INPUT_POST,'version', FILTER_SANITIZE_SPECIAL_CHARS) : 0; $versionRelease = isset($_POST['version_release']) ? (int)filter_input(INPUT_POST,'version_release', FILTER_SANITIZE_SPECIAL_CHARS) : 0; $productsId = isset($_POST['product_id']) ? (int)filter_input(INPUT_POST,'product_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; - $productsTypeId = isset($_POST['product_type_id']) ? (int)filter_input(INPUT_POST,'product_type_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; + $productsTypeId = isset($_POST['product_type_id']) ? (int)filter_input(INPUT_POST,'product_type_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; + $userId = (int)$_SESSION['USERSID']; /** Validando os campos de entrada */ @@ -45,7 +46,13 @@ try{ } else { /** Efetua um novo cadastro ou salva os novos dados */ - if ($Products->Save($ProductsValidate->getProductsId(), $ProductsValidate->getProdutctsTypeId(), $ProductsValidate->getDescription(), $ProductsValidate->getReference(), $ProductsValidate->getVersion(), $ProductsValidate->getVersionRelease())){ + if ($Products->Save($ProductsValidate->getProductsId(), + $ProductsValidate->getProdutctsTypeId(), + $ProductsValidate->getDescription(), + $ProductsValidate->getReference(), + $ProductsValidate->getVersion(), + $ProductsValidate->getVersionRelease(), + $userId)){ /** Prepara a mensagem de retorno - sucesso */ $message = ''; diff --git a/vendor/model/Products.class.php b/vendor/model/Products.class.php index 7398c5b..46722a1 100644 --- a/vendor/model/Products.class.php +++ b/vendor/model/Products.class.php @@ -32,6 +32,7 @@ class Products private $version = null; private $version_release = null; private $productsTypeId = null; + private $userId = null; /** Construtor da classe */ function __construct() @@ -166,7 +167,13 @@ class Products } /** Insere um novo registro no banco */ - public function Save(int $productId, int $productsTypeId, string $description, string $reference, int $version, int $versionRelease) + public function Save(int $productId, + int $productsTypeId, + string $description, + string $reference, + int $version, + int $versionRelease, + int $userId) { @@ -177,6 +184,7 @@ class Products $this->reference = $reference; $this->version = $version; $this->versionRelease = $versionRelease; + $this->userId = $userId; /** Verifica se o ID do registro foi informado */ @@ -206,13 +214,13 @@ class Products /** Consulta SQL */ $this->sql = 'insert into products(product_type_id, description, - users_id, + user_id, reference, version, version_release ) values (:product_type_id, :description, - :users_id, + :user_id, :reference, :version, :version_release)'; @@ -221,7 +229,7 @@ class Products $this->stmt = $this->connection->connect()->prepare($this->sql); /** Preencho os parâmetros do SQL */ - $this->stmt->bindParam('users_id', $_SESSION['USERSID']);/** Informa o usuário responsável pelo novo produto cadastrado */ + $this->stmt->bindParam('user_id', $this->userId);/** Informa o usuário responsável pelo novo produto cadastrado */ $this->stmt->bindParam('product_type_id', $this->productsTypeId); $this->stmt->bindParam('description', $this->description); $this->stmt->bindParam('reference', $this->reference);