public function computeFixedCost(Pap_Contexts_Action $context) { $context->debug('Fixed cost comnputing started'); $context->debug(" Trying to get fixed cost from request parameter '".Pap_Tracking_ActionRequest::PARAM_ACTION_FIXEDCOST."'"); $fixedCost = $context->getFixedCostFromRequest(); if($fixedCost == '') { $context->debug(" Fixedcost not found in request trying to get default for campaign.'"); $fixedCost = $this->getDefaultFixedCost($context); if ($fixedCost != false) { $fixedCost = $fixedCost['fixedcosttype'].$fixedCost['fixedcostvalue']; }else{ $fixedCost = 0; } } if($fixedCost != '') { $type = $this->getParameterType($fixedCost); $fixedCost = $this->makeCorrections($fixedCost); $value = ''; if(is_numeric($fixedCost) && $fixedCost >= 0) { $value = $fixedCost; } if($value != '') { $context->debug(" Fixed cost is $type $value"); if ($type == '%') { if ($value > 100) { $context->debug(" Fixed cost is greater than 100%!"); return; } $context->setFixedCost($context->getRealTotalCost()/100*$value); } elseif ($type=='$') { $context->setFixedCost($value); $this->recognizeCurrency->processFixedCost($context); } } else { $context->debug(" Fixed cost has bad format"); } }else{ $context->setFixedCost(0); } $context->debug('Fixed cost computing ended'); $context->debug(""); }