Skip to content

Commit

Permalink
Merge pull request #46899 from paultsimura/fix/46874-currency-crash
Browse files Browse the repository at this point in the history
Fix the broken currency
  • Loading branch information
AndrewGable authored Aug 6, 2024
2 parents fb0043a + 10bf6c4 commit c860937
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3314,12 +3314,12 @@ function getModifiedExpenseOriginalMessage(
originalMessage.oldCurrency = TransactionUtils.getCurrency(oldTransaction);
originalMessage.oldMerchant = TransactionUtils.getMerchant(oldTransaction);

const modifiedData = TransactionUtils.calculateAmountForUpdatedWaypointOrRate(oldTransaction, transactionChanges, policy, isFromExpenseReport);
const modifiedDistanceFields = TransactionUtils.calculateAmountForUpdatedWaypointOrRate(oldTransaction, transactionChanges, policy, isFromExpenseReport);

// For the originalMessage, we should use the non-negative amount, similar to what TransactionUtils.getAmount does for oldAmount
originalMessage.amount = Math.abs(modifiedData.modifiedAmount);
originalMessage.currency = modifiedData.modifiedCurrency;
originalMessage.merchant = modifiedData.modifiedMerchant;
originalMessage.amount = Math.abs(modifiedDistanceFields.modifiedAmount);
originalMessage.currency = modifiedDistanceFields.modifiedCurrency ?? CONST.CURRENCY.USD;
originalMessage.merchant = modifiedDistanceFields.modifiedMerchant;
}

return originalMessage;
Expand Down
1 change: 0 additions & 1 deletion src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,6 @@ function calculateAmountForUpdatedWaypointOrRate(
amount: CONST.IOU.DEFAULT_AMOUNT,
modifiedAmount: CONST.IOU.DEFAULT_AMOUNT,
modifiedMerchant: Localize.translateLocal('iou.fieldPending'),
modifiedCurrency: Localize.translateLocal('iou.fieldPending'),
};
}

Expand Down

0 comments on commit c860937

Please sign in to comment.