mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
a falta de validar
This commit is contained in:
@ -75,15 +75,23 @@ class Maquinasdefecto extends \App\Controllers\GoBaseResourceController {
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_created_id'] = $session->id_user;
|
||||
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
// JJO: se añade que se checkeen los intervalos de ancho y tirada.
|
||||
// En caso de error se devuelve un mensaje.
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
$error = $this->model->checkIntervals($sanitizedData);
|
||||
if(empty($error)){
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
}
|
||||
else{
|
||||
$successfulResult = false;
|
||||
$this->viewData['errorMessage'] = $error;
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
@ -160,12 +168,20 @@ class Maquinasdefecto 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);
|
||||
// JJO: se añade que se checkeen los intervalos de ancho y tirada.
|
||||
// En caso de error se devuelve un mensaje.
|
||||
try {
|
||||
$error = $this->model->checkIntervals($sanitizedData);
|
||||
if(empty($error)){
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
}
|
||||
else{
|
||||
$successfulResult = false;
|
||||
$this->viewData['errorMessage'] = $error;
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
|
||||
Reference in New Issue
Block a user