Commit Graph

115 Commits

Author SHA1 Message Date
bjoernpoettker e6436b2b9c feat: tag documents as Posteingang when AM entry is missing during upload check
Build and Push Multi-Platform Images / build-and-push (push) Successful in 37s
- Add agrarmonitor_tag_posteingang setting (default empty)
- When a document is not found in Agrarmonitor, move it back to Posteingang
  tag instead of skipping (if tagPosteingang is configured)
- Expose tagPosteingang in polling config API and settings UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 21:45:58 +02:00
bjoernpoettker 1698eba968 fix: correct polling conditions for eingangsDatum and buchungsDatum
Build and Push Multi-Platform Images / build-and-push (push) Successful in 38s
- Only set eingangsDatum when belegNummer is present
- Import documents when buchungsDatum is set (revert inverted condition)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 14:05:11 +02:00
bjoernpoettker b4dd959b4a fix: load all correspondents instead of first 100 in Paperless API
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
Raised page_size from 100 to 9999 on GET /api/paperless/correspondents
so the FreigabePage can resolve all correspondent IDs to names.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 13:56:19 +02:00
bjoernpoettker 036d135109 fix: import documents without buchungsDatum instead of skipping them
Build and Push Multi-Platform Images / build-and-push (push) Successful in 32s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 13:28:27 +02:00
bjoernpoettker 4016802c1e fix: use manual res.json() in getNextJob to prevent double-response on 204
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 10:43:03 +02:00
bjoernpoettker d5bc1bcee0 fix: handle object-format select_options from Paperless for Freigabe field
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
Paperless may return extra_data.select_options as an array of objects
{id, label} instead of plain strings. This caused React error #31
when Ant Design tried to render an object as a child in the Select and
Table components.

- Backend: coerce option items to {id: string, label: string} regardless
  of whether Paperless returns strings or objects
- Frontend: normalize cf.value to a plain string before rendering or
  storing in state, guarding against object-typed values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 07:01:39 +02:00
bjoernpoettker a0d67c7d1b Merge remote-tracking branch 'origin/main' into Freigabe
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s
2026-05-25 21:58:46 +02:00
bjoernpoettker c08559b5c3 ci: also tag and push images as :dev on every build
Build and Push Multi-Platform Images / build-and-push (push) Successful in 12s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 21:57:24 +02:00
bjoernpoettker 37ffc6c13b feat: implement Freigabesystem for payment approval workflow
Adds a dedicated approval view for PM_Freigabe users to release documents
for payment by setting Paperless custom field 15 to a predefined value.

- Backend: VIEW_FREIGABE permission mapped to PM_Freigabe OIDC group
- Backend: FreigabeErforderlich flag on DocumentType entity (auto-migrated)
- Backend: FreigabeModule with endpoints to list documents, fetch field
  options dynamically from Paperless, and set the approval custom field
- Frontend: /freigabe route with filter (default: nicht freigegeben),
  paginated table, and modal to select approval value
- Frontend: Settings checkbox to mark document types as requiring approval
- Frontend: Freigabe menu item visible only to PM_Freigabe/PM_Admin users

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 21:54:09 +02:00
bjoernpoettker 72d199fb3a feat: navigate to mailbox after successful mail import
Build and Push Multi-Platform Images / build-and-push (push) Successful in 16s
- Add onSuccess prop to MailImportWizard, called instead of onClose on success
- MailDetailPage navigates to /mailpostfach after import completes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 15:35:43 +02:00
bjoernpoettker 7cd7b2dbf5 perf: resolve correspondents via stored AgrarmonitorId instead of name lookup
Build and Push Multi-Platform Images / build-and-push (push) Successful in 30s
- getOrCreateCorrespondent first checks CorrespondentSetting by kundenId
- Falls back to name search only when no mapping exists
- Saves the mapping after creation for future polling runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 15:07:09 +02:00
bjoernpoettker 4046c656de fix: match correspondents by Kundennummer (KD-prefix) in addition to Lieferantennummer
Build and Push Multi-Platform Images / build-and-push (push) Successful in 29s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 14:51:31 +02:00
bjoernpoettker 018f487baf feat: detect and resolve duplicate correspondents in Agrarmonitor sync
Build and Push Multi-Platform Images / build-and-push (push) Successful in 35s
- Detect duplicates after sync (same AgrarmonitorId, multiple correspondents)
- Auto-merge duplicates with identical names (delete empty, move docs to larger)
- Expose conflicts with different names for manual resolution
- New mergeCorrespondents endpoint + service method
- Conflict resolution modal in SettingsPage with radio selection per conflict
- deleteCorrespondent added to PaperlessService

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 14:33:48 +02:00
bjoernpoettker b4fe5a336c feat: add Agrarmonitor correspondent sync
Build and Push Multi-Platform Images / build-and-push (push) Successful in 39s
- Extract getOrCreateCorrespondent helper to deduplicate logic
- Add syncCorrespondentIds to match Paperless correspondents to
  Agrarmonitor IDs via Lieferantennummer and persist in CorrespondentSetting
- New POST /api/agrarmonitor/sync-correspondents endpoint
- "Agrarmonitor-Abgleich" button in Correspondents settings tab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 14:01:33 +02:00
bjoernpoettker bbdaf19fff Merge pull request 'Agrarmonitor' (#2) from Agrarmonitor into main
Build and Push Multi-Platform Images / build-and-push (push) Successful in 11s
Reviewed-on: #2
2026-05-25 11:02:58 +00:00
bjoernpoettker 8c5a81ed27 feat: implement ProcessVerarbeiteteDocuments (Upload-Check)
Build and Push Multi-Platform Images / build-and-push (push) Successful in 37s
Ported ProcessVerarbeiteteDocuments() from C# ProcessUploads.cs:
- Checks docs tagged "hochgeladen" → eingangsrechnungVorhanden()
- On match: livesearch, update title/type/created/correspondent/tags,
  set custom fields (externeBelegnummer, AgrarmonitorLink), addNote
- Tag "hochgeladen" → "fertig" swap; owner via Client.AgrarmonitorBetriebId
- 401/403 guard: clearClient() + break (same pattern as runPolling)
- Cron: AGRARMONITOR_UPLOAD_CHECK_CRON (default: 0 * * * * *)
- New settings: agrarmonitor_tag_hochgeladen, agrarmonitor_link_field
- Endpoint: POST /api/agrarmonitor/process-uploads
- Frontend: polling-config extended with tagHochgeladen + linkField select,
  new card "Dokumenten-Verarbeitung" with run button + result display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 12:11:44 +02:00
bjoernpoettker a726f863f0 feat: set loginStrategy to 'redirect' in AgrarmonitorService
Build and Push Multi-Platform Images / build-and-push (push) Successful in 42s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 11:41:22 +02:00
bjoernpoettker 1133023c48 chore: update agrarmonitor-connector to commit cd89a30
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 11:38:45 +02:00
bjoernpoettker 74cd2477f1 fix: two polling bugs — correspondent 400 and Agrarmonitor 403
Build and Push Multi-Platform Images / build-and-push (push) Successful in 30s
- 400 on Korrespondenten-Sync: getCorrespondentByName was called with
  searchName "(12345)" but checked exact match against full displayName
  "Firma (12345)". Always returned null → duplicate addCorrespondent on
  every run → Paperless 400. Fix: search by displayName directly.

- 403 on Livesearch: cached Agrarmonitor session expired. Fix: detect
  401/403 from connector, call clearClient() to invalidate cache, break
  out of the polling loop so next cron run re-authenticates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 16:25:47 +02:00
bjoernpoettker 1d11d8a3bd docs: add Agrarmonitor polling design plans
Build and Push Multi-Platform Images / build-and-push (push) Successful in 57s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 15:09:53 +02:00
bjoernpoettker e5271fc035 chore: add AGRARMONITOR_POLLING_CRON to docker-compose.yml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 15:05:20 +02:00
bjoernpoettker 6e1f995fe5 feat: extend SettingsPage with Agrarmonitor polling UI
Benutzer & Betriebe tab:
- Add Betriebe table with inline-editable AgrarmonitorBetriebId column

Agrarmonitor tab:
- Add Polling-Konfiguration card (tag-IDs, auto-loaded, save button)
- Add Polling ausführen card (run button, result display with error list)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 15:04:17 +02:00
bjoernpoettker 5ca202a59e feat: extend frontend API client for Agrarmonitor polling
- Add SettingClient interface and getClients/updateClient methods
- Add AgrarmonitorPollingConfig/Result interfaces
- Add getPollingConfig, updatePollingConfig, runPolling to agrarmonitorApi

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 15:02:02 +02:00
bjoernpoettker bed797db51 chore: add AGRARMONITOR_POLLING_CRON to .env.example
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 14:59:38 +02:00
bjoernpoettker 31d51dc19d feat: add GET/PUT clients endpoints to SettingsController
GET  /api/settings/clients       — list all Betriebe ordered by name
PUT  /api/settings/clients/:id   — update AgrarmonitorBetriebId

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 14:59:26 +02:00
bjoernpoettker f3e3df3724 feat: add polling endpoints to AgrarmonitorController
GET  /api/agrarmonitor/polling-config
PUT  /api/agrarmonitor/polling-config
POST /api/agrarmonitor/run-polling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 14:58:31 +02:00
bjoernpoettker f3df38610c refactor: replace AgrarmonitorWebService with connector methods
- Delete agrarmonitor-web.service.ts (HTML-scraping no longer needed)
- Rewrite AgrarmonitorPollingService to call connector directly
  (eingangsrechnungenLivesearch, setEingangsdatum, setLieferscheinNummer)
- Fix quality issues: concurrency guard, customer-sync try/catch,
  tag dedup via Set, parseInt NaN guard, page_size overflow warning
- Update AgrarmonitorModule to import TypeORM/PaperlessModule
- Remove node-html-parser dependency
- Update agrarmonitor-connector to latest Gitea commit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 14:56:23 +02:00
bjoernpoettker dd0fcfc2e5 feat: add AgrarmonitorPollingService with cron and runPolling 2026-05-23 14:45:47 +02:00
bjoernpoettker 79874bf54f fix: harden AgrarmonitorWebService error handling and date parsing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 14:41:01 +02:00
bjoernpoettker 433b3be7fa feat: add AgrarmonitorWebService with livesearch and date setters 2026-05-23 14:37:52 +02:00
bjoernpoettker f4131ebcf0 feat: add AgrarmonitorBetriebId to Client entity 2026-05-23 14:36:23 +02:00
bjoernpoettker 0d4302dc7e chore: add node-html-parser for Agrarmonitor HTML scraping 2026-05-23 14:35:47 +02:00
bjoernpoettker 9f39578471 fix: disable auto-retry and improve error messages in Agrarmonitor
Build and Push Multi-Platform Images / build-and-push (push) Successful in 43s
- Set autoRetry: false and timeoutMs: 10000 in AgrarmonitorService
- Show specific error message on timeout or backend error in frontend

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 22:10:36 +02:00
bjoernpoettker 6f6a4d83e5 Merge branch 'main' into Agrarmonitor
Build and Push Multi-Platform Images / build-and-push (push) Successful in 49s
2026-05-21 21:42:15 +02:00
bjoernpoettker 23a889f3a5 fix: install git in backend Docker build stage
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
Required for npm packages that reference git dependencies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 21:41:10 +02:00
bjoernpoettker 6e20dec723 Merge remote-tracking branch 'origin/main' into Agrarmonitor
Build and Push Multi-Platform Images / build-and-push (push) Failing after 23s
2026-05-21 21:38:55 +02:00
bjoernpoettker 2aba9ff004 ci: build and tag images for all branches
Build and Push Multi-Platform Images / build-and-push (push) Successful in 12s
- Trigger build on all branches (not only main)
- Tag image as 'latest' for main, branch name otherwise
- Sanitize branch name for Docker tag (slashes → dashes, lowercase)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 21:34:38 +02:00
bjoernpoettker 1f5dcf4a17 feat: add Agrarmonitor integration module
- New backend module (agrarmonitor) with status check and device registration
- Frontend settings tab with connection status display and registration form
- Environment variables for base URLs, credentials, cookie path and encryption key
- Docker Compose env passthrough for agrarmonitor config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 21:30:46 +02:00
bjoernpoettker f482304061 feat: fix signature editor init and expand README
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
- Pass initialContent prop to WysiwygEditor instead of imperative setContent
  to ensure mail signature loads correctly on mount
- Rewrite README to reflect full project scope (scanner inbox, email import,
  postprocessing rules, label printing, OIDC auth)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 15:48:23 +02:00
bjoernpoettker 2df3af719b feat: add delete-after-action dialogs and auto-refresh in inbox
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s
- Show confirmation dialog to delete document after download or email send
- Auto-refresh inbox list every 30 seconds
- Rename "Vorschau" button to "Weiterverarbeiten"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 15:20:55 +02:00
bjoernpoettker 7de22c9418 feat: improve frontend accessibility, dark mode, and UX
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
- Replace div with semantic button elements in AppLayout for accessibility
- Use Ant Design theme tokens instead of hardcoded colors in MailDetailPage
- Add loading state to refresh buttons and pagination info
- Add German empty state messages to tables
- Clean up unnecessary ConfigProvider wrappers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 14:45:33 +02:00
bjoernpoettker e9d42ce172 löschen
Build and Push Multi-Platform Images / build-and-push (push) Successful in 21s
2026-05-21 12:59:46 +02:00
bjoernpoettker 792733952a fix: improve mail document ID rendering and disable actions for ignored emails
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
2026-05-18 21:07:52 +02:00
bjoernpoettker 1e7e8cf6da feat: inject PAPERLESS_URL environment variable and update document link rendering in MailDetailPage
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
2026-05-18 20:53:17 +02:00
bjoernpoettker 11bed63bad feat: add manual Paperless ID synchronization for email attachments and update default barcode margins to 7mm.
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
2026-05-18 09:14:26 +02:00
bjoernpoettker 76ce4cf900 feat: implement authenticated resource handling for image and PDF previews via AuthImage and AuthIframe components
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s
2026-05-10 22:30:27 +02:00
bjoernpoettker 1ed3afd2e2 feat: add database indexes, implement CORS configuration, and lazy-load frontend routes
Build and Push Multi-Platform Images / build-and-push (push) Successful in 35s
2026-05-10 22:21:01 +02:00
bjoernpoettker aa4c181b0c perf: add database indexes, implement caching, enforce permission guards, and sanitize external URLs
Build and Push Multi-Platform Images / build-and-push (push) Successful in 48s
2026-05-10 22:01:06 +02:00
bjoernpoettker 351938aa5c feat: add email recipient history to user settings and implement management in InboxDetailPage
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
2026-05-10 21:32:19 +02:00
bjoernpoettker 36322ae4c3 fix: update thumbnail tooltip max-height to responsive viewport units in InboxDetailPage
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
2026-05-10 20:57:46 +02:00