Deprecate price_overriden

This commit is contained in:
Deon George
2023-05-09 10:09:00 +09:00
parent a32e8e9d05
commit fe4bc3acef
6 changed files with 24 additions and 25 deletions

View File

@@ -41,7 +41,6 @@ use App\Traits\SiteID;
* + billed_to : When this service has been billed to // @todo rename all references to invoice_to
* + category : The type of service this is, eg: broadband, phone
* + category_name : The type of service this is, eg: Broadband, Telephone (in human friendly)
* + isChargedOverride : Has the price been overridden?
* + contract_term : The term that this service must be active
* + contract_end : The date that the contract ends for this service
* + name : Service short name with service address
@@ -51,10 +50,13 @@ use App\Traits\SiteID;
* + sid : System ID for service
* + supplied : The model of the supplier's product used for this service.
*
* Methods:
* + isChargeOverriden : Has the price been overridden?
* + isPending : Is this a pending active service
*
* @package App\Models
* @todo "Billing Start Date" = "connection date" for sub types??
* @todo Add min_charge
* @todo deprecate price_override, and if price < what would be billed, show it striked through, otherwise show it as if it was the price
* @todo Add charge_orig : The original chargeable price
*/
class Service extends Model implements IDs
{
@@ -1216,6 +1218,15 @@ class Service extends Model implements IDs
return ! ($this->external_billing || $this->suspend_billing || ($this->price === 0));
}
/**
* Has the price for this service been override
* @return bool
*/
public function isChargeOverriden(): bool
{
return ! is_null($this->price);
}
/**
* Should this service be invoiced soon
*
@@ -1239,11 +1250,6 @@ class Service extends Model implements IDs
AND ! in_array($this->order_status,array_merge(self::INACTIVE_STATUS,['INACTIVE']));
}
public function isChargeOverriden(): bool
{
return (! is_null($this->price)) || (! is_null($this->price_override));
}
/**
* Generate a collection of invoice_item objects that will be billed for the next invoice
*
@@ -1299,7 +1305,7 @@ class Service extends Model implements IDs
$o->product_id = $this->product_id;
$o->item_type = 0;
$o->price_base = is_null($this->price)
? (is_null($this->price_override) ? $this->product->getBaseChargeAttribute($this->recur_schedule,$this->account->group) : $this->price_override)
? (is_null($this->price) ? $this->product->getBaseChargeAttribute($this->recur_schedule,$this->account->group) : $this->price)
: $this->price; // @todo change to a method in this class
$o->recur_schedule = $this->recur_schedule;
$o->start_at = $this->invoice_next;