Integrity check: checks, owning models, scheduling

Structure of the integrity runner, the check codes and their owning models, the run log, the settings and system-level scheduling, and the permissions and content scope.

The integrity runner only reads: per check it lists the inconsistencies with a link to the place of the fix. The SQL of the checks lives in the owning models' getIntegrityFindings(); the report/integrity model selects, merges and logs. The settings screen keeps status, order and schedule per check; there is no create or delete, because a check is code.

Checks and owning models

CodeOwning model
orphan_settlementfinance/transaction
orphan_itemfinance/transaction
settled_revocablefinance/transaction
advance_paymentfinance/transaction
import_mismatchbank/bankimport
import_unbookedbank/bankimport
periodic_datesfinance/invoice
open_cashfinance/invoice
missing_partnerfinance/invoice
advance_finalfinance/invoice
partner_taxhufinance/invoice
storno_matchfinance/invoice
tech_partnerfinance/invoice
dup_numberfinance/invoice
doc_clientfinance/invoice

Data model

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

TableRole
integrity_checkstatus, order, cron setting per check
integrity_runrun log with source (manual, scheduled)
cron_queuesystem-level integrity_check templates

Process

  1. report/integrity.list: the chosen or all active checks on the set of allowed companies (a foreign company ID returns an empty result); with run=1 logged with source manual, not when only viewing. Paging (including all); per row a link to the transaction, import row or invoice if the list permission exists. Settings link if canSee(report/integritycheck, list).
  2. report/integritycheck.list: checks with schedule summary (from the scheduler rows, linked with cron/cronqueue + list) and last runs.
  3. report/integritycheck.save, enable, disable: status, order, cron on/off and shared timer (hourly, daily, weekly, monthly); the cron setting is written to the scheduler as a system-level (company_id = 0) integrity_check template, deactivated when switched off.
  4. report/integritycheck.run: one check with source manual on the user's allowed companies (super: all), logged.
  5. Background: integrity_check job → catalog masterdata/cronqueue::runIntegrityChecks. A row from a template (payload.check_code) runs one check, for a client target only on its data; the hourly system row without payload runs the checks that have no own schedule. A successful run without inconsistencies sends no result e-mail.

Permissions

  • report/integrity: list, debug; report/integritycheck: list, edit (and basic modify), run, debug. None classified in the seeds.
  • Content scope: getCompanyGroupFilter when running.
  • Writing the cron template on save does not require cron/cronqueue + edit; the form checks it only for display.