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() function IsLoggedIn()
{ {
if($_SESSION["loginKey"]) if(isset($_SESSION["loginKey"]) && !empty($_SESSION["loginKey"]))
{ {
$GLOBALS["smarty"]->assign('user', $this->Info()); $GLOBALS["smarty"]->assign('user', $this->Info());
return true; return true;

View File

@@ -789,6 +789,8 @@ class Producto extends Main
function SearchDuplicados(){ function SearchDuplicados(){
$sqlAdd = ''; $sqlAdd = '';
$pages = array();
$pages = array();
if($this->noProveedor) if($this->noProveedor)
$sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"'; $sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"';
@@ -822,6 +824,17 @@ class Producto extends Main
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql); $this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
$result = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult(); $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{ }else{
$result = array(); $result = array();
$pages = array( $pages = array(

View File

@@ -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 = array();
$pages["numbers"] = array(); $pages["numbers"] = array();
$pages["first"] = false; $pages["first"] = false;
$pages["prev"] = false; $pages["prev"] = false;
$pages["next"] = false; $pages["next"] = false;
$pages["last"] = 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)) if(!$hasPlaceholder)
$pages["numbers"][$i] = $link."/".$pagevar."/".$i; $pages["numbers"][$i + 1] = $link."/".$pagevar."/".$i;
else 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($page < $total_pages - 1){
if(!$this->hs_eregi("\|$pagevar\|",$link)) if(!$hasPlaceholder)
$pages["next"] = $link."/".$pagevar."/".($page+1); $pages["next"] = $link."/".$pagevar."/".($page+1);
else else
$pages["next"] = $this->hs_preg_replace("\|$pagevar\|",(string)($page+1),$link); $pages["next"] = str_replace("|$pagevar|", (string)($page+1), $link);
}
if(!$hasPlaceholder)
if($page > 0){ $pages["last"] = $link."/".$pagevar."/".(max(0, $total_pages - 1));
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["last"] = $link."/".$pagevar."/".$total_pages;
else 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; $pages["current"] = $page+1;
$items_per_page = defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20;
$pages["items_per_page"] = $items_per_page; $pages["items_per_page"] = $items_per_page;
$pages["start"] = $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 TABLE DESIGN
*******************************************************************************/ *******************************************************************************/
#box-table-a { #box-table-a, #box-table-search {
font-size: 12px; font-size: 12px;
margin: 0px; margin: 0px;
text-align: left; text-align: left;
border-collapse: separate; border-collapse: separate;
border-bottom:none; border-bottom:none;
} }
#box-table-a th { #box-table-a th, #box-table-search th {
font-size: 13px; font-size: 13px;
font-weight: normal; font-weight: normal;
padding: 8px; padding: 8px;
@@ -384,14 +384,14 @@ a.inline_tip { padding-left:21px; background:url(../images/icons/_lightbulb_off.
color: #333; color: #333;
text-align: left; text-align: left;
} }
#box-table-a td { #box-table-a td, #box-table-search td {
padding: 8px; padding: 8px;
background: none; background: none;
border-top: 1px solid #CCC; border-top: 1px solid #CCC;
color: #666; color: #666;
border-bottom: none !important; border-bottom: none !important;
} }
#box-table-a tr:hover td { #box-table-a tr:hover td, #box-table-search tr:hover td {
background: #FBFBFB; background: #FBFBFB;
color: #333; 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> <thead>
<tr> <tr>
<th width="10%"></th> <th align="center" width="80"><div align="center">No. Prov.</div></th>
<th align="center" width="250"><div align="center">No. Prov.</div></th> <th align="center" width="220"><div align="center">Proveedor</div></th>
<th align="center"><div align="center">Proveedor</div></th> <th align="center" width="220"><div align="center">Departamento</div></th>
<th align="center"><div align="center">Departamento</div></th> <th align="center" width="180"><div align="center">Modelo</div></th>
<th align="center"><div align="center">Modelo</div></th> <th align="center" width="120"><div align="center">Cod. Barra</div></th>
<th align="center"><div align="center">Codigo de Barra</div></th>
<th width="10%"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td></td>
<td align="center"> <td align="center">
<input type="text" class="largeInput" name="noProv" id="noProv" style="width:30px" maxlength="3" onkeyup="CheckKey(event)" /> <input type="text" class="largeInput" name="noProv" id="noProv" style="width:30px" maxlength="3" onkeyup="CheckKey(event)" />
</td> </td>
<td align="center"> <td align="center">
<select name="proveedorId2" id="proveedorId2" class="largeInput"> <select name="proveedorId2" id="proveedorId2" class="largeInput" style="width:210px">
<option value="">Seleccione</option> <option value="">Seleccione</option>
{if isset($proveedores) && count($proveedores) > 0}
{if isset($proveedores) && count($proveedores) > 0} {if isset($proveedores) && count($proveedores) > 0}
{foreach from=$proveedores item=item key=key} {foreach from=$proveedores item=item key=key}
<option value="{$item.proveedorId}" {if isset($info.proveedorId) && $info.proveedorId == $item.proveedorId}selected{/if}>{$item.nombre}</option> <option value="{$item.proveedorId}" {if isset($info.proveedorId) && $info.proveedorId == $item.proveedorId}selected{/if}>{$item.nombre}</option>
{/foreach} {/foreach}
{else} {else}
<option value="">No hay proveedores disponibles</option> <option value="">No hay proveedores disponibles</option>
{/if} {/if}
{else}
<option value="">No hay proveedores disponibles</option>
{/if}
</select> </select>
</td> </td>
<td align="center"> <td align="center">
{if isset($categorias) && count($categorias) > 0} {if isset($categorias) && count($categorias) > 0}
{include file="{$DOC_ROOT}/templates/lists/enumProdCatSearch.tpl"} {include file="{$DOC_ROOT}/templates/lists/enumProdCatSearch.tpl"}
{/if} {/if}
</td> </td>
<td align="center"> <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>
<td align="center"> <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></td> </tr>
</tr>
<tr> <tr>
<td colspan="6" align="center"> <td colspan="5" align="center">
<input type="button" name="btnSearch" value="Buscar" class="btnSearch" onclick="Search()" /> <input type="button" name="btnSearch" value="Buscar" class="btnSearch" onclick="Search()" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="6"> <td colspan="5">
<div align="center"> <div align="center">
<div id="loadBusqueda" style="display:none"> <div id="loadBusqueda" style="display:none">
<br /> <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... <br />Cargando...
</div> </div>
</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> <option value="">Todos</option>
{foreach from=$categorias item=item key=key} {foreach from=$categorias item=item key=key}
<option value="{$item.prodCatId}" {if isset($info.prodCatId) && $info.prodCatId == $item.prodCatId}selected{/if}>{$item.nombre}</option> <option value="{$item.prodCatId}" {if isset($info.prodCatId) && $info.prodCatId == $item.prodCatId}selected{/if}>{$item.nombre}</option>