Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Inheritance

Settings are tiered into four sections, maintaining a hierarchy:

  • System Settings
    • Company Settings
      • Client Group Settings
        • Client Settings

Each tier of settings inherits the settings from all of the tiers above it unless explicitly expressed otherwise. As of v3.3 of Blesta, company and system settings have an 'inherit' field which determines whether or not that field can be inherited. Inherited settings are overwritten by the value of identical keys in the tier they are retrieved from. For example, if we would like to retrieve all of the client group settings for some client group, the result would include all client group settings, all company settings for that matching client group, and all system settings. In this case, if a client group setting and a company setting shared an identical key, the client group setting would be used because it takes precedence through the hierarchy over inherited duplicate keys.

Consider, for example, that the following settings exist:

No Format
System Settings
	- autodebit = true
	- default_currency = USD

Company Settings
	- autodebit = false
	- inv_days_before_renewal = 3

Client Group Settings
	- autodebit = true
	- inv_days_before_renewal = 1
	- autosuspend = true
Code Block
languagephp
titleFetch Client Group Settings with Inheritance
firstline1
linenumberstrue
<?php
public function MyController extends AppController {

	...

	public function index() {
		$this->components(array("SettingsCollection"));
		
		// Fetch all Client Group settings
		$client_group_id = 1;
		$client_group_settings = $this->SettingsCollection->fetchClientGroupSettings($client_group_id);
		
		// Take a look at the client group settings
		foreach ($client_group_settings as $setting)
			echo $setting->key . ": " . $setting->value;
	}
}
?>
Code Block
titleExample Output
autodebit: true
inv_days_before_renewal: 1
autosuspend: true
default_currency: USD