Various Bugfixes

This commit is contained in:
Frank Schubert
2021-10-07 19:54:28 +02:00
parent e27da7ec55
commit d150b4e7b5
8 changed files with 167 additions and 39 deletions

View File

@@ -92,8 +92,9 @@ class PatchingController extends mfBaseController {
foreach($terms as $term) {
$term->order = OrderModel::getFirst(["termination_id" => $term->id]);
$terminations[] = $term;
//var_dump($term);
}
$this->layout()->set("terminations", $terms);
}
@@ -141,12 +142,11 @@ class PatchingController extends mfBaseController {
}
$r = $this->request;
//var_dump($r);exit;
//var_dump($r);
$term_id = $r->termination_id;
//var_dump($r);exit;
if(is_numeric($term_id) && $term_id > 0) {
$mode = "edit";
$termination = new Termination($term_id);
if(!$termination->id) {
$this->layout()->setFlash("Anschluss nicht gefunden", "error");
@@ -159,14 +159,6 @@ class PatchingController extends mfBaseController {
$patch_data = [];
$patching = PatchingModel::getFirst(["termination_id" => $term_id]);
if($patching) {
$mode = "edit";
} else {
$mode = "add";
$patch_data["termination_id"] = $term_id;
}
$patch_data["linework_port"] = $r->linework_port;
$patch_data["device_name"] = $r->device_name;
@@ -179,6 +171,15 @@ class PatchingController extends mfBaseController {
$patch_data["device_type"] = null;
}
$patching = PatchingModel::getFirst(["termination_id" => $term_id]);
if($patching) {
$mode = "edit";
} else {
$mode = "add";
$patch_data["termination_id"] = $term_id;
}
//var_dump($mode, $patch_data);exit;
if($mode == "add") {
$patch_data['create_by'] = 1;
$patching = PatchingModel::create($patch_data);