Completed 300-custom-new-order Mailtemplate handling for RML

This commit is contained in:
Frank Schubert
2025-06-13 05:40:17 +02:00
parent 05fe36679f
commit fdcac66a84
5 changed files with 140 additions and 17 deletions
+30 -1
View File
@@ -414,7 +414,7 @@ class Preorder extends mfBaseModel {
return $to;
}
private function getPropertiesAsArray() {
public function getPropertiesAsArray() {
$preorder = clone $this;
unset($preorder->data, $preorder->_old_data, $preorder->db, $preorder->log);
$status = $this->getProperty("status");
@@ -426,6 +426,11 @@ class Preorder extends mfBaseModel {
if(substr($key, 0, 1) == "\0") continue;
$return[$key] = $value;
}
$return["status_code"] = $status->code;
$return["status_name"] = $status->name;
$return["contact_fullname"] = $this->getCompanyOrName();
return $return;
}
@@ -635,6 +640,30 @@ class Preorder extends mfBaseModel {
return true;
}
public function getCompanyOrName() {
$company = trim($this->company);
if($company) {
return $company;
}
return $this->getFullName();
}
public function getFullName() {
// Assumes "Firma1 Firma2" or "firstname lastname" as readable form
$name = "";
if($this->firstname && $this->lastname) {
$name = $this->firstname . " " . $this->lastname;
} elseif($this->lastname) {
$name = $this->lastname;
} elseif($this->firstname) {
$name = $this->firstname;
}
return $name;
}
public function setOrCreateOaid($oaid_attributes = false) {
$campaign = new Preordercampaign($this->preordercampaign_id);
//var_dump($campaign);exit;