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

fix(A02): require valid Jalali opening and fiscal period dates

davoodmehraban89 committed Oct 14, 2026 at 23:30 UTC 07f15d247663a3a9c1002c8204411255d17624c6
1 file changed +5
src/core/OpeningBalanceDryRun.mjs
+5
@@ -1,3 +1,5 @@
1 +import { assertJalaliDate } from './AccountingCore.mjs';
2 +
3 /**
4 * Deterministic preflight for a historical-company opening balance import.
5 * IMPORTANT: No database access or writes, journal posting or activation here.
@@ -41,6 +43,9 @@ export function previewOpeningBalances({
43 openingDate < period.startDate || openingDate > period.endDate) {
44 throw Error('شرکت، دوره یا تاریخ افتتاحیه نامعتبر است');
45 }
46 + assertJalaliDate(openingDate);
47 + assertJalaliDate(period.startDate);
48 + assertJalaliDate(period.endDate);
49 for (const group of [lines, contacts, stock, cash]) rows(group, 'افتتاحیه');
50 unique(lines, r => r.accountId, 'حساب افتتاحیه');
51 unique(contacts, r => r.contactId, 'شخص');