Related-party flag — propagate through the individual→payee sync
Why¶
Owner took himself off related-party in the unified Contacts/Individuals view, but the HKFRS s.33 approval gate kept firing when matching a transaction to 1120 (director current account) pointed at himself.
Root cause¶
Editing related-party in Contacts PATCHes the individual (system.relatedParty),
which triggers syncPayeeFromIndividual (lib/individuals/crud.server.ts). That sync
copied name / email / phone / bank / tax across but OMITTED the related-party field
— so the backing payee record never changed. The gate
(lib/rbac/relatedPartyGate.ts → isRelatedPartyPayeeServer), the Related-Party schedule
and IR56M all read payee.relatedParty.isRelatedParty, so un-flagging on the individual
had no effect there. The reverse direction (payeeSync.server.ts:55) already carried it —
the bridge was one-directional.
Fix¶
Carry isRelatedParty / relatedPartyRelationship / relatedPartyDescription through
syncPayeeFromIndividual, sourced from ind.system.relatedParty. Deliberately NOT via
the present() blank-skip helper — false/null are meaningful states that must
overwrite the payee, not be skipped. The payee update path
(updatePayeeInDirectoryServer) already honours those fields.
Notes¶
- Existing records left untouched (no silent data correction) — re-saving the contact
after deploy re-runs the now-correct sync and heals the stale
JCpayee record. - s.33 caveat raised to owner: a director IS a related party, so the gate firing is the
control working. If the goal is only to stop the per-transaction approval prompt, the
cleaner route is granting the role
transactions:link_related_party, not un-flagging.
Verify¶
tsc + lint clean; full suite 325/325.
Related¶
T-062 (contacts unification finish, same session).