# Phase 118 Plan 01 Summary - Fakturownia Single Instance

## Status

APPLY complete on 2026-05-12 13:47. Ready for UNIFY.

## Implemented

- Added `database/migrations/20260512_000109_fakturownia_single_instance.sql`.
- Converted `FakturowniaIntegrationRepository` to one global settings row with `getSettings()`, `saveSettings()`, `getIntegrationId()`, `getCredentials()`, and compatibility wrappers.
- Simplified `FakturowniaIntegrationController` to one settings page plus save/test actions.
- Replaced Fakturownia multi-account list UI with a single configuration form and test panel.
- Updated integrations hub to show Fakturownia as one instance.
- Updated delegated invoice config save flow to always use the global Fakturownia `integration_id`.
- Removed the invoice config account selector and replaced it with global Fakturownia status.
- Updated `DOCS/DB_SCHEMA.md`, `DOCS/ARCHITECTURE.md`, and `DOCS/TECH_CHANGELOG.md`.
- Updated `.paul/codebase/db_schema.md`, `.paul/codebase/architecture.md`, and `.paul/codebase/tech_changelog.md`.

## Verification

- PASS: `C:\xampp\php\php.exe -l` for changed PHP classes and `routes/web.php`.
- PASS: `C:\xampp\php\php.exe -l` for changed PHP views.
- PASS: static search found no active UI links for adding/deleting Fakturownia accounts; legacy `/new` and `/edit` routes redirect to the global settings page.
- BLOCKED: `C:\xampp\php\php.exe bin\migrate.php` could not connect to local MySQL (`SQLSTATE[HY000] [2002]` target actively refused connection).
- SKIPPED: PHPUnit is not available in `vendor/bin`.
- SKIPPED: `sonar-scanner` is not available in PATH.

## Environment Gaps

- Run `C:\xampp\php\php.exe bin\migrate.php` after local MySQL/XAMPP is running.
- Manually verify `/settings/integrations`, `/settings/integrations/fakturownia`, save/test Fakturownia settings, and local/delegated invoice config edit.
- Live Fakturownia API test still requires valid credentials and network access.

## Files Changed

- `database/migrations/20260512_000109_fakturownia_single_instance.sql`
- `src/Modules/Settings/FakturowniaIntegrationRepository.php`
- `src/Modules/Settings/FakturowniaIntegrationController.php`
- `src/Modules/Settings/IntegrationsHubController.php`
- `src/Modules/Settings/InvoiceConfigRepository.php`
- `src/Modules/Settings/InvoiceConfigController.php`
- `src/Modules/Accounting/InvoiceService.php`
- `resources/views/settings/fakturownia.php`
- `resources/views/settings/fakturownia-edit.php`
- `resources/views/settings/accounting-invoice-edit.php`
- `routes/web.php`
- `DOCS/DB_SCHEMA.md`
- `DOCS/ARCHITECTURE.md`
- `DOCS/TECH_CHANGELOG.md`
- `.paul/codebase/db_schema.md`
- `.paul/codebase/architecture.md`
- `.paul/codebase/tech_changelog.md`
