From c551097d5702c195d1afe9dc50f53f7cbd1affce Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 3 Jul 2014 16:46:25 -0400 Subject: [PATCH] Default to monthly billing for invalid values --- airtime_mvc/application/forms/BillingUpgradeDowngrade.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/forms/BillingUpgradeDowngrade.php b/airtime_mvc/application/forms/BillingUpgradeDowngrade.php index 15492f3d2..e1132673b 100644 --- a/airtime_mvc/application/forms/BillingUpgradeDowngrade.php +++ b/airtime_mvc/application/forms/BillingUpgradeDowngrade.php @@ -15,6 +15,7 @@ class Application_Form_BillingUpgradeDowngrade extends Zend_Form $currentPlanProduct = BillingController::getClientCurrentAirtimeProduct(); $currentPlanProductId = $currentPlanProduct["pid"]; + $currentPlanProductBillingCycle = $currentPlanProduct["billingcycle"]; $pid = new Zend_Form_Element_Radio('newproductid'); $pid->setLabel(_('Plan type:')) @@ -25,8 +26,12 @@ class Application_Form_BillingUpgradeDowngrade extends Zend_Form //Logging::info(BillingController::getClientCurrentAirtimeProduct()); $billingcycle = new Zend_Form_Element_Radio('newproductbillingcycle'); + $billingCycleOptionMap = array('monthly' => 'Monthly', 'annually' => 'Annually'); + if (!array_key_exists($currentPlanProductBillingCycle, $billingCycleOptionMap)) { + $currentPlanProductBillingCycle = 'monthly'; + } $billingcycle->setLabel(_('Billing cycle:')) - ->setMultiOptions(array('monthly' => 'Monthly', 'annually' => 'Annually')) + ->setMultiOptions($billingCycleOptionMap) ->setRequired(true) ->setValue($currentPlanProductBillingCycle);