Commit Graph

26 Commits

Author SHA1 Message Date
Stefan ebdb92713a Docs: evaluation of backend-cached invoice editing over SignalR
Assesses the proposed server-held edit state + SignalR live-edit channel against
the current stateless design. Recommendation: don't do the full rewrite now (it
adds stateful-server/scaling/reconnect complexity for a single-editor back-office
flow); instead add a stateless inv/calc endpoint that reuses the backend pricing
(InvoiceSetPricing/VAT) so the editor stops duplicating the math — capturing the
real value without sockets. Add SignalR later only as transport if real-time
co-editing becomes a genuine requirement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:43:54 +02:00
Stefan c358fdbdb2 Invoice set pricing: 3 display modes (backend contract + PDF + tests)
Sets (mfr__items Type='set') can be shown three ways on the invoice:
- SetPrice (default): set line priced, member items shown without price
- ItemPrices: member items priced, set line as a heading without price
- SetOnly: only the set line (priced), members removed

- InvoiceSetPricing (new): the authoritative, unit-tested transformation
  (SetDisplayMode + Build) that both sides agree on; set price always equals the
  sum of members. Mode is read from InvoiceOptions ("setmode:<mode>").
- FuchsPdf.ApplyInvoice renders through it: lines flagged ShowPrice=false print
  blank price/total cells; set headers are emphasised. Invoices without sets are
  unchanged. Totals come from the registration balance, so modes are purely
  presentational and never change the sum.
- InvoiceSetPricingTests (+14): all three modes, set-price = member sum, header
  total fallback, no-set pass-through, option parsing.
- Docs/INVOICE_SET_PRICING.md documents the front-end contract (the editor sets
  the mode token + tags set header/member items); the back-end does the rest.

Front-end editor wiring is specified in the doc but intentionally not shipped
blind (cannot validate the running editor here).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:42:44 +02:00
Stefan 2c17171e77 Optimize Fuchs_DataService: parallel file sync, shared HttpClient, cancellation
Reviewed the data service against mfr_interface_description.md. The OData entity
sync already follows @odata.nextLink and now inherits the MFR client's transient
retry + timeout, so it is spec-aligned. Reliability/performance improvements:

- MFRClient.GetFile no longer news up an HttpClient per call (socket-exhaustion
  risk); added GetFileAsync backed by one shared static HttpClient with
  per-request auth, and GetFile delegates to it.
- GetInvoiceFiles_async now downloads + stores invoice PDFs in parallel
  (bounded concurrency 4) via Parallel.ForEachAsync instead of sequentially.
- Threaded CancellationToken from the MfrSync job through UpdateIfNecessary_async/
  UpdateRequested_async/GetInvoiceFiles_async and the entity-sync loops for
  graceful shutdown (cooperative checks between iterations). Entity-table sync
  is left sequential on purpose (referential ordering by updateneed).

IFdsMfr sync methods gained optional CancellationToken params (default) — the
web app only uses the read methods, so this stays source-compatible with Fuchs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 15:27:55 +02:00
Stefan 2a75664625 Docs: reference mfr_interface_description.md + Fuchs_Database
- ARCHITECTURE.md: add Fuchs_Database (SSDT) and the MFR interface doc to the
  project table; new MFR ERP Integration and Database sections.
- copilot-instructions.md + CLAUDE.md (kept in sync): add MFR ERP integration
  and Database sections pointing to MFR_RESTClient/Docs/mfr_interface_description.md
  as the contract to read before changing the client; CLAUDE.md doc map updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 15:05:49 +02:00
Stefan 27becf7c68 MFR client: align with interface doc; remove VB-era files
Per MFR_RESTClient/Docs/mfr_interface_description.md (added):
- MFRClientConfig: configurable TimeoutMs (default 30000), UserAgent, MaxRetries,
  and a derived RestRoot (/mfr) alongside the OData BaseUrl.
- MFRClient: apply request Timeout + UserAgent, send Accept: application/json,
  and retry idempotent GETs on transient failures (HTTP 429/5xx and
  network/timeout) with exponential backoff + jitter, honouring Retry-After.
- Added ReadODataAllPages to follow @odata.nextLink pagination.

Cleanup: removed legacy VB project files (MFR_RESTClient.vbproj, .vbproj.user,
app.config My.MySettings) and stopped tracking the generated MFR_RESTClient.xml
(now git-ignored). The active project is MFR_RESTClient.csproj.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 15:04:19 +02:00
Stefan a00ec1da3b Fix backend↔database mismatches found verifying against Fuchs_Database
Verified every [dbo].[...] object the backend calls against the SSDT project.
Two real mismatches fixed (both would fail at runtime):

- Banking search (bam/btl mode=s) called a non-existent
  [dbo].[fds__getBankingtransactions_list2] and dropped @tgtdate. The actual
  proc (and the legacy call) is [dbo].[fds__getBankingtransfers_list2]
  (@tgtdate,@mode,@search,@authuser) — corrected name + parameters.
- Widget generic branch called a phantom [dbo].[fds__getWidget] that never
  existed (legacy only had my/one; the dashboard only requests wdg/my, wdg/one).
  The default branch now returns 404 instead of hitting a missing proc.

(The 'fuchs__admin_logdebug' reference is only in a commented-out line.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 15:03:51 +02:00
Stefan 10ecdfa2e4 Add Fuchs_Database SSDT project (schema source of truth)
Adds the SQL Server Data Tools project for the fuchs_fds database — tables,
table types, functions and stored procedures that the backend calls (e.g.
fds__getInvoice, fds__merge_bankingtransactions, fds__tt__bankingtransactions,
fds__admin_getReportCatalog, fis_* auth). Build/model caches (bin, obj,
*.dbmdl, *.jfm, *.user) are git-ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:50:54 +02:00
Stefan 1376779224 Docs: update ARCHITECTURE + copilot instructions, add CLAUDE.md + USER_GUIDE
- ARCHITECTURE.md: reflect the implemented DI service layer, CAMTParser,
  OpenTelemetry/observability, the ported report engine, and CAMT+MT940
  banking; mark the resolved observations.
- copilot-instructions.md: add Services/DI, dual-format banking, observability
  and testing sections; add an Instruction-Sync banner.
- CLAUDE.md (new): Claude Code project instructions mirroring the shared rules,
  plus build/test workflow notes. Both files state they must stay in sync.
- USER_GUIDE.md (new, Fuchs/Docs): end-user process guide (login, invoices,
  reminders, requests, banking incl. MT940/CAMT upload, DATEV, reports).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:45:39 +02:00
Stefan 7ee4e5302a Add CAMTParser (ISO 20022) alongside MT940; accept both formats
- New CAMTParser project: namespace-agnostic parser for camt.052/053/054
  producing a statement/entry model aligned with the banking columns
  (account, amount, debit/credit, dates, counterparty, references, remittance).
- BankingService now auto-detects the upload format (XML→CAMT, else MT940)
  and maps either into the same fds__tt__bankingtransactions DataTable, so the
  bam/up handler transparently accepts both.
- Frontend (fis.bam.de.js) upload field now advertises accept for both
  MT940 (.sta/.mt940/.txt) and CAMT (.xml/.camt).
- Tests (+14, 151 total): CamtParserTests cover parsing (credit/debit,
  namespace-version agnostic, reversals), detection, and failure/edge inputs
  (empty, invalid XML, non-CAMT); BankingDualFormatTests verify CAMT and MT940
  both land in the same DataTable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:39:54 +02:00
Stefan e04d590c3a Add OpenTelemetry, performance metrics, and broaden logging + tests
Observability:
- New FuchsTelemetry (ActivitySource + Meter) defining business counters
  (invoices/reminders/reports rendered, emails/sms sent+failed, MT940 rows,
  MFR calls) and duration histograms (PDF render, report render, email send).
- Program.cs wires OpenTelemetry tracing (ASP.NET Core, HttpClient, SqlClient,
  app source) and metrics (ASP.NET Core, HttpClient, runtime, app meter).
  OTLP export is enabled only when Fuchs:Telemetry:OtlpEndpoint is set, so a
  missing collector never affects the app; disable via Fuchs:Telemetry:Enabled.

Instrumentation + logging:
- Services (Pdf, Invoice, Reminder, Report, Com, Banking, Widget, MfrFactory)
  now emit spans, record metrics, and log entry/result/timing/errors.
- Added dispatch + key-action logging to the previously silent handlers
  (Banking, Reminder, Reports, Requests).

Tests (137 total, +10):
- ProcessWebComServiceTests with a stub HttpMessageHandler cover success
  (API 200), failure (API 500, invalid email, empty mobile), disabled mode,
  the base64 attachment payload contract, and metric emission via MeterListener.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:02:13 +02:00
Stefan 8dee630abb Complete DI migration: wire all business services end-to-end
Move the intranet off the static-helper / Active-Record pattern onto
constructor-injected services, removing controller coupling and the
sync-over-async (Task.Run().Wait()) hot spots in the data classes.

Services now registered and consumed via DI:
- IBankingService, IPdfService, IMfrClientFactory (singletons)
- IWidgetService, IReportService, IInvoiceService, IReminderService (scoped)

Key changes:
- FuchsWidgetService: real widget logic (sql_table/indicator/html +
  rendering_options) ported from the static class, which is deleted.
- FuchsReportService + FuchsVisualization: report engine decoupled from
  IntranetController (takes connStr/dbSec/userAccountId); static
  FuchsReports deleted.
- InvoiceService / ReminderService: implement load/register/render/store
  (previously NotImplementedException stubs). FdsInvoiceData /
  FdsReminderData are now pure data holders — all DB + PDF work moved into
  the services, async throughout (no Task.Run().Wait()).
- Controllers inject and call the services; all `new FdsMfrClient()` calls
  go through IMfrClientFactory.
- Deleted dead code: static Banking, FuchsWidgets, FuchsReports, and the
  unused IDbConnectionFactory.
- InternalsVisibleTo("Fuchs.Tests") for testing internal mapping logic.

Tests: 127 passing (Banking tests moved to the service; added data-holder
tests for FdsInvoiceData/FdsReminderData). Full solution builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 12:57:59 +02:00
Stefan c81619fa53 Restore legacy parity gaps lost in the VB.NET → C# migration
Close functional regressions found by comparing the legacy applications
(Intranet_Legacy/) against their C# counterparts:

- ProcessWebComService: send attachments inline (base64) with the
  push_com POST so invoice/reminder PDFs are attached again.
- FuchsPdf: wire GetPaycode into ApplyInvoice/ApplyReminder to restore
  the SEPA giro-code payment QR, and restore the full standard invoice
  text block (§35a labor-cost note, Akonto text, §14/§48 notes, AGB,
  Steuernummer, Verrechnungssätze, etc.).
- IntranetController: restore changepassword validation (password
  strength, confirmation match, current-password verification) and the
  mfr empty-id OData $metadata response.
- Reports: port the ocms_visualization engine to C# (FuchsVisualization)
  and wire FuchsReports.ProcessFdsRequest to render generic/
  generic_content/chart reports instead of returning an empty OK stub.

Adds smoke tests for the giro QR generator and report page builder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 16:41:46 +02:00
Stefan c8a4d18f1a added legacy code for reference
Playwright Tests / test (push) Has been cancelled
2026-06-04 14:56:43 +02:00
Stefan dbe6cd8653 Add structured logging to IntranetController actions
Extensive structured logging was added throughout IntranetController and all invoice/account handlers to improve traceability and debugging. Logging now covers action entry/exit, error conditions, and key parameters (user IDs, invoice IDs, etc.). Handlers log warnings for missing/invalid input and info/debug for significant events. Minor refactoring extracts form values for better logging. The jQuery `rwText` plugin was hardened against null input. Updated minified JS, font assets, and OCORE submodule. No functional changes to `tools.js`.
2026-06-04 14:21:14 +02:00
Stefan 8f8d462045 Update IdentityModel and test dependencies to latest
Bump Microsoft.IdentityModel.* packages to 8.19.1 in MFR_RESTClient and OCORE. Update Microsoft.NET.Test.Sdk and coverlet.collector in Fuchs.Tests. Refresh OCORE submodule reference. No functional changes; dependency updates only.
2026-06-03 20:37:43 +02:00
Stefan 9c0bf76a05 Add project-wide instruction files for Fuchs migration
Playwright Tests / test (push) Has been cancelled
Added detailed instruction files for configuration, controller structure, C# standards, OCORE library usage, ImageSharp licensing, and testing. These documents define rules for settings, DI, file layout, package management, and test practices to ensure consistency and compliance during the .NET 10 migration.
2026-05-30 23:31:32 +02:00
Stefan 2d65e34500 Update deps, docs, auth logic; add SixLabors license
Playwright Tests / test (push) Has been cancelled
- Expanded copilot-instructions.md with project/routing details and ImageSharp license handling
- Upgraded MailKit and MimeKit to v4.17.0
- Added sixlabors.lic for ImageSharp 4.x licensing
- Removed SecretManagementExtensions.cs stub
- Updated OCORE and OCORE_web submodules
- Improved unauthorized access handling in IntranetController
- Removed empty placeholder file
2026-05-30 23:20:11 +02:00
Stefan 1ce497b37e -
Playwright Tests / test (push) Has been cancelled
2026-05-18 08:27:07 +02:00
Stefan aceef9ff74 Update NuGet packages and project references
Upgraded multiple NuGet packages to latest versions across all projects, including test and core dependencies. Updated OCORE, OCORE_web, and OCORE_web_pdf project references to use local paths. Added OCORE-related projects to the solution file with environment-specific build configs. Fixed package.json structure for valid JSON.
2026-05-18 08:26:58 +02:00
Stefan 445fc2b858 Add OCORE_Charting as a new Git submodule
Added the OCORE_Charting submodule, referencing its repository at https://git.processweb.de/Stefan/OCORE_Charting.git and tracking commit fcb8f090d4e4147ca7b79c20c65099dd589e3b85.
2026-05-18 08:26:30 +02:00
Stefan 9dcbf0d958 Add OCORE submodules 2026-05-18 08:15:16 +02:00
Stefan b17baca835 Unify email/SMS via ProcessWeb Mailer API, remove legacy
Replaces legacy email/SMS logic with a new IComService abstraction using the ProcessWeb Mailer API for all outbound communication. Removes FuchsFdsEmail, FuchsEmailService, IEmailService, SmtpAccountSettings, and FuchsEmailSettings. Updates controllers to use IComService. Refactors appsettings.json to use a new "Mailer" section. Adds ProcessWebComSettings and a stub for secret management. Removes OCORE.sms.SMS77 and direct SMTP/MailKit usage. Cleans up solution file references to OCORE projects.
2026-05-18 08:11:21 +02:00
Stefan cc2abc91d6 Add Azure Key Vault + DPAPI secret management
Playwright Tests / test (push) Has been cancelled
Integrate OCORE/OCORE_web-based secret management using Azure Key Vault and DPAPI cache. Update appsettings.json to remove plaintext secrets and list managed keys. Register secret management in Program.cs. Update .gitignore for secret files. Add documentation for naming conventions and migration, plus a PowerShell script for initial secret upload. Centralizes and secures secret handling across the app.
2026-05-03 16:24:38 +02:00
Stefan c617e9ae3b Update .gitignore for broader dev and build artifact coverage
Playwright Tests / test (push) Has been cancelled
Expanded .gitignore to exclude Playwright outputs, Node.js folders, NuGet packages, log files, and additional Visual Studio/project-specific directories. Improved formatting for clarity and maintainability.
2026-05-03 02:10:31 +02:00
Stefan a4284234b2 Initial Commit after switching from SVN to git 2026-05-03 01:43:52 +02:00
StefanOtt ab8638e5bb Add .gitattributes. 2026-05-03 01:30:36 +02:00