This description apply to extensions architecture used in FrontAccounting versions 2.2.x

Core FrontAccounting functionality can be easily extended by installation of additional extension packages. Currently FA supports two types of extensions:

Extension plugin
simple extension containing code for one additional main menu option, installed in modules directory.
Extension module
independent extension to core FA functionality installed in separate directory under FA root, adding new functionality available under separate tab in main menu.

Installation

Installation via Install/Update Extensions page

Option Install/Update Extension under Setup tab of main menu enables comfortable installation and maintaining of installed FA extensions. Currently (as of FA 2.2RC) installation can be performed only for extension plugins. Extension modules can be installed only by manual change in configuration files.

Installation of third party code on FA server potentially can lead to security issues, so installed software should be downloaded from trusted sources and checked before installation. This is a reason why extensions can only be installed by admins of first company created during FA installation, which is considered as site admin.

After extension code is installed site admin should activate extensions for all companies he want give access to it. When extension is activated company admins may want make changes in Access Setup to enable any new introduced security areas for respective roles.

Manual installation

Site admin can prefer to install code extensions by manual intervention in configuration files. In fact as of FrontAccounting 2.2RC this is the only method available to install extension modules.

All data related to installed extensions are stored in installed_extensions.php files. Main installed_extensions.php configuration file in FrontAccounting root directory contains parameters of all extension plugins and modules installed in a system. Slightly different copies of this file reside in company/x/ folders.

installed_extensions.php configuration file is automatically included as a common php file containing data about extension modules, used e.g. during main menu rendering.

Example of main installed_extensions.php configuration file:

<?php

$next_extension_id = 6; // unique id for next installed extension

$installed_extensions = array (
	1 => array ( 'name' => 'Repair Services',
			'title' => 'Repair Services',
			'filename' => 'service.php',
			'tab' => 'service',
			'path' => 'service',
			'type' => 'module',
			'acc_file' => 'includes/access_levels.inc',
			'active' => '1',
		),
	4 => array ( 'tab' => 'proj',
			'name' => 'Journal Import',
			'path' => 'import',
			'title' => 'Journal &Import',
			'active' => '0',
			'type' => 'plugin',
			'filename' => 'import_journalentry.php',
			'acc_file' => 'acc_levels.php',
			'access' => 'SA_CSVIMPORTJOURNAL2'
		),
	);
?>
  • Array $installed_extensions contains all parameters for installed plugins and modules.
  • $next_extension_id variable stores unique number used as key to $installed_extensions array during installation of next extension.
  • Elements in $installed_extensions array contain various properties (order does not matter) e.g.
    • name - name for identification purposes
    • type - type of extension: module or plugin
    • path - FA root (or root/modules for plugins) based installation path
    • filename - name of module menu file, or plugin filename (relative to path).
    • tab - index of the module tab (new for module, or one of standard module names for plugin);
    • title - is the menu text (for plugin) or new tab name
    • active - current status of the extension
    • acc_file - (optional) file name with $security_areas / $security_sections extensions (relative to path).
    • access - Access Control Object ID defined

FrontAccounting Extension Properties in pkg config file

  • Stanzas in the extension's config file in FA v2.3.x contain various properties (order does not matter).
  • The complete set of properties are:
    • Package - Package Name without spaces
    • Version - Package Version - Build Number
    • Name - Long Name of Package (can contain spaces)
    • Description - Multi line description with a single space prefix from second line onwards
    • Author - Author Name and / or EMail ID
    • Maintenance - Name of Person Maintaining Package
    • Homepage - Package Website
    • Language - for Language Extensions only ISO639_ISO3166 for languages only
    • Encoding - RFC 1345 for languages only
    • RTLDir - yes/no - Right-To-Left encoding display for languages only
    • Depends - Dependant packages / version
    • Type - Type of extension: extension, chart, theme or language
    • InstallPath - FA webroot (or webroot/modules for extensions, webroot/sql for COA sql files) based installation path for Package files
    • Filename - name of extension package filename (relative to path) without file extension (.pkg) but with version and build number and no spaces
    • SqlScript - Name of SQL Script File if any
    • SHA1sum - SHA1sum of the pkg file

An example stanza for a language extension package config would be:

Package: zh_CN
Version: 2.3.0-4
Description: Simplified chinese translation by Felix Ye
Author: Felix Ye <felix@mixpwr.com>
Maintenance: Felix Ye <felix@mixpwr.com>
Homepage: frontaccounting.net
Language: zh_CN
Encoding: utf-8
RTLDir: no
Depends: 
Type: language
Name: Chinese (Simplified)
InstallPath: lang/zh_CN
Filename: zh_CN-2.3.0-4
SHA1sum: 18105101ac0d0a0ba9ca58e2aa86630e1dc5c33a
  • Lines 487 to 499 of includes/packages.inc in function get_extensions_list parse the extensions properties
  • Properties Author, Maintenance, Homepage, Depends, etc are not parsed in function get_extensions_list
  • The function get_pkg_or_list() parses any filter array of properties given.
  • The properties MenuTabs, MenuEntries and AccessExtensions are commented out.
  • The property DefaultStatus is set to active and not found in any of the default repo's packages.
  • Lines 543 to 548 in function get_themes_list() parses only Package, Version, Name and Description properties.
  • Lines 572 to 581 in function get_charts_list() parse the charts properties
  • Lines 443 to 452 in function get_languages_list() parse the language properties
  • All other properties provided will be ignored by the standard parser functions in includes/packages.inc file

(To be continued...)