Skip to content

Commit

Permalink
Merge pull request #49361 from Expensify/srikar-paymentDisabledBug
Browse files Browse the repository at this point in the history
  • Loading branch information
blimpich authored Sep 23, 2024
2 parents 2c9a980 + e0b8326 commit 7533aa5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ function isSubmitAndClose(policy: OnyxInputOrEntry<Policy>): boolean {
return policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL;
}

function arePaymentsEnabled(policy: OnyxEntry<Policy>): boolean {
return policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO;
}

function isControlOnAdvancedApprovalMode(policy: OnyxInputOrEntry<Policy>): boolean {
return policy?.type === CONST.POLICY.TYPE.CORPORATE && getApprovalWorkflow(policy) === CONST.POLICY.APPROVAL_MODE.ADVANCED;
}
Expand Down Expand Up @@ -1058,6 +1062,7 @@ export {
isPolicyEmployee,
isPolicyFeatureEnabled,
isPolicyOwner,
arePaymentsEnabled,
isSubmitAndClose,
isTaxTrackingEnabled,
shouldShowPolicy,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,10 @@ function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry<Report>): bool
return false;
}

if (PolicyUtils.isInstantSubmitEnabled(policy) && PolicyUtils.isSubmitAndClose(policy) && !PolicyUtils.arePaymentsEnabled(policy)) {
return false;
}

if (isReportApproved(moneyRequestReport) || isSettled(moneyRequestReport?.reportID)) {
return false;
}
Expand Down

0 comments on commit 7533aa5

Please sign in to comment.