Fix usuarios module: resolve PHP 8 warnings and fatal errors
- Fixed undefined array key warnings in usuarios-agregar.php - Fixed undefined variable warnings (, , ) - Fixed null array offset warnings in db.class.php GetSingle() - Added default parameter to ValidateMail() in util.class.php - Fixed PrintErrors() return value for proper error handling - Fixed integer constraint errors for codigoPostal and sucursalId - Added missing identificacion and comprobante fields to INSERT query - Fixed undefined variable in IsEmailTaked()
This commit is contained in:
@@ -168,15 +168,15 @@ class Util extends SystemError
|
||||
return true;
|
||||
}
|
||||
}//ValidateFloat
|
||||
|
||||
function ValidateMail($mail, $field)
|
||||
|
||||
function ValidateMail($mail, $field = 'Email')
|
||||
{
|
||||
$mail = strtolower($mail);
|
||||
if (!preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',trim($mail)))
|
||||
{
|
||||
return $this->setError(10002, "error", "", $field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ValidateUrl($url)
|
||||
{
|
||||
@@ -477,12 +477,16 @@ class Util extends SystemError
|
||||
|
||||
function PrintErrors()
|
||||
{
|
||||
if(empty($this->error)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$errorStr = "<div id='error-box'>";
|
||||
foreach($this->error as $key => $val)
|
||||
{
|
||||
$msg = $this->errorMessage($val);
|
||||
$field = $this->errorField[$key];
|
||||
|
||||
$field = isset($this->errorField[$key]) ? $this->errorField[$key] : '';
|
||||
|
||||
$errorStr .= "<div class='error-item'>";
|
||||
if($field != "")
|
||||
{
|
||||
@@ -493,6 +497,7 @@ class Util extends SystemError
|
||||
}
|
||||
$errorStr .= "</div>";
|
||||
echo $errorStr;
|
||||
return true;
|
||||
}
|
||||
|
||||
function errorMessage($code)
|
||||
|
||||
Reference in New Issue
Block a user