Purpose

FrontAccounting has most of it's data in recognizable files and specific locations where the user can modify it to suit local requirements. However, as the code has been built over the years and forked and synched from many sources (including the core itself from webERP several years ago) besides partaking of entire libraries either in pristine form or customized from slightly to mangled beyond recognition, this page seeks to assimilate key locations of data of interest to the community.

  • All locations specified herein are relative to the FA Webroot unless otherwise stated
  • Line numbers and rarely file names may change as development progresses and is currently valid as of v2.3.25+ dated 2015-07-24.

General Location of Data in FA

  • config.default.php : All user configurable variables with defaults and commented with various options and their meanings in brief. This is a template file and is only used during installation for preparing the working config.php alone and not during regular usage of FA. Further details may be obtained from the config page.
  • version.php : Has the $repo_auth array for installing extensions and the $version of FA.
  • FA.pem : Public key of the extensions install default repo - repo.frontaccounting.eu - is checked in code to match Release.sig file at lines 290-316 in includes/packages.inc using the openssl_verify() PHP function.

Development Note

It would be preferable to have many such FA#.pem files to accomodate user repos that can overwrite / override those from the standard repo. The function get_pkg_or_list() in includes/packages.inc will need to be modified with an iterative loop to traverse a new $repo_auths array having many $repo_auth arrays to be listed in version.php. Alternatively, if present in the config.php it will overwrite those in version.php. Unsigned repos too can be accommodated in this way using a $repo_auth boolean in the config.php.

Data in files generated during installation

  • config.php : contains instance install specific core application choices
  • config_db.php : contains instance install specific database choices
  • lang/$installed_languages.inc : contains installable set of languages in $installed_languages array along with the default language index in the array as $dflt_lang. FA uses the "C" locale by default. Further details are available at the Languages page.
    • If desired to implement amount in words functionality for the default "C" locale, create a folder lang/C and copy over the lang/new_language_template/locale.inc into it and edit the copied file by replacing the string xx_XX with C - this is applicable for each language with their ISO named folders as well.
  • installed_extensions.php : contains application wide available $installed_extensions array and the $next_extension_id - this should not be blindly equated to count($installed_extensions) as there may be extensions that had been installed and uninstalled besides having migrated from elsewhere with unknown install history and possibly conflicting with the maximum index number of all the companies $installed_extensions arrays.
  • company/0/installed_extensions.php : contains allowed installable subset of $installed_extensions array
  • company/[all installed company numbers]/installed_extensions.php : contains company specific subset of $installed_extensions array
  • sql/LanguageCode_CountryCode-[TYPE_DESC]*.sql : Installed Charts of Accounts. The sql folder also contains a few upgrade *.sql and *.php files as well. The standard COAs that come with the core FA package are: sql/en_US-new.sql and sql/en_US-demo.sql. The former is for a blank 4 digit US install and the latter has demo data as well.

Other places with Data in FA (Line numbers in brackets are for FA 2.3)

  • #_users.startup_tab : User preferred startup tab - Priority 1 - taken from database field
  • includes/page/header.inc
    • Line 127 (115) : User preference startup tab = "orders" (sales) - Priority 2 - graceful degrade when user preferred application / extension is uninstalled / disabled / removed
  • includes/prefs/userprefs.inc
    • Line 94 (84) : User preference startup tab = "orders" (sales) - Priority 3 - when no other choice is available
  • includes/ui/ui_lists.inc
    • Lines 2349-2352: COA sql file names and descriptions of the default COAs. Whilst these entries need not be listed in the installed_extensions.php files as elements in the $installed_extensions arrays, it will override the standard descriptions if present.
  • admin/db/maintenance_db.inc:
    • Line 21: define('EXPORT_MAX_INSERT', 50000);. This is the maximum number of bytes in each INSERT statement in a backup sql file.
    • function db_import() Line 308 (285) hard codes the sql file import timeout (180 secs) for db restore.
    • function db_backup() hardcodes creating the db backup filename
    • function db_export() Lines 609-614 (506-513) selects all tables from the database to be backed up if no prefix is used.
    • function db_export() Lines 563-566 (470-473) sets the maximum chunk size to 2MB or if present, from the memory_limit parameter value in php.ini before writing to backup file.
  • reporting/includes/pdf_report.inc:

Data in extension files