From 9f908e56dbce29e9cd273f9e9ab6809e9d55c7b5 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 15 Feb 2022 20:41:59 +0100 Subject: [PATCH] changes linework to openable list --- Layout/default/Contractconfig/Index.php | 118 ++++++++++++++++++ Layout/default/Linework/Index.php | 77 +++++++++++- Layout/default/Linework/inline_history.php | 3 + Layout/default/Voicenumber/Form.php | 4 +- .../Voicenumberblock/include/block-detail.php | 2 +- Layout/default/menu.php | 15 ++- application/Building/Building.php | 41 +++++- .../ContractconfigController.php | 23 ++++ .../ContractconfigGroup.php | 30 +++++ .../ContractconfigGroupModel.php | 114 +++++++++++++++++ .../ContractconfigItem/ContractconfigItem.php | 5 + .../ContractconfigItemModel.php | 115 +++++++++++++++++ .../ContractconfigValue.php | 5 + .../ContractconfigValueModel.php | 114 +++++++++++++++++ application/Linework/LineworkController.php | 2 +- application/Termination/Termination.php | 69 +++++++++- lang/de.php | 3 + 17 files changed, 729 insertions(+), 11 deletions(-) create mode 100644 Layout/default/Contractconfig/Index.php create mode 100644 Layout/default/Linework/inline_history.php create mode 100644 application/Contractconfig/ContractconfigController.php create mode 100644 application/ContractconfigGroup/ContractconfigGroup.php create mode 100644 application/ContractconfigGroup/ContractconfigGroupModel.php create mode 100644 application/ContractconfigItem/ContractconfigItem.php create mode 100644 application/ContractconfigItem/ContractconfigItemModel.php create mode 100644 application/ContractconfigValue/ContractconfigValue.php create mode 100644 application/ContractconfigValue/ContractconfigValueModel.php diff --git a/Layout/default/Contractconfig/Index.php b/Layout/default/Contractconfig/Index.php new file mode 100644 index 000000000..95bad86b1 --- /dev/null +++ b/Layout/default/Contractconfig/Index.php @@ -0,0 +1,118 @@ + + + + +
+
+
+
+ +
+

Vertragsconfig

+
+
+
+ + + +
+
+
+
+ + + +

Gruppe name?>

+
"> + + items) && count($group->items)): ?> + items as $item): ?> + +
"> + +
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + + +
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+
+
+ + + + + + + Keine Vertragsconfig Gruppen gefunden + +
+ +
+
+
+ + + +

+ + + + + + + + + + + - "> + 0): ?> + + + + + + + + + + + + + "> + + + + + + + + + + + hidden"> - - +
AnschlussBaustatusPatchstatusBB hergestelltBEP montiertK-Kabel eingeblasenSpleiß NetzSpleiß KundeFertig
+
+ building->gps_lat && $term->building->gps_long): ?> + + building->street?> + + + building->street?> + +
+ [building->status->name."-b")?>] +
+ ["code" => $term->building->code]])?>" target="_blank">code?> +
+ +
building->getWorkflowvalue('pipework_finished') && empty($term->building->getWorkflowvalue('ist_pipework_finished')))) ? "" : ""?>isWorkflowPatchingDone()) ? "" : "" ?>getWorkflowvalue('backbone_finished') != "1") ? "" : "" ?>getWorkflowvalue('bep_deployed') != "1") ? "" : "" ?>getWorkflowvalue('customer_cable_injected') != "1") ? "" : "" ?>getWorkflowvalue('spliced_network') != "1") ? "" : "" ?>getWorkflowvalue('spliced_customer') != "1") ? "" : "" ?>getWorkflowvalue('customer_passive_finished') != "1") ? "" : "" ?>
@@ -196,7 +248,7 @@ Nicht fertiggestellt.
+ "> @@ -321,6 +373,19 @@ + + + + + + + + + + + + +
AP-Typ
@@ -482,6 +547,14 @@ $(document).ready(function() { }); +function togglePipework(id) { + $("#termination-" + id).toggle(200); + $("#termination-" + id + "-summary td .name").toggle(); + $("#termination-" + id + "-summary td .up-arrow").toggle(); + $("#termination-" + id + "-bottom-header").toggle(); + $("#termination-" + id + "-top-header").toggle(); +} + function validateWorkflowItem(id) { var required_fields = { pop_id: "int", diff --git a/Layout/default/Linework/inline_history.php b/Layout/default/Linework/inline_history.php new file mode 100644 index 000000000..3489d301f --- /dev/null +++ b/Layout/default/Linework/inline_history.php @@ -0,0 +1,3 @@ + diff --git a/Layout/default/Voicenumber/Form.php b/Layout/default/Voicenumber/Form.php index 0d33fc08a..f3710b891 100644 --- a/Layout/default/Voicenumber/Form.php +++ b/Layout/default/Voicenumber/Form.php @@ -53,8 +53,8 @@
diff --git a/Layout/default/Voicenumberblock/include/block-detail.php b/Layout/default/Voicenumberblock/include/block-detail.php index f8dfae462..e6938a62a 100644 --- a/Layout/default/Voicenumberblock/include/block-detail.php +++ b/Layout/default/Voicenumberblock/include/block-detail.php @@ -26,7 +26,7 @@
routing?>routing)?> ported_out): ?> Exportiert diff --git a/Layout/default/menu.php b/Layout/default/menu.php index c20243e43..47cefdeec 100644 --- a/Layout/default/menu.php +++ b/Layout/default/menu.php @@ -87,7 +87,20 @@ - + diff --git a/application/Building/Building.php b/application/Building/Building.php index 822d6bd7e..f216558d0 100644 --- a/application/Building/Building.php +++ b/application/Building/Building.php @@ -79,9 +79,46 @@ class Building extends mfBaseModel { return $code; } - public function getWorkflowvalue($itemname, $type = "string") { + public function getWorkflowvalue($itemname, $type = false) { + $item = WorkflowitemModel::getFirst(['name' => $itemname]); + if(!$item->id) { + return null; + } + + switch($item->type) { + case "string": + $value_type = "string"; + break; + case "enum": + $value_type = "string"; + break; + case "gps": + $value_type = "string"; + break; + case "color": + $value_type = "string"; + break; + case "date": + $value_type = "string"; + break; + case "int": + $value_type = "int"; + break; + case "bool": + $value_type = "int"; + break; + case "file": + $value_type = "int"; + break; + case "text": + $value_type = "text"; + break; + default: + $value_type = "string"; + } + if(array_key_exists($itemname, $this->getProperty("workflowitems"))) { - return $this->getProperty("workflowitems")[$itemname]->value->{"value_$type"}; + return $this->getProperty("workflowitems")[$itemname]->value->{"value_$value_type"}; } return null; diff --git a/application/Contractconfig/ContractconfigController.php b/application/Contractconfig/ContractconfigController.php new file mode 100644 index 000000000..2a2178342 --- /dev/null +++ b/application/Contractconfig/ContractconfigController.php @@ -0,0 +1,23 @@ +needlogin=true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me",$me); + + if(!$me->is(["Admin"])) { + $this->redirect("Dashboard"); + } + } + + protected function indexAction() { + $groups = ContractconfigGroupModel::getAll(); + + $this->layout()->set("groups", $groups); + } + +} \ No newline at end of file diff --git a/application/ContractconfigGroup/ContractconfigGroup.php b/application/ContractconfigGroup/ContractconfigGroup.php new file mode 100644 index 000000000..66e425c03 --- /dev/null +++ b/application/ContractconfigGroup/ContractconfigGroup.php @@ -0,0 +1,30 @@ +$name == null) { + + if($name == "items") { + $this->items = ContractconfigItemModel::search(['group_id' => $this->id]); + return $this->items; + } + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = new $classname($this->$idfield); + + if($this->$name->id) { + return $this->$name; + } else { + return null; + } + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/ContractconfigGroup/ContractconfigGroupModel.php b/application/ContractconfigGroup/ContractconfigGroupModel.php new file mode 100644 index 000000000..77a41f055 --- /dev/null +++ b/application/ContractconfigGroup/ContractconfigGroupModel.php @@ -0,0 +1,114 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model ->$field = $value; + } + } + + $me = new User(); + $me->loadMe(); + + if($model->create_by === null) { + $model->create_by = $me->id; + } + if($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("ContractconfigGroup", "*", "1=1 ORDER BY name, `create`"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new ContractconfigGroup($data); + } + } + return $items; + + } + + public static function getFirst() { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("ContractconfigGroup", "*", "$where LIMIT 1"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new ContractconfigGroup($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("ContractconfigGroup", "*", "$where ORDER BY name, filename"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new ContractconfigGroup($data); + } + } + return $items; + } + + private function getSqlFilter($filter) { + $where = "1=1 "; + + //var_dump($filter);exit; + if(array_key_exists("name", $filter)) { + $name = FronkDB::singleton()->escape($filter['name']); + if($name) { + $where .= " AND name='$name'"; + } + } + + if(array_key_exists("filename", $filter)) { + $filename = FronkDB::singleton()->escape($filter['filename']); + if($filename) { + $where .= " AND filename='$filename'"; + } + } + + if(array_key_exists("subfolder", $filter)) { + $subfolder = FronkDB::singleton()->escape($filter['subfolder']); + if($subfolder) { + $where .= " AND subfolder='$subfolder'"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} \ No newline at end of file diff --git a/application/ContractconfigItem/ContractconfigItem.php b/application/ContractconfigItem/ContractconfigItem.php new file mode 100644 index 000000000..e6fb43949 --- /dev/null +++ b/application/ContractconfigItem/ContractconfigItem.php @@ -0,0 +1,5 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model ->$field = $value; + } + } + + $me = new User(); + $me->loadMe(); + + if($model->create_by === null) { + $model->create_by = $me->id; + } + if($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("ContractconfigItem", "*", "1=1 ORDER BY name, `create`"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new ContractconfigItem($data); + } + } + return $items; + + } + + public static function getFirst() { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("ContractconfigItem", "*", "$where LIMIT 1"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new ContractconfigItem($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("ContractconfigItem", "*", "$where ORDER BY name"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new ContractconfigItem($data); + } + } + return $items; + } + + private function getSqlFilter($filter) { + $where = "1=1 "; + + //var_dump($filter);exit; + if(array_key_exists("name", $filter)) { + $name = FronkDB::singleton()->escape($filter['name']); + if($name) { + $where .= " AND name='$name'"; + } + } + + if(array_key_exists("type", $filter)) { + $type = FronkDB::singleton()->escape($filter['type']); + if($type) { + $where .= " AND type='$type'"; + } + } + + if(array_key_exists("group_id", $filter)) { + $group_id = $filter['group_id']; + if(is_numeric($group_id)) { + $where .= " AND group_id=$group_id"; + } + } + + + //var_dump($filter, $where);exit; + return $where; + } + +} \ No newline at end of file diff --git a/application/ContractconfigValue/ContractconfigValue.php b/application/ContractconfigValue/ContractconfigValue.php new file mode 100644 index 000000000..c59f79872 --- /dev/null +++ b/application/ContractconfigValue/ContractconfigValue.php @@ -0,0 +1,5 @@ + $value) { + if(property_exists(get_called_class(), $field)) { + $model ->$field = $value; + } + } + + $me = new User(); + $me->loadMe(); + + if($model->create_by === null) { + $model->create_by = $me->id; + } + if($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getAll() { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("ContractconfigValue", "*", "1=1"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new ContractconfigValue($data); + } + } + return $items; + + } + + public static function getFirst() { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("ContractconfigValue", "*", "$where LIMIT 1"); + if($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new ContractconfigValue($data); + if($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("ContractconfigValue", "*", "$where ORDER BY name, filename"); + if($db->num_rows($res)) { + while($data = $db->fetch_object($res)) { + $items[] = new ContractconfigValue($data); + } + } + return $items; + } + + private function getSqlFilter($filter) { + $where = "1=1 "; + + //var_dump($filter);exit; + if(array_key_exists("name", $filter)) { + $name = FronkDB::singleton()->escape($filter['name']); + if($name) { + $where .= " AND name='$name'"; + } + } + + if(array_key_exists("filename", $filter)) { + $filename = FronkDB::singleton()->escape($filter['filename']); + if($filename) { + $where .= " AND filename='$filename'"; + } + } + + if(array_key_exists("subfolder", $filter)) { + $subfolder = FronkDB::singleton()->escape($filter['subfolder']); + if($subfolder) { + $where .= " AND subfolder='$subfolder'"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} \ No newline at end of file diff --git a/application/Linework/LineworkController.php b/application/Linework/LineworkController.php index 0cdb16b96..30d404507 100644 --- a/application/Linework/LineworkController.php +++ b/application/Linework/LineworkController.php @@ -25,7 +25,7 @@ class LineworkController extends mfBaseController { // pagination defaults $pagination = []; $pagination['start'] = 0; - $pagination['count'] = 5; + $pagination['count'] = 20; $pagination['maxItems'] = 0; if(is_numeric($this->request->s)) { diff --git a/application/Termination/Termination.php b/application/Termination/Termination.php index 8754a04d5..a5b094073 100644 --- a/application/Termination/Termination.php +++ b/application/Termination/Termination.php @@ -35,14 +35,79 @@ class Termination extends mfBaseModel { return $address; } - public function getWorkflowvalue($itemname, $type = "string") { + public function getWorkflowvalue($itemname, $type = false) { + $item = WorkflowitemModel::getFirst(['name' => $itemname]); + if(!$item->id) { + return null; + } + + switch($item->type) { + case "string": + $value_type = "string"; + break; + case "enum": + $value_type = "string"; + break; + case "gps": + $value_type = "string"; + break; + case "color": + $value_type = "string"; + break; + case "date": + $value_type = "string"; + break; + case "int": + $value_type = "int"; + break; + case "bool": + $value_type = "int"; + break; + case "file": + $value_type = "int"; + break; + case "text": + $value_type = "text"; + break; + default: + $value_type = "string"; + } + if(array_key_exists($itemname, $this->getProperty("workflowitems"))) { - return $this->getProperty("workflowitems")[$itemname]->value->{"value_$type"}; + return $this->getProperty("workflowitems")[$itemname]->value->{"value_$value_type"}; } return null; } + public function isWorkflowPatchingDone() { + $item_names = [ + 'pop_id', + 'schrank', + 'baugruppe', + 'modul', + 'ports', + 'abschlusstyp', + 'bb_kabel', + 'bb_kabel_steps', + 'bb_fasern', + 'kundenkabel_typ', + 'kundenkabel_fasern' + ]; + + $done = true; + + foreach($item_names as $name) { + $this->log->debug(__FILE__.": (Termination ".$this->id.") $name => $type == '".$this->getWorkflowvalue($name)."' (ist: '".$this->getWorkflowvalue("ist_".$name)."')"); + if(empty($this->getWorkflowvalue($name)) && empty($this->getWorkflowvalue("ist_".$name))) { + $done = false; + break; + } + } + + return $done; + } + public function getPop() { $pop_id = $this->getWorkflowvalue('pop_id'); if(!$pop_id) { diff --git a/lang/de.php b/lang/de.php index 5a8fd0734..b6cfc5596 100644 --- a/lang/de.php +++ b/lang/de.php @@ -35,4 +35,7 @@ $l['passed-t'] = "Fasern im Gebäude"; $l['connected-t'] = "Passiv erschlossen"; $l['active-t'] = "Internetprodukt aktiv"; +$l['kolmisoft'] = "VPORTAL (kolmisoft)"; +$l['sipit'] = "SCA (sipit)"; + $lang['de'] = $l; \ No newline at end of file