diff --git a/apps/common/submodules/servicePlanDetails/servicePlanDetails.js b/apps/common/submodules/servicePlanDetails/servicePlanDetails.js index 99ffda8e0..20cab87b3 100644 --- a/apps/common/submodules/servicePlanDetails/servicePlanDetails.js +++ b/apps/common/submodules/servicePlanDetails/servicePlanDetails.js @@ -343,39 +343,39 @@ define(function(require){ account_id: monster.apps.auth.originalAccount.id } } - } - - if(hasFields) { - var field, - value, - subField; - $this.find('[data-field]').each(function(el) { - var $el = $(this); - field = $el.data('field'), - value = $el.find('.input-value').val(); - subField = $el.data('subfield'); + if(hasFields) { + var field, + value, + subField; - if(field === 'exceptions') { value = value.split(','); } + $this.find('[data-field]').each(function(el) { + var $el = $(this); + field = $el.data('field'), + value = $el.find('.input-value').val(); + subField = $el.data('subfield'); - if(!subField) { - formattedData.overrides[plan][category][key][field] = value; - } - else { - formattedData.overrides[plan][category][key][field] = formattedData.overrides[plan][category][key][field] || {}; + if(field === 'exceptions') { value = value.split(','); } - if(!field === 'discounts') { - formattedData.overrides[plan][category][key][field][subField] = value; + if(!subField) { + formattedData.overrides[plan][category][key][field] = value; } else { - if(!formattedData.overrides[plan][category][key][field].hasOwnProperty('cumulative')) { - formattedData.overrides[plan][category][key][field]['cumulative'] = {}; + formattedData.overrides[plan][category][key][field] = formattedData.overrides[plan][category][key][field] || {}; + + if(!field === 'discounts') { + formattedData.overrides[plan][category][key][field][subField] = value; } + else { + if(!formattedData.overrides[plan][category][key][field].hasOwnProperty('cumulative')) { + formattedData.overrides[plan][category][key][field]['cumulative'] = {}; + } - formattedData.overrides[plan][category][key][field]['cumulative'][subField] = value; + formattedData.overrides[plan][category][key][field]['cumulative'][subField] = value; + } } - } - }); + }); + } } });