diff --git a/ci4/app/Controllers/Configuracion/Maquinas.php b/ci4/app/Controllers/Configuracion/Maquinas.php index ddbf022c..9a6eaa02 100644 --- a/ci4/app/Controllers/Configuracion/Maquinas.php +++ b/ci4/app/Controllers/Configuracion/Maquinas.php @@ -176,12 +176,26 @@ class Maquinas extends \App\Controllers\GoBaseResourceController { 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); - } + //JJO: comprobar alto y ancho impresion < alto y ancho + if($sanitizedData['alto'] < $sanitizedData['alto_impresion']){ + $successfulResult = false; + $this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');; + $this->session->setFlashdata('formErrors', $this->model->errors()); + } + else if ($sanitizedData['ancho'] < $sanitizedData['ancho_impresion']){ + $successfulResult = false; + $this->viewData['errorMessage'] = lang('Maquinas.validation.ancho_menor_ancho_impresion');; + $this->session->setFlashdata('formErrors', $this->model->errors()); + } + else{ + 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('Maquinas.maquina'))]); $this->session->setFlashdata('formErrors', $this->model->errors()); @@ -190,7 +204,7 @@ class Maquinas extends \App\Controllers\GoBaseResourceController { $maquina->fill($sanitizedData); - $thenRedirect = true; + $thenRedirect = false; endif; if ($noException && $successfulResult) : $id = $maquina->id ?? $id; diff --git a/ci4/app/Language/en/Maquinas.php b/ci4/app/Language/en/Maquinas.php index ca28974c..443c0bdd 100644 --- a/ci4/app/Language/en/Maquinas.php +++ b/ci4/app/Language/en/Maquinas.php @@ -5,10 +5,10 @@ return [ 'acabado' => 'finish', 'alto' => 'Height', - 'altoClick' => 'Height Click', - 'altoImpresion' => 'Height Printing', + 'altoClick' => 'Click Height', + 'altoImpresion' => 'Printing Height', 'ancho' => 'Width', - 'anchoImpresion' => 'Width Printing', + 'anchoImpresion' => 'Printing Width', 'createdAt' => 'Created At', 'deletedAt' => 'Deleted At', 'duracionJornada' => 'Working day duration', @@ -42,14 +42,16 @@ return [ 'velocidad' => 'Speed', 'velocidadCorte' => 'Cut speed', 'validation' => [ + 'alto_menor_alto_impresion' => '\'Printing Height\' field must be lower than \'Height\'', + 'ancho_menor_ancho_impresion' => '\'Printing Width\' field must be lower than \'Width\'', 'alto' => [ 'decimal' => 'The {field} field must contain a decimal number.', - + 'greater_than' => 'The field {field} must be greater than {param}', ], 'ancho' => [ 'decimal' => 'The {field} field must contain a decimal number.', - + 'greater_than' => 'The field {field} must be greater than {param}', ], 'forzar_num_formas_horizontales_portada' => [ @@ -65,19 +67,20 @@ return [ 'alto_click' => [ 'decimal' => 'The {field} field must contain a decimal number.', 'required' => 'The {field} field is required.', + 'greater_than' => 'The field {field} must be greater than {param}', ], 'alto_impresion' => [ 'decimal' => 'The {field} field must contain a decimal number.', 'required' => 'The {field} field is required.', - + 'greater_than' => 'The field {field} must be greater than {param}', ], 'ancho_impresion' => [ 'decimal' => 'The {field} field must contain a decimal number.', 'required' => 'The {field} field is required.', - + 'greater_than' => 'The field {field} must be greater than {param}', ], 'duracion_jornada' => [ diff --git a/ci4/app/Language/en/MaquinasPapelImpresion.php b/ci4/app/Language/en/MaquinasPapelImpresion.php index b16a906e..f1d3829b 100644 --- a/ci4/app/Language/en/MaquinasPapelImpresion.php +++ b/ci4/app/Language/en/MaquinasPapelImpresion.php @@ -3,6 +3,7 @@ return [ + 'papel_impresion_maquinas' => 'Printing papers', 'activo' => 'Active', 'gramaje_duplicado' => 'It can not be selected two pieces of paper with the same grammage', 'sureToChangeRotativaTitle' => 'Are you sure to change this option?', diff --git a/ci4/app/Language/es/Maquinas.php b/ci4/app/Language/es/Maquinas.php index 733d17d3..a58cfc6c 100644 --- a/ci4/app/Language/es/Maquinas.php +++ b/ci4/app/Language/es/Maquinas.php @@ -42,14 +42,16 @@ return [ 'velocidad' => 'Velocidad', 'velocidadCorte' => 'Velocidad Corte', 'validation' => [ + 'alto_menor_alto_impresion' => 'El campo \'Alto impresión\' debe ser menor que \'Alto\'', + 'ancho_menor_ancho_impresion' => '\'Ancho Impresión\' debe ser menor que \'Ancho\'', 'alto' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - + 'greater_than' => 'El campo {field} debe ser mayor que {param}', ], 'ancho' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - + 'greater_than' => 'El campo {field} debe ser mayor que {param}', ], 'forzar_num_formas_horizontales_portada' => [ @@ -65,19 +67,19 @@ return [ 'alto_click' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'El campo {field} es obligatorio.', - + 'greater_than' => 'El campo {field} debe ser mayor que {param}', ], 'alto_impresion' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'El campo {field} es obligatorio.', - + 'greater_than' => 'El campo {field} debe ser mayor que {param}', ], 'ancho_impresion' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'El campo {field} es obligatorio.', - + 'greater_than' => 'El campo {field} debe ser mayor que {param}', ], 'duracion_jornada' => [ diff --git a/ci4/app/Language/es/MaquinasPapelImpresion.php b/ci4/app/Language/es/MaquinasPapelImpresion.php index a9bc0ce8..65f6e453 100644 --- a/ci4/app/Language/es/MaquinasPapelImpresion.php +++ b/ci4/app/Language/es/MaquinasPapelImpresion.php @@ -3,6 +3,7 @@ return [ + 'papel_impresion_maquinas' => 'Papeles impresion', 'activo' => 'Activo', 'gramaje_duplicado' => 'No se pueden seleccionar dos papeles con el mismo gramaje', 'sureToChangeRotativaTitle' => 'Está seguro de cambiar esta opción?', diff --git a/ci4/app/Models/Configuracion/MaquinaModel.php b/ci4/app/Models/Configuracion/MaquinaModel.php index 35ada300..fb17d42e 100644 --- a/ci4/app/Models/Configuracion/MaquinaModel.php +++ b/ci4/app/Models/Configuracion/MaquinaModel.php @@ -72,23 +72,23 @@ class MaquinaModel extends \App\Models\GoBaseModel protected $validationRules = [ "alto" => [ "label" => "Maquinas.alto", - "rules" => "required|decimal", + "rules" => "required|decimal|greater_than[0]", ], "alto_click" => [ "label" => "Maquinas.altoClick", - "rules" => "required|decimal", + "rules" => "required|decimal|greater_than[0]", ], "alto_impresion" => [ "label" => "Maquinas.altoImpresion", - "rules" => "required|decimal", + "rules" => "required|decimal|greater_than[0]", ], "ancho" => [ "label" => "Maquinas.ancho", - "rules" => "required|decimal", + "rules" => "required|decimal|greater_than[0]", ], "ancho_impresion" => [ "label" => "Maquinas.anchoImpresion", - "rules" => "required|decimal", + "rules" => "required|decimal|greater_than[0]", ], "duracion_jornada" => [ "label" => "Maquinas.duracionJornada", diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php index 860a7f2c..9d051314 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php @@ -69,7 +69,7 @@