<commit_before><?php
class Application_Form_BillingUpgradeDowngrade extends Zend_Form
{
    public function init()
    {
        $productPrices = array();
        $productTypes = array();       
        list($productPrices, $productTypes) = BillingController::getProductPricesAndTypes();
               
        //$currentPlanType = ucfirst(Application_Model_Preference::GetPlanLevel());
        $currentPlanType = "Hobbyist";
        if (($key = array_search($currentPlanType, $productTypes)) !== false) {
            //unset($productTypes[$key]);
        }
        
        $currentPlanProduct = BillingController::getClientCurrentAirtimeProduct();
        $currentPlanProductId = $currentPlanProduct["pid"];
        $currentPlanProductBillingCycle = $currentPlanProduct["billingcycle"];
        $pid = new Zend_Form_Element_Radio('newproductid');
        $pid->setLabel(_('Plan type:'))
            ->setMultiOptions($productTypes)
            ->setRequired(true)
            ->setValue($currentPlanProductId);
        $this->addElement($pid);       
        
        //Logging::info(BillingController::getClientCurrentAirtimeProduct());
        $billingcycle = new Zend_Form_Element_Radio('newproductbillingcycle');
        $billingcycle->setLabel(_('Billing cycle:'))
            ->setMultiOptions(array('monthly' => 'Monthly', 'annually' => 'Annually'))
            ->setRequired(true)
            ->setValue($currentPlanProductBillingCycle);
            
        $this->addElement($billingcycle);

        $paymentmethod = new Zend_Form_Element_Radio('paymentmethod');
        $paymentmethod->setLabel(_('Payment method:'))
            ->setRequired(true)
            ->setMultiOptions(array(
                'paypal' => _('PayPal'),
                'tco' => _('Credit Card via 2Checkout')))
            ->setValue('paypal');
        $this->addElement($paymentmethod);
        
        /*$submit = new Zend_Form_Element_Submit("submit");
        $submit->setIgnore(true)
                ->setLabel(_("Save"));
        $this->addElement($submit);*/
        
        $client = new Application_Form_BillingClient();
        $client->removeElement("password2");
        $client->removeElement("password2verify");
        $this->addSubForm($client, 'billing_client_info');
    }<commit_msg>Default to monthly billing for invalid values<commit_after><?php
class Application_Form_BillingUpgradeDowngrade extends Zend_Form
{
    public function init()
    {
        $productPrices = array();
        $productTypes = array();       
        list($productPrices, $productTypes) = BillingController::getProductPricesAndTypes();
               
        //$currentPlanType = ucfirst(Application_Model_Preference::GetPlanLevel());
        $currentPlanType = "Hobbyist";
        if (($key = array_search($currentPlanType, $productTypes)) !== false) {
            //unset($productTypes[$key]);
        }
        
        $currentPlanProduct = BillingController::getClientCurrentAirtimeProduct();
        $currentPlanProductId = $currentPlanProduct["pid"];
        
        $currentPlanProductBillingCycle = $currentPlanProduct["billingcycle"];
        $pid = new Zend_Form_Element_Radio('newproductid');
        $pid->setLabel(_('Plan type:'))
            ->setMultiOptions($productTypes)
            ->setRequired(true)
            ->setValue($currentPlanProductId);
        $this->addElement($pid);       
        
        //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($billingCycleOptionMap)
            ->setRequired(true)
            ->setValue($currentPlanProductBillingCycle);
            
        $this->addElement($billingcycle);

        $paymentmethod = new Zend_Form_Element_Radio('paymentmethod');
        $paymentmethod->setLabel(_('Payment method:'))
            ->setRequired(true)
            ->setMultiOptions(array(
                'paypal' => _('PayPal'),
                'tco' => _('Credit Card via 2Checkout')))
            ->setValue('paypal');
        $this->addElement($paymentmethod);
        
        /*$submit = new Zend_Form_Element_Submit("submit");
        $submit->setIgnore(true)
                ->setLabel(_("Save"));
        $this->addElement($submit);*/
        
        $client = new Application_Form_BillingClient();
        $client->removeElement("password2");
        $client->removeElement("<PASSWORD>");
        $this->addSubForm($client, 'billing_client_info');
    }
{'fraction_non_alphanumeric': 0.1363260239966901, 'fraction_numerical': 0.001034340091021928, 'mean_word_length': 2.7685113016367886, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4936835', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1281, 'n_words': 177}