Skip to content

Commit 4d5e127

Browse files
authored
Merge pull request #223 from software-mansion-labs/borys3kk-fix-58084-bugs
Borys3kk fix 58084 bugs
2 parents 5e26bd9 + e4e8593 commit 4d5e127

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/libs/ReportPreviewActionUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function canPay(report: Report, violations: OnyxCollection<TransactionViolation[
6666
const isClosed = isClosedReport(report);
6767
const isReportFinished = isApproved || isClosed;
6868
const {reimbursableSpend} = getMoneyRequestSpendBreakdown(report);
69+
const isReimbursed = isSettled(report);
6970

7071
const hasAnyViolations =
7172
hasViolations(report.reportID, violations) || hasNoticeTypeViolations(report.reportID, violations, true) || hasWarningTypeViolations(report.reportID, violations, true);
@@ -76,7 +77,7 @@ function canPay(report: Report, violations: OnyxCollection<TransactionViolation[
7677

7778
const isIOU = isIOUReport(report);
7879

79-
if (isIOU && isReportPayer) {
80+
if (isIOU && isReportPayer && !isReimbursed) {
8081
return true;
8182
}
8283

src/libs/ReportPrimaryActionUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function isApproveAction(report: Report, reportTransactions: Transaction[], poli
5454
const isReportApprover = isApproverUtils(policy, getCurrentUserAccountID());
5555
const isApprovalEnabled = policy?.approvalMode && policy.approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL;
5656

57-
if (!isExpenseReport || !isReportApprover || !isApprovalEnabled) {
57+
if (!isExpenseReport || !isReportApprover || !isApprovalEnabled || reportTransactions.length === 0) {
5858
return false;
5959
}
6060

src/libs/ReportSecondaryActionUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ function isHoldAction(report: Report, reportTransactions: Transaction[]): boolea
253253

254254
function isHoldActionForTransation(report: Report, reportTransaction: Transaction): boolean {
255255
const isExpenseReport = isExpenseReportUtils(report);
256+
const isIOUReport = isIOUReportUtils(report);
257+
const iouOrExpenseReport = isExpenseReport || isIOUReport;
256258

257-
if (!isExpenseReport) {
259+
if (!iouOrExpenseReport) {
258260
return false;
259261
}
260262

0 commit comments

Comments
 (0)