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 Companies

Company management

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
Extended by Companies
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/companies.php
Methods summary
public
# __construct( )

Initialize Companies

Initialize Companies

Overrides

AppModel::__construct()
public integer
# add( array $vars )

Add a company

Add a company

Parameters

$vars

An array of company info including:

  • company_id The ID of the company whose settings to import from
  • name The name of the company
  • hostname The hostname of the company
  • address The address of the company (whole postal address)
  • phone The phone number of the company
  • fax The fax number of the company

Returns

integer
The company ID added, void on error
public
# edit( integer $company_id, array $vars )

Edit an existing company

Edit an existing company

Parameters

$company_id
The ID of the company to update
$vars

An array of company info including:

  • name The name of the company
  • hostname The hostname of the company
  • address The address of the company (whole postal address)
  • phone The phone number of the company
  • fax The fax number of the company
public
# delete( integer $company_id )

Delete an existing company. Only companies no longer in use may be removed.

Delete an existing company. Only companies no longer in use may be removed.

Parameters

$company_id
The company ID to remove from the system
public mixed
# generateKeyPair( integer $company_id, integer $bits, string $passphrase = null )

Generates a new public/private key pair for the company and stores it in the database. Will not overwrite any existing key pair for the same company.

Generates a new public/private key pair for the company and stores it in the database. Will not overwrite any existing key pair for the same company.

Parameters

$company_id
The ID of the company to generate the key pair for
$bits
The number of bits (i.e. 1024) for the key length
$passphrase

The (optional) passphrase to use to encrypt the private key with. Only set if you want super high security (and don't even trust Blesta to decrypt things by itself)

Returns

mixed

An array containing both parts of the key pair on success, false if the key is already set for this company

public mixed
# get( integer $company_id )

Fetches a company with the given ID

Fetches a company with the given ID

Parameters

$company_id
The ID of the company to fetch

Returns

mixed
A stdClass object representing the company, false if no such company exists
public stdClass
# getByHostname( string $hostname )

Retrieves the company configured for the given hostname. Looks for hostname and www.hostname

Retrieves the company configured for the given hostname. Looks for hostname and www.hostname

Parameters

$hostname
The hostname to fetch on (also looks at www.hostname)

Returns

stdClass
A stdClass object representing the company if it exists, false otherwise
public array
# getAllAvailable( integer $staff_id )

Fetches all companies available to the given staff ID

Fetches all companies available to the given staff ID

Parameters

$staff_id
The ID of the staff member

Returns

array
An array of stdClass objects each representing a company
public mixed
# getAll( )

Fetches all companies

Fetches all companies

Returns

mixed
An array of stdClass objects representing each company, or false if none exist
public mixed
# getList( integer $page = 1, string $order_by = ['id' => 'ASC'] )

Fetches a list of all companies

Fetches a list of all companies

Parameters

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

Returns

mixed
An array of objects or false if no results.
public integer
# getListCount( )

Return the total number of client groups returned from Companies::getList(), useful in constructing pagination for the getList() method.

Return the total number of client groups returned from Companies::getList(), useful in constructing pagination for the getList() method.

Returns

integer
The total number of clients

See

Companies::getList()
public array
# getViewDirs( string $type = 'client' )

Fetches data about each installed view directory

Fetches data about each installed view directory

Parameters

$type
The type of view directory to scan

Returns

array
An array of view dirs
public
# setSettings( integer $company_id, array $settings, array $value_keys = null )

Sets a group of company settings

Sets a group of company settings

Parameters

$company_id
The company ID
$settings
Settings to set as key/value pairs
$value_keys
An array of key values to accept as valid fields
public
# setSetting( integer $company_id, string $key, string $value, mixed $encrypted = null, integer $inherit = null )

Sets a company settings

Sets a company settings

Parameters

$company_id
The company ID
$key
The setting key (i.e. name)
$value
The value to set for this setting
$encrypted

True to encrypt $value, false to store unencrypted, null to encrypt if currently set to encrypt

$inherit
Whether or not the setting should be inheritable
public
# unsetSetting( integer $company_id, string $key )

Unsets a setting from the company settings. CAUTION: This method will physically remove the setting from the system, and could have dire consequences. You should never use this method, except when attempting to remove a setting created by Companies::setSettings() or Companies::setSetting() that did not previously exist for this installation.

Unsets a setting from the company settings. CAUTION: This method will physically remove the setting from the system, and could have dire consequences. You should never use this method, except when attempting to remove a setting created by Companies::setSettings() or Companies::setSetting() that did not previously exist for this installation.

Parameters

$company_id
The ID of the company whose setting to unset
$key
The setting to unset
public mixed
# getSettings( integer $company_id, boolean $ignore_inheritence = false )

Fetch all settings that may apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Fetch all settings that may apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Parameters

$company_id
The company ID to retrieve settings for
$ignore_inheritence

True to only retrieve company settings, false to get all inherited settings (default false)

Returns

mixed
An array of objects containg key/values for the settings, false if no records found
public mixed
# getSetting( integer $company_id, string $key )

Fetch a specific setting that may apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Fetch a specific setting that may apply to this company. Settings are inherited in the order of company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Parameters

$company_id
The company ID to retrieve a setting for
$key
The key name of the setting to fetch

Returns

mixed
A stdObject containg the key and value, false if no such key exists
public boolean
# validateAddAllowed( )

Verifies that the company can be added

Verifies that the company can be added

Returns

boolean
True if the company can be added, false otherwise
public boolean
# validateHostnameUnique( string $hostname, integer $company_id = null )

Checks whether the given hostname is unique or not

Checks whether the given hostname is unique or not

Parameters

$hostname
The hostname to check
$company_id
The company ID to exclude from the unique check (ie itself, optional, default null)

Returns

boolean
True if the given hostname is unique, false otherwise
public
# validateCustomization( array $vars )

Validates Invoice customization settings

Validates Invoice customization settings

Parameters

$vars
An array of key/value pairs of invoice customization settings to validate
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