Files
ventas_php/index.php
nickpons666 aaa77e870e Complete PHP 8.3.6 migration with modern architecture
- Added secure .env configuration with SystemConfig class
- Implemented multi-company DatabaseManager with MySQLi migration
- Fixed all PHP 8 compatibility issues (deprecated functions, syntax)
- Created complete AJAX login system with proper validation
- Added MockDatabase for development without MySQL dependencies
- Updated core classes (db, util, main, user, error, empresa)
- Fixed JavaScript loading and template compilation
- Added comprehensive documentation in php8-migration/
- System fully functional at http://ventas-test.local:82/login

Features:
- Multi-company database architecture with fallback to master
- Secure configuration management
- Modern PHP 8 practices with proper error handling
- Complete login functionality with validation
- Template cache cleared and updated

All critical issues resolved and system ready for production.
2026-01-06 22:52:04 -06:00

178 lines
3.6 KiB
PHP
Executable File

<?php
include_once('init.php');
if(!isset($_SESSION)){
session_start();
}
if(isset($_GET['page']) && $_GET['page'] == 'login2'){
$_SESSION['curBD'] = 'Demo';
header('Location: '.(WEB_ROOT ?? '/').'/login');
exit;
}
include_once('config.php');
include_once(DOC_ROOT.'/libraries.php');
$page = $_GET['page'] ?? 'homepage';
$pages = array(
'colores',
'homepage',
'login',
'materiales',
'metodos-pago',
'productos',
'productos-agregar',
'productos-editar',
'productos-detalles',
'productos-categorias',
'productos-duplicados',
'proveedores',
'tallas',
'temporadas',
'usuarios',
'usuarios-agregar',
'usuarios-editar',
'usuarios-detalles',
'datos-generales',
'clientes',
'cuentas-bancarias',
'atributos',
'pedidos',
'pedidos-agregar',
'pedidos-editar',
'pedidos-revivir',
'pedidos-detalles',
'pedidos-enviar-prov',
'pedidos-acuse',
'pedidos-calificacion',
'pedidos-distribucion',
'conjunto-tallas',
'motivos',
'envios',
'envios-detalles',
'envios-cedis-agregar',
'envios-tienda-agregar',
'envios-talones-pdf',
'envios-talones-tienda',
'envios-recibir',
'envios-recibir-reporte',
'envios-tienda',
'envios-tienda-detalles',
'envios-reporte',
'envios-traspasos',
'envios-transito',
'inventario',
'inventario-detalles',
'inventario-bloqueados',
'inventario-bloqueados-detalles',
'inventario-wizard',
'inventario-wizard2',
'inventario-wizard-list',
'inventario-wizard-list2',
'inventario-wizprods',
'inventario-wizprods2',
'inventario-ajustar',
'inventario-ajustar-list',
'inventario-liberar',
'inventario-fisico',
'inventario-fisico-agregar',
'inventario-fisico-detalles',
'inventario-solicitar',
'inventario-solicitar-agregar',
'inventario-solicitar-detalles',
'ventas',
'ventas-nueva',
'ventas-ticket',
'ventas-cobrar',
'ventas-espera',
'devoluciones',
'devoluciones-nueva',
'devoluciones-ticket',
'descuentos',
'descuentos-nuevo',
'cuentas-pagar',
'cuentas-pagar-saldos',
'promociones',
'monederos',
'facturacion',
'facturacion-nueva',
'facturacion-folios',
'facturacion-certificado',
'facturacion-mensual',
'facturacion-pdf',
'debug',
'redirect',
'reportes-ventas',
'reportes-productos',
'reportes-cuentaspagar',
'reportes-cuentascobrar',
'reportes-inventario',
'reportes-invparcial',
'reportes-invparcial-detalles',
'reportes-tickets',
'reportes-faltantes',
'reportes-devcedis',
'bonificacion-devolucion',
'bonificaciones-pendientes',
'bonificaciones',
'bonificaciones-agregar',
'evaluar-pedidos',
'devoluciones-pendientes',
'envios-tienda-cedis',
'comisiones',
'analisis-venta',
'ventas-sucursal',
'devoluciones-cedis',
'devoluciones-cedis-agregar',
'devoluciones-cedis-detalles',
'facturas',
'facturas-listado',
'facturas-datos',
'facturas-nueva'
);
if(!in_array($page, $pages))
{
$page = 'homepage';
}
include_once(DOC_ROOT.'/modules/user.php');
include_once(DOC_ROOT.'/modules/'.$page.'.php');
$includedTpl = $page;
if(isset($_GET['section']) && $_GET['section'])
{
$includedTpl = $page."_".$_GET['section'];
}
//$cIva = $util->GetIvaConfig();
$smarty->assign('curBD', $_SESSION['curBD'] ?? '');
$smarty->assign('cIva', $cIva ?? 0);
$smarty->assign('lang', $lang ?? 'es');
$smarty->assign('page', $page);
$smarty->assign('section', $_GET['section'] ?? '');
$smarty->assign('includedTpl', $includedTpl);
if($page == 'ventas-nueva')
$smarty->display('index-vta.tpl');
elseif($page == 'ventas-cobrar')
$smarty->display('index-cobrar.tpl');
elseif($page == 'descuentos-nuevo')
$smarty->display('index-desc.tpl');
elseif($page == 'devoluciones-nueva')
$smarty->display('index-dev.tpl');
else
$smarty->display('index.tpl');
?>