diff --git a/ci4/.env b/ci4/.env index 79ed1dd9..f9f43edd 100644 --- a/ci4/.env +++ b/ci4/.env @@ -22,8 +22,8 @@ CI_ENVIRONMENT = development # APP #-------------------------------------------------------------------- -# app.baseURL = 'https://sk-jjo.imnavajas.es' -app.baseURL = 'https://sk-imn.imnavajas.es' +app.baseURL = 'https://sk-jjo.imnavajas.es' +# app.baseURL = 'https://sk-imn.imnavajas.es' # app.baseURL = "http://safekat.test/" # app.forceGlobalSecureRequests = false @@ -41,22 +41,22 @@ app.baseURL = 'https://sk-imn.imnavajas.es' # DATABASE #-------------------------------------------------------------------- -# database.default.hostname = localhost -# database.default.database = sk_jjo -# database.default.username = sk_jjo -# database.default.password = 61tv&G1Zf^XY -# database.default.DBDriver = MySQLi -# database.default.DBPrefix = -# database.default.dump = - database.default.hostname = localhost -database.default.database = sk_imn -database.default.username = sk_imn -database.default.password = Uyia19_87 +database.default.database = sk_jjo +database.default.username = sk_jjo +database.default.password = 61tv&G1Zf^XY database.default.DBDriver = MySQLi database.default.DBPrefix = database.default.dump = +# database.default.hostname = localhost +# database.default.database = sk_imn +# database.default.username = sk_imn +# database.default.password = Uyia19_87 +# database.default.DBDriver = MySQLi +# database.default.DBPrefix = +# database.default.dump = + # database.tests.hostname = localhost # database.tests.database = ci4 # database.tests.username = root diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 087f8c93..cf5efcbf 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -127,7 +127,7 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'], $routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']); $routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']); }); -$routes->resource('tarifamanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']); +$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']); $routes->group('tarifamanipuladolineas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { diff --git a/ci4/app/Controllers/Tarifas/Tarifamanipuladolineas.php b/ci4/app/Controllers/Tarifas/Tarifamanipuladolineas.php index ba135419..5e59be55 100644 --- a/ci4/app/Controllers/Tarifas/Tarifamanipuladolineas.php +++ b/ci4/app/Controllers/Tarifas/Tarifamanipuladolineas.php @@ -259,11 +259,20 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController { ->validator( function($editor, $action, $data){ if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){ foreach ($data['data'] as $pkey => $values ){ - $count = $this->model->select('*') - ->where(array('tarifa_manipulado_id'=> $values['tarifa_manipulado_id'], 'tirada_min'=> $values['tirada_min'], 'tirada_max'=> $values['tirada_max'], 'is_deleted'=> 0)) - ->countAllResults(); - if ($count >= 1){ - return lang('TarifaAcabadoLineas.validation.duplicated_tirada'); + // Si no se quiere borrar... + if($data['data'][$pkey]['is_deleted'] != 1) + { + + $count = $this->model->select('*') + ->where(array( + 'tarifa_manipulado_id'=> $values['tarifa_manipulado_id'], + 'tirada_min'=> $values['tirada_min'], + 'tirada_max'=> $values['tirada_max'], + 'is_deleted'=> 0)) + ->countAllResults(); + if ($count >= 1){ + return lang('TarifaAcabadoLineas.validation.duplicated_tirada'); + } } } } @@ -293,13 +302,13 @@ class Tarifamanipuladolineas extends \App\Controllers\GoBaseResourceController { ->data(); - // if unique key is set in DB + /*// if unique key is set in DB if(isset($response['error'])){ if(str_contains($response['error'], "tirada_min_tirada_max") && str_contains($response['error'], "Duplicate entry ")){ $response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada'); } - } + }*/ $newTokenHash = csrf_hash(); $csrfTokenName = csrf_token(); diff --git a/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php b/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php index 5418394a..560173de 100644 --- a/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php +++ b/ci4/app/Controllers/Tarifas/Tarifasmanipulado.php @@ -98,14 +98,15 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController { if ($noException && $successfulResult) : $id = $this->model->db->insertID(); - + $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]).'.'; $message .= anchor( "tarifamanipulado/{$id}/edit" , lang('Basic.global.continueEditing').'?'); $message = ucfirst(str_replace("'", "\'", $message)); if ($thenRedirect) : if (!empty($this->indexRoute)) : - return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message); + return redirect()->to(site_url('tarifas/tarifasmanipulado/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; @@ -160,25 +161,22 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController { $noException = true; if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : - - + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $tarifaManipuladoEntity->fill($sanitizedData); - if ($this->canValidate()) : - try { - $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); - } catch (\Exception $e) { - $noException = false; - $this->dealWithException($e); - } - else: - $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado'))]); - $this->session->setFlashdata('formErrors', $this->model->errors()); - - endif; - - $tarifaManipuladoEntity->fill($sanitizedData); - - $thenRedirect = true; + $thenRedirect = true; endif; if ($noException && $successfulResult) : $id = $tarifaManipuladoEntity->id ?? $id; @@ -187,7 +185,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController { $message = ucfirst(str_replace("'", "\'", $message)); if ($thenRedirect) : - if (!empty($this->indexRoute)) : + if (!empty($this->indexRoute)) : return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message); else: return $this->redirect2listView('sweet-success', $message); @@ -223,7 +221,7 @@ class Tarifasmanipulado extends \App\Controllers\GoBaseResourceController { $length = $reqData['length'] ?? 5; $search = $reqData['search']['value']; $requestedOrder = $reqData['order']['0']['column'] ?? 1; - $order = TarifaManipuladoModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $order = TarifaManipuladoModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php index 2e1d27b4..551026ca 100644 --- a/ci4/app/Controllers/Test.php +++ b/ci4/app/Controllers/Test.php @@ -15,8 +15,11 @@ class Test extends BaseController public function index() { + /* $papel = new Papelesimpresion(); - var_dump($papel->datatablePG()); + var_dump($papel->datatablePG());*/ + return redirect()->to(site_url('tarifas/tarifaacabado/edit/'. 30))->with('sweet-success', 'OK'); + //return redirect()->to('https://sk-jjo.imnavajas.es/tarifas/tarifaacabado/edit/30'); } } \ No newline at end of file diff --git a/ci4/app/Filters/LoginAuthFilter.php b/ci4/app/Filters/LoginAuthFilter.php index cf42fa71..0a30acdb 100644 --- a/ci4/app/Filters/LoginAuthFilter.php +++ b/ci4/app/Filters/LoginAuthFilter.php @@ -182,7 +182,6 @@ class LoginAuthFilter implements FilterInterface 'datatable', 'datatable_editor', 'fetch_single_data', - 'datatableTintas', 'collect', 'cast', ]; diff --git a/ci4/app/Language/en/TarifaManipuladoLineas.php b/ci4/app/Language/en/TarifaManipuladoLineas.php new file mode 100644 index 00000000..1a214500 --- /dev/null +++ b/ci4/app/Language/en/TarifaManipuladoLineas.php @@ -0,0 +1,49 @@ + 'ID', + 'moduleTitle' => 'Handling rates Lines', + 'deleteLine' => 'the selected register', + 'precioMax' => 'Max Price', + 'precioMin' => 'Min Price', + 'precioUnidad' => 'Price Unit', + 'tiradaMax' => 'Print Max', + 'tiradaMin' => 'Print Min', + 'validation' => [ + 'precio_max' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'precio_min' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'precio_unidad' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'tirada_max' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'tirada_min' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/es/TarifaManipuladoLineas.php b/ci4/app/Language/es/TarifaManipuladoLineas.php new file mode 100644 index 00000000..e6751fc4 --- /dev/null +++ b/ci4/app/Language/es/TarifaManipuladoLineas.php @@ -0,0 +1,49 @@ + 'ID', + 'moduleTitle' => 'Tarifa Manipulado Lineas', + 'deleteLine' => 'el registro seleccionado', + 'precioMax' => 'Precio Max', + 'precioMin' => 'Precio Min', + 'precioUnidad' => 'Precio Unidad', + 'tiradaMax' => 'Tirada Max', + 'tiradaMin' => 'Tirada Min', + 'validation' => [ + 'precio_max' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'precio_min' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'precio_unidad' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'tirada_max' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'tirada_min' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Models/Tarifas/TarifaManipuladoLineaModel.php b/ci4/app/Models/Tarifas/TarifaManipuladoLineaModel.php index 8bd6000d..56ae1d14 100644 --- a/ci4/app/Models/Tarifas/TarifaManipuladoLineaModel.php +++ b/ci4/app/Models/Tarifas/TarifaManipuladoLineaModel.php @@ -27,6 +27,9 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel "precio_min", "precio_max", "precio_unidad", + "user_created_id", + "is_deleted", + ]; protected $returnType = "App\Entities\Tarifas\TarifaManipuladoLinea"; @@ -97,12 +100,14 @@ class TarifaManipuladoLineaModel extends \App\Models\GoBaseModel $builder = $this->db ->table($this->table . " t1") ->select( - "t1.id AS id, t1.tarifa_manipulado_id AS tarifa_manipulado_id, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.precio_unidad AS precio_unidad" + "t1.id AS id, t1.tarifa_manipulado_id AS tarifa_manipulado_id, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.precio_unidad AS precio_unidad, t2.id AS tarifa_manipulado" ); - if($tarifa_manipulado_id>=0) - { - $builder->where('tarifa_manipulado_id', $tarifa_manipulado_id); - } + //JJO + $builder->where('tarifa_manipulado_id', $tarifa_manipulado_id); + $builder->where("t1.is_deleted", 0); + + $builder->join("lg_tarifa_manipulado t2", "t1.tarifa_manipulado_id = t2.id", "left"); + return empty($search) ? $builder diff --git a/ci4/app/Models/Tarifas/TarifamanipuladoModel.php b/ci4/app/Models/Tarifas/TarifamanipuladoModel.php index ab0ee8db..97e95c09 100644 --- a/ci4/app/Models/Tarifas/TarifamanipuladoModel.php +++ b/ci4/app/Models/Tarifas/TarifamanipuladoModel.php @@ -13,7 +13,7 @@ class TarifaManipuladoModel extends \App\Models\GoBaseModel protected $useAutoIncrement = true; const SORTABLE = [ - 1 => "t1.nombre", + 0 => "t1.nombre", ]; protected $allowedFields = [ diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifamanipuladoForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifamanipuladoForm.php index f2ae71ec..36c6fb57 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifamanipuladoForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifamanipuladoForm.php @@ -17,20 +17,27 @@ = view("themes/backend/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems") ?>
-| = lang('TarifaAcabadoLineas.tiradaMin') ?> | -= lang('TarifaAcabadoLineas.tiradaMax') ?> | -= lang('TarifaAcabadoLineas.precioMin') ?> | -= lang('TarifaAcabadoLineas.precioMax') ?> | -= lang('TarifaAcabadoLineas.precioUnidad') ?> | += lang('TarifaManipuladoLineas.tiradaMin') ?> | += lang('TarifaManipuladoLineas.tiradaMax') ?> | += lang('TarifaManipuladoLineas.precioMin') ?> | += lang('TarifaManipuladoLineas.precioMax') ?> | += lang('TarifaManipuladoLineas.precioUnidad') ?> |
|---|