Added edit indication to workflow
This commit is contained in:
@@ -24,12 +24,17 @@ class Address extends mfBaseModel {
|
||||
|
||||
}
|
||||
|
||||
public function getCompanyOrName() {
|
||||
public function getCompanyOrName($returnParent = false) {
|
||||
if($returnParent && $this->parent_id) {
|
||||
return $this->getProperty("parent")->getCompanyOrName(true);
|
||||
}
|
||||
|
||||
if($this->company) {
|
||||
return $this->company;
|
||||
}
|
||||
return $this->getFullName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function loadAddresstypes() {
|
||||
|
||||
@@ -153,7 +153,7 @@ class BuildingModel {
|
||||
if(array_key_exists("code", $filter)) {
|
||||
$code = FronkDB::singleton()->escape($filter['code']);
|
||||
if($code) {
|
||||
$where .= "AND Building.`code`='$code'";
|
||||
$where .= " AND Building.`code`='$code'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,15 @@ class BuildingFileController extends mfBaseController {
|
||||
$this->redirect("Building");
|
||||
}
|
||||
|
||||
$building_id = $buildingfile->order_id;
|
||||
$building_id = $buildingfile->building_id;
|
||||
|
||||
$buildingfile->file->delete();
|
||||
$buildingfile->delete();
|
||||
|
||||
if($this->request->from == "pipework") {
|
||||
$this->redirect("Pipework", "Index", false, "object=".$building_id);
|
||||
}
|
||||
|
||||
$this->redirect("Building", "edit", ["id" => $building_id]);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,10 @@ class PipeworkController extends mfBaseController {
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Pipework/Index");
|
||||
|
||||
if($this->request->filter) {
|
||||
$filter = $this->getPreparedFilter($this->request->filter);
|
||||
}
|
||||
|
||||
// get allowed networks
|
||||
if($this->me->is("Admin")) {
|
||||
$my_networks = NetworkModel::getAll();
|
||||
@@ -35,6 +39,12 @@ class PipeworkController extends mfBaseController {
|
||||
"network_id" => $network->id,
|
||||
"workflow_finished" => 0
|
||||
];
|
||||
if(is_array($filter) && count($filter)) {
|
||||
$building_search = array_merge($building_search, $filter);
|
||||
}
|
||||
|
||||
$this->log->debug(print_r($building_search, true));
|
||||
|
||||
|
||||
foreach(BuildingModel::search($building_search) as $b) {
|
||||
if(!array_key_exists($b->id, $networks[$network->name])) {
|
||||
@@ -66,6 +76,10 @@ class PipeworkController extends mfBaseController {
|
||||
|
||||
}
|
||||
|
||||
private function getPreparedFilter($filter) {
|
||||
|
||||
return $filter;
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
@@ -182,7 +196,7 @@ class PipeworkController extends mfBaseController {
|
||||
}
|
||||
|
||||
$this->layout->setFlash("Workflow Eintrag erfolgreich gespeichert.", "success");
|
||||
$this->redirect("Pipework","Index", false, "wf-building-".$building_id);
|
||||
$this->redirect("Pipework","Index", false, "object=".$building_id);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class Workflowvalue extends mfBaseModel {
|
||||
private $item;
|
||||
private $changer;
|
||||
|
||||
public function setValue($value, $items) {
|
||||
$this->item = $this->getProperty("item");
|
||||
@@ -43,18 +44,33 @@ class Workflowvalue extends mfBaseModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->item->type == "gps") {
|
||||
if(is_array($value) && count($value) == 2) {
|
||||
$lat = $value['lat'];
|
||||
$long = $value['long'];
|
||||
$value = "$lat;$long";
|
||||
if($lat == null && $long == null) {
|
||||
$value = null;
|
||||
}
|
||||
} else {
|
||||
$value = "";
|
||||
$value = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($this->item->type == "bool" && $this->{"value_".$value_type} = null && $value == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($value == null && $this->{"value_".$value_type} == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
|
||||
|
||||
if($this->{"value_".$value_type} != $value) {
|
||||
$this->{"value_".$value_type} = $value;
|
||||
@@ -77,6 +93,15 @@ class Workflowvalue extends mfBaseModel {
|
||||
return $this->item;
|
||||
}
|
||||
|
||||
if($name == "changer") {
|
||||
if($this->changed && $this->changed_by) {
|
||||
$this->changer = new User($this->changed_by);
|
||||
return $this->changer;
|
||||
} else {
|
||||
return new Address();
|
||||
}
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
Reference in New Issue
Block a user