Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class Pricings

Pricing management

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
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
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
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 = ['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
The company ID to fetch pricing for
$page
The page to return results for
$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
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

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)
  • 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 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
The ID of the pricing to edit
$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)
  • 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 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
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
The Term to validate
$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
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
The term length
$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
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 used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen