ConstructionConsentProject: Added company permissions

This commit is contained in:
Frank Schubert
2025-02-11 14:32:02 +01:00
parent 3520642930
commit b5124f3dab
4 changed files with 92 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ class ConstructionConsentProject extends mfBaseModel {
private $consents;
private $networks;
private $adb_networks;
private $addresses;
protected function beforeUpdate($data) {
if(!array_key_exists("edit_by", $data)) {
@@ -18,11 +19,21 @@ class ConstructionConsentProject extends mfBaseModel {
public function getProperty($name) {
if($this->$name == null) {
if($name == "addresses") {
$addresses = ConstructionConsentProjectAddress::search(["constructionconsentproject_id" => $this->id]);
if(!count($addresses)) {
return [];
}
foreach($addresses as $address) {
$this->addresses[$address->address->id] = $address;
}
return $this->addresses;
}
if($name == "consents") {
$consents = ConstructionConsent::search(["constructionconsentproject_id" => $this->id]);
if(!$consents) {
return [];
}
$this->consents = $consents;
return $this->consents;