3fa871c742
* feat: add bike benefit handling and optional vacation accrual - Introduced bike benefit (cykelförmån) with calculations for annual market value and monthly taxable value. - Updated schemas to include new benefit types and validation rules. - Implemented API routes for creating, updating, and deleting employee benefits. - Enhanced salary calculation logic to accommodate new vacation rule options, including a 'none' option for no accrual. - Added UI components for managing employee benefits, including input for bike benefit specifics. - Created database migrations for employee benefits and updated salary line items to support new benefit types. * chore: remove Langfuse env var checks Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat: enhance OAuth callback URL handling and update default scopes for Visma integration * feat: remove trade_name field and simplify company naming in invoices * refactor: destructure canWrite from useCanWrite for consistency across components * feat: enhance PATCH endpoint to validate existing benefits and handle bike benefit updates * feat: add missing label for bike benefit in salary line item types --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
1015 B
SQL
33 lines
1015 B
SQL
-- Simplify company naming: remove trade_name field entirely.
|
|
-- Add invoice_show_logo toggle for invoice PDF header.
|
|
-- Migrate any existing trade_name into company_name so users who set a
|
|
-- handelsnamn keep their preferred invoice display name. Existing users
|
|
-- should be notified to verify company_name against Bolagsverket since
|
|
-- this value is used in SIE/INK2/NE filings.
|
|
|
|
ALTER TABLE public.company_settings
|
|
ADD COLUMN IF NOT EXISTS invoice_show_logo boolean DEFAULT true;
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'public'
|
|
AND table_name = 'company_settings'
|
|
AND column_name = 'trade_name'
|
|
) THEN
|
|
EXECUTE $sql$
|
|
UPDATE public.company_settings
|
|
SET company_name = trade_name
|
|
WHERE trade_name IS NOT NULL
|
|
AND trade_name <> ''
|
|
AND trade_name <> company_name
|
|
$sql$;
|
|
END IF;
|
|
END $$;
|
|
|
|
ALTER TABLE public.company_settings
|
|
DROP COLUMN IF EXISTS trade_name;
|
|
|
|
NOTIFY pgrst, 'reload schema';
|