سامانه صدور فاکتور و حسابداری
fix(expense): retain explicit company and project scope in legacy cancellation adapter
davoodmehraban89 committed
Oct 14, 2026 at 12:09 UTC
29d718599d62fe791c9e8e50100225e66ca1a513
1 file changed
+4
js/operations.js
+4
@@ -66,6 +66,10 @@ window.renderExpenses=window.renderExpenses||function(){};
66
window.deleteExpense=function(id){
67
const entry=typeof expenseCurrentVisible==='function'?expenseCurrentVisible(id):null;
68
if(!entry||entry.ownerUserId!==currentUser?.id)return;
69
+ const companyId=entry.companyId,projectId=entry.projectId||'';
70
+ if(companyId!==afCompanyId())return alert('شرکت فعال با سند تطبیق ندارد.');
71
+ // Keep the original projectId reference in the audited correction scope;
72
+ // legacy CRUD must never reassign it when cancelling a posted source.
73
if(typeof expensePostingStatus==='function'&&expensePostingStatus(entry)==='posted')
74
return cancelPostedExpenseUi(entry.id);
75
alert('برای این سند قدیمی یا برگشتخورده، حذف مستقیم مجاز نیست؛ ابتدا تاریخچه حسابداری را تطبیق دهید.');