Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,11 @@
return;
}

if (iouCategory && policyCategories && (!policyCategories[iouCategory] || !policyCategories[iouCategory]?.enabled)) {
setFormError('violations.categoryOutOfPolicy');
return;
}

const transactionTag = getTag(transaction);
if (transactionTag.length > CONST.API_TRANSACTION_TAG_MAX_LENGTH) {
setFormError('iou.error.invalidTagLength');
Expand Down Expand Up @@ -970,7 +975,7 @@
onSendMoney?.(paymentMethod);
}
},
[

Check warning on line 978 in src/components/MoneyRequestConfirmationList.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useCallback has missing dependencies: 'iouCategory' and 'policyCategories'. Either include them or remove the dependency array

Check warning on line 978 in src/components/MoneyRequestConfirmationList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useCallback has missing dependencies: 'iouCategory' and 'policyCategories'. Either include them or remove the dependency array
routeError,
transactionID,
iouType,
Expand Down
3 changes: 3 additions & 0 deletions src/components/MoneyRequestConfirmationListFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ function MoneyRequestConfirmationListFooter({
const shouldDisplayDistanceRateError = formError === 'iou.error.invalidRate';
const shouldDisplayTagError = formError === 'violations.tagOutOfPolicy';
const shouldDisplayTaxRateError = formError === 'violations.taxOutOfPolicy';
const shouldDisplayCategoryError = formError === 'violations.categoryOutOfPolicy';

const showReceiptEmptyState = shouldShowReceiptEmptyState(iouType, action, policy, isPerDiemRequest);
// The per diem custom unit
Expand Down Expand Up @@ -621,6 +622,8 @@ function MoneyRequestConfirmationListFooter({
disabled={didConfirm}
interactive={!isReadOnly}
rightLabel={isCategoryRequired ? translate('common.required') : ''}
brickRoadIndicator={shouldDisplayCategoryError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
errorText={shouldDisplayCategoryError ? translate(formError) : ''}
/>
),
shouldShow: shouldShowCategories,
Expand Down
5 changes: 0 additions & 5 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,6 @@ function IOURequestStepConfirmation({
}
continue;
}

// Clear category field when the category doesn't exist for selected policy, or it's disabled
if (!policyCategories?.[item.category] || !policyCategories[item.category]?.enabled) {
setMoneyRequestCategory(item.transactionID, '', policy?.id, isMovingTransactionFromTrackExpense);
}
}
// We don't want to clear out category every time the transactions change
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
Expand Down
Loading