Chart of accounts — data model, two-branch mapping, delete protection

Tables of the central ledger account master, the save checks, the two-branch statement row mapping, bulk mapping, the delete block and the rights.

The ledger/account module is the central (not client-specific) ledger account master. Per account it stores a two-branch (debit / credit) mapping to a balance sheet or income statement row. There is no content scope, as it is central master data.

Data model

Table names carry the installation's own prefix in the database.

TableRole
accountthe ledger number itself is the key; Hungarian name: account_name
gl_account_descriptionnames in other languages
gl_account_extkind (customer, supplier, cash, bank, opening, closing, other, total), classification (BS, PL or empty), currency, mapping of the two branches
gl_statement_schemastatement rows (read)

Save (save)

  1. Ledger number 1–10 digits; for a new account it must not exist (error_account_id, error_account_exists).
  2. Hungarian name at least 2 characters (error_name); valid kind and classification (error_kind, error_classification).
  3. For a classified account both branches are required (error_debit_row, error_credit_row); the row must exist, be mappable, active and in the statement matching the classification (error_row_not_found, error_row_not_selectable, error_row_inactive, error_row_wrong_statement).
  4. New account: is_new = 1.

Bulk mapping (bulkmap): sets both branches of the selected classified accounts in one step and skips unclassified ones (error_no_selection, error_bulk_rows). Status: enable, disable (setStatus).

Deletion

Physical delete from the three tables if no posting leg refers to it (net, VAT or gross leg of entry_item) and no coding parameter refers to it (contir_config.config_value); otherwise an error with the count.

Mapping health

The list header shows the result of getMappingHealth (missing, half mapped, dead reference); getMissingTables warns about missing tables.

Permissions

  • list (UNMAPPED, gl_account_v1.sql).
  • add is not in the seeds, so canSave(0) asks for edit; the + button shows on the edit right.
  • edit + core modify for save, status and bulk mapping (the form checks only edit); delete + core modify; debug; statusdelete seed only (BASE).