| 
				 public 
				
				
				 | 
			#
			__construct( )
				
Initialize Packages Overrides | 
		
			| 
				 public 
				integer
				
				 | 
			#
			add( array $vars )
				
Adds a new package to the system 
				
Adds a new package to the system Parameters
						$varsarray$vars An array of package information including: - module_id The ID of the
module this package belongs to (optional, default NULL) - name The name of the
package - description The description of the package (optional, default NULL) -
description_html The HTML description of the package (optional, default NULL) -
qty The maximum quantity available 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)
- 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') - 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) - 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) - * A set of miscellaneous fields to pass,
in addition to the above fields, to the module when adding the package
(optional)
Returns
						integerThe package ID created, void on error
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			edit( integer $package_id, array $vars )
				
Update an existing package ID with the data given 
				
Update an existing package ID with the data given Parameters
						$package_idinteger$package_id The ID of the package to update
$varsarray$vars An array of package information including: - module_id The ID of the
module this package belongs to (optional, default NULL) - name The name of the
package - description The description of the package (optional, default NULL) -
description_html The HTML description of the package (optional, default NULL) -
qty The maximum quantity available 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)
- 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') - 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) - 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) - * A set of miscellaneous fields to pass, in addition to the above
fields, to the module when adding the package (optional)
 | 
		
			| 
				 public 
				
				
				 | 
			#
			delete( integer $package_id )
				
Permanently removes the given package from the system. Packages can only be
deleted if no services exist for that package. 
				
Permanently removes the given package from the system. Packages can only be
deleted if no services exist for that package. Parameters
						$package_idinteger$package_id The package ID to delete
 | 
		
			| 
				 public 
				
				
				 | 
			#
			orderPackages( integer $package_group_id, array $package_ids )
				
Save the packages for the given group in the provided order 
				
Save the packages for the given group in the provided order Parameters
						$package_group_idinteger$package_group_id The ID of the package group to order packages for
$package_idsarray$package_ids A numerically indexed array of package IDs
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			get( integer $package_id )
				
Fetches the given package 
				
Fetches the given package Parameters
						$package_idinteger$package_id The package ID to fetch
Returns
						mixedA stdClass object representing the package, false if no such package exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getByPricingId( integer $package_pricing_id )
				
Fetches the given package by package pricing ID 
				
Fetches the given package by package pricing ID Parameters
						$package_pricing_idinteger$package_pricing_id The package pricing ID to use to fetch the package
Returns
						mixedA stdClass object representing the package, false if no such package exists
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAll( integer $company_id, array $order = array('name'=>"ASC"), string $status = null, string $type = null )
				
Fetch all packages belonging to the given company 
				
Fetch all packages belonging to the given company Parameters
						$company_idinteger$company_id The ID of the company to fetch pages for
$orderarray$order 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)
$statusstring$status The status type of packages to retrieve ('active', 'inactive',
'restricted', default null for all)
$typestring$type The type of packages to retrieve ('standard', 'addon', default null for
all)
Returns
						arrayAn array of stdClass objects each representing a package
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getList( integer $page = 1, array $order_by = array('id_code'=>"asc"), string $status = null )
				
Fetches a list of all packages 
				
Fetches a list of all packages Parameters
						$pageinteger$page The page to return results for (optional, default 1)
$order_byarray$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
$statusstring$status The status type of packages to retrieve ('active', 'inactive',
'restricted', default null for all)
Returns
						arrayAn array of stdClass objects each representing a package
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			search( string $query, integer $page = 1 )
				
Search packages Parameters
						$querystring$query The value to search packages for
$pageinteger$page The page number of results to fetch (optional, default 1)
Returns
						arrayAn array of packages that match the search criteria
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			getSearchCount( string $query )
				
Return the total number of packages returned from Packages::search(), useful
in constructing pagination 
				
Return the total number of packages returned from Packages::search(), useful
in constructing pagination Parameters
						$querystring$query The value to search services for
See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getPricingPeriods( boolean $plural = false )
				
Retrieves a list of package pricing periods 
				
Retrieves a list of package pricing periods Parameters
						$pluralboolean$plural True to return language for plural periods, false for singular
Returns
						arrayKey=>value pairs of package pricing periods
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getStatusTypes( )
				
Retrieves a list of package status types 
				
Retrieves a list of package status types Returns
						arrayKey=>value pairs of package status types
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getProrataDays( )
				
Retrieves a list of acceptable pro rata day options 
				
Retrieves a list of acceptable pro rata day options Returns
						arrayA set of key=>value pairs of pro rata days
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			isDateAfterProrataCutoff( string $date, integer $cutoff_day )
				
Determines whether the pro rata cutoff day has passed 
				
Determines whether the pro rata cutoff day has passed Parameters
						$datestring$date The date to check
$cutoff_dayinteger$cutoff_day The day of the month representing the cutoff day
Returns
						booleanTrue if the given date is after the pro rata cutoff day, or false otherwise
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getProrateDate( string $start_date, string $period, integer $pro_rata_day )
				
Retrieves the date to prorate a service to 
				
Retrieves the date to prorate a service to Parameters
						$start_datestring$start_date The date to start from
$periodstring$period The period associated with the service
$pro_rata_dayinteger$pro_rata_day The day of the month to prorate to
Returns
						mixedThe prorated UTC end date; null if not prorating; or boolean false if it cannot
be determined
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			isProrataDay( string $start_date, integer $pro_rata_day )
				
Determines whether the given start date is on the pro rata day 
				
Determines whether the given start date is on the pro rata day Parameters
						$start_datestring$start_date The start date
$pro_rata_dayinteger$pro_rata_day The pro rata day of the month
Returns
						booleanTrue if the given start date is the current pro rata day for the company's
timezone, or false otherwise
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getDaysToProrate( string $start_date, string $period, integer $pro_rata_day )
				
Retrieves the number of days to prorate a service 
				
Retrieves the number of days to prorate a service Parameters
						$start_datestring$start_date The date to start from
$periodstring$period The period associated with the service
$pro_rata_dayinteger$pro_rata_day The day of the month to prorate to
Returns
						mixedThe number of days to prorate, or boolean false if it cannot be determined
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getDaysToProrateBetween( string $start_date, string $end_date )
				
Retrieves the number of days between the two given dates 
				
Retrieves the number of days between the two given dates Deprecated
							since 3.5.0
 Parameters
						$start_datestring$start_date The start date
$end_datestring$end_date The end date
Returns
						integerThe number of days between the dates
 
 | 
		
			| 
				 public 
				float
				
				 | 
			#
			getProrateAmount( float $amount, integer $prorate_days, integer $term, string $period, boolean $allow_all_recurring_periods = false )
				
Retrieves the amount to prorate a value given the number of days to prorate
it 
				
Retrieves the amount to prorate a value given the number of days to prorate
it Deprecated
							since 3.5.0
 Parameters
						$amountfloat$amount The total cost for the given term and period
$prorate_daysinteger$prorate_days The number of days to prorate the amount for
$terminteger$term The term length
$periodstring$period The period type (one of "month", "year", unless $allow_all_periods is
true)
$allow_all_recurring_periodsboolean$allow_all_recurring_periods True to allow all recurring periods, or false to
limit to "month" and "year" only (optional, default false)
Returns
						floatThe prorate amount
 
 See | 
		
			| 
				 public 
				float
				
				 | 
			#
			getProratePrice( float $amount, string $start_date, integer $term, string $period, integer $pro_rata_day, boolean $allow_all_recurring_periods = false, string $prorate_date = null )
				
Retrieves the price to prorate a value given the date, term, and period to
prorate from 
				
Retrieves the price to prorate a value given the date, term, and period to
prorate from Parameters
						$amountfloat$amount The total cost for the given term and period
$start_datestring$start_date The start date to calculate the price from
$terminteger$term The term length
$periodstring$period The period type (e.g. "month", "year")
$pro_rata_dayinteger$pro_rata_day The day of the month to prorate to
$allow_all_recurring_periodsboolean$allow_all_recurring_periods True to allow all recurring periods, or false to
limit to "month" and "year" only (optional, default false)
$prorate_datestring$prorate_date The date to prorate to. Setting this value will ignore the
$pro_rata_day (optional)
Returns
						floatThe prorate price
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getPackageItems( array $package_pricings, integer $client_id = null, string $currency = null )
				
Retrieves a list of all package items and config options (including prorated
items) from those given 
				
Retrieves a list of all package items and config options (including prorated
items) from those given Parameters
						$package_pricingsarray$package_pricings A numerical array of package pricing and quantity values of
the form: - pricing_id The package pricing ID - qty The qty being purchased for
the package pricing ID - fees A numerical array of fee types to include in the
pricing calculations, including: - setup - cancel - configoptions An array of
key/value pairs where each key is the package option ID and each value is the
package option value
$client_idinteger$client_id The ID of the client to which the pricings are to be applied
(optional)
$currencystring$currency The ISO 4217 currency code to calculate totals in (null defaults to
default client or company currency)
Returns
						arrayA numerically-indexed array of all package items with any config options
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			calcLineTotals( integer $client_id, array $package_pricings, string $coupon_code = null, array $tax_rules = null, integer $client_group_id = null, string $currency = null )
				
Caclulates the cost in one or more package pricings for a client with the
given coupon. Tax is only applied if the package is configured as taxable and
there exists tax rules that apply to the given client. 
				
Caclulates the cost in one or more package pricings for a client with the
given coupon. Tax is only applied if the package is configured as taxable and
there exists tax rules that apply to the given client. Parameters
						$client_idinteger$client_id The ID of the client to which the pricings are to be applied
$package_pricingsarray$package_pricings A numerical array of package pricing and quantity values of
the form: - pricing_id The package pricing ID - qty The qty being purchased for
the package pricing ID - fees A numerical array of fee types to include in the
pricing calculations, including: - setup - cancel - configoptions An array of
key/value pairs where each key is the package option ID and each value is the
package option value
$coupon_codestring$coupon_code The coupon code to apply to each package pricing ID
$tax_rulesarray$tax_rules A numerically indexed array of stdClass objects each representing a
tax rule to apply to this client or client group. Must be provided if $client_id
not specified
$client_group_idinteger$client_group_id The ID of the client group to calculate line totals for
$currencystring$currency The ISO 4217 currency code to calculate totals in (null defaults to
default client or client group currency)
Returns
						arrayAn array of pricing information including: - subtotal The total before discount,
fees, and tax - discount The total savings - fees An array of fees requested
including: - setup The setup fee - cancel The cancel fee - total The total after
discount, fees, but before tax - total_w_tax The total after discount, fees, and
tax - tax The total tax
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			convertPricing( stdClass$pricing, string $currency, boolean $allow_conversion )
				
Convert pricing to the given currency if allowed 
				
Convert pricing to the given currency if allowed Parameters
						$pricingstdClass$pricing A stdClass object representing a package pricing
$currencystring$currency The ISO 4217 currency code to convert to
$allow_conversionboolean$allow_conversion True to allow converion, false otherwise
Returns
						mixedThe stdClass object representing the converted pricing (if conversion allowed),
null otherwise
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getListCount( string $status = null )
				
Return the total number of packages returned from Packages::getList(), useful
in constructing pagination for the getList() method. 
				
Return the total number of packages returned from Packages::getList(), useful
in constructing pagination for the getList() method. Parameters
						$statusstring$status The status type of packages to retrieve ('active', 'inactive',
'restricted', default null for all)
Returns
						integerThe total number of packages
 
 See | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getAllGroups( integer $company_id, integer $package_id = null, string $type = null )
				
Fetches all package groups belonging to a company, or optionally, all package
groups belonging to a specific package 
				
Fetches all package groups belonging to a company, or optionally, all package
groups belonging to a specific package Parameters
						$company_idinteger$company_id The company ID
$package_idinteger$package_id The package ID to fetch groups of (optional, default null)
$typestring$type The type of group to fetch (null, standard, addon)
Returns
						mixedAn array of stdClass objects representing package groups, or false if none found
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAllAddonGroups( integer $parent_group_id )
				
Returns all addon package groups for the given package group. 
				
Returns all addon package groups for the given package group. Parameters
						$parent_group_idinteger$parent_group_id The ID of the parent package group
Returns
						arrayA list of addon package groups
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getAllPackagesByGroup( integer $package_group_id, string $status = null )
				
Fetches all packages belonging to a specific package group 
				
Fetches all packages belonging to a specific package group Parameters
						$package_group_idinteger$package_group_id The ID of the package group
$statusstring$status The status type of packages to retrieve ('active', 'inactive',
'restricted', default null for all)
Returns
						mixedAn array of stdClass objects representing packages, or false if none exist
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getCompatiblePackages( integer $package_id, integer $module_id, string $type )
				
Get all compatible packages 
				
Get all compatible packages Parameters
						$package_idinteger$package_id The ID of the package to fetch all compatible packages for
$module_idinteger$module_id The ID of the module to include compatible packages for
$typestring$type The type of package group to include ("standard", "addon")
Returns
						arrayAn array of stdClass objects, each representing a compatible package and its
pricing
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateServiceExists( integer $package_id )
				
Checks whether a service exists for a specific package ID 
				
Checks whether a service exists for a specific package ID Parameters
						$package_idinteger$package_id The package ID to check
Returns
						booleanTrue if a service exists for this package, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateStatus( string $status )
				
Validates the package 'status' field type 
				
Validates the package 'status' field type Parameters
						$statusstring$status The status type
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateTerm( integer $term, string $period )
				
Validates that the term is valid for the period. That is, the term must be
> 0 if the period is something other than "onetime". 
				
Validates that the term is valid for the period. That is, the term must be
> 0 if the period is something other than "onetime". Parameters
						$terminteger$term The Term to validate
$periodstring$period The period to validate the term against
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validatePeriod( string $period )
				
Validates the pricing 'period' field type 
				
Validates the pricing 'period' field type Parameters
						$periodstring$period The period type
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateGroup( integer $group_id, integer $company_id )
				
Validates that the given group belongs to the given company ID 
				
Validates that the given group belongs to the given company ID Parameters
						$group_idinteger$group_id The ID of the group to test
$company_idinteger$company_id The ID of the company to validate exists for the given group
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateOptionGroup( integer $option_group_id, mixed $company_id )
				
Validates that the given group is valid 
				
Validates that the given group is valid Parameters
						$option_group_idinteger$option_group_id The ID of the package option group to validate
$company_idReturns
						booleanTrue if the package option group is valid, or false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validatePriceInUse( string $term, integer $pricing_id )
				
Validates that the given price is in use 
				
Validates that the given price is in use Parameters
						$termstring$term The term of the price point, if non-empty no check is performed.
$pricing_idinteger$pricing_id The package pricing ID
Returns
						booleanTrue if the price is in use, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateCurrency( string $currency, string $term, mixed $period )
				
Validates that the given currency is valid for adding/editing a package 
				
Validates that the given currency is valid for adding/editing a package Parameters
						$currencystring$currency The ISO 4217 currency code for this pricing option
$termstring$term The term for this pricing option
$periodReturns
						booleanTrue if the currency is valid, or false otherwise
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			validateParse( array $email_content )
				
Validate that the given email content parses template parsing 
				
Validate that the given email content parses template parsing Parameters
						$email_contentarrayA numerically-indexed array of template data to parse, containing: - html The
HTML version of the email content - text The text version of the email content
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			formatPricingTerm( integer $term, string $period )
				
Formats the pricing term Parameters
						$terminteger$term The term length
$periodstring$period The period of this term
Returns
						mixedThe term formatted in accordance to the period, if possible
 
 |