NAV background jobs – invoice sync, tax account, returns, public debt
How the NAV job types work: the quarter-hour invoice sync chain, digest and full invoice data queries, the reference refresh, tax account, missing returns and public debt.
Overview
NAV jobs run on the central job queue in system context. NAV calls are made by the navmtom library.
Job types
| Type | Behaviour | Tables |
|---|---|---|
nav_invoice_sync (per company, at interval boundaries, default 15 min) | runCompanyNavSync(): UTC window of the last interval (for a missed band back to the last successful run, max 48 hours); inbound and outbound via nav/invoicequery::processForCronqueueJob() by submission date (INS); nav_invoice_data rows for new invoices; a human-readable NAV log (nav/sync) and notifications about new invoices and errors | invoice tables |
nav_invoice_query (Main Job item) | digest of one (client × window × direction) unit (queryInvoiceDigest, paged), header upsert, classification of new and known invoices, nav_invoice_data rows for new ones; the worker tracks progress in the job table | invoice, job |
nav_invoice_data | queryInvoiceData, raw response to the audit, items into invoice_item, header totals from the items, additional data (line_additional_data), partner master update (bank account, address, tax number — on the customer side only for a matching partner), sync_status='done', status=2 | invoice, invoice_item, line_additional_data |
nav_invoice_ref | queued by the invoice list's "NAV references" function above the limit (payload: invoice IDs); per invoice dlbtinvoice->refreshKindFromNav(); what does not fit goes into an immediate continuation row | invoice |
taxaccount (per company, daily) | nav/taxaccount::processForCronqueue(): first 8 digits of the tax number, adozoQuery('TetelesAdoszamla'); per tax type liability and payment items with bank account identification, diagnostics (repeated items with raw response), saved with addTaxaccount(); PDF from the cron template according to the doc centre storage rule (without a rule only as an e-mail attachment), then e-mail | nav_tax_account, _item, _document, nav_tax_type, doc |
missingtaxreturn (per company, daily) | adozoQuery('HianyzoBevallas'), known keys filtered out, new rows via addMissingTaxReturn(), e-mail for a new gap (failure logged) | nav_missing_tax_return |
nav_tax_debt (global, 06:10) | nav/taxdebt::run(): query for the companies due according to the per-client schedule (enabled and within the date window); items interpreted by Navmtom::taxDebtItems() | nav_tax_debt, nav_tax_debt_config |
invoice | old type, switched off: listed in the order, but its dispatch() branch is commented out and companyWantsJobType('invoice') is always false, so no row is created | — |
Error handling
Tax type errors are collected into the result; on an exception the worker retries. A permanent NAV error is tried once, a transient network error three times; the company's authorised users are notified about NAV sync errors.