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:
2026-01-09 16:55:08 -06:00
parent cea1423109
commit 6839e0efd2
6 changed files with 72 additions and 83 deletions

View File

@@ -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;

View File

@@ -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(

View File

@@ -262,8 +262,11 @@ 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;
@@ -271,64 +274,45 @@ class Util extends SystemError
$pages["next"] = false;
$pages["last"] = false;
if($page == 0)
$page == 0;
// Lógica simple de reemplazo o concatenación
$hasPlaceholder = (strpos($link, "|$pagevar|") !== false);
if($page > 0){
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["first"] = $link."/".$pagevar."/0";
if(!$hasPlaceholder)
$pages["first"] = $link."/".$pagevar."/0";
else
$pages["first"] = $this->hs_preg_replace("\|$pagevar\|","0",$link);
$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);
}
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++)
for($i = ($page - $limit); $i <= ($page + $limit); $i++)
{
if($i >= 0)
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);
}
}
$pages[$page] = $link."/".$pagevar."/".$page;
for($i = ($page + 1); $i <= ($page + $limit); $i++)
{
if($i <= $total_pages)
{
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["numbers"][$i] = $link."/".$pagevar."/".$i;
else
$pages["numbers"][$i] = $this->hs_preg_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);
}
$pages["next"] = str_replace("|$pagevar|", (string)($page+1), $link);
if($page > 0){
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["last"] = $link."/".$pagevar."/".$total_pages;
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;

View File

@@ -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;
}

View File

@@ -1,61 +1,53 @@
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" style="border-top:1px solid #999999">
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-search" style="border-top:1px solid #999999">
<thead>
<tr>
<th width="10%"></th>
<th align="center" width="250"><div align="center">No. Prov.</div></th>
<th align="center"><div align="center">Proveedor</div></th>
<th align="center"><div align="center">Departamento</div></th>
<th align="center"><div align="center">Modelo</div></th>
<th align="center"><div align="center">Codigo de Barra</div></th>
<th width="10%"></th>
<th align="center" width="80"><div align="center">No. Prov.</div></th>
<th align="center" width="220"><div align="center">Proveedor</div></th>
<th align="center" width="220"><div align="center">Departamento</div></th>
<th align="center" width="180"><div align="center">Modelo</div></th>
<th align="center" width="120"><div align="center">Cod. Barra</div></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td align="center">
<input type="text" class="largeInput" name="noProv" id="noProv" style="width:30px" maxlength="3" onkeyup="CheckKey(event)" />
</td>
<td align="center">
<select name="proveedorId2" id="proveedorId2" class="largeInput">
<select name="proveedorId2" id="proveedorId2" class="largeInput" style="width:210px">
<option value="">Seleccione</option>
{if isset($proveedores) && count($proveedores) > 0}
{if isset($proveedores) && count($proveedores) > 0}
{foreach from=$proveedores item=item key=key}
<option value="{$item.proveedorId}" {if isset($info.proveedorId) && $info.proveedorId == $item.proveedorId}selected{/if}>{$item.nombre}</option>
{/foreach}
{else}
<option value="">No hay proveedores disponibles</option>
{/if}
{else}
<option value="">No hay proveedores disponibles</option>
{/if}
{foreach from=$proveedores item=item key=key}
<option value="{$item.proveedorId}" {if isset($info.proveedorId) && $info.proveedorId == $item.proveedorId}selected{/if}>{$item.nombre}</option>
{/foreach}
{else}
<option value="">No hay proveedores disponibles</option>
{/if}
</select>
</td>
<td align="center">
{if isset($categorias) && count($categorias) > 0}
{include file="{$DOC_ROOT}/templates/lists/enumProdCatSearch.tpl"}
{/if}
{include file="{$DOC_ROOT}/templates/lists/enumProdCatSearch.tpl"}
{/if}
</td>
<td align="center">
<input type="text" size="35" name="word" id="word" class="largeInput" onkeyup="CheckKey(event)" style="width:180px" />
<input type="text" size="35" name="word" id="word" class="largeInput" onkeyup="CheckKey(event)" style="width:170px" />
</td>
<td align="center">
<input type="text" size="35" name="codigoBarra" id="codigoBarra" class="largeInput" onkeyup="CheckKey(event)" style="width:100px" />
<input type="text" size="35" name="codigoBarra" id="codigoBarra" class="largeInput" onkeyup="CheckKey(event)" style="width:110px" />
</td>
<td></td>
</tr>
</tr>
<tr>
<td colspan="6" align="center">
<td colspan="5" align="center">
<input type="button" name="btnSearch" value="Buscar" class="btnSearch" onclick="Search()" />
</td>
</tr>
<tr>
<td colspan="6">
<td colspan="5">
<div align="center">
<div id="loadBusqueda" style="display:none">
<br />
<img src="http://www.facturase.com/images/loading.gif" width="16" height="16" />
<img src="images/loading.gif" width="16" height="16" />
<br />Cargando...
</div>
</div>

View File

@@ -1,4 +1,4 @@
<select name="idProdCat" id="idProdCat" class="largeInput wide2">
<select name="idProdCat" id="idProdCat" class="largeInput" style="width:210px">
<option value="">Todos</option>
{foreach from=$categorias item=item key=key}
<option value="{$item.prodCatId}" {if isset($info.prodCatId) && $info.prodCatId == $item.prodCatId}selected{/if}>{$item.nombre}</option>