# Currency and record-code settings

## Currency

Company Settings → Workspace → Currency sets the company default or a branch override. Super Admin's existing General and Tenant defaults settings also use the shared currency dropdown. Built-in currency fields now use code/name dropdowns across plans, tenant subscriptions, billing, contracts, recruitment offers, salary bands, career changes, requests, payroll, assets and document renewals. New financial forms use the company default where no recorded currency applies. A stored legacy currency remains visible when reviewing existing records.

The bundled reference list comes from the Node runtime's Intl/Unicode currency data; no external lookup or new dependency is needed. Changing a default does not convert amounts or rewrite existing financial records. This change does not introduce exchange rates or change the existing monetary calculation/storage precision.

## Employee codes

Company Settings → People & policies → Employee numbering controls this company's series. Defaults are automatic `EMP-000001`, with manual overrides allowed for compatibility. Configure:

- Automatic generation when the code is blank, or mandatory manual entry.
- Prefix and suffix, up to 12 letters/digits/hyphens/underscores each.
- Minimum digit length from 1 to 12; larger numbers retain all their digits.
- Starting/next number, from 1 to 999999999999.
- Whether automatic mode also accepts manually entered older-system codes.

For example, prefix `HR-`, digit length `5` and next number `500` generate `HR-00500`, then `HR-00501`. The live preview does not reserve a number. Existing employees retain their codes. The internal record IDs and links are unchanged. Blank employee codes also follow the series through recruitment hiring, API creation and CSV imports. CSV retains its existing employee_number column; leave its cell blank for automatic generation. Manual-only mode requires a nonempty code. To import older-system codes when automatic-only mode is enabled, an administrator must first allow manual overrides.

Employee series are independent between companies. Allocation locks the company/sequence inside the record transaction, checks all existing employee numbers including retained deleted records, and skips collisions. Failed record transactions roll back the sequence update. Invalid or unauthorized requests do not consume numbers. An exhausted or heavily overlapping range reports a validation error rather than reusing an identifier.

## Plan codes

Super Admin → Settings → Plan code numbering provides the same prefix/suffix/digit/next-number controls for a platform-wide series, default `PLAN-0001`. Leave the code blank on Create subscription plan to generate it. Manual mode and manual override settings are enforced by the service. Existing plan codes and subscription agreements are retained; leaving a saved plan's code blank during editing keeps its current code.

## Upgrade and verification

Migration `2026_10_19_000021_create_record_code_sequences.php` adds an InnoDB sequence table with a tenant foreign key and unique scope key. No existing identifiers, financial amounts or historical agreements are rewritten. Back up before migration. The local upgrade used encrypted backup `d3a66edc-5d3f-4c45-9632-15763568dd65` and verified original employee, company, user, plan and mail records stayed unchanged.

Verification covered 40 SQLite employee/import/settings/platform/page regressions, then 27 platform/numbering checks including the six new scenarios (overlapping suites, not 67 distinct tests). The isolated MySQL numbering suite passed six tests/37 assertions. Two browser workflows passed, covering company currency selection, automatic employee creation, financial-form defaults, plan-code generation, live preview, mobile layout and dark mode. Production build, encoding, formatting and whitespace checks passed.

On the existing cPanel host, pull the source, run the migration and clear compiled views. Upload/extract the matching precompiled frontend ZIP into `public` before bringing the site up. Composer dependencies are unchanged; no server npm installation is required for this update. Keep the original `.env` and document keys; do not run seeders or reset the database.
