diff --git a/Layout/default/Address/View.php b/Layout/default/Address/View.php
index 278d8fb2c..4c5d12823 100644
--- a/Layout/default/Address/View.php
+++ b/Layout/default/Address/View.php
@@ -158,6 +158,15 @@
| RTR Code |
=(is_array($address->attributes) && array_key_exists("rtrcode", $address->attributes)) ? $address->attributes['rtrcode']->value : ""?> |
+
+ |
+ |
+
+ | Erstellt |
+ =date("d.m.Y H:i:s", $address->create)?> (=$address->creator->name?>) |
+
+ | Letzte Bearbeitung |
+ =date("d.m.Y H:i:s", $address->edit)?> (=$address->editor->name?>) |
diff --git a/application/Address/Address.php b/application/Address/Address.php
index e6b919121..8917b347d 100644
--- a/application/Address/Address.php
+++ b/application/Address/Address.php
@@ -17,7 +17,9 @@ class Address extends mfBaseModel {
private $active_contracts;
private $phoneparts;
-
+ private $creator;
+ private $editor;
+
protected function afterSave() {
// prevent potential infinite loop
if($this->in_after_save) return true;
@@ -647,16 +649,42 @@ class Address extends mfBaseModel {
}
return $this->links_to;
}
-
- $classname = ucfirst($name);
- $idfield = $name."_id";
- $this->$name = new $classname($this->$idfield);
-
- if($this->$name->id) {
- return $this->$name;
- } else {
- return null;
- }
+
+ if($name == "creator") {
+ $this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
+ if($this->creator === null) {
+ $this->creator = new User($this->create_by);
+ if($this->creator->id) {
+ mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
+ }
+ }
+ return $this->creator;
+ }
+
+ if($name == "editor") {
+ $this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
+ if($this->editor === null) {
+ $this->editor = new User($this->edit_by);
+ if($this->editor->id) {
+ mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
+ }
+ }
+ return $this->editor;
+ }
+
+ $classname = ucfirst($name);
+ $idfield = $name."_id";
+ $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
+ if(!$this->$name) {
+ $this->$name = new $classname($this->$idfield);
+ }
+
+ if($this->$name->id) {
+ mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
+ return $this->$name;
+ } else {
+ return null;
+ }
}
return $this->$name;