Skip to content

Commit a690230

Browse files
luacmartinsOSBotify
authored andcommitted
Merge pull request #62611 from twilight2294/patch-38
[CP Staging] Fix: Not here page opens when admin clicks Move expense in member's report (cherry picked from commit 54919d4) (cherry-picked to staging by arosiclair)
1 parent 8cc4489 commit a690230

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/libs/ReportUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3896,7 +3896,7 @@ function canEditFieldOfMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction>
38963896
}
38973897

38983898
if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.REPORT) {
3899-
return getOutstandingReportsForUser(moneyRequestReport?.policyID, moneyRequestReport?.ownerAccountID, allReports ?? {}).length > 0;
3899+
return getOutstandingReportsForUser(moneyRequestReport?.policyID, moneyRequestReport?.ownerAccountID, allReports ?? {}).length > 1;
39003900
}
39013901

39023902
return true;

src/pages/iou/request/step/IOURequestEditReportCommon.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,20 @@ type Props = {
4545
function IOURequestEditReportCommon({backTo, transactionsReports, selectReport}: Props) {
4646
const {translate} = useLocalize();
4747
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {selector: (reports) => mapOnyxCollectionItems(reports, reportSelector), canBeMissing: true});
48-
const [allPoliciesID] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (policies) => mapOnyxCollectionItems(policies, (policy) => policy?.id), canBeMissing: false});
4948

5049
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
5150
const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState('');
5251

5352
const expenseReports = useMemo(
5453
() =>
55-
Object.values(allPoliciesID ?? {}).flatMap((policyID) => {
56-
if (!policyID) {
54+
Object.values(transactionsReports ?? {}).flatMap((transactionsReport) => {
55+
if (!transactionsReport.policyID) {
5756
return [];
5857
}
59-
const reports = getOutstandingReportsForUser(policyID, currentUserPersonalDetails.accountID, allReports ?? {});
58+
const reports = getOutstandingReportsForUser(transactionsReport.policyID, transactionsReport?.ownerAccountID ?? currentUserPersonalDetails.accountID, allReports ?? {});
6059
return reports;
6160
}),
62-
[allPoliciesID, allReports, currentUserPersonalDetails.accountID],
61+
[allReports, currentUserPersonalDetails.accountID, transactionsReports],
6362
);
6463

6564
const reportOptions: ReportListItem[] = useMemo(() => {

0 commit comments

Comments
 (0)