mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
buildium-gl-sync: include inactive bank-account GL ids from /v1/bankaccounts
/v1/glaccounts omits some inactive accounts (e.g. prior-management bank accounts) whose ledgers still hold one side of historical transactions, making checks/deposits come back unbalanced on backfills (found during the Casuarina Club GL import). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -189,6 +189,24 @@ Deno.serve(async (req) => {
|
||||
if (Array.isArray(g.SubAccounts)) for (const s of g.SubAccounts) addGl(s);
|
||||
};
|
||||
for (const g of glAccounts) addGl(g);
|
||||
|
||||
// /v1/glaccounts omits some inactive accounts (e.g. prior-management bank
|
||||
// accounts) whose ledgers still hold one side of historical transactions —
|
||||
// without them, checks/deposits come back unbalanced. /v1/bankaccounts
|
||||
// returns inactive banks too, so merge their GL ids in.
|
||||
const bankAccts = await buildiumFetchAll("/v1/bankaccounts", clientId, clientSecret);
|
||||
for (const b of bankAccts) {
|
||||
const gid = String(b.GLAccount?.Id ?? b.Id ?? "");
|
||||
if (gid && !bGlById.has(gid)) {
|
||||
bGlById.set(gid, {
|
||||
Id: gid,
|
||||
Name: b.GLAccount?.Name ?? b.Name,
|
||||
AccountNumber: b.GLAccount?.AccountNumber ?? null,
|
||||
Type: b.GLAccount?.Type ?? "Asset",
|
||||
IsActive: b.IsActive,
|
||||
});
|
||||
}
|
||||
}
|
||||
const allGlIds = [...bGlById.keys()];
|
||||
|
||||
const today = isoDate(new Date());
|
||||
|
||||
Reference in New Issue
Block a user