Fix undefined variable $pages in producto Search functions
Fixed 'Undefined variable $pages' error when no search criteria are provided in Search3(), Search2(), and SearchDuplicados() functions by initializing $pages array with proper pagination structure in the else blocks.
This commit is contained in:
@@ -627,31 +627,41 @@ class Producto extends Main
|
||||
$sqlAdd .= ' AND codigoBarra LIKE "%'.$this->codigoBarra.'%"';
|
||||
|
||||
if($sqlAdd != ''){
|
||||
|
||||
|
||||
$sql = 'SELECT *
|
||||
|
||||
FROM
|
||||
|
||||
FROM
|
||||
producto
|
||||
WHERE
|
||||
baja = "0"
|
||||
WHERE
|
||||
baja = "0"
|
||||
'.$sqlAdd.'
|
||||
ORDER BY
|
||||
descripcion';
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
ORDER BY
|
||||
descripcion';
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
}else{
|
||||
|
||||
}else{
|
||||
$result = array();
|
||||
$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
|
||||
);
|
||||
}//else
|
||||
|
||||
|
||||
$data["items"] = $result;
|
||||
$data["pages"] = $pages;
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
|
||||
}//Search
|
||||
|
||||
function Search(){
|
||||
|
||||
function Search2(){
|
||||
|
||||
$sqlAdd = '';
|
||||
|
||||
@@ -687,17 +697,27 @@ class Producto extends Main
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
}else{
|
||||
}else{
|
||||
$result = array();
|
||||
$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
|
||||
);
|
||||
}//else
|
||||
|
||||
|
||||
$data["items"] = $result;
|
||||
$data["pages"] = $pages;
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
|
||||
}//Search
|
||||
|
||||
|
||||
function SearchDuplicados(){
|
||||
|
||||
$sqlAdd = '';
|
||||
@@ -734,17 +754,27 @@ class Producto extends Main
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
}else{
|
||||
}else{
|
||||
$result = array();
|
||||
$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
|
||||
);
|
||||
}//else
|
||||
|
||||
|
||||
$data["items"] = $result;
|
||||
$data["pages"] = $pages;
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
|
||||
}//SearchDuplicados
|
||||
|
||||
|
||||
function Search2(){
|
||||
|
||||
$sqlAdd = '';
|
||||
|
||||
Reference in New Issue
Block a user