Skip to content

Commit 75e0fab

Browse files
extract isNotOwnerOrHasPerDiem condition
1 parent 695bd7e commit 75e0fab

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/pages/iou/request/step/IOURequestEditReport.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ function IOURequestEditReport({route}: IOURequestEditReportProps) {
6161
// transactions, use the policy of their report (or the transaction's policy as fallback) so the
6262
// selected workspace is preserved.
6363
// For the current user's own non-per-diem expenses, fall back to undefined to let the default workspace apply.
64-
const targetExpensePolicyID = selectedReport?.ownerAccountID !== session?.accountID || hasPerDiemTransactions ? selectedReport?.policyID : undefined;
64+
const isNotOwnerOrHasPerDiem = selectedReport?.ownerAccountID !== session?.accountID || hasPerDiemTransactions;
65+
const targetExpensePolicyID = isNotOwnerOrHasPerDiem ? selectedReport?.policyID : undefined;
6566
const {policyForMovingExpensesID, shouldSelectPolicy} = usePolicyForMovingExpenses(hasPerDiemTransactions, undefined, targetExpensePolicyID);
6667
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
6768
const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? '');

0 commit comments

Comments
 (0)