changes linework to openable list
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigGroup extends mfBaseModel {
|
||||
private $items;
|
||||
private $value;
|
||||
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigGroupModel {
|
||||
public $name;
|
||||
public $description;
|
||||
public $filename;
|
||||
public $store_filename;
|
||||
public $orig_filename;
|
||||
public $subfolder;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new ContractconfigGroup();
|
||||
|
||||
foreach($data as $field => $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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigItem extends mfBaseModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigItemModel {
|
||||
public $name;
|
||||
public $description;
|
||||
public $filename;
|
||||
public $store_filename;
|
||||
public $orig_filename;
|
||||
public $subfolder;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new ContractconfigItem();
|
||||
|
||||
foreach($data as $field => $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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigValue extends mfBaseModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
class ContractconfigValueModel {
|
||||
public $name;
|
||||
public $description;
|
||||
public $filename;
|
||||
public $store_filename;
|
||||
public $orig_filename;
|
||||
public $subfolder;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new ContractconfigValue();
|
||||
|
||||
foreach($data as $field => $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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user