سامانه صدور فاکتور و حسابداری
fix(B03-R3): isolate recovery rendering in js/accounting-foundation.js
davoodmehraban89 committed
Nov 24, 2026 at 17:06 UTC
69fa593f79d362e440d52f6f82f741dfdcbb58e6
1 file changed
+2
js/accounting-foundation.js
+2
@@ -108,11 +108,13 @@ function afEnsureIranComplianceTemplateV3(){
108
company.accountingTemplate.complianceVersion=3;company.accountingTemplate.complianceMigratedAt=new Date().toISOString();if(changed)saveDatastore();else saveDatastore();
109
}
110
function afSeed(){
111
+ if(typeof finoraIsReadOnlyRefresh==='function'&&finoraIsReadOnlyRefresh())return;
112
if(!currentUser||!afCompanyId())return;afEnsureFloatingSlotCompatibility();afEnsureAccountingP0Compatibility();afEnsureContractingPhase4Accounts();afEnsureIranComplianceTemplateV3();let ch=false,cid=afCompanyId();
113
if(!getMyFiscalYears().length){const y=toEnDigits(String(getJalaliNumeric()).split('/')[0]);datastore.fiscalYears.push({id:afId('FY'),ownerUserId:currentUser.id,companyId:cid,title:'سال مالی '+y,startDate:y+'/01/01',endDate:y+'/12/29',status:'open',createdAt:new Date().toISOString()});ch=true}
114
if(ch)saveDatastore();
115
}
116
function afMigrateLegacyProjects(){
117
+ if(typeof finoraIsReadOnlyRefresh==='function'&&finoraIsReadOnlyRefresh())return;
118
if(!currentUser||!afCompanyId())return;const s=getMySettings();const key='accountingFoundationMigrationV2_'+afCompanyId();if(s[key])return;let ch=false;
119
getMyContacts().forEach(c=>(c.projects||[]).forEach(p=>{let g=datastore.projects.find(x=>x.id===p.id&&x.ownerUserId===currentUser.id);if(!g){g={id:p.id,ownerUserId:currentUser.id,companyId:afCompanyId(),code:p.id,name:p.name,parentId:'',direction:p.direction||'both',linkedContactIds:[c.id],active:true,legacy:true};datastore.projects.push(g);ch=true}else if(!(g.linkedContactIds||[]).includes(c.id)){g.linkedContactIds=[...(g.linkedContactIds||[]),c.id];ch=true}(p.subprojects||[]).forEach(z=>{let q=datastore.projects.find(x=>x.id===z.id&&x.ownerUserId===currentUser.id);if(!q){datastore.projects.push({id:z.id,ownerUserId:currentUser.id,companyId:afCompanyId(),code:z.id,name:z.name,parentId:p.id,direction:z.direction||p.direction||'both',linkedContactIds:[c.id],active:true,legacy:true});ch=true}})}));
120
s[key]={completedAt:new Date().toISOString(),mode:'copy-preserve-ids'};if(ch||!s[key])saveDatastore();else saveDatastore();