This commit is contained in:
Kenio 2025-07-17 14:44:30 -03:00
parent 4f9767bca2
commit 6f8f6404a1
2 changed files with 17 additions and 17 deletions

View file

@ -18,7 +18,7 @@ try{
$reference = isset($_POST['reference']) ? (string)filter_input(INPUT_POST,'reference', FILTER_SANITIZE_SPECIAL_CHARS) : '';
$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['products_id']) ? (int)filter_input(INPUT_POST,'products_id', 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['products_type_id']) ? (int)filter_input(INPUT_POST,'products_type_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;

View file

@ -23,7 +23,7 @@ class Products
private $start = null;
private $max = null;
private $limit = null;
private $productsId = null;
private $productId = null;
private $description = null;
private $dateRegister = null;
private $usersId = null;
@ -77,11 +77,11 @@ class Products
}
/** Lista os registros do banco de dados com limitação */
public function Get(int $productsId)
public function Get(int $productId)
{
/** Parametros de entrada */
$this->productsId = $productsId;
$this->productId = $productId;
/** Consulta SQL */
$this->sql = 'select * from products
@ -91,7 +91,7 @@ class Products
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam(':product_id', $this->productsId);
$this->stmt->bindParam(':product_id', $this->productId);
/** Executo o SQL */
$this->stmt->execute();
@ -166,12 +166,12 @@ class Products
}
/** Insere um novo registro no banco */
public function Save(int $productsId, 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)
{
/** Parametros */
$this->productsId = $productsId;
$this->productId = $productId;
$this->productsTypeId = $productsTypeId;
$this->description = $description;
$this->reference = $reference;
@ -180,10 +180,10 @@ class Products
/** Verifica se o ID do registro foi informado */
if($this->productsId > 0){
if($this->productId > 0){
/** Consulta SQL */
$this->sql = 'update products set products_type_id = :products_type_id,
$this->sql = 'update products set product_type_id = :product_type_id,
description = :description,
reference = :reference,
version = :version,
@ -194,8 +194,8 @@ class Products
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('product_id', $this->productsId);
$this->stmt->bindParam('products_type_id', $this->productsTypeId);
$this->stmt->bindParam('product_id', $this->productId);
$this->stmt->bindParam('product_type_id', $this->productsTypeId);
$this->stmt->bindParam('description', $this->description);
$this->stmt->bindParam('reference', $this->reference);
$this->stmt->bindParam('version', $this->version);
@ -204,13 +204,13 @@ class Products
}else{//Se o ID não foi informado, grava-se um novo registro
/** Consulta SQL */
$this->sql = 'insert into products(products_type_id,
$this->sql = 'insert into products(product_type_id,
description,
users_id,
reference,
version,
version_release
) values (:products_type_id,
) values (:product_type_id,
:description,
:users_id,
:reference,
@ -222,7 +222,7 @@ class Products
/** 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('products_type_id', $this->productsTypeId);
$this->stmt->bindParam('product_type_id', $this->productsTypeId);
$this->stmt->bindParam('description', $this->description);
$this->stmt->bindParam('reference', $this->reference);
$this->stmt->bindParam('version', $this->version);
@ -236,10 +236,10 @@ class Products
}
/** Deleta um determinado registro no banco de dados */
function Delete(int $productsId)
function Delete(int $productId)
{
/** Parametros de entrada */
$this->productsId = $productsId;
$this->productId = $productId;
/** Consulta SQL */
$this->sql = 'delete from products
@ -249,7 +249,7 @@ class Products
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('product_id', $this->productsId);
$this->stmt->bindParam('product_id', $this->productId);
/** Executo o SQL */
return $this->stmt->execute();