Creado mecanismo de generacion de alertas tipo Boostrap (defecto) y ToastR. Aplicado a los controladores existentes

This commit is contained in:
imnavajas
2023-07-26 22:36:57 +02:00
parent 47a6c3b62a
commit d25ff9666c
28 changed files with 2214 additions and 2195 deletions

View File

@ -19,7 +19,8 @@ use App\Models\Configuracion\FormaPagoModel;
use App\Models\Configuracion\PaisModel; use App\Models\Configuracion\PaisModel;
class Cliente extends \App\Controllers\GoBaseResourceController { class Cliente extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ClienteModel::class; protected $modelName = ClienteModel::class;
protected $format = 'json'; protected $format = 'json';
@ -36,8 +37,8 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'clienteList'; protected $indexRoute = 'clienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Clientes.moduleTitle'); $this->viewData['pageTitle'] = lang('Clientes.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
@ -57,7 +58,8 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -73,7 +75,8 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -99,7 +102,7 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Clientes.cliente'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -109,9 +112,7 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Clientes.cliente'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/cliente/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -143,7 +144,8 @@ class Cliente extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -185,12 +187,10 @@ if ($this->request->getPost('lineasEnvioFactura') == null ) {
} }
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -210,9 +210,7 @@ if ($this->request->getPost('lineasEnvioFactura') == null ) {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $clienteEntity->id ?? $id; $id = $clienteEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Clientes.cliente'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/cliente/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -246,8 +244,8 @@ if ($this->request->getPost('lineasEnvioFactura') == null ) {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -266,11 +264,14 @@ if ($this->request->getPost('lineasEnvioFactura') == null ) {
foreach ($resourceData as $item) : foreach ($resourceData as $item) :
if (isset($item->direccion) && strlen($item->direccion) > 100) : if (isset($item->direccion) && strlen($item->direccion) > 100) :
$item->direccion = character_limiter($item->direccion, 100); $item->direccion = character_limiter($item->direccion, 100);
endif;if (isset($item->comentarios_tirada_flexible) && strlen($item->comentarios_tirada_flexible) > 100) : endif;
if (isset($item->comentarios_tirada_flexible) && strlen($item->comentarios_tirada_flexible) > 100) :
$item->comentarios_tirada_flexible = character_limiter($item->comentarios_tirada_flexible, 100); $item->comentarios_tirada_flexible = character_limiter($item->comentarios_tirada_flexible, 100);
endif;if (isset($item->comentarios_produccion) && strlen($item->comentarios_produccion) > 100) : endif;
if (isset($item->comentarios_produccion) && strlen($item->comentarios_produccion) > 100) :
$item->comentarios_produccion = character_limiter($item->comentarios_produccion, 100); $item->comentarios_produccion = character_limiter($item->comentarios_produccion, 100);
endif;if (isset($item->comentarios) && strlen($item->comentarios) > 100) : endif;
if (isset($item->comentarios) && strlen($item->comentarios) > 100) :
$item->comentarios = character_limiter($item->comentarios, 100); $item->comentarios = character_limiter($item->comentarios, 100);
endif; endif;
endforeach; endforeach;
@ -285,7 +286,8 @@ endif;
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -307,7 +309,8 @@ endif;
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -334,7 +337,8 @@ endif;
} }
protected function getPaisListItems($selId = null) { protected function getPaisListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])];
if (!empty($selId)) : if (!empty($selId)) :
$paisModel = model('App\Models\Configuracion\PaisModel'); $paisModel = model('App\Models\Configuracion\PaisModel');
@ -348,7 +352,8 @@ endif;
} }
protected function getUserListItems($selId = null) { protected function getUserListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
if (!empty($selId)) : if (!empty($selId)) :
$userModel = model('App\Models\Usuarios\UserModel'); $userModel = model('App\Models\Usuarios\UserModel');
@ -362,7 +367,8 @@ endif;
} }
protected function getComunidadAutonomaListItems($selId = null) { protected function getComunidadAutonomaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])];
if (!empty($selId)) : if (!empty($selId)) :
$comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel'); $comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel');
@ -376,7 +382,8 @@ endif;
} }
protected function getUserListItems2($selId = null) { protected function getUserListItems2($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
if (!empty($selId)) : if (!empty($selId)) :
$userModel = model('App\Models\Configuracion\UserModel'); $userModel = model('App\Models\Configuracion\UserModel');
@ -390,7 +397,8 @@ endif;
} }
protected function getFormaDePagoListItems($selId = null) { protected function getFormaDePagoListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPagoes.formaDePago'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPagoes.formaDePago'))])];
if (!empty($selId)) : if (!empty($selId)) :
$formaPagoModel = model('App\Models\Configuracion\FormaPagoModel'); $formaPagoModel = model('App\Models\Configuracion\FormaPagoModel');
@ -404,7 +412,8 @@ endif;
} }
protected function getProvinciaListItems($selId = null) { protected function getProvinciaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])];
if (!empty($selId)) : if (!empty($selId)) :
$provinciaModel = model('App\Models\Configuracion\ProvinciaModel'); $provinciaModel = model('App\Models\Configuracion\ProvinciaModel');

View File

@ -11,7 +11,8 @@ use App\Models\Clientes\ClienteModel;
use App\Models\Clientes\ClienteContactoModel; use App\Models\Clientes\ClienteContactoModel;
class Clientecontactos extends \App\Controllers\GoBaseResourceController { class Clientecontactos extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ClienteContactoModel::class; protected $modelName = ClienteContactoModel::class;
protected $format = 'json'; protected $format = 'json';
@ -28,15 +29,16 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'contactoDeClienteList'; protected $indexRoute = 'contactoDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('ClienteContactos.moduleTitle'); $this->viewData['pageTitle'] = lang('ClienteContactos.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -52,8 +54,8 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -79,7 +81,7 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('ClienteContactos.contactoDeCliente'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -89,9 +91,7 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('ClienteContactos.contactoDeCliente'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/cliente-contactos/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -118,7 +118,8 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -142,12 +143,10 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -167,9 +166,7 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $clienteContactoEntity->id ?? $id; $id = $clienteContactoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ClienteContactos.contactoDeCliente'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/cliente-contactos/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -196,8 +193,8 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -229,7 +226,8 @@ endif;
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -251,7 +249,8 @@ endif;
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -278,7 +277,8 @@ endif;
} }
protected function getClienteListItems($selId = null) { protected function getClienteListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Clientes.cliente'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Clientes.cliente'))])];
if (!empty($selId)) : if (!empty($selId)) :
$clienteModel = model('App\Models\Clientes\ClienteModel'); $clienteModel = model('App\Models\Clientes\ClienteModel');

View File

@ -15,7 +15,8 @@ use App\Models\Configuracion\ProvinciaModel;
use App\Models\Configuracion\ComunidadAutonomaModel; use App\Models\Configuracion\ComunidadAutonomaModel;
class Clientedistribuidores extends \App\Controllers\GoBaseResourceController { class Clientedistribuidores extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ClienteDistribuidorModel::class; protected $modelName = ClienteDistribuidorModel::class;
protected $format = 'json'; protected $format = 'json';
@ -32,15 +33,16 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'distribuidorDeClienteList'; protected $indexRoute = 'distribuidorDeClienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('ClienteDistribuidores.moduleTitle'); $this->viewData['pageTitle'] = lang('ClienteDistribuidores.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -56,8 +58,8 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -83,7 +85,7 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('ClienteDistribuidores.distribuidorDeCliente'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -93,9 +95,7 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('ClienteDistribuidores.distribuidorDeCliente'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/cliente-distribuidores/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -124,7 +124,8 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -148,12 +149,10 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -173,9 +172,7 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $clienteDistribuidorEntity->id ?? $id; $id = $clienteDistribuidorEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ClienteDistribuidores.distribuidorDeCliente'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/cliente-distribuidores/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -204,8 +201,8 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -224,7 +221,8 @@ class Clientedistribuidores extends \App\Controllers\GoBaseResourceController {
foreach ($resourceData as $item) : foreach ($resourceData as $item) :
if (isset($item->direccion) && strlen($item->direccion) > 100) : if (isset($item->direccion) && strlen($item->direccion) > 100) :
$item->direccion = character_limiter($item->direccion, 100); $item->direccion = character_limiter($item->direccion, 100);
endif;if (isset($item->horarios_entrega) && strlen($item->horarios_entrega) > 100) : endif;
if (isset($item->horarios_entrega) && strlen($item->horarios_entrega) > 100) :
$item->horarios_entrega = character_limiter($item->horarios_entrega, 100); $item->horarios_entrega = character_limiter($item->horarios_entrega, 100);
endif; endif;
endforeach; endforeach;
@ -239,7 +237,8 @@ endif;
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -261,7 +260,8 @@ endif;
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -288,7 +288,8 @@ endif;
} }
protected function getComunidadAutonomaListItems($selId = null) { protected function getComunidadAutonomaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])];
if (!empty($selId)) : if (!empty($selId)) :
$comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel'); $comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel');
@ -302,7 +303,8 @@ endif;
} }
protected function getPaisListItems($selId = null) { protected function getPaisListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])];
if (!empty($selId)) : if (!empty($selId)) :
$paisModel = model('App\Models\Configuracion\PaisModel'); $paisModel = model('App\Models\Configuracion\PaisModel');
@ -316,7 +318,8 @@ endif;
} }
protected function getProvinciaListItems($selId = null) { protected function getProvinciaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])];
if (!empty($selId)) : if (!empty($selId)) :
$provinciaModel = model('App\Models\Configuracion\ProvinciaModel'); $provinciaModel = model('App\Models\Configuracion\ProvinciaModel');

View File

@ -11,7 +11,8 @@ use App\Models\Configuracion\PaisModel;
use App\Models\Configuracion\ComunidadAutonomaModel; use App\Models\Configuracion\ComunidadAutonomaModel;
class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ComunidadAutonomaModel::class; protected $modelName = ComunidadAutonomaModel::class;
protected $format = 'json'; protected $format = 'json';
@ -28,15 +29,16 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'comunidadAutonomaList'; protected $indexRoute = 'comunidadAutonomaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('ComunidadesAutonomas.moduleTitle'); $this->viewData['pageTitle'] = lang('ComunidadesAutonomas.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -52,8 +54,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -79,7 +81,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -89,9 +91,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/comunidades-autonomas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -118,7 +118,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -142,12 +143,10 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -167,9 +166,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $comunidadAutonomaEntity->id ?? $id; $id = $comunidadAutonomaEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/comunidades-autonomas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -196,8 +193,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -224,7 +221,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -246,7 +244,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -273,7 +272,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
} }
protected function getPaisListItems($selId = null) { protected function getPaisListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])];
if (!empty($selId)) : if (!empty($selId)) :
$paisModel = model('App\Models\Configuracion\PaisModel'); $paisModel = model('App\Models\Configuracion\PaisModel');

View File

@ -3,7 +3,8 @@
use App\Entities\Configuracion\FormasPagoEntity; use App\Entities\Configuracion\FormasPagoEntity;
class Formaspago extends \App\Controllers\GoBaseController { class Formaspago extends \App\Controllers\GoBaseController
{
use \CodeIgniter\API\ResponseTrait; use \CodeIgniter\API\ResponseTrait;
@ -19,8 +20,8 @@ class Formaspago extends \App\Controllers\GoBaseController {
protected $indexRoute = 'formaPagoList'; protected $indexRoute = 'formaPagoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle'); $this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
@ -33,7 +34,8 @@ class Formaspago extends \App\Controllers\GoBaseController {
} }
} }
public function index() { public function index()
{
$this->viewData['usingClientSideDataTable'] = true; $this->viewData['usingClientSideDataTable'] = true;
@ -42,7 +44,8 @@ class Formaspago extends \App\Controllers\GoBaseController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -67,7 +70,7 @@ class Formaspago extends \App\Controllers\GoBaseController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaPago'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -77,9 +80,7 @@ class Formaspago extends \App\Controllers\GoBaseController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('FormasPagoes.formaPago'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor(route_to('editFormaPago', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -105,7 +106,8 @@ class Formaspago extends \App\Controllers\GoBaseController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -128,7 +130,6 @@ class Formaspago extends \App\Controllers\GoBaseController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -152,9 +153,7 @@ class Formaspago extends \App\Controllers\GoBaseController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $formasPagoEntity->id ?? $id; $id = $formasPagoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('FormasPagoes.formaPago'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor(route_to('editFormaPago', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -180,8 +179,8 @@ class Formaspago extends \App\Controllers\GoBaseController {
} // end function edit(...) } // end function edit(...)
public function allItemsSelect()
public function allItemsSelect() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -203,7 +202,8 @@ class Formaspago extends \App\Controllers\GoBaseController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -9,7 +9,8 @@ use App\Entities\Configuracion\FormaPagoEntity;
use App\Models\Configuracion\FormaPagoModel; use App\Models\Configuracion\FormaPagoModel;
class Formaspagos extends \App\Controllers\GoBaseResourceController { class Formaspagos extends \App\Controllers\GoBaseResourceController
{
protected $modelName = FormaPagoModel::class; protected $modelName = FormaPagoModel::class;
protected $format = 'json'; protected $format = 'json';
@ -26,15 +27,16 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'formaDePagoList'; protected $indexRoute = 'formaDePagoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle'); $this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -50,8 +52,8 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -77,7 +79,7 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaDePago'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -87,9 +89,7 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('FormasPagoes.formaDePago'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/formas-pagos/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -115,7 +115,8 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -139,12 +140,10 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -164,9 +163,7 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $formaPagoEntity->id ?? $id; $id = $formaPagoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('FormasPagoes.formaDePago'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/formas-pagos/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -192,8 +189,8 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -220,7 +217,8 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -242,7 +240,8 @@ class Formaspagos extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -24,7 +24,8 @@ class Group extends \App\Controllers\GoBaseController
private $group_user_model; private $group_user_model;
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Group.moduleTitle'); $this->viewData['pageTitle'] = lang('Group.moduleTitle');
self::$viewPath = getenv('theme.path') . 'form/group/'; self::$viewPath = getenv('theme.path') . 'form/group/';
@ -55,7 +56,6 @@ class Group extends \App\Controllers\GoBaseController
$postData = $this->request->getPost(); $postData = $this->request->getPost();
$title = $postData['title']; $title = $postData['title'];
$dashboard = $postData['dashboard']; $dashboard = $postData['dashboard'];
unset($postData['title']); unset($postData['title']);
@ -85,7 +85,6 @@ class Group extends \App\Controllers\GoBaseController
} }
$temp_data['rules'] = json_encode($rules_access ?? '{}'); $temp_data['rules'] = json_encode($rules_access ?? '{}');
$temp_data['token'] = md5(uniqid(rand(), true));; $temp_data['token'] = md5(uniqid(rand(), true));;
$temp_data['title'] = $title; $temp_data['title'] = $title;
@ -105,7 +104,7 @@ class Group extends \App\Controllers\GoBaseController
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Group.userGroup'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -115,9 +114,7 @@ class Group extends \App\Controllers\GoBaseController
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Group.userGroup'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/user-groups/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -144,7 +141,8 @@ class Group extends \App\Controllers\GoBaseController
} }
public function edit($requestedId = null) { public function edit($requestedId = null)
{
helper('general'); helper('general');
$session = session(); $session = session();
@ -211,7 +209,6 @@ class Group extends \App\Controllers\GoBaseController
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -231,9 +228,7 @@ class Group extends \App\Controllers\GoBaseController
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $groupEntity->id ?? $id; $id = $groupEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Group.userGroup'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor(route_to('editGroup', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($session->get('group') == $this->request->getPost('token')) { if ($session->get('group') == $this->request->getPost('token')) {
$session->set('rules', $temp_data['rules']); $session->set('rules', $temp_data['rules']);
@ -262,8 +257,8 @@ class Group extends \App\Controllers\GoBaseController
} // end function edit(...) } // end function edit(...)
public function allItemsSelect()
public function allItemsSelect() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -285,7 +280,8 @@ class Group extends \App\Controllers\GoBaseController
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -9,7 +9,8 @@ use App\Entities\Configuracion\Imposicion;
use App\Models\Configuracion\ImposicionModel; use App\Models\Configuracion\ImposicionModel;
class Imposiciones extends \App\Controllers\GoBaseResourceController { class Imposiciones extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ImposicionModel::class; protected $modelName = ImposicionModel::class;
protected $format = 'json'; protected $format = 'json';
@ -26,15 +27,16 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'imposicionList'; protected $indexRoute = 'imposicionList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Imposiciones.moduleTitle'); $this->viewData['pageTitle'] = lang('Imposiciones.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -50,8 +52,8 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -77,7 +79,7 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Imposiciones.imposicion'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -87,9 +89,7 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Imposiciones.imposicion'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/imposiciones/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -116,7 +116,8 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -140,12 +141,10 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -165,9 +164,7 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $imposicion->id ?? $id; $id = $imposicion->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Imposiciones.imposicion'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/imposiciones/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -194,8 +191,8 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -222,7 +219,8 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -244,7 +242,8 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -271,7 +270,8 @@ class Imposiciones extends \App\Controllers\GoBaseResourceController {
} }
protected function getOrientacionOptions() { protected function getOrientacionOptions()
{
$orientacionOptions = [ $orientacionOptions = [
'' => lang('Basic.global.pleaseSelect'), '' => lang('Basic.global.pleaseSelect'),
'H' => 'H', 'H' => 'H',

View File

@ -9,7 +9,8 @@ use App\Entities\Configuracion\Maquina;
use App\Models\Configuracion\MaquinaModel; use App\Models\Configuracion\MaquinaModel;
class Maquinas extends \App\Controllers\GoBaseResourceController { class Maquinas extends \App\Controllers\GoBaseResourceController
{
protected $modelName = MaquinaModel::class; protected $modelName = MaquinaModel::class;
protected $format = 'json'; protected $format = 'json';
@ -26,8 +27,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'maquinaList'; protected $indexRoute = 'maquinaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Maquinas.moduleTitle'); $this->viewData['pageTitle'] = lang('Maquinas.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
@ -48,7 +49,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -64,7 +66,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
// JJO // JJO
$session = session(); $session = session();
@ -94,7 +97,7 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Maquinas.maquina'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -104,9 +107,7 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Maquinas.maquina'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "maquinas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -135,7 +136,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
// JJO // JJO
$session = session(); $session = session();
@ -181,13 +183,11 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
$successfulResult = false; $successfulResult = false;
$this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');; $this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');;
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
} } else if ($sanitizedData['ancho'] < $sanitizedData['ancho_impresion']) {
else if ($sanitizedData['ancho'] < $sanitizedData['ancho_impresion']){
$successfulResult = false; $successfulResult = false;
$this->viewData['errorMessage'] = lang('Maquinas.validation.ancho_menor_ancho_impresion');; $this->viewData['errorMessage'] = lang('Maquinas.validation.ancho_menor_ancho_impresion');;
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
} } else {
else{
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) { } catch (\Exception $e) {
@ -208,9 +208,7 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $maquina->id ?? $id; $id = $maquina->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Maquinas.maquina'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "maquinas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -238,8 +236,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -271,7 +269,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -293,7 +292,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -320,7 +320,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} }
protected function getMaquinaListItems($selId = null) { protected function getMaquinaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) : if (!empty($selId)) :
$maquinaModel = model('App\Models\Configuracion\MaquinaModel'); $maquinaModel = model('App\Models\Configuracion\MaquinaModel');
@ -334,7 +335,8 @@ class Maquinas extends \App\Controllers\GoBaseResourceController {
} }
protected function getTipoOptions() { protected function getTipoOptions()
{
$tipoOptions = [ $tipoOptions = [
'' => lang('Basic.global.pleaseSelect'), '' => lang('Basic.global.pleaseSelect'),
'impresion' => 'impresion', 'impresion' => 'impresion',

View File

@ -11,7 +11,8 @@ use App\Models\Configuracion\MaquinaModel;
use App\Models\Configuracion\MaquinasDefectoModel; use App\Models\Configuracion\MaquinasDefectoModel;
class Maquinasdefecto extends \App\Controllers\GoBaseResourceController { class Maquinasdefecto extends \App\Controllers\GoBaseResourceController
{
protected $modelName = MaquinasDefectoModel::class; protected $modelName = MaquinasDefectoModel::class;
protected $format = 'json'; protected $format = 'json';
@ -28,8 +29,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'maquinaPorDefectoList'; protected $indexRoute = 'maquinaPorDefectoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('MaquinasPorDefecto.moduleTitle'); $this->viewData['pageTitle'] = lang('MaquinasPorDefecto.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
@ -42,7 +43,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -58,7 +60,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
// JJO // JJO
$session = session(); $session = session();
@ -86,8 +89,7 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
$error = $this->model->checkIntervals($sanitizedData); $error = $this->model->checkIntervals($sanitizedData);
if (empty($error)) { if (empty($error)) {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData); $successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} } else {
else{
$successfulResult = false; $successfulResult = false;
$this->viewData['errorMessage'] = $error; $this->viewData['errorMessage'] = $error;
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
@ -97,7 +99,7 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('MaquinasPorDefecto.maquinaPorDefecto'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -107,9 +109,7 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('MaquinasPorDefecto.maquinaPorDefecto'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "configuracion/maquinasdefecto/edit/{$id}" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -137,7 +137,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
// JJO // JJO
$session = session(); $session = session();
@ -176,8 +177,7 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
$error = $this->model->checkIntervals($sanitizedData, $id); $error = $this->model->checkIntervals($sanitizedData, $id);
if (empty($error)) { if (empty($error)) {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} } else {
else{
$successfulResult = false; $successfulResult = false;
$this->viewData['errorMessage'] = $error; $this->viewData['errorMessage'] = $error;
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
@ -198,9 +198,7 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $maquinasDefectoEntity->id ?? $id; $id = $maquinasDefectoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('MaquinasPorDefecto.maquinaPorDefecto'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "maquinasdefecto/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -228,8 +226,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -259,7 +257,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -281,7 +280,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -308,7 +308,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} }
protected function getMaquinaListItems($selId = null) { protected function getMaquinaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) : if (!empty($selId)) :
$maquinaModel = model('App\Models\Configuracion\MaquinaModel'); $maquinaModel = model('App\Models\Configuracion\MaquinaModel');
@ -322,7 +323,8 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
} }
protected function getTipoOptions() { protected function getTipoOptions()
{
$tipoOptions = [ $tipoOptions = [
'' => lang('Basic.global.pleaseSelect'), '' => lang('Basic.global.pleaseSelect'),
'bn' => 'bn', 'bn' => 'bn',

View File

@ -22,7 +22,8 @@ use
DataTables\Editor\Validate, DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions; DataTables\Editor\ValidateOptions;
class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController { class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
{
protected $modelName = MaquinasTarifasImpresionModel::class; protected $modelName = MaquinasTarifasImpresionModel::class;
protected $format = 'json'; protected $format = 'json';
@ -39,15 +40,16 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
protected $indexRoute = 'maquinasTarifaImpresionList'; protected $indexRoute = 'maquinasTarifaImpresionList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('MaquinasTarifasImpresions.moduleTitle'); $this->viewData['pageTitle'] = lang('MaquinasTarifasImpresions.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -63,8 +65,8 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -90,7 +92,7 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -100,9 +102,7 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "maquinastarifasimpresion/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -130,7 +130,8 @@ class Maquinastarifasimpresion extends \App\Controllers\GoBaseResourceController
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -157,12 +158,10 @@ if ($this->request->getPost('predeterminado') == null ) {
} }
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -182,9 +181,7 @@ if ($this->request->getPost('predeterminado') == null ) {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $maquinasTarifasImpresion->id ?? $id; $id = $maquinasTarifasImpresion->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "maquinastarifasimpresion/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -212,7 +209,8 @@ if ($this->request->getPost('predeterminado') == null ) {
} // end function edit(...) } // end function edit(...)
public function datatable_editor() { public function datatable_editor()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php"); include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
@ -248,8 +246,7 @@ if ($this->request->getPost('predeterminado') == null ) {
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) { if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
foreach ($data['data'] as $pkey => $values) { foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar... // Si no se quiere borrar...
if($data['data'][$pkey]['is_deleted'] != 1) if ($data['data'][$pkey]['is_deleted'] != 1) {
{
// Cubierta y sobrecubierta sólo pueden ser en color // Cubierta y sobrecubierta sólo pueden ser en color
if ($values['uso'] != 'interior' && $values['tipo'] != 'color') { if ($values['uso'] != 'interior' && $values['tipo'] != 'color') {
return lang('MaquinasTarifasImpresions.validation.cubierta_sobrecubierta_color'); return lang('MaquinasTarifasImpresions.validation.cubierta_sobrecubierta_color');
@ -318,7 +315,8 @@ if ($this->request->getPost('predeterminado') == null ) {
} }
} }
public function datatable() { public function datatable()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -347,7 +345,8 @@ if ($this->request->getPost('predeterminado') == null ) {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -369,7 +368,8 @@ if ($this->request->getPost('predeterminado') == null ) {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -396,7 +396,8 @@ if ($this->request->getPost('predeterminado') == null ) {
} }
protected function getMaquinaListItems($selId = null) { protected function getMaquinaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) : if (!empty($selId)) :
$maquinaModel = model('App\Models\Configuracion\MaquinaModel'); $maquinaModel = model('App\Models\Configuracion\MaquinaModel');
@ -410,7 +411,8 @@ if ($this->request->getPost('predeterminado') == null ) {
} }
protected function getTipoOptions() { protected function getTipoOptions()
{
$tipoOptions = [ $tipoOptions = [
'' => lang('Basic.global.pleaseSelect'), '' => lang('Basic.global.pleaseSelect'),
'negro' => 'negro', 'negro' => 'negro',

View File

@ -9,7 +9,8 @@ use App\Entities\Configuracion\PaisEntity;
use App\Models\Configuracion\PaisModel; use App\Models\Configuracion\PaisModel;
class Paises extends \App\Controllers\GoBaseResourceController { class Paises extends \App\Controllers\GoBaseResourceController
{
protected $modelName = PaisModel::class; protected $modelName = PaisModel::class;
protected $format = 'json'; protected $format = 'json';
@ -26,15 +27,16 @@ class Paises extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'paisList'; protected $indexRoute = 'paisList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Paises.moduleTitle'); $this->viewData['pageTitle'] = lang('Paises.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -50,8 +52,8 @@ class Paises extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -77,7 +79,7 @@ class Paises extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Paises.pais'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -87,9 +89,7 @@ class Paises extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Paises.pais'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/paises/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -115,7 +115,8 @@ class Paises extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -142,12 +143,10 @@ if ($this->request->getPost('show_erp') == null ) {
} }
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -167,9 +166,7 @@ if ($this->request->getPost('show_erp') == null ) {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $paisEntity->id ?? $id; $id = $paisEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Paises.pais'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/paises/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -195,8 +192,8 @@ if ($this->request->getPost('show_erp') == null ) {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -223,7 +220,8 @@ if ($this->request->getPost('show_erp') == null ) {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -245,7 +243,8 @@ if ($this->request->getPost('show_erp') == null ) {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -95,7 +95,7 @@ class Papelesgenericos extends \App\Controllers\GoBaseResourceController
$this->dealWithException($e); $this->dealWithException($e);
} }
else : else :
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('PapelGenerico.papelGenerico'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -105,9 +105,7 @@ class Papelesgenericos extends \App\Controllers\GoBaseResourceController
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('PapelGenerico.papelGenerico'))]) . '.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor("papelesgenericos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -185,9 +183,7 @@ class Papelesgenericos extends \App\Controllers\GoBaseResourceController
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $papelGenerico->id ?? $id; $id = $papelGenerico->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('PapelGenerico.papelGenerico'))]) . '.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
$message .= anchor("papelesgenericos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :

View File

@ -118,7 +118,7 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
$this->dealWithException($e); $this->dealWithException($e);
} }
else : else :
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('PapelImpresion.papelImpresion'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -128,9 +128,7 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('PapelImpresion.papelImpresion'))]) . '.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor("papelesimpresion/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -232,9 +230,7 @@ class Papelesimpresion extends \App\Controllers\GoBaseResourceController
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $papelImpresion->id ?? $id; $id = $papelImpresion->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('PapelImpresion.papelImpresion'))]) . '.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
$message .= anchor("papelesimpresion/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :

View File

@ -78,7 +78,7 @@ class Papelimpresiontipologias extends \App\Controllers\GoBaseResourceController
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -88,9 +88,7 @@ class Papelimpresiontipologias extends \App\Controllers\GoBaseResourceController
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "papelimpresiontipologias/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -177,9 +175,7 @@ class Papelimpresiontipologias extends \App\Controllers\GoBaseResourceController
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $papelImpresionTipologia->id ?? $id; $id = $papelImpresionTipologia->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ImpresionTipologias.papelImpresionTipologia'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
$message .= anchor( "papelimpresiontipologias/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :

View File

@ -11,7 +11,8 @@ use App\Models\Configuracion\PaisModel;
use App\Models\Configuracion\ProvinciaModel; use App\Models\Configuracion\ProvinciaModel;
class Provincias extends \App\Controllers\GoBaseResourceController { class Provincias extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ProvinciaModel::class; protected $modelName = ProvinciaModel::class;
protected $format = 'json'; protected $format = 'json';
@ -28,15 +29,16 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'provinciaList'; protected $indexRoute = 'provinciaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Provincias.moduleTitle'); $this->viewData['pageTitle'] = lang('Provincias.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -52,8 +54,8 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -79,7 +81,7 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Provincias.provincia'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -89,9 +91,7 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Provincias.provincia'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/provincias/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -118,7 +118,8 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -142,12 +143,10 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -167,9 +166,7 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $provinciaEntity->id ?? $id; $id = $provinciaEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Provincias.provincia'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "admin/provincias/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -196,8 +193,8 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -224,7 +221,8 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -246,7 +244,8 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -273,7 +272,8 @@ class Provincias extends \App\Controllers\GoBaseResourceController {
} }
protected function getPaisListItems($selId = null) { protected function getPaisListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])];
if (!empty($selId)) : if (!empty($selId)) :
$paisModel = model('App\Models\Configuracion\PaisModel'); $paisModel = model('App\Models\Configuracion\PaisModel');

View File

@ -3,7 +3,8 @@
use App\Entities\Configuracion\TipologiasEntity; use App\Entities\Configuracion\TipologiasEntity;
class Tipologias extends \App\Controllers\GoBaseController { class Tipologias extends \App\Controllers\GoBaseController
{
use \CodeIgniter\API\ResponseTrait; use \CodeIgniter\API\ResponseTrait;
@ -19,14 +20,15 @@ class Tipologias extends \App\Controllers\GoBaseController {
protected $indexRoute = 'tipologiaLibrosList'; protected $indexRoute = 'tipologiaLibrosList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('TipologiasLibros.moduleTitle'); $this->viewData['pageTitle'] = lang('TipologiasLibros.moduleTitle');
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$this->viewData['usingClientSideDataTable'] = true; $this->viewData['usingClientSideDataTable'] = true;
@ -35,8 +37,8 @@ class Tipologias extends \App\Controllers\GoBaseController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -61,7 +63,7 @@ class Tipologias extends \App\Controllers\GoBaseController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TipologiasLibros.tipologiaLibros'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -71,9 +73,7 @@ class Tipologias extends \App\Controllers\GoBaseController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TipologiasLibros.tipologiaLibros'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor(route_to('editTipologiaLibros', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -99,7 +99,8 @@ class Tipologias extends \App\Controllers\GoBaseController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -122,12 +123,10 @@ class Tipologias extends \App\Controllers\GoBaseController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -147,9 +146,7 @@ class Tipologias extends \App\Controllers\GoBaseController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tipologiasEntity->id ?? $id; $id = $tipologiasEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TipologiasLibros.tipologiaLibros'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor(route_to('editTipologiaLibros', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -175,8 +172,8 @@ class Tipologias extends \App\Controllers\GoBaseController {
} // end function edit(...) } // end function edit(...)
public function allItemsSelect()
public function allItemsSelect() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -198,7 +195,8 @@ class Tipologias extends \App\Controllers\GoBaseController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -68,6 +68,15 @@ abstract class GoBaseResourceController extends \CodeIgniter\RESTful\ResourceCon
*/ */
public $delete_flag = 0; public $delete_flag = 0;
/**
* IMN: Variable para seleccionar el tipo de mensajeria que usa una clase
*
* 'alerts' -> Boostrap 5 default alerts
* 'toastr' -> Javascript ToastR library
* @var string
*/
public $alertStyle = 'alerts';
/** /**
* An array of helpers to be loaded automatically upon * An array of helpers to be loaded automatically upon
@ -116,6 +125,9 @@ abstract class GoBaseResourceController extends \CodeIgniter\RESTful\ResourceCon
$this->viewData['viewPath'] = static::$viewPath; $this->viewData['viewPath'] = static::$viewPath;
$this->viewData['currentLocale'] = $this->request->getLocale(); $this->viewData['currentLocale'] = $this->request->getLocale();
/* IMN */
$this->viewData['alertStyle'] = $this->alertStyle;
} }
/** /**

View File

@ -98,7 +98,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -108,9 +108,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]) . '.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor("tarifasacabado/{$id}/edit", lang('Basic.global.continueEditing') . '?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -120,9 +118,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
return $this->redirect2listView('sweet-success', $message); return $this->redirect2listView('sweet-success', $message);
endif; endif;
else: else:
//JJO $this->session->setFlashData('sweet-success', $message);
$this->viewData['successMessage'] = $message;
//$this->session->setFlashData('sweet-success', $message);
endif; endif;
endif; // $noException && $successfulResult endif; // $noException && $successfulResult
@ -194,9 +190,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifaacabadoEntity->id ?? $id; $id = $tarifaacabadoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]) . '.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
//$message .= anchor("tarifasacabado/{$id}/edit", lang('Basic.global.continueEditing') . '?');
//$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -205,8 +199,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
return $this->redirect2listView('sweet-success', $message); return $this->redirect2listView('sweet-success', $message);
endif; endif;
else: else:
//JJO $this->session->setFlashData('sweet-success', $message);
$this->viewData['successMessage'] = $message;
endif; endif;
endif; // $noException && $successfulResult endif; // $noException && $successfulResult

View File

@ -24,7 +24,8 @@ use
use function PHPUnit\Framework\isEmpty; use function PHPUnit\Framework\isEmpty;
class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController { class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController
{
protected $modelName = TarifaAcabadoLineaModel::class; protected $modelName = TarifaAcabadoLineaModel::class;
protected $format = 'json'; protected $format = 'json';
@ -41,15 +42,16 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'tarifaAcabadoLineaList'; protected $indexRoute = 'tarifaAcabadoLineaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('TarifaAcabadoLineas.moduleTitle'); $this->viewData['pageTitle'] = lang('TarifaAcabadoLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -65,8 +67,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -92,7 +94,7 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -102,9 +104,7 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifa-acabado-lineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -131,7 +131,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -155,12 +156,10 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -180,9 +179,7 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifaAcabadoLinea->id ?? $id; $id = $tarifaAcabadoLinea->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifa-acabado-lineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -209,8 +206,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -242,7 +239,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function datatable_editor() { public function datatable_editor()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php"); include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
@ -354,7 +352,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -376,7 +375,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];
@ -403,7 +403,8 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
} }
protected function getTarifaAcabadoListItems($selId = null) { protected function getTarifaAcabadoListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Tarifaacabado.tarifaAcabado'))])]; $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Tarifaacabado.tarifaAcabado'))])];
if (!empty($selId)) : if (!empty($selId)) :
$tarifaacabadoModel = model('App\Models\tarifas\TarifaacabadoModel'); $tarifaacabadoModel = model('App\Models\tarifas\TarifaacabadoModel');

View File

@ -21,7 +21,8 @@ use
DataTables\Editor\ValidateOptions; DataTables\Editor\ValidateOptions;
class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceController { class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceController
{
protected $modelName = TarifaEncuadernacionLineaModel::class; protected $modelName = TarifaEncuadernacionLineaModel::class;
protected $format = 'json'; protected $format = 'json';
@ -38,15 +39,16 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
protected $indexRoute = 'tarifaEncuadernacionLineaList'; protected $indexRoute = 'tarifaEncuadernacionLineaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('TarifaEncuadernacionLineas.moduleTitle'); $this->viewData['pageTitle'] = lang('TarifaEncuadernacionLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -62,8 +64,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -89,7 +91,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -99,9 +101,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifaencuadernacionlineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -127,7 +127,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -151,12 +152,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -176,9 +175,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifaEncuadernacionLinea->id ?? $id; $id = $tarifaEncuadernacionLinea->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifaencuadernacionlineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -204,7 +201,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
} // end function edit(...) } // end function edit(...)
public function datatable_editor() { public function datatable_editor()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php"); include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
@ -260,8 +258,7 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) { if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
foreach ($data['data'] as $pkey => $values) { foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar... // Si no se quiere borrar...
if($data['data'][$pkey]['is_deleted'] != 1) if ($data['data'][$pkey]['is_deleted'] != 1) {
{
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min']; $process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max']; $process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_encuadernacion_id']); $response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_encuadernacion_id']);
@ -309,7 +306,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
} }
} }
public function datatable() { public function datatable()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -338,7 +336,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -360,7 +359,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -21,7 +21,8 @@ use
DataTables\Editor\ValidateOptions; DataTables\Editor\ValidateOptions;
class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController { class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController
{
protected $modelName = TarifaManipuladoLineaModel::class; protected $modelName = TarifaManipuladoLineaModel::class;
protected $format = 'json'; protected $format = 'json';
@ -38,15 +39,16 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'tarifaManipuladoLineaList'; protected $indexRoute = 'tarifaManipuladoLineaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('TarifaManipuladoLineas.moduleTitle'); $this->viewData['pageTitle'] = lang('TarifaManipuladoLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -62,8 +64,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -89,7 +91,7 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifaManipuladoLineas.tarifamanipuladoLinea'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -99,9 +101,7 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TarifaManipuladoLineas.tarifamanipuladoLinea'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifamanipuladolineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -127,7 +127,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
if ($requestedId == null) : if ($requestedId == null) :
return $this->redirect2listView(); return $this->redirect2listView();
@ -151,12 +152,10 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
$sanitizedData = $this->sanitized($postData, $nullIfEmpty); $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :
try { try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -176,9 +175,7 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifaManipuladoLinea->id ?? $id; $id = $tarifaManipuladoLinea->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TarifaManipuladoLineas.tarifamanipuladoLinea'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifamanipuladolineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -204,7 +201,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable_editor() { public function datatable_editor()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php"); include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
@ -260,8 +258,7 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) { if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
foreach ($data['data'] as $pkey => $values) { foreach ($data['data'] as $pkey => $values) {
// Si no se quiere borrar... // Si no se quiere borrar...
if($data['data'][$pkey]['is_deleted'] != 1) if ($data['data'][$pkey]['is_deleted'] != 1) {
{
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min']; $process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max']; $process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_manipulado_id']); $response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tarifa_manipulado_id']);
@ -309,7 +306,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function datatable() { public function datatable()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -338,7 +336,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -360,7 +359,8 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -3,7 +3,8 @@
use App\Entities\Tarifas\TarifapreimpresionEntity; use App\Entities\Tarifas\TarifapreimpresionEntity;
class Tarifapreimpresion extends \App\Controllers\GoBaseController { class Tarifapreimpresion extends \App\Controllers\GoBaseController
{
use \CodeIgniter\API\ResponseTrait; use \CodeIgniter\API\ResponseTrait;
@ -19,8 +20,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
protected $indexRoute = 'tarifapreimpresionList'; protected $indexRoute = 'tarifapreimpresionList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Tarifapreimpresion.moduleTitle'); $this->viewData['pageTitle'] = lang('Tarifapreimpresion.moduleTitle');
// Se indica que este controlador trabaja con soft_delete // Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true; $this->soft_delete = true;
@ -37,7 +38,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
} }
public function index() { public function index()
{
$this->viewData['usingClientSideDataTable'] = true; $this->viewData['usingClientSideDataTable'] = true;
@ -46,8 +48,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
} }
public function add() { public function add()
{
$requestMethod = $this->request->getMethod(); $requestMethod = $this->request->getMethod();
@ -72,7 +74,7 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifapreimpresion.tarifapreimpresion'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -82,9 +84,7 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifapreimpresion.tarifapreimpresion'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor(route_to('editTarifapreimpresion', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -93,7 +93,7 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
return $this->redirect2listView('successMessage', $message); return $this->redirect2listView('successMessage', $message);
endif; endif;
else: else:
$this->viewData['successMessage'] = $message; $this->session->setFlashData('sweet-success', $message);
endif; endif;
endif; // $noException && $successfulResult endif; // $noException && $successfulResult
@ -110,7 +110,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
// JJO // JJO
$session = session(); $session = session();
@ -161,9 +162,7 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifapreimpresionEntity->id ?? $id; $id = $tarifapreimpresionEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifapreimpresion.tarifapreimpresion'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
//$message .= anchor(route_to('editTarifapreimpresion', $id), lang('Basic.global.continueEditing').'?');
//$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -172,8 +171,7 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
return $this->redirect2listView('successMessage', $message); return $this->redirect2listView('successMessage', $message);
endif; endif;
else: else:
//JJO $this->session->setFlashData('sweet-success', $message);
$this->viewData['successMessage'] = $message;
endif; endif;
endif; // $noException && $successfulResult endif; // $noException && $successfulResult
@ -190,8 +188,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
} // end function edit(...) } // end function edit(...)
public function allItemsSelect()
public function allItemsSelect() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -213,7 +211,8 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -9,7 +9,8 @@ use App\Entities\Tarifas\TarifaEncuadernacionEntity;
use App\Models\Tarifas\TarifaEncuadernacionModel; use App\Models\Tarifas\TarifaEncuadernacionModel;
class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController { class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController
{
protected $modelName = TarifaEncuadernacionModel::class; protected $modelName = TarifaEncuadernacionModel::class;
protected $format = 'json'; protected $format = 'json';
@ -26,8 +27,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'tarifaEncuadernacionList'; protected $indexRoute = 'tarifaEncuadernacionList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Tarifaencuadernacion.moduleTitle'); $this->viewData['pageTitle'] = lang('Tarifaencuadernacion.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
@ -48,7 +49,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -64,7 +66,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
// JJO // JJO
$session = session(); $session = session();
@ -96,7 +99,7 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifaencuadernacion.tarifaencuadernacion'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -106,9 +109,7 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifaencuadernacion.tarifaencuadernacion'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
//$message .= anchor( "tarifaencuadernacion/{$id}/edit" , lang('Basic.global.continueEditing').'?');
//$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -118,9 +119,7 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
return $this->redirect2listView('sweet-success', $message); return $this->redirect2listView('sweet-success', $message);
endif; endif;
else: else:
//JJO $this->session->setFlashData('sweet-success', $message);
$this->viewData['successMessage'] = $message;
//$this->session->setFlashData('sweet-success', $message);
endif; endif;
endif; // $noException && $successfulResult endif; // $noException && $successfulResult
@ -137,7 +136,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
// JJO // JJO
$session = session(); $session = session();
@ -149,7 +149,7 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
$tarifaEncuadernacionEntity = $this->model->find($id); $tarifaEncuadernacionEntity = $this->model->find($id);
if ($tarifaEncuadernacionEntity == false) : if ($tarifaEncuadernacionEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaencuadernacion.tarifaencuadernacion')), $id]); $message = lang('Basic.global.notFoundWithIdErr', [lang('Basic.global.record'), $id]);
return $this->redirect2listView('sweet-error', $message); return $this->redirect2listView('sweet-error', $message);
endif; endif;
@ -178,7 +178,7 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifaencuadernacion.tarifaencuadernacion'))]); $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -189,9 +189,7 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifaEncuadernacionEntity->id ?? $id; $id = $tarifaEncuadernacionEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifaencuadernacion.tarifaencuadernacion'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
//$message .= anchor( "tarifa ulado/{$id}/edit" , lang('Basic.global.continueEditing').'?');
//$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -217,8 +215,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -245,7 +243,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -267,7 +266,8 @@ class Tarifasencuadernacion extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -9,7 +9,8 @@ use App\Entities\Tarifas\TarifaManipuladoEntity;
use App\Models\Tarifas\TarifaManipuladoModel; use App\Models\Tarifas\TarifaManipuladoModel;
class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController { class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController
{
protected $modelName = TarifaManipuladoModel::class; protected $modelName = TarifaManipuladoModel::class;
protected $format = 'json'; protected $format = 'json';
@ -26,8 +27,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
protected $indexRoute = 'tarifaManipuladoList'; protected $indexRoute = 'tarifaManipuladoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { {
$this->viewData['pageTitle'] = lang('Tarifamanipulado.moduleTitle'); $this->viewData['pageTitle'] = lang('Tarifamanipulado.moduleTitle');
$this->viewData['usingSweetAlert'] = true; $this->viewData['usingSweetAlert'] = true;
@ -48,7 +49,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
} }
public function index() { public function index()
{
$viewData = [ $viewData = [
'currentModule' => static::$controllerSlug, 'currentModule' => static::$controllerSlug,
@ -64,7 +66,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
} }
public function add() { public function add()
{
// JJO // JJO
$session = session(); $session = session();
@ -96,7 +99,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
$this->dealWithException($e); $this->dealWithException($e);
} }
else: else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]); $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
$this->session->setFlashdata('formErrors', $this->model->errors()); $this->session->setFlashdata('formErrors', $this->model->errors());
endif; endif;
@ -106,9 +109,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
$id = $this->model->db->insertID(); $id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]).'.'; $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
$message .= anchor( "tarifamanipulado/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -118,9 +119,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
return $this->redirect2listView('sweet-success', $message); return $this->redirect2listView('sweet-success', $message);
endif; endif;
else: else:
//JJO $this->session->setFlashData('sweet-success', $message);
$this->viewData['successMessage'] = $message;
//$this->session->setFlashData('sweet-success', $message);
endif; endif;
endif; // $noException && $successfulResult endif; // $noException && $successfulResult
@ -137,7 +136,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
return $this->displayForm(__METHOD__); return $this->displayForm(__METHOD__);
} // end function add() } // end function add()
public function edit($requestedId = null) { public function edit($requestedId = null)
{
// JJO // JJO
$session = session(); $session = session();
@ -189,9 +189,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
endif; endif;
if ($noException && $successfulResult) : if ($noException && $successfulResult) :
$id = $tarifaManipuladoEntity->id ?? $id; $id = $tarifaManipuladoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]).'.'; $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
//$message .= anchor( "tarifamanipulado/{$id}/edit" , lang('Basic.global.continueEditing').'?');
//$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : if (!empty($this->indexRoute)) :
@ -217,8 +215,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
} // end function edit(...) } // end function edit(...)
public function datatable()
public function datatable() { {
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$reqData = $this->request->getPost(); $reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns'])) { if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
@ -245,7 +243,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
} }
} }
public function allItemsSelect() { public function allItemsSelect()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$onlyActiveOnes = true; $onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id'; $reqVal = $this->request->getPost('val') ?? 'id';
@ -267,7 +266,8 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController {
} }
} }
public function menuItems() { public function menuItems()
{
if ($this->request->isAJAX()) { if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0];

View File

@ -63,7 +63,7 @@ return [
'pleaseSelect' => 'Por favor seleccione...', 'pleaseSelect' => 'Por favor seleccione...',
'pleaseSelectA' => 'Por favor seleccione un {0}... ', 'pleaseSelectA' => 'Por favor seleccione un {0}... ',
'pleaseSelectOne' => 'Por favor seleccione un...', 'pleaseSelectOne' => 'Por favor seleccione un...',
'record' => 'el registro', 'record' => 'registro',
'saveSuccess' => 'El {0} se ha guardado satisfactoriamente', 'saveSuccess' => 'El {0} se ha guardado satisfactoriamente',
'saveSuccess1' => 'El {0} ', 'saveSuccess1' => 'El {0} ',
'saveSuccess2' => ' se ha guardado satisfactoriamente', 'saveSuccess2' => ' se ha guardado satisfactoriamente',

View File

@ -28,14 +28,31 @@
"hideMethod": "fadeOut" "hideMethod": "fadeOut"
}; };
<?php if (session('sweet-success')) { ?> <?php if (session('sweet-success')) {
if (isset($alertStyle) && ($alertStyle == 'toastr')) { ?>
toastr.success(`<?= session('sweet-success') ?>`); toastr.success(`<?= session('sweet-success') ?>`);
<?php } ?> <?php } else { ?>
<?php if (session('sweet-warning')) { ?> popSuccessAlert(`<?= session('sweet-success') ?>`);
toastr.success(`<?= session('sweet-warning') ?>`); <?php }
<?php } ?> }
<?php if (session('sweet-error')) { ?> ?>
toastr.success(`<?= session('sweet-error') ?>`);
<?php } ?> <?php if (session('sweet-warning')) {
if (isset($alertStyle) && ($alertStyle == 'toastr')) { ?>
toastr.warning(`<?= session('sweet-warning') ?>`);
<?php } else { ?>
popWarningAlert(`<?= session('sweet-warning') ?>`);
<?php }
}
?>
<?php if (session('sweet-error')) {
if (isset($alertStyle) && ($alertStyle == 'toastr')) { ?>
toastr.error(`<?= session('sweet-error') ?>`);
<?php } else { ?>
popErrorgAlert(`<?= session('sweet-error') ?>`);
<?php }
}
?>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -134,7 +134,6 @@ if (!empty($token) && $tfa == false) {
aria-expanded="false" aria-expanded="false"
> >
<i class="ti ti-bell ti-md"></i> <i class="ti ti-bell ti-md"></i>
<span class="badge bg-danger rounded-pill badge-notifications">5</span>
</a> </a>
</li> </li>
<!--/ Notification --> <!--/ Notification -->