Document blocks – system description
Data model of the invoice number series, the prefix collision check, the sequence counters and the numbering operations called by other modules.
Invoice number series per client (prefix, suffix, separator, digits, year) with a sequence counter. The content scope is the block's company; other modules call number generation through the block model.
Data model
Table names carry the installation's own prefix in the database.
| Table | Role |
|---|---|
invoice_block | series definition: company, name, prefix, suffix, separator, digits, year, status |
invoice_block_counter | yearly sequence counter per block (getLastSeq) |
invoice_client_counter | client-level counter (generateClientNumber) |
invoice | read: issued invoice count, prefix check |
Process and rules
- List: filter by name, prefix, status and company group/company intersected with the content right; per row the client, preview number, this year's last sequence and issued invoices.
- Save: client required and in scope; name 1–128, prefix/suffix max. 32, digits 1–20; the prefix must not collide with the client's invoices from other sources (
finance/invoice::isNumberPrefixTaken) nor with another block (isPrefixUsedByOtherBlock); after an issued invoice the client cannot change (error_company_locked). - Status: blocks outside the scope are skipped silently.
- Delete: blocks outside the scope or with issued invoices are kept (
error_block_has_invoices), the rest are deleted.
Operations used by other modules
generateNumber, generateClientNumber, peekNextNumber, peekClientNumber, lockSeries/unlockSeries, nextSeriesSeq/commitSeriesSeq, ensureDefaultBlock.
Permissions
- Function rights:
list; header Add button:editandadd; savecanSave(); statusedit;delete;debug. - Content scope: the block's company. Company picker:
companiesByGroup(listright).
Known limitations
form()checks the scope only, not a function right.statusdeleteis classified BASE but not implemented.