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.

TableRole
invoice_blockseries definition: company, name, prefix, suffix, separator, digits, year, status
invoice_block_counteryearly sequence counter per block (getLastSeq)
invoice_client_counterclient-level counter (generateClientNumber)
invoiceread: issued invoice count, prefix check

Process and rules

  1. 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.
  2. 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).
  3. Status: blocks outside the scope are skipped silently.
  4. 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: edit and add; save canSave(); status edit; delete; debug.
  • Content scope: the block's company. Company picker: companiesByGroup (list right).

Known limitations

  • form() checks the scope only, not a function right.
  • statusdelete is classified BASE but not implemented.
Related topics: invoice numbering permissions