Compare commits

...

6 Commits

Author SHA1 Message Date
e8b1afdb71 Fix collation issue in productos search by removing BINARY
Removed BINARY keyword from LIKE clauses to allow proper comparison
between UTF-8 search terms and latin1_swedish_ci database values.
BINARY was causing exact match issues preventing search functionality.
2026-01-07 23:26:07 -06:00
4dbc9cfc52 Fix collation error by using BINARY in LIKE operations
Added BINARY keyword to LIKE clauses in Search() function to bypass
collation issues. BINARY forces byte-by-byte comparison and avoids
'Illegal mix of collations' error when connection uses utf8mb4
and table uses latin1_swedish_ci.
2026-01-07 23:17:50 -06:00
a0ada73c81 Remove COLLATE clause from LIKE operations
Removed COLLATE specification from Search() LIKE clauses to fix
'COLLATION latin1_swedish_ci is not valid for CHARACTER SET utf8mb4' error.
Let MySQL use the table's default collation for LIKE comparisons.
2026-01-07 23:10:38 -06:00
d28414cff1 Fix collation mismatch error in productos search
Added COLLATE latin1_swedish_ci to LIKE operations in Search()
function to prevent 'Illegal mix of collations' error when searching
by modelo or codigoBarra. The database uses latin1_swedish_ci but
PHP 8 uses UTF-8 encoding.
2026-01-07 23:06:54 -06:00
c616072d6c Fix undefined variable $pages in Search() function - move initialization
Moved $pages array initialization outside of if/else block to prevent
undefined variable warning when search returns results (if block executes).
$pages is now initialized before the conditional logic.
2026-01-07 23:01:55 -06:00
5cdfc9c39a Fix undefined variable $pages in producto Search() function
Initialized $pages array in else block to prevent undefined variable
warning when no search criteria are provided and SQL returns results.
2026-01-07 22:58:08 -06:00

View File

@@ -661,6 +661,64 @@ class Producto extends Main
}//Search3 }//Search3
function Search(){
$sqlAdd = '';
$pages = array(
'numbers' => array(),
'first' => false,
'prev' => false,
'next' => false,
'last' => false,
'current' => 1,
'items_per_page' => defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20,
'start' => 0
);
if($this->noProveedor)
$sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"';
if($this->proveedorId)
$sqlAdd .= ' AND p.proveedorId = "'.$this->proveedorId.'"';
if($this->prodCatId)
$sqlAdd .= ' AND p.prodCatId = "'.$this->prodCatId.'"';
if($this->descripcion)
$sqlAdd .= ' AND p.modelo LIKE "%'.$this->descripcion.'%"';
if($this->codigoBarra)
$sqlAdd .= ' AND p.codigoBarra LIKE "%'.$this->codigoBarra.'%"';
if($sqlAdd != ''){
$sql = 'SELECT p.*
FROM
producto AS p,
proveedor AS prov
WHERE
p.proveedorId = prov.proveedorId
AND
p.baja = "0"
'.$sqlAdd.'
ORDER BY
descripcion';
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
$result = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
}else{
$result = array();
}
$data["items"] = $result;
$data["pages"] = $pages;
return $data;
}//Search
function Search2(){ function Search2(){
$sqlAdd = ''; $sqlAdd = '';