Move base_cost/base_charge product::class methods into __get(), and base_charge(), no functional changes

This commit is contained in:
2025-05-22 11:55:09 +10:00
parent c8f1c97078
commit 04ae35b1dd
8 changed files with 31 additions and 38 deletions

View File

@@ -291,7 +291,7 @@ class Service extends Model implements IDs
'billing_cost_orig_normalised_taxed' => $this->billing_cost_orig_taxed*Invoice::billing_change($this->product->type->billing_interval,Invoice::BILL_MONTHLY),
'billing_cost_orig_taxed' => $this->account->taxed($this->billing_cost_orig),
'billing_charge_orig' => $this->product->getBaseChargeAttribute($this->billing_interval,$this->account->group),
'billing_charge_orig' => $this->product->base_charge($this->billing_interval,$this->account->group),
'billing_charge_orig_normalised_taxed' => $this->billing_charge_orig_taxed*Invoice::billing_change($this->billing_interval,Invoice::BILL_MONTHLY),
'billing_charge_orig_taxed' => $this->account->taxed($this->billing_charge_orig),
'billing_charge' => $this->billing_charge(),
@@ -908,7 +908,7 @@ class Service extends Model implements IDs
private function billing_cost(): float
{
return is_null($this->cost)
? $this->product->getBaseCostAttribute()
? $this->product->base_cost
: $this->cost*Invoice::billing_change($this->product->type->billing_interval,$this->billing_interval);
}