Blesta Source Documentation

Packages extends AppModel

Package management

Table of Contents

Methods

__construct() Initialize Packages
add() Adds a new package to the system
checkInUse() Checks if the pricing it's in use
convertPricing() Convert pricing to the given currency if allowed
delete() Permanently removes the given package from the system. Packages can only be deleted if no services exist for that package.
edit() Update an existing package ID with the data given
formatPricingTerm() Formats the pricing term
get() Fetches the given package
getAll() Fetch all packages belonging to the given company
getAllAddonGroups() Returns all addon package groups for the given package group.
getAllGroups() Fetches all package groups belonging to a company, or optionally, all package groups belonging to a specific package
getAllPackagesByGroup() Fetches all packages belonging to a specific package group
getByPricingId() Fetches the given package by package pricing ID
getCompatiblePackages() Get all compatible packages
getDaysToProrate() Retrieves the number of days to prorate a service
getList() Fetches a list of all packages
getListCount() Return the total number of packages returned from Packages::getList(), useful in constructing pagination for the getList() method.
getPricingPeriods() Retrieves a list of package pricing periods
getProrataDates() Gets a list of dates for proration
getProrataDays() Retrieves a list of acceptable pro rata day options
getProrateDate() Retrieves the date to prorate a service to
getProratePrice() Retrieves the price to prorate a value given the date, term, and period to prorate from
getSearchCount() Return the total number of packages returned from Packages::search(), useful in constructing pagination
getStatusTypes() Retrieves a list of package status types
isDateAfterProrataCutoff() Determines whether the pro rata cutoff day has passed
isProrataDay() Determines whether the given start date is on the pro rata day
orderPackages() Save the packages for the given group in the provided order
search() Search packages
validateCurrency() Validates that the given currency is valid for adding/editing a package
validateGroup() Validates that the given group belongs to the given company ID
validateHasChildren() Validates whether the services belonging to a specific package has children NOT of the given status
validateModuleChange() Validates whether the given package can be changed to the given module
validateOptionGroup() Validates that the given group is valid
validateParse() Validate that the given email content parses template parsing
validatePeriod() Validates the pricing 'period' field type
validateServiceExists() Checks whether a service exists for a specific package ID
validateStatus() Validates the package 'status' field type
validateTerm() Validates that the term is valid for the period. That is, the term must be > 0 if the period is something other than "onetime".
addPackagePricing() Adds a pricing and package pricing record
addPlugins() Assigns the given plugin to the given package
appendGroupNamesDescriptions() Updates the given package group to set package names and descriptions
appendPackageContent() Updates the given package to set additional package information
appendPackageNamesDescriptions() Updates the given package to set package names and descriptions
editPackagePricing() Edit package pricing, removes any pricing with a missing term
formatRawMeta() Formats an array of raw meta stdClass objects into a stdClass object whose public member variables represent meta keys and whose values are automatically decrypted and unserialized as necessary.
getAPackagePricing() Fetches a single pricing, including its package's taxable status
getDefaultPricing() Retrieves the default pricing for each one of the currencies associated with this package
getGroupDescriptions() Fetches all descriptions created for the given package group
getGroupNames() Fetches all names created for the given package group
getPackageDescriptions() Fetches all descriptions created for the given package
getPackageEmails() Fetches all emails created for the given package
getPackageGroups() Fetches all package group assignment for the given package
getPackageMeta() Fetches all package meta data for the given package
getPackageModuleGroups() Fetches all package module groups assignment for the given package
getPackageNames() Fetches all names created for the given package
getPackageOptionGroups() Fetches all package option groups assigned to the given package
getPackagePlugins() Retrieves a list of plugin IDs associated with this package
getPackagePricing() Fetches all pricing for the given package
getPackages() Partially constructs the query required by both Packages::getList() and Packages::getListCount()
getPackageServices() Get all the services belonging to a specific package
getRules() Fetches the rules for adding/editing a package
getSelectFieldList() Gets a list a fields to fetch for packages
removeOptionGroups() Removes all package option groups assigned to this package
removePlugins() Removes all plugins assigned to this package
searchPackages() Partially constructs the query for searching packages
setDescriptions() Sets the multilingual package descriptions
setGroups() Removes all existing groups set for the given package, replaces them with the given list of groups
setMeta() Updates the meta data for the given package, removing all existing data and replacing it with the given data
setModuleGroups() Removes all existing module groups set for the given package, replaces them with the given list of module groups
setNames() Sets the multilingual package names
setOptionGroups() Assigns the given package option group to the given package
setParseError() Sets the parse error in the set of errors
Methods

__construct()

Initialize Packages

public __construct() : mixed

add()

Adds a new package to the system

public add(array<string|int, mixed> $vars) : int
Parameters
$vars : array<string|int, mixed>

An array of package information including:

  • module_id The ID of the module this package belongs to (optional, default NULL)
  • names A list of names for the package in different languages
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • name The name in the specified language
  • descriptions A list of descriptions in text and html for the package in different languages (optional, default NULL)
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • text The text description in the specified language
    • html The HTML description in the specified language
  • qty The maximum quantity available in this package, if any (optional, default NULL)
  • client_qty The maximum quantity available per client in this package, if any (optional, default NULL)
  • module_row The module row this package belongs to (optional, default 0)
  • module_group The module group this package belongs to (optional, default NULL)
  • module_groups An list of module groups available for this package (optional)
  • taxable Whether or not this package is taxable (optional, default 0)
  • single_term Whether or not services derived from this package should be canceled at the end of term (optional, default 0)
  • status The status of this package, 'active', 'inactive', 'restricted' (optional, default 'active')
  • hidden Whether or not to hide this package in the interface
    • 1 = true, 0 = false (optional, default 0)
  • company_id The ID of the company this package belongs to
  • prorata_day The prorated day of the month (optional, default NULL)
  • prorata_cutoff The day of the month pro rata should cut off (optional, default NULL)
  • email_content A numerically indexed array of email content including:
    • lang The language of the email content
    • html The html content for the email (optional)
    • text The text content for the email, will be created automatically from html if not given (optional)
  • pricing A numerically indexed array of pricing info including:
    • term The term as an integer 1-65535 (period should be given if this is set; optional, default 1)
    • period The period, 'day', 'week', 'month', 'year', 'onetime' (optional, default 'month')
    • price The price of this term (optional, default 0.00)
    • price_renews The renewal price of this term (optional, default null)
    • price_transfer The transfer price of this term (optional, default null)
    • setup_fee The setup fee for this package (optional, default 0.00)
    • cancel_fee The cancelation fee for this package (optional, default 0.00)
    • currency The ISO 4217 currency code for this pricing
  • groups A numerically indexed array of package group assignments (optional)
  • option_groups A numerically indexed array of package option group assignments (optional)
  • plugins A numerically-indexed array of valid plugin IDs to associate with the plugin (optional)
    • A set of miscellaneous fields to pass, in addition to the above fields, to the module when adding the package (optional)
Return values
int

The package ID created, void on error

checkInUse()

Checks if the pricing it's in use

public checkInUse(mixed $value, string $var[, int $pricing_id = null ]) : mixed
Parameters
$value : mixed

The value of the variable to validate

$var : string

The name of the variable to validate

$pricing_id : int = null

convertPricing()

Convert pricing to the given currency if allowed

public convertPricing(stdClass $pricing, string $currency, bool $allow_conversion) : mixed
Parameters
$pricing : stdClass

A stdClass object representing a package pricing

$currency : string

The ISO 4217 currency code to convert to

$allow_conversion : bool

True to allow conversion, false otherwise

Return values
mixed

The stdClass object representing the converted pricing (if conversion allowed), null otherwise

delete()

Permanently removes the given package from the system. Packages can only be deleted if no services exist for that package.

public delete(int $package_id[, bool $remove_services = false ]) : mixed
Parameters
$package_id : int

The package ID to delete

$remove_services : bool = false

True to remove all canceled services related to the package (optional, default false)

edit()

Update an existing package ID with the data given

public edit(int $package_id, array<string|int, mixed> $vars) : mixed
Parameters
$package_id : int

The ID of the package to update

$vars : array<string|int, mixed>

An array of package information including:

  • module_id The ID of the module this package belongs to (optional, default NULL)
  • names A list of names for the package in different languages
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • name The name in the specified language
  • descriptions A list of descriptions in text and html for the package in different languages (optional, default NULL)
    • lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
    • text The text description in the specified language
    • html The HTML description in the specified language
  • qty The maximum quantity available in this package, if any (optional, default NULL)
  • client_qty The maximum quantity available per client in this package, if any (optional, default NULL)
  • module_row The module row this package belongs to (optional, default 0)
  • module_group The module group this package belongs to (optional, default NULL)
  • module_groups An list of module groups available for this package (optional)
  • taxable Whether or not this package is taxable (optional, default 0)
  • single_term Whether or not services derived from this package should be canceled at the end of term (optional, default 0)
  • status The status of this package, 'active', 'inactive', 'restricted' (optional, default 'active')
  • hidden Whether or not to hide this package in the interface
    • 1 = true, 0 = false (optional, default 0)
  • company_id The ID of the company this package belongs to (optional)
  • prorata_day The prorated day of the month (optional)
  • prorata_cutoff The day of the month pro rata should cut off (optional)
  • email_content A numerically indexed array of email content including:
    • lang The language of the email content
    • html The html content for the email (optional)
    • text The text content for the email, will be created automatically from html if not given (optional)
  • pricing A numerically indexed array of pricing info including (required):
    • id The pricing ID (optional, required if an edit else will add as new)
    • term The term as an integer 1-65535 (period should be given if this is set; optional, default 1), if term is empty will remove this pricing option
    • period The period, 'day', 'week', 'month', 'year', 'onetime' (optional, default 'month')
    • price The price of this term (optional, default 0.00)
    • price_renews The renewal price of this term (optional, default null)
    • price_transfer The transfer price of this term (optional, default null)
    • setup_fee The setup fee for this package (optional, default 0.00)
    • cancel_fee The cancelation fee for this package (optional, default 0.00)
    • currency The ISO 4217 currency code for this pricing
  • groups A numerically indexed array of package group assignments (optional), if given will replace all package group assignments with those given
  • option_groups A numerically indexed array of package option group assignments (optional)
  • plugins A numerically-indexed array of valid plugin IDs to associate with the plugin (optional)
    • A set of miscellaneous fields to pass, in addition to the above fields, to the module when adding the package (optional)

formatPricingTerm()

Formats the pricing term

public formatPricingTerm(int $term, string $period) : mixed
Parameters
$term : int

The term length

$period : string

The period of this term

Return values
mixed

The term formatted in accordance to the period, if possible

get()

Fetches the given package

public get(int $package_id) : mixed
Parameters
$package_id : int

The package ID to fetch

Return values
mixed

A stdClass object representing the package, false if no such package exists

getAll()

Fetch all packages belonging to the given company

public getAll(int $company_id[, array<string|int, mixed> $order = ['name' => 'ASC'] ][, string $status = null ][, string $type = null ][, array<string|int, mixed> $filters = [] ]) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company to fetch pages for

$order : array<string|int, mixed> = ['name' => 'ASC']

The sort order in key = value order, where 'key' is the field to sort on and 'value' is the order to sort (asc or desc)

$status : string = null

The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)

$type : string = null

The type of packages to retrieve ('standard', 'addon', default null for all)

$filters : array<string|int, mixed> = []

A list of package filters including:

  • status The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)
  • name The name or part of the name of the packages to fetch
  • module_id The module ID to filter packages on
  • package_group_id The package group ID on which to filter packages
  • hidden Whether or nor to include the hidden packages
Return values
array<string|int, mixed>

An array of stdClass objects each representing a package

getAllAddonGroups()

Returns all addon package groups for the given package group.

public getAllAddonGroups(int $parent_group_id) : array<string|int, mixed>
Parameters
$parent_group_id : int

The ID of the parent package group

Return values
array<string|int, mixed>

A list of addon package groups

getAllGroups()

Fetches all package groups belonging to a company, or optionally, all package groups belonging to a specific package

public getAllGroups(int $company_id[, int $package_id = null ][, string $type = null ][, array<string|int, mixed> $filters = [] ]) : mixed
Parameters
$company_id : int

The company ID

$package_id : int = null

The package ID to fetch groups of (optional, default null)

$type : string = null

The type of group to fetch (null, standard, addon)

$filters : array<string|int, mixed> = []

A list of package groups filters including:

  • hidden Whether or nor to include the hidden package groups
Return values
mixed

An array of stdClass objects representing package groups, or false if none found

getAllPackagesByGroup()

Fetches all packages belonging to a specific package group

public getAllPackagesByGroup(int $package_group_id[, string $status = null ][, array<string|int, mixed> $filters = [] ]) : mixed
Parameters
$package_group_id : int

The ID of the package group

$status : string = null

The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)

$filters : array<string|int, mixed> = []

A list of package filters including:

  • status The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)
  • name The name or part of the name of the packages to fetch
  • module_id The module ID to filter packages on
  • hidden Whether or nor to include the hidden packages
Return values
mixed

An array of stdClass objects representing packages, or false if none exist

getByPricingId()

Fetches the given package by package pricing ID

public getByPricingId(int $package_pricing_id) : mixed
Parameters
$package_pricing_id : int

The package pricing ID to use to fetch the package

Return values
mixed

A stdClass object representing the package, false if no such package exists

getCompatiblePackages()

Get all compatible packages

public getCompatiblePackages(int $package_id, int $module_id, string $type) : array<string|int, mixed>
Parameters
$package_id : int

The ID of the package to fetch all compatible packages for

$module_id : int

The ID of the module to include compatible packages for

$type : string

The type of package group to include ("standard", "addon")

Return values
array<string|int, mixed>

An array of stdClass objects, each representing a compatible package and its pricing

getDaysToProrate()

Retrieves the number of days to prorate a service

public getDaysToProrate(string $start_date, string $period, int $pro_rata_day) : mixed
Parameters
$start_date : string

The date to start from

$period : string

The period associated with the service

$pro_rata_day : int

The day of the month to prorate to

Return values
mixed

The number of days to prorate, or boolean false if it cannot be determined

getList()

Fetches a list of all packages

public getList([int $page = 1 ][, array<string|int, mixed> $order_by = ['id_code' => 'asc'] ][, string $status = null ][, array<string|int, mixed> $filters = [] ]) : array<string|int, mixed>
Parameters
$page : int = 1

The page to return results for (optional, default 1)

$order_by : array<string|int, mixed> = ['id_code' => 'asc']

The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

$status : string = null

The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)

$filters : array<string|int, mixed> = []

A list of package filters including: (optional)

  • status The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)
  • name The name or part of the name of the packages to fetch
  • module_id The module ID to filter packages on
  • package_group_id The package group ID on which to filter packages
  • hidden Whether or nor to include the hidden packages
Return values
array<string|int, mixed>

An array of stdClass objects each representing a package

getListCount()

Return the total number of packages returned from Packages::getList(), useful in constructing pagination for the getList() method.

public getListCount([string $status = null ][, array<string|int, mixed> $filters = [] ]) : int
Parameters
$status : string = null

The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)

$filters : array<string|int, mixed> = []

A list of package filters including:

  • status The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)
  • name The name or part of the name of the packages to fetch
  • module_id The module ID to filter packages on
  • package_group_id The package group ID on which to filter packages
  • hidden Whether or nor to include the hidden packages
Tags
see
Packages::getList()
Return values
int

The total number of packages

getPricingPeriods()

Retrieves a list of package pricing periods

public getPricingPeriods([bool $plural = false ]) : array<string|int, mixed>
Parameters
$plural : bool = false

True to return language for plural periods, false for singular

Return values
array<string|int, mixed>

Key=>value pairs of package pricing periods

getProrataDates()

Gets a list of dates for proration

public getProrataDates(int $pricing_id, string $prorate_from_date, string $date_to_prorate) : mixed
Parameters
$pricing_id : int

The ID of the pricing to get the package and period from

$prorate_from_date : string

The date to base proration on

$date_to_prorate : string

The date to prorate

Return values
mixed

An array of dates for proration, false on failure

getProrataDays()

Retrieves a list of acceptable pro rata day options

public getProrataDays() : array<string|int, mixed>
Return values
array<string|int, mixed>

A set of key=>value pairs of pro rata days

getProrateDate()

Retrieves the date to prorate a service to

public getProrateDate(string $start_date, string $period, int $pro_rata_day) : mixed
Parameters
$start_date : string

The date to start from

$period : string

The period associated with the service

$pro_rata_day : int

The day of the month to prorate to

Return values
mixed

The prorated UTC end date; null if not prorating; or boolean false if it cannot be determined

getProratePrice()

Retrieves the price to prorate a value given the date, term, and period to prorate from

public getProratePrice(float $amount, string $start_date, int $term, string $period, int $pro_rata_day[, bool $allow_all_recurring_periods = false ][, string $prorate_date = null ]) : float
Parameters
$amount : float

The total cost for the given term and period

$start_date : string

The start date to calculate the price from

$term : int

The term length

$period : string

The period type (e.g. "month", "year")

$pro_rata_day : int

The day of the month to prorate to

$allow_all_recurring_periods : bool = false

True to allow all recurring periods, or false to limit to "month" and "year" only (optional, default false)

$prorate_date : string = null

The date to prorate to. Setting this value will ignore the $pro_rata_day (optional)

Return values
float

The prorate price

getSearchCount()

Return the total number of packages returned from Packages::search(), useful in constructing pagination

public getSearchCount(string $query) : mixed
Parameters
$query : string

The value to search services for

Tags
see
Packages::search()

getStatusTypes()

Retrieves a list of package status types

public getStatusTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

Key=>value pairs of package status types

isDateAfterProrataCutoff()

Determines whether the pro rata cutoff day has passed

public isDateAfterProrataCutoff(string $date, int $cutoff_day) : bool
Parameters
$date : string

The date to check

$cutoff_day : int

The day of the month representing the cutoff day

Return values
bool

True if the given date is after the pro rata cutoff day, or false otherwise

isProrataDay()

Determines whether the given start date is on the pro rata day

public isProrataDay(string $start_date, int $pro_rata_day) : bool
Parameters
$start_date : string

The start date

$pro_rata_day : int

The pro rata day of the month

Return values
bool

True if the given start date is the current pro rata day for the company's timezone, or false otherwise

orderPackages()

Save the packages for the given group in the provided order

public orderPackages(int $package_group_id, array<string|int, mixed> $package_ids) : mixed
Parameters
$package_group_id : int

The ID of the package group to order packages for

$package_ids : array<string|int, mixed>

A numerically indexed array of package IDs

Search packages

public search(string $query[, int $page = 1 ]) : array<string|int, mixed>
Parameters
$query : string

The value to search packages for

$page : int = 1

The page number of results to fetch (optional, default 1)

Return values
array<string|int, mixed>

An array of packages that match the search criteria

validateCurrency()

Validates that the given currency is valid for adding/editing a package

public validateCurrency(string $currency, string $term, string $period) : bool
Parameters
$currency : string

The ISO 4217 currency code for this pricing option

$term : string

The term for this pricing option

$period : string

The period type to validate the currency for

Return values
bool

True if the currency is valid, or false otherwise

validateGroup()

Validates that the given group belongs to the given company ID

public validateGroup(int $group_id, int $company_id) : bool
Parameters
$group_id : int

The ID of the group to test

$company_id : int

The ID of the company to validate exists for the given group

Return values
bool

True if validated, false otherwise

validateHasChildren()

Validates whether the services belonging to a specific package has children NOT of the given status

public validateHasChildren(int $package_id[, string $status = null ]) : bool
Parameters
$package_id : int

The package ID to check

$status : string = null

The status of children services to ignore (e.g. "canceled") (optional, default null to not ignore any child services)

Return values
bool

True if the services belonging to this package has children not of the given status, false otherwise

validateModuleChange()

Validates whether the given package can be changed to the given module

public validateModuleChange(int $module_id, int $package_id) : bool
Parameters
$module_id : int

The new module ID

$package_id : int

The ID of the package

Return values
bool

True if the package can be changed to the module, or false otherwise

validateOptionGroup()

Validates that the given group is valid

public validateOptionGroup(int $option_group_id, int $company_id) : bool
Parameters
$option_group_id : int

The ID of the package option group to validate

$company_id : int

The ID of the company whose option group to validate

Return values
bool

True if the package option group is valid, or false otherwise

validateParse()

Validate that the given email content parses template parsing

public validateParse(mixed $email_content) : mixed
Parameters
$email_content : mixed

validatePeriod()

Validates the pricing 'period' field type

public validatePeriod(string $period) : bool
Parameters
$period : string

The period type

Return values
bool

True if validated, false otherwise

validateServiceExists()

Checks whether a service exists for a specific package ID

public validateServiceExists(int $package_id[, bool $exclude_canceled = false ]) : bool
Parameters
$package_id : int

The package ID to check

$exclude_canceled : bool = false

True to exclude canceled services (optional, default false)

Return values
bool

True if a service exists for this package, false otherwise

validateStatus()

Validates the package 'status' field type

public validateStatus(string $status) : bool
Parameters
$status : string

The status type

Return values
bool

True if validated, false otherwise

validateTerm()

Validates that the term is valid for the period. That is, the term must be > 0 if the period is something other than "onetime".

public validateTerm(int $term, string $period) : bool
Parameters
$term : int

The Term to validate

$period : string

The period to validate the term against

Return values
bool

True if validated, false otherwise

addPackagePricing()

Adds a pricing and package pricing record

private addPackagePricing(mixed $package_id, array<string|int, mixed> $vars) : int
Parameters
$package_id : mixed
$vars : array<string|int, mixed>

An array of pricing info including:

  • company_id The company ID to add pricing for
  • term The term as an integer 1-65535 (optional, default 1)
  • period The period, 'day', 'week', 'month', 'year', 'onetime' (optional, default 'month')
  • price The price of this term (optional, default 0.00)
  • setup_fee The setup fee for this package (optional, default 0.00)
  • cancel_fee The cancelation fee for this package (optional, default 0.00)
  • default Whether or not this is the default pricing for this package (optional)
  • currency The ISO 4217 currency code for this pricing (optional, default USD)
Return values
int

The package pricing ID

addPlugins()

Assigns the given plugin to the given package

private addPlugins(int $package_id, array<string|int, mixed> $plugins) : mixed
Parameters
$package_id : int

The ID of the package

$plugins : array<string|int, mixed>

A numerically-indexed array of plugins to assign

appendGroupNamesDescriptions()

Updates the given package group to set package names and descriptions

private appendGroupNamesDescriptions(stdClass $package_group) : stdClass
Parameters
$package_group : stdClass

The package_group to update, containing at minimum:

  • id The package group ID
Return values
stdClass

The updated package group

appendPackageContent()

Updates the given package to set additional package information

private appendPackageContent(stdClass $package) : stdClass
Parameters
$package : stdClass

The package to update, containing at minimum:

  • id The package ID
Return values
stdClass

The updated package

appendPackageNamesDescriptions()

Updates the given package to set package names and descriptions

private appendPackageNamesDescriptions(stdClass $package) : stdClass
Parameters
$package : stdClass

The package to update, containing at minimum:

  • id The package ID
Return values
stdClass

The updated package

editPackagePricing()

Edit package pricing, removes any pricing with a missing term

private editPackagePricing(int $package_pricing_id, array<string|int, mixed> $vars) : mixed
Parameters
$package_pricing_id : int

The package pricing ID to update

$vars : array<string|int, mixed>

An array of pricing info including:

  • package_id The package ID to add pricing for
  • company_id The company ID to add pricing for
  • term The term as an integer 1-65535 (optional, default 1)
  • period The period, 'day', 'week', 'month', 'year', 'onetime' (optional, default 'month')
  • price The price of this term (optional, default 0.00)
  • price_renews The renewal price of this term (optional, default null)
  • price_transfer The transfer price of this term (optional, default null)
  • setup_fee The setup fee for this package (optional, default 0.00)
  • cancel_fee The cancelation fee for this package (optional, default 0.00)
  • default Whether or not this is the default pricing for this package (optional)
  • currency The ISO 4217 currency code for this pricing (optional, default USD)

formatRawMeta()

Formats an array of raw meta stdClass objects into a stdClass object whose public member variables represent meta keys and whose values are automatically decrypted and unserialized as necessary.

private formatRawMeta(array<string|int, mixed> $raw_meta) : mixed
Parameters
$raw_meta : array<string|int, mixed>

An array of stdClass objects representing meta data

getAPackagePricing()

Fetches a single pricing, including its package's taxable status

private getAPackagePricing(int $package_pricing_id) : mixed
Parameters
$package_pricing_id : int

The ID of the package pricing to fetch

Return values
mixed

A stdClass object representing the package pricing, false if no such package pricing exists

getDefaultPricing()

Retrieves the default pricing for each one of the currencies associated with this package

private getDefaultPricing(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The ID of the package to fetch the default pricing

Return values
array<string|int, mixed>

An array of default pricing associated with this package, where the key is the currency and the value the pricing ID

getGroupDescriptions()

Fetches all descriptions created for the given package group

private getGroupDescriptions(int $package_group_id) : array<string|int, mixed>
Parameters
$package_group_id : int

The package group ID to fetch descriptions for

Return values
array<string|int, mixed>

An array of stdClass objects representing group descriptions

getGroupNames()

Fetches all names created for the given package group

private getGroupNames(int $package_group_id) : array<string|int, mixed>
Parameters
$package_group_id : int

The package group ID to fetch names for

Return values
array<string|int, mixed>

An array of stdClass objects representing group names

getPackageDescriptions()

Fetches all descriptions created for the given package

private getPackageDescriptions(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch descriptions for

Return values
array<string|int, mixed>

An array of stdClass objects representing package descriptions

getPackageEmails()

Fetches all emails created for the given package

private getPackageEmails(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch email for

Return values
array<string|int, mixed>

An array of stdClass objects representing email content

getPackageGroups()

Fetches all package group assignment for the given package

private getPackageGroups(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch pricing for

Return values
array<string|int, mixed>

An array of stdClass objects representing package groups

getPackageMeta()

Fetches all package meta data for the given package

private getPackageMeta(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch meta data for

Return values
array<string|int, mixed>

An array of stdClass objects representing package meta data

getPackageModuleGroups()

Fetches all package module groups assignment for the given package

private getPackageModuleGroups(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch the module groups for

Return values
array<string|int, mixed>

An array of stdClass objects representing package module groups

getPackageNames()

Fetches all names created for the given package

private getPackageNames(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch names for

Return values
array<string|int, mixed>

An array of stdClass objects representing package names

getPackageOptionGroups()

Fetches all package option groups assigned to the given package

private getPackageOptionGroups(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch option groups for

Return values
array<string|int, mixed>

An array of stdClass objects representing package option groups

getPackagePlugins()

Retrieves a list of plugin IDs associated with this package

private getPackagePlugins(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The ID of the package whose plugins to fetch

Return values
array<string|int, mixed>

An array of package plugins associated with this package

getPackagePricing()

Fetches all pricing for the given package

private getPackagePricing(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch pricing for

Return values
array<string|int, mixed>

An array of stdClass objects representing package pricing

getPackages()

Partially constructs the query required by both Packages::getList() and Packages::getListCount()

private getPackages([array<string|int, mixed> $filters = [] ]) : Record
Parameters
$filters : array<string|int, mixed> = []

A list of package filters including:

  • status The status type of packages to retrieve ('active', 'inactive', 'restricted', default null for all)
  • name The name or part of the name of the packages to fetch
  • module_id The module ID to filter packages on
  • package_group_id The package group ID on which to filter packages
  • hidden Whether or nor to include the hidden packages
Return values
Record

The partially constructed query Record object

getPackageServices()

Get all the services belonging to a specific package

private getPackageServices(int $package_id) : array<string|int, mixed>
Parameters
$package_id : int

The package ID to fetch the services

Return values
array<string|int, mixed>

A numerically indexed array of objects containing the services

getRules()

Fetches the rules for adding/editing a package

private getRules(mixed $vars[, bool $edit = false ][, int $package_id = null ]) : array<string|int, mixed>
Parameters
$vars : mixed
$edit : bool = false

True to fetch the edit rules, or false for the add rules

$package_id : int = null

The ID of the package being updated (on edit)

Return values
array<string|int, mixed>

The package rules

getSelectFieldList()

Gets a list a fields to fetch for packages

private getSelectFieldList() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list a fields to fetch for packages

removeOptionGroups()

Removes all package option groups assigned to this package

private removeOptionGroups(int $package_id) : mixed
Parameters
$package_id : int

The ID of the package

removePlugins()

Removes all plugins assigned to this package

private removePlugins(int $package_id) : mixed
Parameters
$package_id : int

The ID of the package

searchPackages()

Partially constructs the query for searching packages

private searchPackages(string $query) : Record
Parameters
$query : string

The value to search packages for

Tags
see

Packages::search(), Packages::getSearchCount()

Return values
Record

The partially constructed query Record object

setDescriptions()

Sets the multilingual package descriptions

private setDescriptions(int $package_id, array<string|int, mixed> $descriptions) : mixed
Parameters
$package_id : int

The ID of the package to set the names for

$descriptions : array<string|int, mixed>

An array including:

  • lang The language code (e.g. 'en_us')
  • text The text in the specified language
  • html The HTML in the specified language

setGroups()

Removes all existing groups set for the given package, replaces them with the given list of groups

private setGroups(int $package_id[, array<string|int, mixed> $groups = null ]) : mixed
Parameters
$package_id : int

The package to replace groups on

$groups : array<string|int, mixed> = null

A numerically-indexed array of group IDs to add to the package (optional)

setMeta()

Updates the meta data for the given package, removing all existing data and replacing it with the given data

private setMeta(int $package_id, array<string|int, mixed> $vars) : mixed
Parameters
$package_id : int

The ID of the package to update

$vars : array<string|int, mixed>

A numerically indexed array of meta data containing:

  • key The key for this meta field
  • value The value for this key
  • encrypted Whether or not this field should be encrypted (default 0, not encrypted)

setModuleGroups()

Removes all existing module groups set for the given package, replaces them with the given list of module groups

private setModuleGroups(int $package_id[, array<string|int, mixed> $module_groups = null ]) : mixed
Parameters
$package_id : int

The package to replace module groups on

$module_groups : array<string|int, mixed> = null

A numerically-indexed array of module group IDs to add to the package (optional)

setNames()

Sets the multilingual package names

private setNames(int $package_id, array<string|int, mixed> $names) : mixed
Parameters
$package_id : int

The ID of the package to set the names for

$names : array<string|int, mixed>

An array including:

  • lang The language code (e.g. 'en_us')
  • name The name in the specified language

setOptionGroups()

Assigns the given package option group to the given package

private setOptionGroups(int $package_id, array<string|int, mixed> $option_groups) : mixed
Parameters
$package_id : int

The ID of the package to be assigned the option group

$option_groups : array<string|int, mixed>

A numerically-indexed array of package option groups to assign

setParseError()

Sets the parse error in the set of errors

private setParseError() : mixed
Tags
subpackage

app.models

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results