@davoodmehraban89 / Factor-easy / commits / e418a9d
Fork 0

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

Protect purchase invoices referenced by settlements

davoodmehraban89 committed Sep 28, 2026 at 15:09 UTC e418a9dfe70a668fd9b053ba1c32b868378297d2
1 file changed +1
js/purchases.js
+1
@@ -169,6 +169,7 @@
169 w.document.close();
170 };
171 window.purDelete=function(id){
172 + if(typeof getMyPayments==='function'&&getMyPayments().some(p=>p.invoiceType==='purchase'&&p.invoiceId===id)){alert('برای این فاکتور پرداخت ثبت شده است؛ برای حفظ سابقه مالی ابتدا تخصیص پرداخت را اصلاح کنید.');return;}
173 if(!requireWrite()||!confirm('این فاکتور خرید حذف شود؟'))return;
174 datastore.purchases=datastore.purchases.filter(p=>!(p.id===id&&p.ownerUserId===currentUser.id));
175 saveDatastore();refreshAllSurfaces();