@zeniai/client-epic-state 5.0.53-betaML3 → 5.0.53-betaML4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -397,6 +397,17 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
397
397
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
398
398
|
.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
399
399
|
if (transactionLocalData != null) {
|
|
400
|
+
// Snapshot the pre-fetch selection. setEntityRecommendationForLineIdInLocalData
|
|
401
|
+
// mutates selectedCheckBoxTransactionIds internally (auto-add when
|
|
402
|
+
// all-filled, auto-remove otherwise) but does not enforce
|
|
403
|
+
// MAX_SELECTION_LIMIT. We restore from this snapshot below and let
|
|
404
|
+
// the reducer-level gate own the selection contract so the cap is
|
|
405
|
+
// honored and the gate mirrors the original auto-add gate from
|
|
406
|
+
// updateSelectedVendor/CustomerForTransaction.
|
|
407
|
+
const selectionBeforeFetch = [
|
|
408
|
+
...draft.transactionCategorizationView[selectedTab]
|
|
409
|
+
.selectedCheckBoxTransactionIds,
|
|
410
|
+
];
|
|
400
411
|
const newLocalData = setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
|
|
401
412
|
// Flip the per-line "fetching" flag to Completed for the lines this
|
|
402
413
|
// fetch covered. Reads as the success arm of the
|
|
@@ -417,6 +428,22 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
417
428
|
transactionId: transaction.id,
|
|
418
429
|
transactionReviewLocalData: newLocalData,
|
|
419
430
|
};
|
|
431
|
+
// Auto-add the transaction to the bulk-save selection now that
|
|
432
|
+
// fresh recs have landed and all required fields are filled. This
|
|
433
|
+
// is the success-arm of the deferral noted in
|
|
434
|
+
// updateSelectedVendor/CustomerForTransaction: their auto-add was
|
|
435
|
+
// suppressed because pre-fetch category/class were stale; we run
|
|
436
|
+
// the same gate here against newLocalData so the checkbox flips
|
|
437
|
+
// on against fresh recs.
|
|
438
|
+
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = selectionBeforeFetch;
|
|
439
|
+
if (checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true &&
|
|
440
|
+
selectionBeforeFetch.length < MAX_SELECTION_LIMIT &&
|
|
441
|
+
selectionBeforeFetch.includes(transaction.id) === false) {
|
|
442
|
+
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
443
|
+
...selectionBeforeFetch,
|
|
444
|
+
transaction.id,
|
|
445
|
+
];
|
|
446
|
+
}
|
|
420
447
|
// Mark transaction as dirty (autofill happened)
|
|
421
448
|
if (!draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData.includes(transaction.id)) {
|
|
422
449
|
draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData = [
|