Files
ventas_php/classes/error.class.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

97 lines
1.6 KiB
PHP
Executable File

<?php
class SystemError
{
private $type = array();
private $errorField = array();
private $error = array();
private $complete = false;
private $errorValue = null;
private $Util = null;
public function Util()
{
if(!isset($this->Util) || $this->Util == null )
{
$this->Util = new Util();
}
return $this->Util;
}
public function setError($value = NULL, $type="error", $custom = "", $errorField = "")
{
$this->type[] = $type;
$this->setErrorField($errorField);
$this->setErrorValue($value, $custom);
if($type == "complete")
{
$this->complete = true;
}
}
function setErrorValue($value, $custom)
{
if($custom != "")
{
$this->error[] = $custom;
}
else
{
$this->error[] = $value;
}
}
function setErrorField($value)
{
if($value != "")
{
$this->errorField[] = $value;
}
else
{
$this->errorField[] = NULL;
}
}
public function getErrors()
{
global $property;
foreach($this->error as $key => $val)
{
if(is_numeric($val))
{
$this->error[$key] = $property["error"][$val];
}
}
$errors = array("value" => $this->error, "field" => $this->errorField, "type" => $this->type);
$errors["total"] = count($errors["value"]);
$errors["complete"] = $this->complete;
return $errors;
}
public function cleanErrors()
{
$this->error = array();
$this->errorField = array();
$this->type = array();
$this->complete = false;
}
public function PrintErrors()
{
$errors = $this->getErrors();
if($errors["total"])
{
$GLOBALS["smarty"]->assign('errors', $errors);
$this->cleanErrors();
return true;
}
return false;
}
}
?>