Contractqueue: commit to Contract finished
This commit is contained in:
@@ -526,7 +526,7 @@ class Address extends mfBaseModel {
|
||||
|
||||
if($name == "permissions") {
|
||||
$this->permissions = NetworkAddressModel::search(['address_id' => $this->id]);
|
||||
return $permissions;
|
||||
return $this->permissions;
|
||||
}
|
||||
|
||||
if($name == "parent") {
|
||||
@@ -540,16 +540,36 @@ class Address extends mfBaseModel {
|
||||
}
|
||||
|
||||
if($name == "contracts") {
|
||||
$owning = ContractModel::search(['owner_id' => $this->id]);
|
||||
$billing = ContractModel::search(['billingaddress_id' => $this->id]);
|
||||
$this->contracts = array_merge($owning, $billing);
|
||||
$contracts = [];
|
||||
foreach(ContractModel::search(['owner_id' => $this->id]) as $contract) {
|
||||
if(!array_key_exists($contract->id, $contracts)) {
|
||||
$contracts[$contract->id] = $contract;
|
||||
}
|
||||
}
|
||||
foreach(ContractModel::search(['billingaddress_id' => $this->id]) as $contract) {
|
||||
if(!array_key_exists($contract->id, $contracts)) {
|
||||
$contracts[$contract->id] = $contract;
|
||||
}
|
||||
}
|
||||
|
||||
$this->contracts = $contracts;
|
||||
return $this->contracts;
|
||||
}
|
||||
|
||||
if($name == "active_contracts") {
|
||||
$owning = ContractModel::searchActive(['owner_id' => $this->id]);
|
||||
$billing = ContractModel::searchActive(['billingaddress_id' => $this->id]);
|
||||
$this->contracts = array_merge($owning, $billing);
|
||||
$contracts = [];
|
||||
foreach(ContractModel::searchActive(['owner_id' => $this->id]) as $contract) {
|
||||
if(!array_key_exists($contract->id, $contracts)) {
|
||||
$contracts[$contract->id] = $contract;
|
||||
}
|
||||
}
|
||||
foreach(ContractModel::searchActive(['billingaddress_id' => $this->id]) as $contract) {
|
||||
if(!array_key_exists($contract->id, $contracts)) {
|
||||
$contracts[$contract->id] = $contract;
|
||||
}
|
||||
}
|
||||
|
||||
$this->contracts = $contracts;
|
||||
return $this->contracts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user