• DevPilot's avatar
    fix(accounting): make the advances reclassification actually runnable, and safe afterwards · 9f48d4aa
    DevPilot authored
    Phase_107_002 has never run. Its first INSERT wrote to chart_of_accounts.notes,
    a column that does not exist, so the migration threw and MigrationRunner swallowed
    it — leaving 3,032,258 EGP of member advances sitting in revenue this whole time.
    Writing to description_ar instead lets it complete.
    
    That exposed a second problem the original migration would have caused. It
    deactivates 410503/504/505, but payment:down_payment carries an active posting
    rule crediting 410503. Deactivating the account without moving the rule means
    every future down payment records a receipt and posts no journal entry, because
    JournalService refuses an inactive account — quietly worse than the overstatement
    being fixed. The rule now moves to the matching contract-liability account, which
    is where a down payment belonged anyway: it is an advance from the moment it is
    collected, and only becomes revenue as the service is delivered. Otherwise the
    account being emptied would just refill.
    
    Also seeds the four bank accounts the chart already names as the club's current
    accounts. bank_accounts was empty, which is why the cash chain's deposit step
    had nothing to resolve and reported red. Account numbers are deliberate
    placeholders reading "رقم الحساب غير محدد" — a seed has no business inventing an
    IBAN that could reach a printed deposit slip — and the seed never overwrites a
    row someone has already filled in.
    
    And drops POST /waivers/{id}/pay: WaiverController::pay() does not exist, so the
    route was a guaranteed 500. Leftover from a direct-payment design that
    send-to-cashier replaced; nothing posts to it.
    
    Verified on a full 369-table production clone: balances move (410503/504/505 -> 0,
    deactivated; 23081119/20/21 created), entry balances Dr=Cr=3,032,258.00, re-runs
    post nothing, down payments still post clean, no active rule anywhere resolves to
    a dead or header account, all four chains green, trial balance diff 0.00.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    9f48d4aa
Name
Last commit
Last update
.claude Loading commit data...
Another ERP that we may want to cheat from Loading commit data...
HR requests Loading commit data...
Proposal Loading commit data...
Server Connection Data Loading commit data...
app Loading commit data...
config Loading commit data...
cron Loading commit data...
database Loading commit data...
docker Loading commit data...
docs Loading commit data...
public Loading commit data...
support_tickets_downloads/support_screenshots Loading commit data...
tests Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.editorconfig Loading commit data...
.env Loading commit data...
.env.example Loading commit data...
.gitignore Loading commit data...
.php-cs-fixer.php Loading commit data...
BalanceSheet.html Loading commit data...
CLAUDE.md Loading commit data...
Dockerfile Loading commit data...
Makefile Loading commit data...
SYSTEM_MAP.md Loading commit data...
Sports Module System Design DETAILED.md Loading commit data...
UPGRADE_PLAN.md Loading commit data...
captain-definition Loading commit data...
cli.php Loading commit data...
composer.json Loading commit data...
composer.lock Loading commit data...
interesting_features.md Loading commit data...
phpstan.neon Loading commit data...
phpunit.xml Loading commit data...
sports activity stuff .txt Loading commit data...
sports-activity-alignment-plan.md Loading commit data...
sports-activity-smart-filtering-plan.md Loading commit data...
trial_balance_2026-01-01_to_2026-05-10.csv Loading commit data...