Audit script: branch -> partner -> CSC
Script: scripts/audit_branch_partner_csc.php (read-only, outputs JSON).
How to run (PowerShell)
$ts = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
C:\xampp\php\php.exe scripts\audit_branch_partner_csc.php | Out-File -Encoding utf8 "reports\audit_branch_partner_csc_$ts.json"
How to read results
- summary.counts: high-level counts of each issue type.
- orphaned_* sections: missing/invalid foreign links (best-effort checks).
- status_mismatches: active CSC under non-active partner, missing post_office_code, etc.
- routing_issues: missing/inconsistent derived routing when partner-level routing columns do not exist.
Rule: store the JSON evidence first. Then plan safe fixes (prefer workflow/UI validation, not schema changes).