From 90d6c31678635395ab54a2d6cf530d6d32a6d1d6 Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Sun, 23 Nov 2025 21:42:15 +0100 Subject: [PATCH] (bugfix) ViewLocationCart: still fixing conditional hub3a calculation --- app/ui/ViewLocationCard.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/ui/ViewLocationCard.tsx b/app/ui/ViewLocationCard.tsx index 0cceb9a..298cb4e 100644 --- a/app/ui/ViewLocationCard.tsx +++ b/app/ui/ViewLocationCard.tsx @@ -74,9 +74,13 @@ export const ViewLocationCard:FC = ({location, userSettin // sum all the billAmounts (only for bills billed to tenant) const monthlyExpense = bills.reduce((acc, bill) => (bill.paid && (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant) ? acc + (bill.payedAmount ?? 0) : acc, 0); - const hub3a_text = useMemo(() => { + const { hub3aText, paymentParams } = useMemo(() => { + if(!userSettings?.show2dCodeInMonthlyStatement || !generateTenantCode) { - return ""; + return { + hub3aText: "", + paymentParams: {} as PaymentParams + }; } const locationNameTrimmed_max20 = locationName.trimEnd().trimEnd().substring(0,19); @@ -96,7 +100,10 @@ export const ViewLocationCard:FC = ({location, userSettin OpisPlacanja: `Režije-${locationNameTrimmed_max20}-${formatYearMonth(yearMonth)}`, // max length 35 = "Režije-" (7) + locationName (20) + "-" (1) + "YYYY-MM" (7) }; - return(EncodePayment(paymentParams)); + return({ + hub3aText: EncodePayment(paymentParams), + paymentParams + }); }, [userSettings?.show2dCodeInMonthlyStatement, generateTenantCode, locationName, tenantName, tenantStreet, tenantTown, userSettings, monthlyExpense, yearMonth]); return( @@ -130,7 +137,7 @@ export const ViewLocationCard:FC = ({location, userSettin
  • {t("payment-reference-label")}
    {paymentParams.PozivNaBroj}
  • {t("payment-purpose-code-label")}
    {paymentParams.SifraNamjene}
  • - + : null }