Skip to content

Commit

Permalink
Approval button is missing after payment of the report with hold expense
Browse files Browse the repository at this point in the history
  • Loading branch information
ikevin127 committed Oct 25, 2024
1 parent ed242f5 commit 5250878
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 @@ -7035,9 +7035,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 5250878

Please sign in to comment.