añadido la comprobación de que no se solape el alto en maquinas defecto

This commit is contained in:
Jaime Jimenez
2023-07-13 13:41:12 +02:00
parent 60881245e8
commit 7b42d497e0
3 changed files with 15 additions and 17 deletions

View File

@ -32,8 +32,10 @@ return [
'userUpdatedId' => 'User Updated ID',
'validation' => [
'error_ancho_overlap' => 'The range [Min Width, Max Width] is overlapped with another one for the selected type.',
'error_alto_overlap' => 'The range [Min Height, Max Height] is overlapped with another one for the selected type.',
'error_tirada_overlap' => 'The range [Min Printing, Max Printing] is overlapped with another one for the selected type.',
'error_ancho_range' => 'The field Min Width must be lower than the field Max Width',
'error_alto_range' => 'The field Min Height must be lower than the field Max Height',
'error_tirada_range' => 'The field Min Printing must be lower than the field Max Printing',
'alto_max' => [
'decimal' => 'The {field} field must contain a decimal number.',

View File

@ -32,8 +32,10 @@ return [
'userUpdatedId' => 'User Updated ID',
'validation' => [
'error_ancho_overlap' => 'El rango [Ancho Min, Ancho Max] se solapa con otro existente para el tipo seleccionado.',
'error_alto_overlap' => 'El rango [Alto Min, Alto Max] se solapa con otro existente para el tipo seleccionado.',
'error_tirada_overlap' => 'El rango [Tirada Min, Tirada Max] se solapa con otro existente para el tipo seleccionado.',
'error_ancho_range' => 'El campo Ancho Min debe ser menor que el campo Ancho Max',
'error_alto_range' => 'El campo Alto Min debe ser menor que el campo Alto Max',
'error_tirada_range' => 'El campo Tirada Min debe ser menor que el campo Tirada Max',
'alto_max' => [
'decimal' => 'El campo {field} debe contener un número decimal.',

View File

@ -191,15 +191,19 @@ class MaquinasDefectoModel extends \App\Models\GoBaseModel
return lang('MaquinasPorDefecto.validation.error_tirada_range');
}
$anchos = $this->db
if(floatval($data["alto_min"])>= floatval($data["alto_max"])){
return lang('MaquinasPorDefecto.validation.error_alto_range');
}
$rows = $this->db
->table($this->table)
->select("id, ancho_min, ancho_max")
->select("id, ancho_min, ancho_max, alto_min, alto_max, tirada_min, tirada_max")
->where("is_deleted", 0)
->where("tipo", $data["tipo"])
->get()->getResultObject();
foreach ($anchos as $row) {
foreach ($rows as $row) {
if (!is_null($id)){
if($row->id == $id){
continue;
@ -209,20 +213,9 @@ class MaquinasDefectoModel extends \App\Models\GoBaseModel
$row->ancho_min, $row->ancho_max)){
return lang('MaquinasPorDefecto.validation.error_ancho_overlap');
}
}
$tiradas = $this->db
->table($this->table)
->select("id, tirada_min, tirada_max")
->where("is_deleted", 0)
->where("tipo", $data["tipo"])
->get()->getResultObject();
foreach ($tiradas as $row) {
if (!is_null($id)){
if($row->id == $id){
continue;
}
if($this->check_overlap(floatval($data["alto_min"]), floatval($data["alto_max"]),
$row->alto_min, $row->alto_max)){
return lang('MaquinasPorDefecto.validation.error_alto_overlap');
}
if($this->check_overlap(floatval($data["tirada_min"]), floatval($data["tirada_max"]),
$row->tirada_min, $row->tirada_max)){
@ -230,6 +223,7 @@ class MaquinasDefectoModel extends \App\Models\GoBaseModel
}
}
return "";
}