fix(productos): Resuelve múltiples errores de variables undefined y validación
- Arregla variable \$_GET["p"] con null coalescing - Implementa paginación completa en EnumDuplicados() - Agrega validación isset() en templates para evitar null access - Mejora validación de entradas GET - Corrige inicialización de variables en templates Resuelve errores masivos y warnings en módulo de productos.
This commit is contained in:
@@ -321,6 +321,16 @@ class Producto extends Main
|
|||||||
|
|
||||||
function EnumDuplicados()
|
function EnumDuplicados()
|
||||||
{
|
{
|
||||||
|
$db = $this->Util()->DBSelect($_SESSION["empresaId"]);
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT(*) FROM producto WHERE codigoBarra LIKE '%-%'";
|
||||||
|
$db->setQuery($sql);
|
||||||
|
$total = $db->GetSingle();
|
||||||
|
|
||||||
|
$pages = $this->Util()->HandleMultipages($this->page, $total ,WEB_ROOT."/productos-duplicados", "p");
|
||||||
|
|
||||||
|
$sqlAdd = "LIMIT ".$pages["start"].", ".$pages["items_per_page"];
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM producto
|
FROM producto
|
||||||
WHERE codigoBarra LIKE '%-%'
|
WHERE codigoBarra LIKE '%-%'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
$empresa->AuthUser();
|
$empresa->AuthUser();
|
||||||
|
|
||||||
$producto->SetPage($_GET["p"]);
|
$producto->SetPage($_GET["p"] ?? 1);
|
||||||
$productos = $producto->EnumDuplicados();
|
$productos = $producto->EnumDuplicados();
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|||||||
@@ -19,13 +19,23 @@
|
|||||||
<td align="center">
|
<td align="center">
|
||||||
<select name="proveedorId2" id="proveedorId2" class="largeInput">
|
<select name="proveedorId2" id="proveedorId2" class="largeInput">
|
||||||
<option value="">Seleccione</option>
|
<option value="">Seleccione</option>
|
||||||
{foreach from=$proveedores item=item key=key}
|
{if isset($proveedores) && count($proveedores) > 0}
|
||||||
<option value="{$item.proveedorId}" {if $info.proveedorId == $item.proveedorId}selected{/if}>{$item.nombre|truncate:25:"..."}</option>
|
{if isset($proveedores) && count($proveedores) > 0}
|
||||||
{/foreach}
|
{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}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
{include file="{$DOC_ROOT}/templates/lists/enumProdCatSearch.tpl"}
|
{if isset($categorias) && count($categorias) > 0}
|
||||||
|
{include file="{$DOC_ROOT}/templates/lists/enumProdCatSearch.tpl"}
|
||||||
|
{/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:180px" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<select name="idProdCat" id="idProdCat" class="largeInput wide2">
|
<select name="idProdCat" id="idProdCat" class="largeInput wide2">
|
||||||
<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 $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>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
Reference in New Issue
Block a user