public function computeCustomCommissions(Pap_Contexts_Action $context) { $context->debug('Custom commission computing started'); $commission = $context->getCustomCommissionFromRequest(); if($commission != '') { $context->debug(" Found custom commission: ".$commission.", decoding"); $type = $this->getParameterType($commission); $commission = $this->makeCorrections($commission); $value = ''; if(is_numeric($commission) && $commission >= 0) { $value = $commission; } if($value != '') { $context->debug(" Custom commission is $type $value"); $i = 1; while ($context->getCommission($i) != null) { $context->removeCommission($i++); } $newCommission = new Pap_Tracking_Common_Commission(1, $type, $value); $newCommission->setStatus($this->recognizeStatus($context->getCommissionTypeObject())); $context->addCommission($newCommission); if ($type!='%'){ $this->recognizeCurrency->computeCustomCommission($context); } } else { $context->debug(" Custom commission has bad format"); } } else { $context->debug('No custom commission defined'); } $context->debug('Checking for forced commissions ended'); $context->debug('Custom commission computing ended'); $context->debug(""); }