Corrección de visibilidad y diseño en la tabla de productos duplicados. Mejora global en el sistema de paginación y optimización de anchos de tabla.
This commit is contained in:
@@ -456,7 +456,7 @@ $this->Util()->ValidateMail($value, "Email");
|
||||
|
||||
function IsLoggedIn()
|
||||
{
|
||||
if($_SESSION["loginKey"])
|
||||
if(isset($_SESSION["loginKey"]) && !empty($_SESSION["loginKey"]))
|
||||
{
|
||||
$GLOBALS["smarty"]->assign('user', $this->Info());
|
||||
return true;
|
||||
|
||||
@@ -789,6 +789,8 @@ class Producto extends Main
|
||||
function SearchDuplicados(){
|
||||
|
||||
$sqlAdd = '';
|
||||
$pages = array();
|
||||
$pages = array();
|
||||
|
||||
if($this->noProveedor)
|
||||
$sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"';
|
||||
@@ -822,6 +824,17 @@ class Producto extends Main
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$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{
|
||||
$result = array();
|
||||
$pages = array(
|
||||
|
||||
@@ -262,73 +262,57 @@ class Util extends SystemError
|
||||
}
|
||||
}
|
||||
|
||||
function HandleMultipages($page, $total_pages, $link, $pagevar, $limit = 5)
|
||||
function HandleMultipages($page, $total_items, $link, $pagevar = "p", $limit = 5)
|
||||
{
|
||||
$items_per_page = defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20;
|
||||
$total_pages = ceil($total_items / $items_per_page);
|
||||
|
||||
$pages = array();
|
||||
$pages["numbers"] = array();
|
||||
$pages["first"] = false;
|
||||
$pages["prev"] = false;
|
||||
$pages["next"] = false;
|
||||
$pages["last"] = false;
|
||||
|
||||
if($page == 0)
|
||||
$page == 0;
|
||||
|
||||
if($page > 0){
|
||||
if(!$this->hs_eregi("\|$pagevar\|",$link))
|
||||
$pages["first"] = $link."/".$pagevar."/0";
|
||||
else
|
||||
$pages["first"] = $this->hs_preg_replace("\|$pagevar\|","0",$link);
|
||||
}
|
||||
|
||||
if($page > 0){
|
||||
if(!$this->hs_eregi("\|$pagevar\|",$link))
|
||||
$pages["prev"] = $link."/".$pagevar."/".($page-1);
|
||||
else
|
||||
$pages["prev"] = $this->hs_preg_replace("\|$pagevar\|",(string)($page-1),$link);
|
||||
}
|
||||
|
||||
for($i = ($page - $limit); $i < $page; $i++)
|
||||
{
|
||||
if($i >= 0)
|
||||
{
|
||||
if(!$this->hs_eregi("\|$pagevar\|",$link))
|
||||
$pages["numbers"][$i] = $link."/".$pagevar."/".$i;
|
||||
else
|
||||
$pages["numbers"][$i] = $this->hs_preg_replace("\|$pagevar\|",(string)($i),$link);
|
||||
}
|
||||
}
|
||||
|
||||
$pages[$page] = $link."/".$pagevar."/".$page;
|
||||
|
||||
for($i = ($page + 1); $i <= ($page + $limit); $i++)
|
||||
// Lógica simple de reemplazo o concatenación
|
||||
$hasPlaceholder = (strpos($link, "|$pagevar|") !== false);
|
||||
|
||||
if($page > 0){
|
||||
if(!$hasPlaceholder)
|
||||
$pages["first"] = $link."/".$pagevar."/0";
|
||||
else
|
||||
$pages["first"] = str_replace("|$pagevar|", "0", $link);
|
||||
|
||||
if(!$hasPlaceholder)
|
||||
$pages["prev"] = $link."/".$pagevar."/".($page-1);
|
||||
else
|
||||
$pages["prev"] = str_replace("|$pagevar|", (string)($page-1), $link);
|
||||
}
|
||||
|
||||
for($i = ($page - $limit); $i <= ($page + $limit); $i++)
|
||||
{
|
||||
if($i <= $total_pages)
|
||||
if($i >= 0 && $i < $total_pages)
|
||||
{
|
||||
if(!$this->hs_eregi("\|$pagevar\|",$link))
|
||||
$pages["numbers"][$i] = $link."/".$pagevar."/".$i;
|
||||
if(!$hasPlaceholder)
|
||||
$pages["numbers"][$i + 1] = $link."/".$pagevar."/".$i;
|
||||
else
|
||||
$pages["numbers"][$i] = $this->hs_preg_replace("\|$pagevar\|",(string)($i),$link);
|
||||
$pages["numbers"][$i + 1] = str_replace("|$pagevar|", (string)($i), $link);
|
||||
}
|
||||
}
|
||||
|
||||
if($page < $total_pages){
|
||||
if(!$this->hs_eregi("\|$pagevar\|",$link))
|
||||
$pages["next"] = $link."/".$pagevar."/".($page+1);
|
||||
if($page < $total_pages - 1){
|
||||
if(!$hasPlaceholder)
|
||||
$pages["next"] = $link."/".$pagevar."/".($page+1);
|
||||
else
|
||||
$pages["next"] = $this->hs_preg_replace("\|$pagevar\|",(string)($page+1),$link);
|
||||
}
|
||||
|
||||
if($page > 0){
|
||||
if(!$this->hs_eregi("\|$pagevar\|",$link))
|
||||
$pages["last"] = $link."/".$pagevar."/".$total_pages;
|
||||
$pages["next"] = str_replace("|$pagevar|", (string)($page+1), $link);
|
||||
|
||||
if(!$hasPlaceholder)
|
||||
$pages["last"] = $link."/".$pagevar."/".(max(0, $total_pages - 1));
|
||||
else
|
||||
$pages["last"] = $this->hs_preg_replace("\|$pagevar\|",(string)($total_pages),$link);
|
||||
$pages["last"] = str_replace("|$pagevar|", (string)(max(0, $total_pages - 1)), $link);
|
||||
}
|
||||
|
||||
$pages["current"] = $page+1;
|
||||
|
||||
$items_per_page = defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20;
|
||||
$pages["items_per_page"] = $items_per_page;
|
||||
$pages["start"] = $page * $items_per_page;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user