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

fix: freeze source locally if atomic link verification fails

davoodmehraban89 committed Nov 17, 2026 at 14:24 UTC dc2604b78566b1de415b0a040e82e417067f2354
1 file changed +4 -2
js/journal-rpc.js
+4 -2
@@ -257,8 +257,10 @@ async function jeRpcAutoPost(kind,sourceId){
257 if(jeRpcEffectiveStatus(voucher)==='reversed')throw new Error('این منبع قبلاً برگشت حسابداری شده است؛ ثبت مجدد آن مجاز نیست.');
258 const reconciledSource=jeRpcSourceRecord(collection,sourceId);
259 if(!reconciledSource||reconciledSource.journalVoucherId!==voucher.id||
260 - reconciledSource.accountingStatus!=='posted'||reconciledSource.documentStatus!=='posted')
261 - throw new Error('سند قطعی ثبت شد اما پیوند منبع در همان تراکنش سرور تأیید نشد؛ ثبت مجدد نکنید و وضعیت را بررسی کنید.');
260 + reconciledSource.accountingStatus!=='posted'||reconciledSource.documentStatus!=='posted'){
261 + if(reconciledSource){reconciledSource.accountingPostingPending=true;reconciledSource.accountingPostingPendingAt=new Date().toISOString();}
262 + throw new Error('سند قطعی ثبت شد اما پیوند منبع در همان تراکنش سرور تأیید نشد؛ ثبت مجدد یا ویرایش نکنید و وضعیت را بررسی کنید.');
263 + }
264 return voucher;
265 }finally{jeRpcAutoPostBusy=false;}
266 }