Added creater/editer to Address/View
This commit is contained in:
@@ -158,6 +158,15 @@
|
||||
</tr><tr>
|
||||
<th>RTR Code</th>
|
||||
<td><?=(is_array($address->attributes) && array_key_exists("rtrcode", $address->attributes)) ? $address->attributes['rtrcode']->value : ""?></td>
|
||||
</tr><tr>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<th>Erstellt</th>
|
||||
<td class="text-monospace"><?=date("d.m.Y H:i:s", $address->create)?> (<?=$address->creator->name?>)</td>
|
||||
</tr><tr>
|
||||
<th>Letzte Bearbeitung</th>
|
||||
<td class="text-monospace"><?=date("d.m.Y H:i:s", $address->edit)?> (<?=$address->editor->name?>)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user