Automatic account coding — process and rights

Collecting the invoice’s coding input, building the coding proposal, recording the ledger entry and changing the posting type.

Account coding (finance/invoice.makeentry) builds a proposal according to the invoice's typeofcontir type with the contir library and records it as a ledger entry.

Process

  1. Collect the invoice's coding input (getContirInput).
  2. Proposal with the type's adapter (contir->build); the general adapter uses the contir_rule rule store, the type adapters the contir_config parameters.
  3. Recording: finance/entry::saveEntryPayload() (entry header + entry_item lines).
  4. For lease/subscription invoices the validity period is written back (setPassValidity; missing period: error_lease_period).
  5. Warnings are returned, temporary files are cleaned up.

Posting type (savetypeofcontir)

Sets the invoice's typeofcontir field to a value from the shared Company::CONTIR_TYPES list (saveTypeofcontir); an invalid value gives error_contirtype_input.

Data model

Table names carry the installation's own prefix in the database: entry, entry_item, invoice (typeofcontir), contir_rule.

Permissions

EndpointRight
makeentrycore modify + accounting (SUBSCRIPTION) + invoiceInScope; error: error_invoice_id
savetypeofcontircontirtype (legacy permission table only; edit does not replace it) + invoiceInScope