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.
This commit is contained in:
2026-01-07 23:01:55 -06:00
parent 5cdfc9c39a
commit c616072d6c

View File

@@ -665,6 +665,17 @@ class Producto extends Main
$sqlAdd = ''; $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) if($this->noProveedor)
$sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"'; $sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"';
@@ -699,16 +710,6 @@ class Producto extends Main
}else{ }else{
$result = array(); $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
);
} }
$data["items"] = $result; $data["items"] = $result;