Added Credit CSV download to Invoice/Index

This commit is contained in:
Frank Schubert
2024-07-12 18:57:46 +02:00
parent 1ca399786f
commit 5e5e4de27d
5 changed files with 103 additions and 51 deletions

View File

@@ -1,6 +1,8 @@
<?php
class Invoiceposition extends mfBaseModel {
private $invoice;
private $contract;
public function setOption($name, $value) {
$options = $this->getOptions;
@@ -65,4 +67,52 @@ class Invoiceposition extends mfBaseModel {
//$this->log->debug("Cloned Invoiceposition $old_id");
}
public function getProperty($name) {
if($this->$name == null) {
if(!$this->id) {
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;
}
}