mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
haciendo el buscador
This commit is contained in:
@ -6,7 +6,7 @@ use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Email extends BaseConfig
|
||||
{
|
||||
public string $fromEmail = 'safekat@imnavajas.es';
|
||||
public string $fromEmail = 'soporte_erp@safekat.es';
|
||||
public string $fromName = 'Safekat ERP';
|
||||
public string $recipients = '';
|
||||
|
||||
@ -28,22 +28,22 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* SMTP Server Hostname
|
||||
*/
|
||||
public string $SMTPHost = 'imnavajas.es';
|
||||
public string $SMTPHost = 'smtp.ionos.es';
|
||||
|
||||
/**
|
||||
* SMTP Username
|
||||
*/
|
||||
public string $SMTPUser = 'safekat@imnavajas.es';
|
||||
public string $SMTPUser = 'soporte_erp@safekat.es';
|
||||
|
||||
/**
|
||||
* SMTP Password
|
||||
*/
|
||||
public string $SMTPPass = 'Etkd9~448';
|
||||
public string $SMTPPass = 'H%5&qDkDkWnfLTGN';
|
||||
|
||||
/**
|
||||
* SMTP Port
|
||||
*/
|
||||
public int $SMTPPort = 25;
|
||||
public int $SMTPPort = 465;
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers\Soporte;
|
||||
|
||||
use App\Models\Sistema\SettingsModel;
|
||||
use App\Models\Soporte\TicketModel;
|
||||
use App\Models\CategoriaModel;
|
||||
use App\Models\EstadoModel;
|
||||
@ -25,7 +26,7 @@ class Ticketcontroller extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/soporte/';
|
||||
|
||||
protected $indexRoute = 'ticketList';
|
||||
protected $indexRoute = 'TicketIndex';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
@ -57,6 +58,48 @@ class Ticketcontroller extends \App\Controllers\BaseResourceController
|
||||
return view(static::$viewPath . 'viewTicketList', $viewData);
|
||||
}
|
||||
|
||||
private function sendMail($subject,$body,$recipient)
|
||||
{
|
||||
$settings_model = new SettingsModel();
|
||||
$config = $settings_model->first()->toArray();
|
||||
$gateway = $config['email_gateway'];
|
||||
$body = html_entity_decode($body);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
@ -100,6 +143,10 @@ class Ticketcontroller extends \App\Controllers\BaseResourceController
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
$userModel = new \App\Models\UserModel();
|
||||
|
||||
$this->sendMail(lang('Tickets.newTicket'), lang('Tickets.newTicketBody') . base_url(route_to('editTicket', $id)), $userModel->find($sanitizedData['supportUser'])->email);
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||
|
||||
@ -93,5 +93,7 @@ class CreateTicketsSystem extends Migration
|
||||
$this->forge->dropTable('tickets_categorias');
|
||||
$this->forge->dropTable('tickets_estados');
|
||||
$this->forge->dropTable('tickets_secciones');
|
||||
|
||||
$this->db->table('config_variables_app')->where('name', 'default_soporte_user_id')->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,4 +47,7 @@ return [
|
||||
'adjuntos' => 'Adjuntar imágenes',
|
||||
'adjuntos_ticket' => 'Imágenes adjuntas',
|
||||
|
||||
// Mail
|
||||
'newTicket' => 'Nuevo Ticket en ERP Safekat',
|
||||
'newTicketBody' => '<p>Se ha creado un nuevo ticket en el sistema de soporte de Safekat ERP. <br><br>Puede verlo en el siguiente enlace:</p>',
|
||||
];
|
||||
|
||||
@ -15,14 +15,15 @@ class TicketModel extends \App\Models\BaseModel
|
||||
protected $returnType = "App\Entities\Soporte\TicketEntity";
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.categoria_id",
|
||||
1 => "t1.seccion_id",
|
||||
2 => "t1.estado_id",
|
||||
3 => "t1.prioridad",
|
||||
4 => "t1.titulo",
|
||||
5 => "t1.usuario_id",
|
||||
6 => "t1.usuario_soporte_id",
|
||||
7 => "t1.created_at",
|
||||
0 => "t1.id",
|
||||
1 => "t1.categoria_id",
|
||||
2 => "t1.seccion_id",
|
||||
3 => "t1.estado_id",
|
||||
4 => "t1.prioridad",
|
||||
5 => "t1.titulo",
|
||||
6 => "t1.usuario_id",
|
||||
7 => "t1.usuario_soporte_id",
|
||||
8 => "t1.created_at",
|
||||
];
|
||||
|
||||
public function getEstados()
|
||||
|
||||
Reference in New Issue
Block a user