mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadido la comprobación de que no se solape el alto en maquinas defecto
This commit is contained in:
@ -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 "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user