From 5590076d7d1d54a291b40bcd3c42ba225f703ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Sat, 28 Jun 2025 12:45:52 +0200 Subject: [PATCH] corregidos varios fallos que no permitian cogetr la rotativa cuando es un presupuesto con forzar_rotativa_pod --- ci4/app/Models/Presupuestos/ErrorPresupuesto.php | 5 +++-- ci4/app/Services/PresupuestoClienteService.php | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci4/app/Models/Presupuestos/ErrorPresupuesto.php b/ci4/app/Models/Presupuestos/ErrorPresupuesto.php index 308d868e..63d0bd07 100755 --- a/ci4/app/Models/Presupuestos/ErrorPresupuesto.php +++ b/ci4/app/Models/Presupuestos/ErrorPresupuesto.php @@ -56,10 +56,11 @@ class ErrorPresupuesto extends Model protected $beforeDelete = []; protected $afterDelete = []; - public function insertError(int $presupuesto_id, int $presupuesto_user_id, string $error, mixed $datos) + public function insertError($presupuesto_id, int $presupuesto_user_id, string $error, mixed $datos) { + $presupuesto = is_null($presupuesto_id) ? 0 : $presupuesto_id; $this->insert([ - "presupuesto_id" => $presupuesto_id, + "presupuesto_id" => $presupuesto, "presupuesto_user_id" => $presupuesto_user_id, "error" => $error, "datos_presupuesto" => json_encode($datos) diff --git a/ci4/app/Services/PresupuestoClienteService.php b/ci4/app/Services/PresupuestoClienteService.php index bb702918..ff69a85b 100755 --- a/ci4/app/Services/PresupuestoClienteService.php +++ b/ci4/app/Services/PresupuestoClienteService.php @@ -23,7 +23,7 @@ class PresupuestoClienteService extends BaseService // no se busca en plana cuando es estándar (no Premium) excepto cuando es PoD if ($data['isHq'] || $isPoD) $plana = PresupuestoClienteService::obtenerPresupuestoClienteInterior($data); - if (!$data['excluirRotativa'] && !$data['isHq']) + if ((!$data['excluirRotativa'] && !$data['isHq']) || $data['forzarRotativa'] == 1) $rotativa = PresupuestoClienteService::obtenerPresupuestoClienteInteriorRotativa($data); $total_plana = -1; @@ -33,8 +33,6 @@ class PresupuestoClienteService extends BaseService if ($data['datosPedido']->paginas == $data['paginas_color']) { if (count($plana[1]) > 2) $total_plana += floatval($plana[1]['total_impresion']); - else - return -1; } else { if (count($plana[0]) > 2 && count($plana[1]) > 2) { $total_plana = 0.0; @@ -56,7 +54,8 @@ class PresupuestoClienteService extends BaseService } $total_rotativa = -1; - if (!$data['excluirRotativa'] && count($rotativa) > 0 && $rotativa['num_formas']['posicion_formas'] != 'n/a') { + if ((!$data['excluirRotativa'] && count($rotativa) > 0 && $rotativa['num_formas']['posicion_formas'] != 'n/a') + || ($data['forzarRotativa'] == 1 && count($rotativa) > 0 && $rotativa['num_formas']['posicion_formas'] != 'n/a')) { $total_rotativa = floatval($rotativa['total_impresion']); } if ($total_plana < 0 && $total_rotativa < 0)