Skip to content

Commit

Permalink
Merge pull request #51503 from ikevin127/ikevin127-fix-50932
Browse files Browse the repository at this point in the history
Approval button is missing after payment of the report with hold expense
  • Loading branch information
marcochavezf authored Nov 7, 2024
2 parents 580bf69 + 5250878 commit afa7b33
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7049,9 +7049,19 @@ function canApproveIOU(iouReport: OnyxTypes.OnyxInputOrEntry<OnyxTypes.Report>,
const iouSettled = ReportUtils.isSettled(iouReport?.reportID);
const reportNameValuePairs = ReportUtils.getReportNameValuePairs(iouReport?.reportID);
const isArchivedReport = ReportUtils.isArchivedRoom(iouReport, reportNameValuePairs);
const unheldTotalIsZero = iouReport && iouReport.unheldTotal === 0;
let isTransactionBeingScanned = false;
const reportTransactions = TransactionUtils.getAllReportTransactions(iouReport?.reportID);
for (const transaction of reportTransactions) {
const hasReceipt = TransactionUtils.hasReceipt(transaction);
const isReceiptBeingScanned = TransactionUtils.isReceiptBeingScanned(transaction);

// If transaction has receipt (scan) and its receipt is being scanned, we shouldn't be able to Approve
if (hasReceipt && isReceiptBeingScanned) {
isTransactionBeingScanned = true;
}
}

return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !unheldTotalIsZero;
return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !isTransactionBeingScanned;
}

function canIOUBePaid(
Expand Down

0 comments on commit afa7b33

Please sign in to comment.