mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'add/calculo_credito_cliente'
Main See merge request jjimenez/safekat!614
This commit is contained in:
@ -60,4 +60,14 @@ class Services extends BaseService
|
||||
{
|
||||
return new ChatService();
|
||||
}
|
||||
|
||||
public static function emailService($getShared = true)
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance('emailService');
|
||||
}
|
||||
|
||||
return new \App\Services\EmailService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -399,6 +399,8 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['formAction'] = route_to('updatePresupuestoAdmin', $id);
|
||||
|
||||
$this->viewData['cliente_id'] = $presupuestoEntity->cliente_id;
|
||||
|
||||
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
||||
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
||||
if ($presupuestoEntity->is_duplicado) {
|
||||
|
||||
@ -60,43 +60,10 @@ class Ticketcontroller extends \App\Controllers\BaseResourceController
|
||||
|
||||
private function sendMail($subject, $body, $recipient)
|
||||
{
|
||||
$settings_model = new SettingsModel();
|
||||
$config = $settings_model->first()->toArray();
|
||||
$gateway = $config['email_gateway'];
|
||||
$body = html_entity_decode($body);
|
||||
// Funcion wrapper para el servicio de envio de correos dentro de la fucionalidad previa
|
||||
$emailService = service('emailService');
|
||||
|
||||
if ($gateway == 'smtp') {
|
||||
try {
|
||||
//https://codeigniter.com/user_guide/libraries/email.html
|
||||
$email = \Config\Services::email();
|
||||
$config['protocol'] = $config['email_gateway'];
|
||||
$config['SMTPHost'] = $config['email_smtp'];
|
||||
$config['SMTPUser'] = $config['email_address'];
|
||||
$config['SMTPPass'] = $config['email_pass'];
|
||||
$config['SMTPPort'] = intval($config['email_port']);
|
||||
$config['SMTPCrypto'] = $config['email_cert'] == 'none' ? '' : $config['email_cert'];
|
||||
$config['SMTPTimeout'] = 15;
|
||||
$config['mailType'] = 'html';
|
||||
$config['wordWrap'] = true;
|
||||
|
||||
$email->initialize($config);
|
||||
|
||||
$email->setFrom($config['email_address'], $config['email_name']);
|
||||
$email->setTo($recipient);
|
||||
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($body);
|
||||
|
||||
if (!$email->send()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return $emailService->send($subject, $body, $recipient);
|
||||
}
|
||||
|
||||
public function add()
|
||||
|
||||
@ -40,7 +40,7 @@ class ChatService extends BaseService
|
||||
protected array $modelClassMap;
|
||||
public function __construct()
|
||||
{
|
||||
$this->emailService = service('email');
|
||||
$this->emailService = service('emailService'); // Usar el servicio de email de Safekat y no el de CI4
|
||||
$this->userModel = model(UserModel::class);
|
||||
$this->chatModel = model(ChatModel::class);
|
||||
$this->chatMessageModel = model(ChatMessageModel::class);
|
||||
@ -186,10 +186,15 @@ class ChatService extends BaseService
|
||||
{
|
||||
$users = auth()->getProvider();
|
||||
$toEmail = $users->find($user->id)->getEmail();
|
||||
$this->emailService->setTo($toEmail);
|
||||
$subject = '[Safekat]' . lang('Chat.mail.mail_subject') . '-' . $chatMessageEntity->chat()->title;
|
||||
$this->emailService->setSubject($subject);
|
||||
$this->emailService->setMessage(view('themes/vuexy/mail/messageNotification', ["header" => lang('Chat.mail.mail_subject'), "data" => $chatMessageEntity->withUser()]));
|
||||
return $this->emailService->send();
|
||||
|
||||
$subject = '[Safekat]' . lang('Chat.mail.mail_subject') . ' - ' . $chatMessageEntity->chat()->title;
|
||||
|
||||
$message = view('themes/vuexy/mail/messageNotification', [
|
||||
"header" => lang('Chat.mail.mail_subject'),
|
||||
"data" => $chatMessageEntity->withUser(),
|
||||
]);
|
||||
|
||||
return $this->emailService->send($subject, $message, $toEmail);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,9 @@
|
||||
<div class="mb-3">
|
||||
<label for="clienteId" class="form-label">
|
||||
<?= lang('Presupuestos.clienteId') ?>*
|
||||
<a id="openCliente" href="javascript(void)" target="_blank" ><i class="ti ti-file-search ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<?php if(isset($cliente_id)):?>
|
||||
<a href="<?= route_to('editarCliente', $cliente_id); ?>" target="_blank" ><i class="ti ti-file-search ti-sm mx-2""></i></a>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
<select id="clienteId" name="cliente_id" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
|
||||
@ -507,11 +507,12 @@ class PresupuestoAdminEdit {
|
||||
|
||||
if (mano > 0) {
|
||||
anchoTotal += 6 + 5; // dobleces + sangre
|
||||
maxSolapas = Math.min(Math.floor((865 - anchoTotal) / 2), 0.75 * this.getDimensionLibro().ancho);
|
||||
maxSolapas = Math.min(Math.floor((865 - anchoTotal) / 2), 0.95 * this.getDimensionLibro().ancho);
|
||||
}
|
||||
else {
|
||||
maxSolapas = 0.75 * this.getDimensionLibro().ancho;
|
||||
maxSolapas = 0.95 * this.getDimensionLibro().ancho;
|
||||
}
|
||||
maxSolapas = Math.floor(maxSolapas, 0);
|
||||
if ($('#solapas_ancho').length > 0 && $('#solapas_ancho').attr('max') != maxSolapas) {
|
||||
$('#solapas_ancho').attr('max', maxSolapas);
|
||||
$('#solapas_ancho').trigger('change');
|
||||
|
||||
@ -16,9 +16,7 @@ class DatosGenerales{
|
||||
this.numeroEdicion = this.domItem.find('#numeroEdicion');
|
||||
this.isbn = this.domItem.find('#isbn');
|
||||
|
||||
this.openCliente = this.domItem.find('#openCliente');
|
||||
|
||||
|
||||
|
||||
this.cliente = new ClassSelect($('#clienteId'), '/clientes/cliente/getSelect2', 'Seleccione cliente');
|
||||
this.pais = new ClassSelect($('#paisId'), '/paises/menuitems2', 'Seleccione País');
|
||||
this.referenciaCliente = this.domItem.find('#referenciaCliente');
|
||||
@ -34,10 +32,7 @@ class DatosGenerales{
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
this.openCliente.click(()=>{
|
||||
const urlObj = new URL(window.location.href);
|
||||
window.open(`${urlObj.origin}` + '/clientes/cliente/edit/' + this.cliente.getVal());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
cargarDatos(datos){
|
||||
|
||||
Reference in New Issue
Block a user