Class ServiceChanges
Service upgrades/downgrades
-
Model
-
AppModel
-
ServiceChanges
Methods summary
public
|
#
__construct( )
Initialize language
Overrides
|
public
integer
|
#
add( mixed $service_id, mixed $invoice_id, array $vars )
Queues a pending service change entry
Queues a pending service change entry
Parameters
- $service_id
mixed $service_id The service ID
- $invoice_id
mixed $invoice_id The ID of the invoice
- $vars
array $vars An array of information including: - data An array of input data used
later to process the service change
Returns
integer The service change ID on success, or void on failure
|
public
|
#
edit( integer $service_change_id, array $vars )
Updates a service change entry
Updates a service change entry
Parameters
- $service_change_id
integer $service_change_id The ID of the service change to update
- $vars
array $vars An array of fields to update: - status The service change status (one of:
'pending', 'canceled', 'error', 'completed')
|
public
mixed
|
#
get( integer $service_change_id )
Retrieves a service change
Retrieves a service change
Parameters
- $service_change_id
integer $service_change_id The ID of the service change to update
Returns
mixed An stdClass object representing the service change, or false otherwise
|
public
array
|
#
getAll( mixed $status = null, integer $service_id = null )
Retrieves a list of all service change entries of the given status
Retrieves a list of all service change entries of the given status
Parameters
- $status
mixed $status The status of the service changes to fetch, or null for all
- $service_id
integer $service_id The ID of the service the service change belongs to (optional)
Returns
array A list of service change entries
|
public
|
#
process( integer $service_change_id )
Processes the pending service change by updating the service
Processes the pending service change by updating the service
Parameters
- $service_change_id
integer $service_change_id The ID of the pending service change to update
|
public
mixed
|
#
getItems( integer $service_id, array $vars )
Retrieves a set of items, discounts, and taxes for a service change (i.e.
upgrade/downgrade)
Retrieves a set of items, discounts, and taxes for a service change (i.e.
upgrade/downgrade)
Parameters
- $service_id
integer $service_id The ID of the service to change
- $vars
array $vars An array of input representing the new service changes - configoptions An
array of key/value pairs where each key is an option ID and each value is the
selected value - pricing_id The ID of the new pricing selected - coupon_code A
new coupon code to use
Returns
mixed Boolean false if no valid service is given, otherwise an array of formatted
items, discounts, and taxes from the PricingPresenter: - items An array of each
item removed and added for this change, including - price The unit price of the
item - qty The quantity of the item - description The description of the item -
discounts An array of all applying discounts, including - amount The amount of
the discount - type The type of the discount - description A description of the
discount - apply An array of indices referencing items to which the discount
applies - taxes An array of arrays of each tax group containing tax rules that
apply, including: - amount The amount of the tax - type The type of tax -
description The tax description - apply An array of indices referencing items to
which the tax applies
|
public
array
|
#
getStatuses( )
Retrieves a list of available service change statuses and their language
Retrieves a list of available service change statuses and their language
Returns
array A list of service change statuses and their language
|
Methods inherited from AppModel
_(),
boolToInt(),
currencyToDecimal(),
dateToUtc(),
errors(),
getPerPage(),
ifSet(),
loadCrypto(),
setDefaultIfEmpty(),
setPerPage(),
setRulesIfSet(),
strToBool(),
systemDecrypt(),
systemEncrypt(),
systemHash(),
truncateDecimal(),
validateExists(),
validateStateCountry()
Methods inherited from Model
affectedRows(),
begin(),
commit(),
getConnection(),
lastInsertId(),
makeDSN(),
prepare(),
query(),
rollBack(),
setAttribute(),
setFetchMode()
Magic methods summary
Properties summary
Properties inherited from AppModel
$replacement_keys