diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 713e1915..8ccde276 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -70,7 +70,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion'] /* Series Factura */ $routes->group('series-facturas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { - $routes->get('', 'SeriesFacturas::index', ['as' => 'seriesFacturasList']); $routes->match(['get', 'post'], 'add', 'SeriesFacturas::add', ['as' => 'seriesFacturasAdd']); $routes->match(['get', 'post'], 'edit/(:num)', 'SeriesFacturas::edit/$1', ['as' => 'seriesFacturasEdit']); @@ -79,6 +78,15 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion'] $routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']); }); + /* Formas de Pago */ + $routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']); + $routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']); + $routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']); + $routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']); + $routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']); + }); + }); diff --git a/ci4/app/Controllers/Clientes/Cliente.php b/ci4/app/Controllers/Clientes/Cliente.php index 2f7faefa..678532c9 100755 --- a/ci4/app/Controllers/Clientes/Cliente.php +++ b/ci4/app/Controllers/Clientes/Cliente.php @@ -395,7 +395,7 @@ class Cliente extends \App\Controllers\BaseResourceController protected function getFormaDePagoListItems($selId = null) { - $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPagoes.formaDePago'))])]; + $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPago.formaDePago'))])]; if (!empty($selId)) : $formaPagoModel = model('App\Models\Configuracion\FormaPagoModel'); diff --git a/ci4/app/Controllers/Configuracion/Formaspagos.php b/ci4/app/Controllers/Configuracion/FormasPago.php old mode 100755 new mode 100644 similarity index 87% rename from ci4/app/Controllers/Configuracion/Formaspagos.php rename to ci4/app/Controllers/Configuracion/FormasPago.php index ef027110..a2867c59 --- a/ci4/app/Controllers/Configuracion/Formaspagos.php +++ b/ci4/app/Controllers/Configuracion/FormasPago.php @@ -9,7 +9,7 @@ use App\Entities\Configuracion\FormaPagoEntity; use App\Models\Configuracion\FormaPagoModel; -class Formaspagos extends \App\Controllers\BaseResourceController +class FormasPago extends \App\Controllers\BaseResourceController { protected $modelName = FormaPagoModel::class; @@ -22,15 +22,22 @@ class Formaspagos extends \App\Controllers\BaseResourceController protected static $controllerSlug = 'formas-pagos'; - protected static $viewPath = 'themes/vuexy/form/configuracion/formasPagoViews/'; + protected static $viewPath = 'themes/vuexy/form/configuracion/formas-pago/'; protected $indexRoute = 'formaDePagoList'; 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('FormasPago.moduleTitle'); $this->viewData['usingSweetAlert'] = true; + + // Breadcrumbs (IMN) + $this->viewData['breadcrumb'] = [ + ['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false], + ['title' => lang("App.menu_formas_pago"), 'route' => route_to('formasPagoList'), 'active' => true] + ]; + parent::initController($request, $response, $logger); } @@ -40,7 +47,7 @@ class Formaspagos extends \App\Controllers\BaseResourceController $viewData = [ 'currentModule' => static::$controllerSlug, - 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaDePago')]), + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPago.formaDePago')]), 'formaPagoEntity' => new FormaPagoEntity(), 'usingServerSideDataTable' => true, @@ -55,22 +62,15 @@ class Formaspagos extends \App\Controllers\BaseResourceController public function add() { - - - if ($this->request->getPost()) : - $nullIfEmpty = true; // !(phpversion() >= '8.1'); - $postData = $this->request->getPost(); - $sanitizedData = $this->sanitized($postData, $nullIfEmpty); - + $sanitizedData = $this->sanitized($postData, true); $noException = true; if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : - if ($this->canValidate()) : try { $successfulResult = $this->model->skipValidation(true)->save($sanitizedData); @@ -93,7 +93,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController if ($thenRedirect) : if (!empty($this->indexRoute)) : - return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message); + return redirect()->to(site_url('/configuracion/formas-pago/edit/' . $id))->with('sweet-success', $message); + //return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message); else: return $this->redirect2listView('sweet-success', $message); endif; @@ -106,11 +107,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController endif; // ($requestMethod === 'post') $this->viewData['formaPagoEntity'] = isset($sanitizedData) ? new FormaPagoEntity($sanitizedData) : new FormaPagoEntity(); - - $this->viewData['formAction'] = route_to('createFormaDePago'); - - $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPagoes.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix'); - + $this->viewData['formAction'] = route_to('formasPagoAdd'); + $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPago.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix'); return $this->displayForm(__METHOD__); } // end function add() @@ -125,25 +123,18 @@ class Formaspagos extends \App\Controllers\BaseResourceController $formaPagoEntity = $this->model->find($id); if ($formaPagoEntity == false) : - $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaDePago')), $id]); + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPago.formaDePago')), $id]); return $this->redirect2listView('sweet-error', $message); endif; - - if ($this->request->getPost()) : - $nullIfEmpty = true; // !(phpversion() >= '8.1'); - $postData = $this->request->getPost(); - - $sanitizedData = $this->sanitized($postData, $nullIfEmpty); - + $sanitizedData = $this->sanitized($postData, true); $noException = true; if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : - if ($this->canValidate()) : try { $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); @@ -152,13 +143,12 @@ class Formaspagos extends \App\Controllers\BaseResourceController $this->dealWithException($e); } else: - $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaDePago'))]); + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPago.formaDePago'))]); $this->session->setFlashdata('formErrors', $this->model->errors()); endif; $formaPagoEntity->fill($sanitizedData); - $thenRedirect = false; endif; if ($noException && $successfulResult) : @@ -179,11 +169,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController endif; // ($requestMethod === 'post') $this->viewData['formaPagoEntity'] = $formaPagoEntity; - - $this->viewData['formAction'] = route_to('updateFormaDePago', $id); - - $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPagoes.moduleTitle') . ' ' . lang('Basic.global.edit3'); - + $this->viewData['formAction'] = route_to('formasPagoEdit', $id); + $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPago.moduleTitle') . ' ' . lang('Basic.global.edit3'); return $this->displayForm(__METHOD__, $id); } // end function edit(...) diff --git a/ci4/app/Controllers/Configuracion/SeriesFacturas.php b/ci4/app/Controllers/Configuracion/SeriesFacturas.php index 6dd1a0dc..f7618629 100644 --- a/ci4/app/Controllers/Configuracion/SeriesFacturas.php +++ b/ci4/app/Controllers/Configuracion/SeriesFacturas.php @@ -66,7 +66,6 @@ class SeriesFacturas extends BaseResourceController $noException = true; if ($successfulResult = $this->canValidate()) : - if ($this->canValidate()) : try { $successfulResult = $this->model->skipValidation(true)->save($sanitizedData); @@ -105,7 +104,6 @@ class SeriesFacturas extends BaseResourceController $this->viewData['formAction'] = route_to('seriesFacturasAdd'); $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('SeriesFacturas.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix'); - return $this->displayForm(__METHOD__); } // end function add() @@ -126,7 +124,6 @@ class SeriesFacturas extends BaseResourceController if ($this->request->getPost()) : $postData = $this->request->getPost(); - $sanitizedData = $this->sanitized($postData, true); if ($this->request->getPost('show_erp') == null) { $sanitizedData['show_erp'] = false; diff --git a/ci4/app/Language/en/App.php b/ci4/app/Language/en/App.php index 8a54743e..be8505b2 100755 --- a/ci4/app/Language/en/App.php +++ b/ci4/app/Language/en/App.php @@ -679,7 +679,7 @@ return [ "menu_calendario" => "Calendar", "menu_paises" => "Countries", "menu_correo" => "Mail", - "menu_formaspago" => "Payment methods", + "menu_formas_pago" => "Payment methods", "menu_imposiciones" => "Impositions", "menu_maquina" => "Machines", "menu_papelgenerico" => "Generic paper", diff --git a/ci4/app/Language/en/FormasPagoes.php b/ci4/app/Language/en/FormasPago.php old mode 100755 new mode 100644 similarity index 95% rename from ci4/app/Language/en/FormasPagoes.php rename to ci4/app/Language/en/FormasPago.php index 7e7e55cf..a2d39cc3 --- a/ci4/app/Language/en/FormasPagoes.php +++ b/ci4/app/Language/en/FormasPago.php @@ -11,7 +11,6 @@ return [ 'formasDePagos' => 'Formas de Pagos', 'formasPago' => 'Formas Pago', 'formasPagoList' => 'Formas Pago List', - 'formasPagoes' => 'Formas Pagoes', 'id' => 'ID', 'moduleTitle' => 'Formas Pagoes', 'nombre' => 'Nombre', diff --git a/ci4/app/Language/es/App.php b/ci4/app/Language/es/App.php index e03fa10d..fbfc1cd4 100755 --- a/ci4/app/Language/es/App.php +++ b/ci4/app/Language/es/App.php @@ -682,7 +682,7 @@ return [ "menu_calendario" => "Calendario", "menu_paises" => "Paises", "menu_correo" => "Correo", - "menu_formaspago" => "Metodos de pago", + "menu_formas_pago" => "Formas de pago", "menu_imposiciones" => "Imposiciones", "menu_maquina" => "Maquinas", "menu_maquina_defecto" => "Maquinas por defecto", diff --git a/ci4/app/Language/es/RolesPermisos.php b/ci4/app/Language/es/RolesPermisos.php index d09ccf35..6c631c16 100644 --- a/ci4/app/Language/es/RolesPermisos.php +++ b/ci4/app/Language/es/RolesPermisos.php @@ -37,6 +37,7 @@ return [ 'tarifaExtraSection' => 'Tarifas extra', 'proveedoresSection' => 'Proveedores', 'paisesSection' => 'Países', + 'formasPagoSection' => 'Formas de Pago', 'maquinasSection' => 'Máquinas', 'maquinasDefectoSection' => 'Máquinas por defecto', 'papelGenericoSection' => 'Papel genérico', diff --git a/ci4/app/Models/Clientes/ClienteModel.php b/ci4/app/Models/Clientes/ClienteModel.php index 741a736a..85df9782 100755 --- a/ci4/app/Models/Clientes/ClienteModel.php +++ b/ci4/app/Models/Clientes/ClienteModel.php @@ -257,7 +257,7 @@ class ClienteModel extends \App\Models\BaseModel LEFT JOIN lg_paises t4 ON t1.pais_id = t4.id LEFT JOIN users t5 ON t1.comercial_id = t5.id LEFT JOIN users t6 ON t1.soporte_id = t6.id - LEFT JOIN lg_formas_pago t7 ON t1.forma_pago_id = t7.id"; + LEFT JOIN formas_pago t7 ON t1.forma_pago_id = t7.id"; if (!is_null($limit) && intval($limit) > 0) { $sql .= " LIMIT " . intval($limit); } @@ -287,7 +287,7 @@ class ClienteModel extends \App\Models\BaseModel ) ->where("is_deleted", 0);; $builder->join("users t5", "t1.comercial_id = t5.id", "left"); - $builder->join("lg_formas_pago t7", "t1.forma_pago_id = t7.id", "left"); + $builder->join("formas_pago t7", "t1.forma_pago_id = t7.id", "left"); return empty($search) diff --git a/ci4/app/Models/Configuracion/FormaPagoModel.php b/ci4/app/Models/Configuracion/FormaPagoModel.php index d22a1bd5..2a7374bb 100755 --- a/ci4/app/Models/Configuracion/FormaPagoModel.php +++ b/ci4/app/Models/Configuracion/FormaPagoModel.php @@ -15,8 +15,6 @@ class FormaPagoModel extends \App\Models\BaseModel const SORTABLE = [ 1 => "t1.id", 2 => "t1.nombre", - 3 => "t1.created_at", - 4 => "t1.updated_at", ]; protected $allowedFields = ["nombre"]; @@ -26,15 +24,15 @@ class FormaPagoModel extends \App\Models\BaseModel protected $validationRules = [ "nombre" => [ - "label" => "FormasPagoes.nombre", + "label" => "FormasPago.nombre", "rules" => "trim|required|max_length[255]", ], ]; protected $validationMessages = [ "nombre" => [ - "max_length" => "FormasPagoes.validation.nombre.max_length", - "required" => "FormasPagoes.validation.nombre.required", + "max_length" => "FormasPago.validation.nombre.max_length", + "required" => "FormasPago.validation.nombre.required", ], ]; @@ -61,7 +59,7 @@ class FormaPagoModel extends \App\Models\BaseModel { $builder = $this->db ->table($this->table . " t1") - ->select("t1.id AS id, t1.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at"); + ->select("t1.id AS id, t1.nombre AS nombre"); return empty($search) ? $builder @@ -69,12 +67,6 @@ class FormaPagoModel extends \App\Models\BaseModel ->groupStart() ->like("t1.id", $search) ->orLike("t1.nombre", $search) - ->orLike("t1.created_at", $search) - ->orLike("t1.updated_at", $search) - ->orLike("t1.id", $search) - ->orLike("t1.nombre", $search) - ->orLike("t1.created_at", $search) - ->orLike("t1.updated_at", $search) ->groupEnd(); } } diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index dc8c3ad3..424ba107 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -215,7 +215,7 @@ class PresupuestoModel extends \App\Models\BaseModel ", t2.nombre AS cliente, t3.nombre AS forma_pago, t4.nombre AS tipo_impresion, t5.nombre AS tipologia, t6.nombre AS pais, t7.estado AS estado, t8.id AS papel_formato, t9.first_name AS total_confirmado_user, t10.first_name AS aprobado_user FROM " . $this->table . " t1 LEFT JOIN clientes - t2 ON t1.cliente_id = t2.id LEFT JOIN lg_formas_pago + t2 ON t1.cliente_id = t2.id LEFT JOIN formas_pago t3 ON t1.forma_pago_id = t3.id LEFT JOIN lg_tipos_impresion t4 ON t1.tipo_impresion_id = t4.id LEFT JOIN lg_tipologias_libros t5 ON t1.tipologia_id = t5.id LEFT JOIN lg_paises diff --git a/ci4/app/Views/themes/vuexy/form/clientes/cliente/viewClienteList.php b/ci4/app/Views/themes/vuexy/form/clientes/cliente/viewClienteList.php index ecb9a1e5..f2448cbc 100644 --- a/ci4/app/Views/themes/vuexy/form/clientes/cliente/viewClienteList.php +++ b/ci4/app/Views/themes/vuexy/form/clientes/cliente/viewClienteList.php @@ -21,7 +21,7 @@
| = lang('Basic.global.Action') ?> | -=lang('FormasPagoes.id')?> | -= lang('FormasPagoes.nombre') ?> | -= lang('FormasPagoes.createdAt') ?> | -= lang('FormasPagoes.updatedAt') ?> | += lang('FormasPago.nombre') ?> | = lang('Basic.global.Action') ?> |
|---|