Fix systematic errors in pagination, sucursal warnings, and fatal count() errors across multiple modules

This commit is contained in:
2026-01-07 01:06:27 -06:00
parent aaa77e870e
commit 3a5afa82fe
354 changed files with 9022 additions and 15093 deletions

View File

@@ -182,8 +182,9 @@ class Usuario extends Main
public function Info()
{
$this->Util()->DB()->setQuery("SELECT * FROM usuario WHERE usuarioId ='".$this->usuarioId."'");
$usuario = $this->Util()->DB()->GetRow();
$db = new DB(true);
$db->setQuery("SELECT * FROM usuario WHERE usuarioId ='".$this->usuarioId."'");
$usuario = $db->GetRow();
return $usuario;
}
@@ -194,8 +195,9 @@ class Usuario extends Main
WHERE empresaId ='".$this->empresaId."'
AND main = 'no'
AND baja = '0'";
$this->Util()->DB()->setQuery($sql);
$usuarios = $this->Util()->DB()->GetResult();
$db = new DB(true);
$db->setQuery($sql);
$usuarios = $db->GetResult();
return $usuarios;
}
@@ -207,8 +209,9 @@ class Usuario extends Main
AND main = 'no'
AND baja = '0'
AND sucursalId = '".$this->sucursalId."'";
$this->Util()->DB()->setQuery($sql);
$usuarios = $this->Util()->DB()->GetResult();
$db = new DB(true);
$db->setQuery($sql);
$usuarios = $db->GetResult();
return $usuarios;
}
@@ -228,7 +231,8 @@ class Usuario extends Main
return false;
}
$this->Util()->DB()->setQuery("
$db = new DB(true);
$db->setQuery("
INSERT INTO usuario (
empresaId,
nombre,
@@ -277,7 +281,7 @@ class Usuario extends Main
'".$this->tipo."',
'".$this->sucursalId."')"
);
$usuarioId = $this->Util()->DB()->InsertData();
$usuarioId = $db->InsertData();
$this->Util()->setError(20017, "complete");
$this->Util()->PrintErrors();
@@ -291,7 +295,8 @@ class Usuario extends Main
return false;
}
$this->Util()->DB()->setQuery("
$db = new DB(true);
$db->setQuery("
UPDATE usuario SET
nombre = '".$this->nombre."',
apellidos = '".$this->apellidos."',
@@ -316,7 +321,7 @@ class Usuario extends Main
sucursalId = '".$this->sucursalId."'
WHERE usuarioId = '".$this->usuarioId."'"
);
$this->Util()->DB()->UpdateData();
$db->UpdateData();
$this->Util()->setError(20019, "complete");
$this->Util()->PrintErrors();
@@ -330,8 +335,9 @@ class Usuario extends Main
return false;
}
$this->Util()->DB()->setQuery("DELETE FROM usuario WHERE usuarioId = '".$this->usuarioId."' ");
$this->Util()->DB()->DeleteData();
$db = new DB(true);
$db->setQuery("DELETE FROM usuario WHERE usuarioId = '".$this->usuarioId."' ");
$db->DeleteData();
$this->Util()->setError(20018, "complete");
$this->Util()->PrintErrors();
@@ -341,13 +347,14 @@ class Usuario extends Main
function Baja(){
$this->Util()->DB()->setQuery("
$db = new DB(true);
$db->setQuery("
UPDATE usuario SET
baja = '1'
WHERE
usuarioId = '".$this->usuarioId."'"
);
$this->Util()->DB()->UpdateData();
$db->UpdateData();
$this->Util()->setError(20110, "complete");
$this->Util()->PrintErrors();
@@ -368,13 +375,14 @@ class Usuario extends Main
function UpdateIdentificacion(){
$this->Util()->DB()->setQuery("
$db = new DB(true);
$db->setQuery("
UPDATE usuario SET
identificacion = '".$this->identificacion."'
WHERE
usuarioId = '".$this->usuarioId."'"
);
$this->Util()->DB()->UpdateData();
$db->UpdateData();
return true;
@@ -382,13 +390,14 @@ class Usuario extends Main
function UpdateComprobante(){
$this->Util()->DB()->setQuery("
$db = new DB(true);
$db->setQuery("
UPDATE usuario SET
comprobante = '".$this->comprobante."'
WHERE
usuarioId = '".$this->usuarioId."'"
);
$this->Util()->DB()->UpdateData();
$db->UpdateData();
return true;
@@ -399,8 +408,9 @@ class Usuario extends Main
$sql = 'SELECT nombre FROM usuario
WHERE usuarioId = "'.$this->usuarioId.'"';
$this->Util()->DB()->setQuery($sql);
$nombre = $this->Util()->DB()->GetSingle();
$db = new DB(true);
$db->setQuery($sql);
$nombre = $db->GetSingle();
return $nombre;
}
@@ -410,8 +420,9 @@ class Usuario extends Main
$sql = 'SELECT CONCAT(nombre," ",apellidos) AS name FROM usuario
WHERE usuarioId = "'.$this->usuarioId.'"';
$this->Util()->DB()->setQuery($sql);
$nombre = $this->Util()->DB()->GetSingle();
$db = new DB(true);
$db->setQuery($sql);
$nombre = $db->GetSingle();
return $nombre;
}
@@ -422,8 +433,9 @@ class Usuario extends Main
WHERE sucursalId = "'.$this->sucursalId.'"
AND `type` = "'.$this->tipo.'"
LIMIT 1';
$this->Util()->DB()->setQuery($sql);
$info = $this->Util()->DB()->GetRow();
$db = new DB(true);
$db->setQuery($sql);
$info = $db->GetRow();
return $info;
}
@@ -432,8 +444,9 @@ class Usuario extends Main
{
$sql = 'SELECT type FROM usuario
WHERE usuarioId = "'.$this->usuarioId.'"';
$this->Util()->DB()->setQuery($sql);
$tipo = $this->Util()->DB()->GetSingle();
$db = new DB(true);
$db->setQuery($sql);
$tipo = $db->GetSingle();
return $tipo;
}
@@ -443,8 +456,9 @@ class Usuario extends Main
$sql = 'SELECT usuarioId FROM usuario
WHERE type = "'.$this->tipo.'"
LIMIT 1';
$this->Util()->DB()->setQuery($sql);
$usuarioId = $this->Util()->DB()->GetSingle();
$db = new DB(true);
$db->setQuery($sql);
$usuarioId = $db->GetSingle();
return $usuarioId;
}
@@ -455,8 +469,9 @@ class Usuario extends Main
WHERE type = "'.$this->tipo.'"
AND sucursalId = "'.$this->sucursalId.'"
LIMIT 1';
$this->Util()->DB()->setQuery($sql);
$usuarioId = $this->Util()->DB()->GetSingle();
$db = new DB(true);
$db->setQuery($sql);
$usuarioId = $db->GetSingle();
return $usuarioId;
}
@@ -471,8 +486,9 @@ class Usuario extends Main
AND type = "'.$this->tipo.'"
AND sucursalId = "'.$this->sucursalId.'"
'.$sqlFilter;
$this->Util()->DB()->setQuery($sql);
$usuarios = $this->Util()->DB()->GetResult();
$db = new DB(true);
$db->setQuery($sql);
$usuarios = $db->GetResult();
return $usuarios;
}
@@ -486,8 +502,9 @@ class Usuario extends Main
WHERE email = "'.$this->email.'"
'.$sqlAdd.'
LIMIT 1';
$this->Util()->DB()->setQuery($sql);
$allow = $this->Util()->DB()->GetSingle();
$db = new DB(true);
$db->setQuery($sql);
$allow = $db->GetSingle();
return $allow;
@@ -528,8 +545,9 @@ class Usuario extends Main
WHERE empresaId ='".$this->empresaId."'
AND main = 'no'
AND baja = '0'".$sqlFilter;
$this->Util()->DB()->setQuery($sql);
$usuarios = $this->Util()->DB()->GetResult();
$db = new DB(true);
$db->setQuery($sql);
$usuarios = $db->GetResult();
return $usuarios;
}