Commit Graph

66 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 5c8a71bdda feat: add source attachment details as notes to processed documents
Build and Push Multi-Platform Images / build-and-push (push) Successful in 30s
2026-05-09 14:06:04 +02:00
bjoernpoettker 0318fe8e7a feat: add default label template setting and apply it to print dialog selection
Build and Push Multi-Platform Images / build-and-push (push) Successful in 35s
2026-05-09 12:41:05 +02:00
bjoernpoettker 3f2b3a7af4 chore: add project documentation, restrict email import permissions, and set date format in InboxPage
Build and Push Multi-Platform Images / build-and-push (push) Successful in 32s
2026-05-09 11:06:11 +02:00
bjoernpoettker 195ebc793e fix: scope barcode template permissions to specific endpoints instead of the entire controller
Build and Push Multi-Platform Images / build-and-push (push) Successful in 26s
2026-05-09 10:50:48 +02:00
bjoernpoettker 01d9aec655 feat: configure nginx proxy and response headers to support SSE for label print agent
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
2026-05-09 10:27:30 +02:00
bjoernpoettker 48d4ff1ab3 refactor: remove authentication guard from label-print-agent controller
Build and Push Multi-Platform Images / build-and-push (push) Successful in 27s
2026-05-09 10:21:22 +02:00
bjoernpoettker 86d3c062d6 feat: implement public route support and elevate auth guard log levels to info
Build and Push Multi-Platform Images / build-and-push (push) Successful in 35s
2026-05-09 10:03:34 +02:00
bjoernpoettker 367c8fe002 feat: add detailed request logging and error tracing to API key and JWT guards
Build and Push Multi-Platform Images / build-and-push (push) Successful in 29s
2026-05-09 09:55:30 +02:00
bjoernpoettker a207b3057e feat: add support for API keys in Authorization header for SSE clients
Build and Push Multi-Platform Images / build-and-push (push) Successful in 28s
2026-05-09 09:37:55 +02:00
bjoernpoettker f4428afb9b feat: add SSE event stream for print jobs, implement batch printing in frontend, and update API documentation.
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
2026-05-09 09:04:20 +02:00
bjoernpoettker 3683fe9487 refactor: remove remote label number fetching and default number to 1 in label print service
Build and Push Multi-Platform Images / build-and-push (push) Successful in 28s
2026-05-09 08:19:44 +02:00
bjoernpoettker af2af83709 fix: change json column types to simple-json in barcode template and print job entities
Build and Push Multi-Platform Images / build-and-push (push) Successful in 29s
2026-05-09 06:47:19 +02:00
bjoernpoettker ebe6f48dd9 feat: add dd.MM.yyyy date formatting, default label number, and improve variable padding safety in label rendering
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
2026-05-08 16:37:15 +02:00
bjoernpoettker 2fbbe1142b fix: add liberation fonts to Docker image and configure resvg to use them for label rendering
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
2026-05-08 09:36:55 +02:00
bjoernpoettker 658c6de74e feat: migrate label rendering from sharp to resvg for improved SVG support
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
2026-05-08 09:05:05 +02:00
bjoernpoettker 45c371a60d fix: adjust text y-coordinate to account for librsvg baseline rendering limitations
Build and Push Multi-Platform Images / build-and-push (push) Successful in 28s
2026-05-08 08:00:02 +02:00
bjoernpoettker c6b5431fab feat: add LabelPrintAgentModule to application imports
Build and Push Multi-Platform Images / build-and-push (push) Successful in 29s
2026-05-07 23:59:37 +02:00
bjoernpoettker 71b447154d feat: add label preview functionality to barcode templates with backend rendering and UI modal
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
2026-05-07 23:52:39 +02:00
bjoernpoettker 71502df7b4 feat: add label configuration fields to barcode templates and implement zero-padding support in variable replacement
Build and Push Multi-Platform Images / build-and-push (push) Successful in 27s
2026-05-07 23:34:52 +02:00
bjoernpoettker 80f862a0c0 feat: implement backend label print agent system for remote label rendering and job management
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
2026-05-07 22:46:29 +02:00
bjoernpoettker d19fd266c7 feat: add configurable sender name and allow users to choose between system and personal SMTP accounts when sending emails
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s
2026-05-06 20:49:09 +02:00
bjoernpoettker 8212f733ab feat: implement AES-256-GCM encryption for SMTP passwords with environment-based key support
Build and Push Multi-Platform Images / build-and-push (push) Successful in 27s
2026-05-06 20:10:20 +02:00
bjoernpoettker a000e0f5c6 feat: add debug logging for SMTP configuration and detailed mail delivery status
Build and Push Multi-Platform Images / build-and-push (push) Failing after 34s
2026-05-06 19:48:29 +02:00
bjoernpoettker 443ab765c9 feat: implement multi-segment PDF email attachments and add PWA mobile icons
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
2026-05-06 10:14:16 +02:00
bjoernpoettker 415f8bbcf3 feat: implement segment-based PDF download functionality with a dedicated UI for multi-page export
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s
2026-05-06 09:46:23 +02:00