fix pod and file if not exist

This commit is contained in:
amazuecos
2025-04-16 20:25:13 +02:00
parent 2a8c4b9da6
commit 8e97e7b58c
3 changed files with 32 additions and 20 deletions

View File

@ -74,7 +74,7 @@ class OrdenTrabajoEntity extends Entity
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll();
}
public function tareas_impresion() : array
public function tareas_impresion(): array
{
$m = model(OrdenTrabajoTarea::class);
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
@ -144,11 +144,13 @@ class OrdenTrabajoEntity extends Entity
helper('filesystem');
$path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"];
$portada_path = null;
if ($path) {
if (file_exists($path)) {
$portada_path = $path;
} else {
$portada_path = null;
if ($this->attributes["portada_path"]) {
if ($path) {
if (file_exists($path)) {
$portada_path = $path;
} else {
$portada_path = null;
}
}
}
return $portada_path;