Skip to content

Commit

Permalink
Merge pull request #42984 from bernhardoj/fix/42971-scan-in-progress-…
Browse files Browse the repository at this point in the history
…shown-for-manual-request-with-receipt

Fix scan in progress shown for manual request with receipt moved from tracked expense
  • Loading branch information
techievivek authored Jun 5, 2024
2 parents 3c04b02 + f5e4339 commit 4e4715f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function isScanRequest(transaction: OnyxEntry<Transaction>): boolean {
return transaction?.iouRequestType === CONST.IOU.REQUEST_TYPE.SCAN;
}

return Boolean(transaction?.receipt?.source);
return Boolean(transaction?.receipt?.source) && transaction?.amount === 0;
}

function getRequestType(transaction: OnyxEntry<Transaction>): IOURequestType {
Expand Down
11 changes: 7 additions & 4 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function IOURequestStepConfirmation({
const isSharingTrackExpense = action === CONST.IOU.ACTION.SHARE;
const isCategorizingTrackExpense = action === CONST.IOU.ACTION.CATEGORIZE;
const isSubmittingFromTrackExpense = action === CONST.IOU.ACTION.SUBMIT;
const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action);
const payeePersonalDetails = useMemo(() => {
if (personalDetails?.[transaction?.splitPayerAccountIDs?.[0] ?? -1]) {
return personalDetails?.[transaction?.splitPayerAccountIDs?.[0] ?? -1];
Expand Down Expand Up @@ -468,7 +469,7 @@ function IOURequestStepConfirmation({
return;
}

if (requestType === CONST.IOU.REQUEST_TYPE.DISTANCE && !IOUUtils.isMovingTransactionFromTrackExpense(action)) {
if (requestType === CONST.IOU.REQUEST_TYPE.DISTANCE && !isMovingTransactionFromTrackExpense) {
const customUnitRateID = TransactionUtils.getRateID(transaction) ?? '';
createDistanceRequest(selectedParticipants, trimmedComment, customUnitRateID);
return;
Expand All @@ -489,7 +490,7 @@ function IOURequestStepConfirmation({
createDistanceRequest,
isSharingTrackExpense,
isCategorizingTrackExpense,
action,
isMovingTransactionFromTrackExpense,
policy,
policyTags,
policyCategories,
Expand Down Expand Up @@ -538,7 +539,9 @@ function IOURequestStepConfirmation({
<HeaderWithBackButton
title={headerTitle}
onBackButtonPress={navigateBack}
shouldShowThreeDotsButton={requestType === CONST.IOU.REQUEST_TYPE.MANUAL && (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK)}
shouldShowThreeDotsButton={
requestType === CONST.IOU.REQUEST_TYPE.MANUAL && (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK) && !isMovingTransactionFromTrackExpense
}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)}
threeDotsMenuItems={[
{
Expand Down Expand Up @@ -569,7 +572,7 @@ function IOURequestStepConfirmation({
iouMerchant={transaction?.merchant}
iouCreated={transaction?.created}
isDistanceRequest={requestType === CONST.IOU.REQUEST_TYPE.DISTANCE}
shouldShowSmartScanFields={IOUUtils.isMovingTransactionFromTrackExpense(action) ? transaction?.amount !== 0 : requestType !== CONST.IOU.REQUEST_TYPE.SCAN}
shouldShowSmartScanFields={isMovingTransactionFromTrackExpense ? transaction?.amount !== 0 : requestType !== CONST.IOU.REQUEST_TYPE.SCAN}
action={action}
payeePersonalDetails={payeePersonalDetails}
/>
Expand Down

0 comments on commit 4e4715f

Please sign in to comment.