فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

fix(A05): reject disabled bank transfers, cash expenses and cheque settlements

davoodmehraban89 committed Oct 17, 2026 at 00:07 UTC de9bbb639be37acf98bb99bc1cd62a9393e3ce61
1 file changed +7 -3
src/core/RetailPostingService.js
+7 -3
@@ -422,6 +422,8 @@ class RetailPostingServiceImpl {
422 ctx.companyId,'حساب مبدا');
423 const to=sameCompany(all.find(a=>a.id===info.toAccountId&&a.recordType==='account'),
424 ctx.companyId,'حساب مقصد');
425 + if(from.isActive===false||to.isActive===false)
426 + throw Error('انتقال بین حساب‌های بانکی/صندوق غیرفعال مجاز نیست');
427 if(from.id===to.id)throw Error('حساب مبدا و مقصد باید متفاوت باشند');
428 const mapping=account=>cashLedger(ctx,account);
429 const id=info.transactionId||uid('tx_');
@@ -453,7 +455,8 @@ class RetailPostingServiceImpl {
455 if(await tx.get('expenses',row.id))throw Error('سند هزینه/درآمد تکراری است');
456 const sum=positiveAmount(row.amount);
457 if(row.method==='cheque')throw Error('هزینه یا درآمد چکی را در بخش چک‌ها ثبت کنید');
456 - const cash=(await tx.getAll('treasury')).filter(a=>a.companyId===company&&a.recordType==='account');
458 + const cash=(await tx.getAll('treasury')).filter(a=>a.companyId===company&&
459 + a.recordType==='account'&&a.isActive!==false);
460 const selected=cash.find(a=>a.isDefault)||cash[0];
461 if(!selected)throw Error('صندوق یا بانک برای ثبت هزینه/درآمد موجود نیست');
462 const cashLedgerId=cashLedger(ctx,selected);
@@ -508,9 +511,10 @@ class RetailPostingServiceImpl {
511 const ctx=await this.context(tx,company,options.date||cheque.dueDate);
512 const sum=amount(cheque.amount),inbound=cheque.direction==='inbound';
513 const ref={contactId:cheque.contactId};
511 - const accounts=(await tx.getAll('treasury')).filter(a=>a.companyId===company&&a.recordType==='account');
514 + const accounts=(await tx.getAll('treasury')).filter(a=>a.companyId===company&&
515 + a.recordType==='account'&&a.isActive!==false);
516 if(options.accountId&&!accounts.some(a=>a.id===options.accountId))
513 - throw Error('حساب بانکی انتخاب‌شده در شرکت فعال وجود ندارد');
517 + throw Error('حساب بانکی انتخاب‌شده فعال نیست یا در شرکت فعال وجود ندارد');
518 const bank=accounts.find(a=>a.id===options.accountId)||accounts.find(a=>a.isDefault)||accounts[0];
519 if(status==='cleared'&&!bank)throw Error('حساب بانک یا صندوق برای وصول چک مشخص نیست');
520 const bankLedger=status==='cleared'?cashLedger(ctx,bank):null;