From 5623df8797d4f3758b7f49efbe835d86645a364c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Mar 2025 14:28:56 +0100 Subject: [PATCH 1/2] =?UTF-8?q?A=C3=B1adido=20archivos=20EmailServies.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci4/app/Services/EmailService.php | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 ci4/app/Services/EmailService.php diff --git a/ci4/app/Services/EmailService.php b/ci4/app/Services/EmailService.php new file mode 100644 index 00000000..74caed35 --- /dev/null +++ b/ci4/app/Services/EmailService.php @@ -0,0 +1,58 @@ +first()->toArray(); + $gateway = $config['email_gateway']; + $body = html_entity_decode($body); + + if ($gateway === 'smtp') { + try { + $email = Services::email(); + + $emailConfig = [ + 'protocol' => $config['email_gateway'], + 'SMTPHost' => $config['email_smtp'], + 'SMTPUser' => $config['email_address'], + 'SMTPPass' => $config['email_pass'], + 'SMTPPort' => (int) $config['email_port'], + 'SMTPCrypto' => $config['email_cert'] === 'none' ? '' : $config['email_cert'], + 'SMTPTimeout' => 15, + 'mailType' => 'html', + 'wordWrap' => true, + ]; + + $email->initialize($emailConfig); + + $email->setFrom($config['email_address'], $config['email_name']); + $email->setTo($recipient); + $email->setSubject($subject); + $email->setMessage($body); + + return $email->send(); + } catch (\Throwable $e) { + log_message('error', 'EmailService failed: ' . $e->getMessage()); + return false; + } + } + + return false; + } +} From e3c494e68d48e16899bdd063fab988631a888b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Thu, 27 Mar 2025 17:38:42 +0100 Subject: [PATCH 2/2] =?UTF-8?q?modificado=20select=20de=20a=C3=B1adir=20pe?= =?UTF-8?q?didos=20en=20facturas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci4/app/Models/Pedidos/PedidoLineaModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci4/app/Models/Pedidos/PedidoLineaModel.php b/ci4/app/Models/Pedidos/PedidoLineaModel.php index 19eef0d0..0072f4b8 100644 --- a/ci4/app/Models/Pedidos/PedidoLineaModel.php +++ b/ci4/app/Models/Pedidos/PedidoLineaModel.php @@ -208,7 +208,7 @@ class PedidoLineaModel extends \App\Models\BaseModel ->join("tipos_presupuestos t4", "t4.id = t3.tipo_impresion_id", "left") ->join("($subquery) fpl", "fpl.pedido_linea_id = t1.id", "left") ->where("t3.cliente_id", $cliente_id) - ->where("t2.estado", "finalizado") + ->whereIn("t2.estado", ["produccion", "enviado","finalizado"]) ->where("(t3.tirada > IFNULL(fpl.total_cantidad, 0))"); // Ejecutar la consulta y devolver resultados