Commit aad7c1d6 authored by Juorder Antonio's avatar Juorder Antonio

fix problem with arrCos on edit domain view

parent 6e298d1b
......@@ -217,7 +217,7 @@ export default class EditDomain extends React.Component {
const maxCosAccounts = Utils.parseMaxCOSAccounts(domain.attrs.zimbraDomainCOSMaxAccounts);
let total = 0;
const ownPlans = enabledPlans.map((p) => {
const planId = maxCosAccounts[plans[p]];
const planId = maxCosAccounts[plans[p]] || 0;
total += parseInt(planId, 10) || 0;
return (
<div
......
......@@ -676,12 +676,14 @@ export function extractLockOuts(object) {
export function parseMaxCOSAccounts(maxCosAccounts) {
const response = {};
const arrCos = maxCosAccounts || false;
let arrCos = typeof maxCosAccounts === 'string' && typeof maxCosAccounts !== 'undefined' ? maxCosAccounts.split(false) : maxCosAccounts;
if (arrCos) {
arrCos.forEach((p) => {
const splitter = p.split(':');
response[splitter.shift()] = splitter[0] || 0;
const key = splitter.shift();
const value = splitter[0] ? parseInt(splitter[0], 10) : false;
response[key] = value || 0;
});
return response;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment