Skip to content

Add payment-period budgeting, split monthly/period budget views, and period-start summary notifications#1002

Open
uniskela wants to merge 9 commits intoellite:mainfrom
uniskela:feat/payment-period-budgeting
Open

Add payment-period budgeting, split monthly/period budget views, and period-start summary notifications#1002
uniskela wants to merge 9 commits intoellite:mainfrom
uniskela:feat/payment-period-budgeting

Conversation

@uniskela
Copy link
Copy Markdown

@uniskela uniskela commented Feb 28, 2026

Summary

This PR adds payment-period budgeting alongside the existing monthly budget flow.

Users can now:

  • keep a separate period_budget
  • choose a payment period cadence (weekly, fortnightly, or monthly)
  • set an anchor date for that period
  • optionally receive a summary at the start of each payment period

The feature is wired through Settings, Dashboard, Stats, Notifications, and API endpoints, while keeping legacy monthly budget updates backward compatible.

Why

Monthly budget tracking works well for some users, but others budget around pay cycles rather than calendar months. This change adds first-class support for payment-period budgeting without removing or changing the existing monthly budget behavior.

Highlights

  • Adds period-budget calculation helpers and persistence
  • Keeps monthly and period budget handling separate
  • Adds API support for:
    • saving budget settings
    • fetching active period-budget status and projections
  • Updates Dashboard and Stats to show period-budget data separately from monthly budget data
  • Adds notification support for:
    • including a period summary in renewal notifications
    • optionally sending a summary-only notification at period start
  • Includes compatibility/backfill migrations for older installs

Migrations

This PR adds:

  • 000045.php
  • 000046.php
  • 000047.php
  • 000048.php

These cover:

  • notification_settings.period_summary_at_period_start
  • user.budget_period_type
  • user.budget_period_anchor_date
  • user.period_budget
  • compatibility backfills for older installs

Backward Compatibility

  • Existing monthly budget behavior remains supported
  • Legacy budget updates are still accepted for monthly budget writes
  • Added backfills to reduce risk on older databases

Validation

  • Ran php -l on touched PHP files

Test Plan

  1. Run migrations 000045 through 000048
  2. In Settings:
    • save monthly budget
    • save period budget, type, and anchor date
    • enable period-start summary notifications
  3. Verify Dashboard and Stats show separate monthly vs period budget views
  4. Run php endpoints/cronjobs/sendnotifications.php and confirm period summaries appear as expected
  5. Verify the new budget API endpoints return and persist the expected values

Note: AI assistance was used during implementation; code was manually reviewed before submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant