Added creater/editer to Address/View
This commit is contained in:
@@ -158,6 +158,15 @@
|
|||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>RTR Code</th>
|
<th>RTR Code</th>
|
||||||
<td><?=(is_array($address->attributes) && array_key_exists("rtrcode", $address->attributes)) ? $address->attributes['rtrcode']->value : ""?></td>
|
<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>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ class Address extends mfBaseModel {
|
|||||||
private $active_contracts;
|
private $active_contracts;
|
||||||
|
|
||||||
private $phoneparts;
|
private $phoneparts;
|
||||||
|
private $creator;
|
||||||
|
private $editor;
|
||||||
|
|
||||||
protected function afterSave() {
|
protected function afterSave() {
|
||||||
// prevent potential infinite loop
|
// prevent potential infinite loop
|
||||||
if($this->in_after_save) return true;
|
if($this->in_after_save) return true;
|
||||||
@@ -647,16 +649,42 @@ class Address extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
return $this->links_to;
|
return $this->links_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
$classname = ucfirst($name);
|
if($name == "creator") {
|
||||||
$idfield = $name."_id";
|
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||||
$this->$name = new $classname($this->$idfield);
|
if($this->creator === null) {
|
||||||
|
$this->creator = new User($this->create_by);
|
||||||
if($this->$name->id) {
|
if($this->creator->id) {
|
||||||
return $this->$name;
|
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||||
} else {
|
}
|
||||||
return null;
|
}
|
||||||
}
|
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;
|
return $this->$name;
|
||||||
|
|||||||
Reference in New Issue
Block a user