---
name: evolution-two-accounting-files
description: Evolution has TWO accounting.php files (web-root global functions vs library class) — invoice/bill commit uses the web-root one
metadata: 
  node_type: memory
  type: project
  originSessionId: ad28526d-09fc-419e-b563-f045fb13f915
---

Evolution has **two `accounting.php` files** with same-named GL posting routines — editing the wrong one ships a dead fix.

- **`/accounting.php`** (web root) — defines **global functions** `commitInvoice()` / `commitBill()` / `commitBillPayments()` / `commitPayments()` / `doJournal()`. This is the **live trading path**: invoice Approve (`invoiceaddsave.php`→ global `commitInvoice($id)`), bill commit (`billaddsave.php`, `billpay2save.php`), `stocktakesave.php`, the Shopify plugin, and `cron/send.php` all `include("accounting.php")` (bare relative path → resolves to web root) and call the **global functions**.
- **`/library/accounting.php`** — defines a **class** (tab-indented methods of the same names). Used only by `payment.php` (AR/AP payment commit) and `cron/xero_payment_cron.php` / `library/xero.php`. No redeclare clash with the globals because one set is methods, the other free functions.

**Why:** a 2026-06-11 branch-stamping fix (add `branchid` to gledger inserts) was first applied only to the `library/` class, so committed invoices still posted `branchid=0` — the global web-root functions are what actually run. Both files are now patched.
**How to apply:** when changing GL posting logic, patch **both** files (or at least confirm which path the caller uses). For invoice/bill commits it's the **web-root** `/accounting.php` globals. See [[evolution-gl-pl-data-model]].
