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 Companies

Company management

Model
Extended by AppModel
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
array
$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
integer
$company_id The ID of the company to update
$vars
array
$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
integer
$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
integer
$company_id The ID of the company to generate the key pair for
$bits
integer
$bits The number of bits (i.e. 1024) for the key length
$passphrase
string
$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
integer
$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
string
$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
integer
$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 = array('id'=>"ASC") )

Fetches a list of all companies

Fetches a list of all companies

Parameters

$page
integer
$page The page to return results for
$order_by
string
$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
string
$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
integer
$company_id The company ID
$settings
array
$settings Settings to set as key/value pairs
$value_keys
array
$value_keys An array of key values to accept as valid fields
public
# setSetting( string $company_id, integer $key, string $value, mixed $encrypted = null, integer $inherit = null )

Sets a company settings

Sets a company settings

Parameters

$company_id
string
$key The setting key (i.e. name)
$key
integer
$company_id The company ID
$value
string
$value The value to set for this setting
$encrypted
mixed
$encrypted True to encrypt $value, false to store unencrypted, null to encrypt if currently set to encrypt
$inherit
integer
$inherit Whether or not the setting should be inheritable
public
# unsetSetting( string $company_id, mixed $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
string
$key The setting to unset
$key
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
integer
$company_id The company ID to retrieve settings for
$ignore_inheritence
boolean
$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
integer
$company_id The company ID to retrieve a setting for
$key
string
$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
string
$hostname The hostname to check
$company_id
integer
$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 boolean
# validateCompanyInUse( integer $company_id )

Checks whether the given company ID is in use by a client or staff group

Checks whether the given company ID is in use by a client or staff group

Deprecated

3.1.0

Parameters

$company_id
integer
$company_id The company ID to check

Returns

boolean
True if the company is in use, false otherwise
public
# validateCustomization( array $vars )

Validates Invoice customization settings

Validates Invoice customization settings

Parameters

$vars
array
$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 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