<commit_before><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
 * @license         GNU Affero General Public License Version 3; see LICENSE.txt
 */

/**
 * Billing paypage controller class
 *
 * @package  Controller
 * @since    5.0
 */
class ExternalPaypageController extends Yaf_Controller_Abstract {
	public function init() {
		Billrun_Factory::db();
	}

	public function indexAction() {
		$view = new Yaf_View_Simple(Billrun_Factory::config()->getConfigValue('application.directory') . '/views/paypage');
		$request = $this->getRequest()->getRequest();
		$query = array(
			'type' => 'account',
			'aid' => intval($request['aid'])
		);
		$selectedPlan = $request['plan'];
		$account = Billrun_Factory::db()->subscribersCollection()->query($query)->cursor()->current()->getRawData();
		$config = Billrun_Factory::db()->configCollection()->query()->cursor()->sort(array('_id' => -1))->current()->getRawData();
		$plans = Billrun_Factory::db()->plansCollection()->query()->cursor();
		$planNames = array();
		foreach ($plans as $plan) {
			$p = $plan->getRawData();
			$planNames[] = $p['name'];
		}
		$this->getView()->assign('account', $account);
	        $this->getView()->assign('config', $config['subscribers']['account']['fields']);
	        $this->getView()->assign('payment_gateways', $config['payment_gateways']);
		$this->getView()->assign('plans', $planNames);
		$this->getView()->assign('plan', $selectedPlan);
		return $view->render();
	}<commit_msg>Get only active records in "pay page" (plans, account)<commit_after><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
 * @license         GNU Affero General Public License Version 3; see LICENSE.txt
 */

/**
 * Billing paypage controller class
 *
 * @package  Controller
 * @since    5.0
 */
class ExternalPaypageController extends Yaf_Controller_Abstract {
	public function init() {
		Billrun_Factory::db();
	}

	public function indexAction() {
		$view = new Yaf_View_Simple(Billrun_Factory::config()->getConfigValue('application.directory') . '/views/paypage');
		$request = $this->getRequest()->getRequest();
		$query = array(
			'type' => 'account',
			'aid' => intval($request['aid'])
		);
		$query = array_merge($query, Billrun_Utils_Mongo::getDateBoundQuery());
		$selectedPlan = $request['plan'];
		$account = Billrun_Factory::db()->subscribersCollection()->query($query)->cursor()->current()->getRawData();
		$config = Billrun_Factory::db()->configCollection()->query()->cursor()->sort(array('_id' => -1))->current()->getRawData();
		$plans = Billrun_Factory::db()->plansCollection()->query(Billrun_Utils_Mongo::getDateBoundQuery())->cursor();
		$planNames = array();
		foreach ($plans as $plan) {
			$p = $plan->getRawData();
			$planNames[] = $p['name'];
		}
		$this->getView()->assign('account', $account);
	        $this->getView()->assign('config', $config['subscribers']['account']['fields']);
	        $this->getView()->assign('payment_gateways', $config['payment_gateways']);
		$this->getView()->assign('plans', $planNames);
		$this->getView()->assign('plan', $selectedPlan);
		return $view->render();
	}
{'fraction_non_alphanumeric': 0.20264859870649832, 'fraction_numerical': 0.0073914382506929475, 'mean_word_length': 4.98158379373849, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '2000900', 'n_tokens_mistral': 1048, 'n_tokens_neox': 972, 'n_words': 181}