Skip to content

Commit

Permalink
fix(journal): ensure cost_center_id exists
Browse files Browse the repository at this point in the history
This commit adds in a NULL check to the posting journal's cost center id
checks.

Closes #6214.
  • Loading branch information
jniles committed Dec 24, 2021
1 parent 4af07b6 commit 2fd270c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/js/services/TransactionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function TransactionService($http, util, Modal, Accounts) {
return ERROR_INVALID_DEBITS_AND_CREDITS;
}

const hasCostCenters = angular.isDefined(row.cost_center_id);
const hasCostCenters = angular.isDefined(row.cost_center_id) && row.cost_center_id !== null;
if (hasCostCenters && !Accounts.isIncomeOrExpenseAccountTypeId(row.account_type_id)) {
return ERROR_COST_CENTER_ON_OTHER_ACCOUNT;
}
Expand Down

0 comments on commit 2fd270c

Please sign in to comment.