private function computeFixedCost(Pap_Contexts_Action $context) {
    	$context->debug('Recognizing fixedCost currency started');

    	$defaultCurrency = $this->getDefaultCurrency();
    	$context->debug("    Default currency is ".$defaultCurrency->getName());
    	$context->set("defaultCurrencyObject", $defaultCurrency);
    	
    	if ($context->getCurrencyFromRequest() != '') {
    		Gpf_Plugins_Engine::extensionPoint('Tracker.action.computeFixedCost', $context);
    	}
    	
    	$context->debug('Recognizing fixedCost currency ended');
		$context->debug("");
    	return Gpf_Plugins_Engine::PROCESS_CONTINUE;
    }
Ejemplo n.º 2
0
    private function process(Pap_Contexts_Action $context) {
        $currencyCode = $context->getCurrencyFromRequest();
        if ($currencyCode == '') {
            throw new Gpf_Exception('Currency code is not defined');
        }

        if ($currencyCode == $context->getDefaultCurrencyObject()->getName()) {
            throw new Gpf_Exception('Currency is the same as default currency');
        }

        $currency = new Gpf_Db_Currency();
        try {
            $currency = $currency->findCurrencyByCode($currencyCode);
        } catch (Gpf_DbEngine_NoRowException $e) {
            throw new Gpf_Exception('Currency does not exist');
        }
        return $currency;
    }