From 0a57b6e20e709d2446b7339df04c669541a589f0 Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Fri, 6 Jun 2025 20:40:56 +0200 Subject: [PATCH] fix: cashflow statement localization --- packages/server/src/i18n/en/financial_sheet.json | 6 +++--- .../src/modules/Expenses/commands/PublishExpense.service.ts | 2 +- .../FinancialStatements/FinancialStatements.module.ts | 1 - .../modules/CashFlowStatement/CashFlow.ts | 4 +--- .../modules/CashFlowStatement/CashFlowTable.ts | 5 +++-- .../src/modules/Tenancy/TenancyDB/UnitOfWork.service.ts | 4 +--- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/server/src/i18n/en/financial_sheet.json b/packages/server/src/i18n/en/financial_sheet.json index 5e42ecaaa..828015570 100644 --- a/packages/server/src/i18n/en/financial_sheet.json +++ b/packages/server/src/i18n/en/financial_sheet.json @@ -1,9 +1,9 @@ { - "previoud_period_date": "{{date}} (PP)", + "previoud_period_date": "{date} (PP)", "fianncial_sheet.previous_period_change": "Change (PP)", "previous_period_percentage": "% Change (PP)", - "previous_year_date": "{{date}} (PY)", + "previous_year_date": "{date} (PY)", "previous_year_change": "Change (PY)", "previous_year_percentage": "% Change (PY)", - "total_row": "Total {{value}}" + "total_row": "Total {value}" } diff --git a/packages/server/src/modules/Expenses/commands/PublishExpense.service.ts b/packages/server/src/modules/Expenses/commands/PublishExpense.service.ts index b2baeb813..d0256fe58 100644 --- a/packages/server/src/modules/Expenses/commands/PublishExpense.service.ts +++ b/packages/server/src/modules/Expenses/commands/PublishExpense.service.ts @@ -21,8 +21,8 @@ export class PublishExpense { */ constructor( private readonly eventPublisher: EventEmitter2, - private readonly uow: UnitOfWork, private readonly validator: CommandExpenseValidator, + private readonly uow: UnitOfWork, @Inject(Expense.name) private readonly expenseModel: TenantModelProxy, diff --git a/packages/server/src/modules/FinancialStatements/FinancialStatements.module.ts b/packages/server/src/modules/FinancialStatements/FinancialStatements.module.ts index 35b0a1328..bdedb8993 100644 --- a/packages/server/src/modules/FinancialStatements/FinancialStatements.module.ts +++ b/packages/server/src/modules/FinancialStatements/FinancialStatements.module.ts @@ -19,7 +19,6 @@ import { VendorBalanceSummaryModule } from './modules/VendorBalanceSummary/Vendo import { BalanceSheetModule } from './modules/BalanceSheet/BalanceSheet.module'; @Module({ - providers: [], imports: [ BalanceSheetModule, PurchasesByItemsModule, diff --git a/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlow.ts b/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlow.ts index f4f4e2619..880ee0a34 100644 --- a/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlow.ts +++ b/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlow.ts @@ -227,12 +227,10 @@ export class CashFlowStatement extends R.pipe( const accountsTotal = this.getAccountsMetaTotal(accounts); const total = this.getTotalAmountMeta(accountsTotal); - console.log(sectionSchema.label, 'label'); - const node = { sectionType: ICashFlowStatementSectionType.ACCOUNTS, id: sectionSchema.id, - label: sectionSchema.label, + label: this.i18n.t(sectionSchema.label), footerLabel: sectionSchema.footerLabel, children: accounts, total, diff --git a/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlowTable.ts b/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlowTable.ts index 61ddfead9..6b30583be 100644 --- a/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlowTable.ts +++ b/packages/server/src/modules/FinancialStatements/modules/CashFlowStatement/CashFlowTable.ts @@ -240,8 +240,9 @@ export class CashFlowTable { ): ICashFlowStatementSection => { const label = section.footerLabel ? section.footerLabel - : this.i18n.t('Total {{accountName}}', { accountName: section.label }); - + : this.i18n.t('financial_sheet.total_row', { + args: { value: section.label }, + }); section.children.push({ sectionType: ICashFlowStatementSectionType.TOTAL, label, diff --git a/packages/server/src/modules/Tenancy/TenancyDB/UnitOfWork.service.ts b/packages/server/src/modules/Tenancy/TenancyDB/UnitOfWork.service.ts index f903bc467..0121517f2 100644 --- a/packages/server/src/modules/Tenancy/TenancyDB/UnitOfWork.service.ts +++ b/packages/server/src/modules/Tenancy/TenancyDB/UnitOfWork.service.ts @@ -12,9 +12,7 @@ export class UnitOfWork { ) {} /** - * - * @param {number} tenantId - * @param {} work + * @param {function} work - The work to be done in the transaction. * @param {IsolationLevel} isolationLevel * @returns {} */