Faktura-scan behavior
Documented against app commit ed7d6935. The same text lives in docs/agent/faktura-scan.md in the app repo.
Faktura-scan
Section titled “Faktura-scan”Pulls invoice PDFs into the inbox, classifies them, and creates bogføringer from the rows a user has reviewed. The posting those rows become is docs/agent/transactions.md. The inbox after that is docs/agent/faktura-indbakke.md.
Middleware: auth.check, module:bogforing, account, year.
The scheduler entries for imap:fetch-invoices and invoices:scan are commented out in app/Console/Kernel.php. Nothing runs every fifteen minutes. Fetch and classify happen only when someone uses these pages. Company IMAP and Gmail settings are docs/agent/admin.md.
Screens
Section titled “Screens”| Path | View | What it is |
|---|---|---|
GET /bogforings/faktura-scan | resources/views/pages/invoicescan/page1.blade.php | Fetch from the mailbox and classify new PDFs. |
GET /bogforings/faktura-scan/review | resources/views/pages/invoicescan/page2.blade.php | Review classified documents, fix the supplier and modkonto, and create bilag. |
Page 1 regions: fetch, the list of new files, skip, and classify. Page 2 regions: the PDF preview, supplier match, modkonto, asset order, archive rows, and create.
Off-screen
Section titled “Off-screen”All of these are InvoiceScanController.
| Call | Method | Writes |
|---|---|---|
POST /bogforings/faktura-scan/fetch | fetch | Reads the company mailbox and stores new PDFs as invoice_imgs for this account. Does not create a bogføring. |
POST /bogforings/faktura-scan/classify | classify | Sends selected images to the invoice extraction provider and stores the parsed fields on the image. |
POST /bogforings/faktura-scan/skip/{id} | skip | Marks an image skipped so fetch will not offer it again. |
POST /bogforings/faktura-scan/skip-doc/{id} | skipDocAI | Skips extraction for one document. |
POST /bogforings/faktura-scan/process-one | processOne | Runs extraction for a single image. |
POST /bogforings/faktura-scan/process-archive-one | processArchiveOne | Same for an archive row. |
POST /bogforings/faktura-scan/rotate-pdf | rotatePdf | Rewrites the stored PDF. |
POST /bogforings/faktura-scan/create-supplier | createSupplier | Inserts a leverandør from the review form. |
POST /bogforings/faktura-scan/update-supplier-modkonto | updateSupplierModkonto | Saves the default modkonto number on that leverandør. |
POST /bogforings/faktura-scan/assign-asset | assignAsset | Attaches a page asset to a document. |
POST /bogforings/faktura-scan/reorder-assets | reorderAssets | Stores the page order. |
POST /bogforings/faktura-scan/merge-assets | mergeAssets | Merges assets into one document. |
POST /bogforings/faktura-scan/create | createInvoices | Creates bogføringer from reviewed rows, and stores archive metadata from archive_rows. |
createInvoices resolves the leverandør, takes account_id from the image path, and resolves the modkonto number to the kontoplan row for the invoice date’s year. It then creates the header and lines through the same services as a manual bilag (BogforingService::store and BogforingTransactionService::store), with invoice_img_id set. An empty payload returns 422 Ingen rækker at gemme. A failed row is reported and the others continue.
Do not document ProductSubsController or the old invoice controllers here. They are not on this path.