Files
orderPRO/database/migrations/20260511_000107_seed_default_invoice_config.sql
Jacek Pyziak 6129042ff6 feat(114): accounting configs refactor + invoice configs CRUD
Phase 114 complete (v3.7 Invoices):
- /settings/accounting jako hub-rozdroze (Paragony / Faktury)
- /settings/accounting/receipts + /invoices osobne podstrony list i edycji
- InvoiceConfigRepository + Controller (CRUD z walidacja delegacji)
- Seed Domyslny VAT (NOT EXISTS idempotent)
- invoice-config-form.js (toggle is_delegated -> integration_id)
- confirm-delete.js (globalny modul OrderProAlerts.confirm)
- Legacy aliasy starych endpointow /settings/accounting/save|toggle|delete

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 22:32:29 +02:00

11 lines
585 B
SQL

-- Phase 114-01: Seed default invoice config 'Domyslny VAT'.
-- Idempotent via NOT EXISTS guard (invoice_configs.name is not UNIQUE on purpose -
-- operators may want multiple configs with the same name across departments).
INSERT INTO `invoice_configs`
(`name`, `number_format`, `numbering_type`, `sale_date_source`, `order_reference`, `payment_to_days`, `default_kind`, `is_delegated`, `is_active`)
SELECT 'Domyslny VAT', 'FV/%N/%M/%Y', 'monthly', 'issue_date', 'none', 7, 'vat', 0, 1
FROM dual
WHERE NOT EXISTS (
SELECT 1 FROM `invoice_configs` WHERE `name` = 'Domyslny VAT'
);