mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fix user model imports
This commit is contained in:
@ -15,6 +15,7 @@ use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\I18n\Time;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Config\LogoImpresion;
|
||||
use Exception;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
@ -276,16 +277,26 @@ class Ordentrabajo extends BaseController
|
||||
}
|
||||
public function get_portada_img($orden_trabajo_id)
|
||||
{
|
||||
$ot = $this->otModel->find($orden_trabajo_id);
|
||||
if ($ot->portada_path) {
|
||||
$filePath = WRITEPATH . 'uploads/' . $ot->portada_path;
|
||||
$mimeType = mime_content_type($filePath);
|
||||
return $this->response
|
||||
->setHeader('Content-Type', $mimeType)
|
||||
->setHeader('Content-Length', filesize($filePath))
|
||||
->setBody(file_get_contents($filePath));
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => "Portada error", "error" => "No hay portada"])->setStatusCode(400);
|
||||
try {
|
||||
$ot = $this->otModel->find($orden_trabajo_id);
|
||||
if ($ot->portada_path) {
|
||||
$filePath = WRITEPATH . 'uploads/' . $ot->portada_path;
|
||||
if (file_exists($filePath)) {
|
||||
|
||||
$mimeType = mime_content_type($filePath);
|
||||
return $this->response
|
||||
->setHeader('Content-Type', $mimeType)
|
||||
->setHeader('Content-Length', filesize($filePath))
|
||||
->setBody(file_get_contents($filePath));
|
||||
} else {
|
||||
throw new Exception('File' . $ot->portada_path . ' does not exist');
|
||||
}
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => "Portada error", "error" => "No hay portada"])->setStatusCode(400);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode(500);
|
||||
|
||||
}
|
||||
}
|
||||
public function planning_rotativa_datatable()
|
||||
@ -302,8 +313,8 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$q = $this->produccionService->planningPlanaQueryDatatable();
|
||||
$padreId = $this->request->getGet('padre_id');
|
||||
if($padreId){
|
||||
$q->where('lg_maquinas.padre_id',$padreId);
|
||||
if ($padreId) {
|
||||
$q->where('lg_maquinas.padre_id', $padreId);
|
||||
}
|
||||
return DataTable::of($q)
|
||||
->edit("tiempo_real_sum", fn($q) => $q->tiempo_real_sum)
|
||||
@ -372,9 +383,9 @@ class Ordentrabajo extends BaseController
|
||||
$ps = $this->produccionService->init($bodyData["orden_trabajo_id"]);
|
||||
$existingFiles = json_decode($bodyData["oldFiles"]);
|
||||
$ps->deleteOtFiles($existingFiles);
|
||||
if($files){
|
||||
if ($files) {
|
||||
$response = $ps->storeOtFiles($files);
|
||||
}else{
|
||||
} else {
|
||||
$response = null;
|
||||
}
|
||||
return $this->response->setJSON([
|
||||
|
||||
@ -2,17 +2,15 @@
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use App\Controllers\Produccion\Ordentrabajo;
|
||||
use App\Database\Migrations\OrdenTrabajoDatesTable;
|
||||
use App\Entities\Pedidos\PedidoEntity;
|
||||
use App\Entities\Usuarios\UserEntity;
|
||||
use App\Entities\Usuarios\UsersEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoDate;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoFileModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
|
||||
use App\Models\Pedidos\PedidoModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
use Picqer\Barcode\Renderers\PngRenderer;
|
||||
use Picqer\Barcode\Types\TypeCode128;
|
||||
@ -123,7 +121,7 @@ class OrdenTrabajoEntity extends Entity
|
||||
$m = model(OrdenTrabajoFileModel::class);
|
||||
return $m->where('orden_trabajo_id',$this->attributes['id'])->findAll() ?? [];
|
||||
}
|
||||
public function pedidoEsperaBy() : ?UsersEntity
|
||||
public function pedidoEsperaBy() : ?UserEntity
|
||||
{
|
||||
$m = model(UserModel::class);
|
||||
if($this->attributes['pedido_espera_by']){
|
||||
@ -132,7 +130,7 @@ class OrdenTrabajoEntity extends Entity
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public function getPedidoEsperaBy(): ?UsersEntity
|
||||
public function getPedidoEsperaBy(): ?UserEntity
|
||||
{
|
||||
return $this->pedidoEsperaBy();
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Database\Migrations\ConfigVariablesApp;
|
||||
use App\Entities\Clientes\ClienteEntity;
|
||||
use App\Entities\Pedidos\PedidoEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoEntity;
|
||||
@ -12,7 +11,6 @@ use App\Models\OrdenTrabajo\OrdenTrabajoDate;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Entities\Configuracion\Maquina as MaquinaEntity;
|
||||
use App\Entities\Produccion\OrdenTrabajoFileEntity;
|
||||
@ -20,10 +18,10 @@ use App\Entities\Produccion\OrdenTrabajoTareaEntity;
|
||||
use App\Models\Configuracion\ConfigVariableModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoFileModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Database\BaseResult;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
use CodeIgniter\Files\File;
|
||||
use CodeIgniter\HTTP\Files\UploadedFile;
|
||||
use CodeIgniter\I18n\Time;
|
||||
use Exception;
|
||||
|
||||
Reference in New Issue
Block a user