Skip to content

Commit 25f4e71

Browse files
added a check if current is admin and manager to show gbr if there is a manager assigned
1 parent bb4c4f3 commit 25f4e71

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2396,11 +2396,17 @@ function isPayer(session: OnyxEntry<Session>, iouReport: OnyxEntry<Report>, only
23962396
const policyType = policy?.type;
23972397
const isAdmin = policyType !== CONST.POLICY.TYPE.PERSONAL && policy?.role === CONST.POLICY.ROLE.ADMIN;
23982398
const isManager = iouReport?.managerID === session?.accountID;
2399+
23992400
if (isPaidGroupPolicy(iouReport)) {
24002401
if (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES) {
2401-
// If we get here without a reimburser only show the pay button if we are the admin.
24022402
if (!policy?.achAccount?.reimburser) {
2403+
// if there is a manager assigned we need to check if user is admin and manager to fix issue https://github.com/Expensify/App/issues/64825
2404+
if (iouReport?.managerID) {
2405+
return isAdmin && isManager;
2406+
}
2407+
// If we get here without a reimburser only show the pay button if we are the admin.
24032408
return isAdmin;
2409+
24042410
}
24052411

24062412
// If we are the reimburser and the report is approved or we are the manager then we can pay it.

src/libs/actions/IOU.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9453,17 +9453,7 @@ function getIOUReportActionToApproveOrPay(chatReport: OnyxEntry<OnyxTypes.Report
94539453
// eslint-disable-next-line deprecation/deprecation
94549454
const policy = getPolicy(iouReport?.policyID);
94559455

9456-
const canPay = canIOUBePaid(iouReport, chatReport, policy);
9457-
const canApprove = canApproveIOU(iouReport, policy);
9458-
9459-
// Don't show settlement button if user is expense owner but not manager
9460-
const isExpenseOwner = iouReport?.ownerAccountID === getCurrentUserAccountID();
9461-
const isManager = iouReport?.managerID === getCurrentUserAccountID();
9462-
const canUserPay = isExpenseOwner && !isManager ? false : canPay;
9463-
9464-
// For submitted expense reports, prioritize approval workflow
9465-
const isSubmittedExpenseReport = isExpenseReport(iouReport) && iouReport?.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED;
9466-
const shouldShowSettlementButton = isSubmittedExpenseReport ? canApprove : canUserPay || canApprove;
9456+
const shouldShowSettlementButton = canIOUBePaid(iouReport, chatReport, policy) || canApproveIOU(iouReport, policy);
94679457

94689458
return action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && shouldShowSettlementButton && !isDeletedAction(action);
94699459
});

0 commit comments

Comments
 (0)