Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class Pricings

Pricing management

Model
Extended by AppModel
Extended by Pricings
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/pricings.php

Methods summary

public
# __construct( )

Initialize Pricings

Initialize Pricings

Overrides

AppModel::__construct
public mixed
# get( integer $pricing_id )

Fetches the pricing

Fetches the pricing

Parameters

$pricing_id
integer
$pricing_id The ID of the pricing to fetch

Returns

mixed
A stdClass object representing the pricing, false if no such pricing exists
public array
# getAll( integer $company_id )

Fetches all pricing for a given company

Fetches all pricing for a given company

Parameters

$company_id
integer
$company_id The company ID

Returns

array
An array of stdClass objects representing each pricing
public array
# getList( integer $company_id, integer $page = 1, array $order_by = array('period'=>"asc", 'term' => "asc") )

Fetches a list of pricing for a given company

Fetches a list of pricing for a given company

Parameters

$company_id
integer
$company_id The company ID to fetch pricing for
$page
integer
$page The page to return results for
$order_by
array
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

array
An array of objects, each representing a pricing
public integer
# getListCount( integer $company_id )

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

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

Parameters

$company_id
integer
$company_id The company ID to fetch pricings for

Returns

integer
The total number of pricings

See

Pricings::getList()
public integer
# add( array $vars )

Adds a pricing for the given company

Adds a pricing for the given company

Parameters

$vars
array
$vars An array of pricing info including: - company_id The ID of the company to add the 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 pricing (optional, default 0.00) - cancel_fee The cancelation fee for this pricing (optional, default 0.00) - currency The ISO 4217 currency code for this pricing (optional, default USD)

Returns

integer
The ID of the pricing record added, void on error
public
# edit( integer $pricing_id, array $vars )

Updates a pricing

Updates a pricing

Parameters

$pricing_id
integer
$pricing_id The ID of the pricing to edit
$vars
array
$vars An array of pricing info including: - 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 pricing (optional, default 0.00) - cancel_fee The cancelation fee for this pricing (optional, default 0.00) - currency The ISO 4217 currency code for this pricing (optional, default USD)
public
# delete( integer $pricing_id )

Permanently removes a pricing from the system.

Permanently removes a pricing from the system.

Parameters

$pricing_id
integer
$pricing_id The pricing ID to delete
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

$term
integer
$term The Term to validate
$period
string
$period The period to validate the term against

Returns

boolean
True if validated, false otherwise
public boolean
# validatePeriod( string $period )

Validates the pricing 'period' field type

Validates the pricing 'period' field type

Parameters

$period
string
$period The period type

Returns

boolean
True if validated, false otherwise
public mixed
# formatTerm( integer $term, string $period )

Formats the pricing term

Formats the pricing term

Parameters

$term
integer
$term The term length
$period
string
$period The period of this term

Returns

mixed
The term formatted in accordance to the period, if possible
public array
# getPeriods( boolean $plural = false )

Retrieves a list of pricing periods

Retrieves a list of pricing periods

Parameters

$plural
boolean
$plural True to return language for plural periods, false for singular

Returns

array
Key=>value pairs of pricing periods

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

Blesta API documentation generated by ApiGen 2.8.0