From 6839e0efd241050508a891922f440b5e60df1a13 Mon Sep 17 00:00:00 2001 From: nickpons666 Date: Fri, 9 Jan 2026 16:55:08 -0600 Subject: [PATCH] =?UTF-8?q?Correcci=C3=B3n=20de=20visibilidad=20y=20dise?= =?UTF-8?q?=C3=B1o=20en=20la=20tabla=20de=20productos=20duplicados.=20Mejo?= =?UTF-8?q?ra=20global=20en=20el=20sistema=20de=20paginaci=C3=B3n=20y=20op?= =?UTF-8?q?timizaci=C3=B3n=20de=20anchos=20de=20tabla.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/empresa.class.php | 2 +- classes/producto.class.php | 13 +++++ classes/util.class.php | 80 +++++++++++---------------- css/blue.css | 8 +-- templates/forms/search-productos.tpl | 50 +++++++---------- templates/lists/enumProdCatSearch.tpl | 2 +- 6 files changed, 72 insertions(+), 83 deletions(-) diff --git a/classes/empresa.class.php b/classes/empresa.class.php index 12663fa..b58f306 100755 --- a/classes/empresa.class.php +++ b/classes/empresa.class.php @@ -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; diff --git a/classes/producto.class.php b/classes/producto.class.php index f116962..30a1737 100755 --- a/classes/producto.class.php +++ b/classes/producto.class.php @@ -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( diff --git a/classes/util.class.php b/classes/util.class.php index 42a0faa..8a31449 100755 --- a/classes/util.class.php +++ b/classes/util.class.php @@ -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; diff --git a/css/blue.css b/css/blue.css index 1a6d953..49940a6 100755 --- a/css/blue.css +++ b/css/blue.css @@ -368,14 +368,14 @@ a.inline_tip { padding-left:21px; background:url(../images/icons/_lightbulb_off. /******************************************************************************* TABLE DESIGN *******************************************************************************/ -#box-table-a { +#box-table-a, #box-table-search { font-size: 12px; margin: 0px; text-align: left; border-collapse: separate; border-bottom:none; } -#box-table-a th { +#box-table-a th, #box-table-search th { font-size: 13px; font-weight: normal; padding: 8px; @@ -384,14 +384,14 @@ a.inline_tip { padding-left:21px; background:url(../images/icons/_lightbulb_off. color: #333; text-align: left; } -#box-table-a td { +#box-table-a td, #box-table-search td { padding: 8px; background: none; border-top: 1px solid #CCC; color: #666; border-bottom: none !important; } -#box-table-a tr:hover td { +#box-table-a tr:hover td, #box-table-search tr:hover td { background: #FBFBFB; color: #333; } diff --git a/templates/forms/search-productos.tpl b/templates/forms/search-productos.tpl index a5e561b..bffd945 100755 --- a/templates/forms/search-productos.tpl +++ b/templates/forms/search-productos.tpl @@ -1,61 +1,53 @@ - +
- - - - - - - + + + + + - - - + - -