سامانه صدور فاکتور و حسابداری
fix: F2 journal view guard and explicit confirmation before purchase final posting
davoodmehraban89 committed
Oct 12, 2026 at 00:06 UTC
78bafd3510edd0b4db2b5a139e1b1d1cedeb189e
1 file changed
+5
-1
js/ux-hardening-r2.js
+5
-1
@@ -154,7 +154,7 @@
154
const handler=window[ids[view]];
155
if(typeof handler!=='function')return f2Error('در این صفحه، فرم قابل ذخیرهای برای کلید F2 تعریف نشده است.');
156
// Do not turn approval of the manual voucher or a sales invoice into an implicit posting.
157
- if(view==='view-journal'&&document.querySelector('[data-finora-task="documents"]')?.offsetParent!==null)
157
+ if(view==='view-journal'&&document.querySelector('[data-finora-task="documents"]')?.getClientRects().length>0)
158
return f2Error('قطعیسازی سند مالی فقط از مدیریت اسناد و با تأیید صریح انجام میشود؛ F2 برای ثبت پیشنویس است.');
159
// Accessible native inputs supply field-specific errors before any write is attempted.
160
const visibleView=document.getElementById(view);
@@ -177,6 +177,10 @@
177
return f2Error('حداقل یک ردیف کالا یا خدمت با تعداد معتبر وارد کنید.');
178
if(!$('pur-supplier')?.value)return f2Error('تأمینکننده را انتخاب کنید.');
179
}
180
+ // Unlike sales drafts, the current purchase Save posts its financial voucher.
181
+ // Require an explicit second confirmation rather than silently posting through a hotkey.
182
+ if(view==='view-purchases'&&!confirm('ثبت فاکتور خرید در نسخه فعلی سند حسابداری را قطعی میکند. با ثبت قطعی موافقید؟'))
183
+ return f2Error('عملیات متوقف شد؛ قطعیسازی خرید نیازمند تأیید صریح است.');
184
f2Running=true;
185
try{await Promise.resolve(handler());return true}
186
catch(error){return f2Error('فرم ذخیره نشد: '+(error?.message||String(error)))}