extended workflow cache
This commit is contained in:
@@ -79,6 +79,14 @@ class Building extends mfBaseModel {
|
||||
return $code;
|
||||
}
|
||||
|
||||
public function loadWorkflowItems() {
|
||||
foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
mfValuecache::set("wfBuilding-".$item->name, $item);
|
||||
}
|
||||
}
|
||||
|
||||
public function getWorkflowvalue($itemname, $type = false) {
|
||||
$item = mfValuecache::get("wfBuilding-".$itemname);
|
||||
if(!$item) {
|
||||
@@ -190,6 +198,7 @@ class Building extends mfBaseModel {
|
||||
}
|
||||
|
||||
if($name == "workflowitems") {
|
||||
$this->loadWorkflowItems();
|
||||
foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
|
||||
@@ -35,6 +35,14 @@ class Termination extends mfBaseModel {
|
||||
return $address;
|
||||
}
|
||||
|
||||
public function loadWorkflowItems() {
|
||||
foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
mfValuecache::set("wfTerm-".$item->name, $item);
|
||||
}
|
||||
}
|
||||
|
||||
public function getWorkflowvalue($itemname, $type = false) {
|
||||
$item = mfValuecache::get("wfTerm-".$itemname);
|
||||
if(!$item) {
|
||||
@@ -239,10 +247,11 @@ class Termination extends mfBaseModel {
|
||||
}
|
||||
|
||||
if($name == "workflowitems") {
|
||||
foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
|
||||
$this->loadWorkflowItems();
|
||||
/*foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
}
|
||||
}*/
|
||||
//var_dump($this->workflowitems);exit;
|
||||
return $this->workflowitems;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user