سامانه صدور فاکتور و حسابداری

test(company): support standalone module harness while scoping runtime company reads

davoodmehraban89 committed Oct 14, 2026 at 11:49 UTC 747d8acdee3854dc9049e5f52dfde8e777ea80c2
1 file changed +7 -1
js/phase4-contracting.js
+7 -1
@@ -1,5 +1,11 @@
1 /* Phase 4 — contracts, deductions, guarantees and contractor accounting */
2 -function p4Owned(k){return finoraScopedRows(k)}
2 +function p4Owned(k){
3 + if(typeof finoraScopedRows==='function')return finoraScopedRows(k);
4 + // Standalone domain-contract harnesses load this module without sync.js.
5 + const cid=afCompanyId(),single=typeof getMyCompanies!=='function'||getMyCompanies().length===1;
6 + return (datastore[k]||[]).filter(x=>x.ownerUserId===currentUser?.id&&
7 + (x.companyId===cid||(single&&!x.companyId)));
8 +}
9 function getMyContracts(){return p4Owned('contracts')} function getMyContractAmendments(){return p4Owned('contractAmendments')}
10 function getMyContractParties(){return p4Owned('contractParties')} function getMyContractDeductions(){return p4Owned('contractDeductions')}
11 function getMyGuarantees(){return p4Owned('guarantees')} function getMyGuaranteeEvents(){return p4Owned('guaranteeEvents')}