@@ -6812,7 +6812,6 @@ function sendMoneyWithWallet(report: OnyxEntry<OnyxTypes.Report>, amount: number
6812
6812
function canApproveIOU (
6813
6813
iouReport : OnyxTypes . OnyxInputOrEntry < OnyxTypes . Report > | SearchReport ,
6814
6814
policy : OnyxTypes . OnyxInputOrEntry < OnyxTypes . Policy > | SearchPolicy ,
6815
- violations ?: OnyxCollection < OnyxTypes . TransactionViolation [ ] > ,
6816
6815
chatReportRNVP ?: OnyxTypes . ReportNameValuePairs ,
6817
6816
) {
6818
6817
// Only expense reports can be approved
@@ -6833,8 +6832,6 @@ function canApproveIOU(
6833
6832
const iouSettled = ReportUtils . isSettled ( iouReport ?. reportID ) ;
6834
6833
const reportNameValuePairs = chatReportRNVP ?? ReportUtils . getReportNameValuePairs ( iouReport ?. reportID ) ;
6835
6834
const isArchivedReport = ReportUtils . isArchivedRoom ( iouReport , reportNameValuePairs ) ;
6836
- const allViolations = violations ?? allTransactionViolations ;
6837
- const hasNonHoldViolation = ReportUtils . hasNonHoldViolation ( iouReport ?. reportID ?? '-1' , allViolations ) ;
6838
6835
let isTransactionBeingScanned = false ;
6839
6836
const reportTransactions = TransactionUtils . getAllReportTransactions ( iouReport ?. reportID ) ;
6840
6837
for ( const transaction of reportTransactions ) {
@@ -6847,15 +6844,14 @@ function canApproveIOU(
6847
6844
}
6848
6845
}
6849
6846
6850
- return isCurrentUserManager && ! isOpenExpenseReport && ! isApproved && ! iouSettled && ! isArchivedReport && ! isTransactionBeingScanned && ! hasNonHoldViolation ;
6847
+ return isCurrentUserManager && ! isOpenExpenseReport && ! isApproved && ! iouSettled && ! isArchivedReport && ! isTransactionBeingScanned ;
6851
6848
}
6852
6849
6853
6850
function canIOUBePaid (
6854
6851
iouReport : OnyxTypes . OnyxInputOrEntry < OnyxTypes . Report > | SearchReport ,
6855
6852
chatReport : OnyxTypes . OnyxInputOrEntry < OnyxTypes . Report > | SearchReport ,
6856
6853
policy : OnyxTypes . OnyxInputOrEntry < OnyxTypes . Policy > | SearchPolicy ,
6857
6854
transactions ?: OnyxTypes . Transaction [ ] | SearchTransaction [ ] ,
6858
- violations ?: OnyxCollection < OnyxTypes . TransactionViolation [ ] > ,
6859
6855
onlyShowPayElsewhere = false ,
6860
6856
chatReportRNVP ?: OnyxTypes . ReportNameValuePairs ,
6861
6857
invoiceReceiverPolicy ?: SearchPolicy ,
@@ -6902,9 +6898,7 @@ function canIOUBePaid(
6902
6898
6903
6899
const { reimbursableSpend} = ReportUtils . getMoneyRequestSpendBreakdown ( iouReport ) ;
6904
6900
const isAutoReimbursable = policy ?. reimbursementChoice === CONST . POLICY . REIMBURSEMENT_CHOICES . REIMBURSEMENT_YES ? false : ReportUtils . canBeAutoReimbursed ( iouReport , policy ) ;
6905
- const allViolations = violations ?? allTransactionViolations ;
6906
- const shouldBeApproved = canApproveIOU ( iouReport , policy , allViolations ) ;
6907
- const hasNonHoldViolation = ReportUtils . hasNonHoldViolation ( iouReport ?. reportID ?? '-1' , allViolations ) ;
6901
+ const shouldBeApproved = canApproveIOU ( iouReport , policy ) ;
6908
6902
6909
6903
const isPayAtEndExpenseReport = ReportUtils . isPayAtEndExpenseReport ( iouReport ?. reportID , transactions ) ;
6910
6904
return (
@@ -6916,7 +6910,6 @@ function canIOUBePaid(
6916
6910
! isChatReportArchived &&
6917
6911
! isAutoReimbursable &&
6918
6912
! shouldBeApproved &&
6919
- ! hasNonHoldViolation &&
6920
6913
! isPayAtEndExpenseReport
6921
6914
) ;
6922
6915
}
@@ -6927,7 +6920,7 @@ function getIOUReportActionToApproveOrPay(chatReport: OnyxEntry<OnyxTypes.Report
6927
6920
return Object . values ( chatReportActions ) . find ( ( action ) => {
6928
6921
const iouReport = ReportUtils . getReportOrDraftReport ( action . childReportID ?? '-1' ) ;
6929
6922
const policy = PolicyUtils . getPolicy ( iouReport ?. policyID ) ;
6930
- const shouldShowSettlementButton = canIOUBePaid ( iouReport , chatReport , policy , undefined , allTransactionViolations ) || canApproveIOU ( iouReport , policy , allTransactionViolations ) ;
6923
+ const shouldShowSettlementButton = canIOUBePaid ( iouReport , chatReport , policy ) || canApproveIOU ( iouReport , policy ) ;
6931
6924
return action . childReportID ?. toString ( ) !== excludedIOUReportID && action . actionName === CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW && shouldShowSettlementButton ;
6932
6925
} ) ;
6933
6926
}
0 commit comments