From 69e9292b2ec243e5784ea91e9ba5ade2a0fbc24a Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 1 Feb 2024 12:01:30 +0700 Subject: [PATCH] fix IOU with category can be created when admin disable the same category --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 6028a735d132..aec441b28207 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -115,6 +115,15 @@ function IOURequestStepConfirmation({ IOU.setMoneyRequestBillable_temporaryForRefactor(transactionID, defaultBillable); }, [transactionID, defaultBillable]); + useEffect(() => { + if (!transaction.category) { + return; + } + if (policyCategories[transaction.category] && !policyCategories[transaction.category].enabled) { + IOU.resetMoneyRequestCategory_temporaryForRefactor(transactionID); + } + }, [policyCategories, transaction.category, transactionID]); + const navigateBack = useCallback(() => { // If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken // back to the participants step