Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1722,12 +1722,13 @@ function isPayer(session: OnyxEntry<Session>, iouReport: OnyxEntry<Report>, only
const policyType = policy?.type;
const isAdmin = policyType !== CONST.POLICY.TYPE.PERSONAL && policy?.role === CONST.POLICY.ROLE.ADMIN;
const isManager = iouReport?.managerID === session?.accountID;
const reimbursementChoice = policy?.reimbursement?.choice?.reimbursementChoice ?? policy?.reimbursementChoice;
if (isPaidGroupPolicy(iouReport)) {
if (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES) {
if (reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES) {
const isReimburser = session?.email === policy?.achAccount?.reimburser;
return (!policy?.achAccount?.reimburser || isReimburser) && (isApproved || isManager);
}
if (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL || onlyShowPayElsewhere) {
if (reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL || onlyShowPayElsewhere) {
return isAdmin && (isApproved || isManager);
}
return false;
Expand Down
9 changes: 9 additions & 0 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,15 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback<
/** The reimbursement choice for policy */
reimbursementChoice?: ValueOf<typeof CONST.POLICY.REIMBURSEMENT_CHOICES>;

/** reimbursement options */
reimbursement?: {
/** The reimbursement choice for policy */
choice?: {
/** The reimbursement choice for policy */
reimbursementChoice?: ValueOf<typeof CONST.POLICY.REIMBURSEMENT_CHOICES>;
};
};

/** Detailed settings for the autoReimbursement */
autoReimbursement?: OnyxCommon.OnyxValueWithOfflineFeedback<
{
Expand Down