Invoice numbering always started at 001 for each new year, with no way for a user to pick up numbering at a different point (e.g. continuing from a previous system, or reserving a block of numbers).
Approach
Added a user_settings table with an invoice_starting_number column (default 1).
Added GET/PUT /api/settings to read and update this per-user setting.
Invoice creation now seeds a year's counter at GREATEST(existing max invoice number for that year, starting_number - 1). This means the setting only takes effect for a year that hasn't issued any invoices yet, so existing numbering for years already in use is never disturbed.
Added a "Číslování faktur" panel in the account menu (mirrors the existing "Změnit heslo" panel) where the user can view and change the starting number, with 1 as the suggested/default placeholder.
Notes for reviewers
The starting number only affects the next year that has no invoices; it won't renumber or skip existing invoices for the current year.
No migration needed for existing rows since the setting defaults to 1, matching current behavior.
Verified with npm test (existing suite passes).
Invoice numbering always started at `001` for each new year, with no way for a user to pick up numbering at a different point (e.g. continuing from a previous system, or reserving a block of numbers).
## Approach
- Added a `user_settings` table with an `invoice_starting_number` column (default `1`).
- Added `GET/PUT /api/settings` to read and update this per-user setting.
- Invoice creation now seeds a year's counter at `GREATEST(existing max invoice number for that year, starting_number - 1)`. This means the setting only takes effect for a year that hasn't issued any invoices yet, so existing numbering for years already in use is never disturbed.
- Added a "Číslování faktur" panel in the account menu (mirrors the existing "Změnit heslo" panel) where the user can view and change the starting number, with `1` as the suggested/default placeholder.
## Notes for reviewers
- The starting number only affects the *next* year that has no invoices; it won't renumber or skip existing invoices for the current year.
- No migration needed for existing rows since the setting defaults to `1`, matching current behavior.
Verified with `npm test` (existing suite passes).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Invoice numbering always started at
001for each new year, with no way for a user to pick up numbering at a different point (e.g. continuing from a previous system, or reserving a block of numbers).Approach
user_settingstable with aninvoice_starting_numbercolumn (default1).GET/PUT /api/settingsto read and update this per-user setting.GREATEST(existing max invoice number for that year, starting_number - 1). This means the setting only takes effect for a year that hasn't issued any invoices yet, so existing numbering for years already in use is never disturbed.1as the suggested/default placeholder.Notes for reviewers
1, matching current behavior.Verified with
npm test(existing suite passes).