public function createCommissions() {
        $comissionEntry = new Pap_Db_RecurringCommissionEntry();
        $comissionEntry->setRecurringCommissionId($this->getId());
        try {
            $parentTransaction = $this->getTransaction();
        } catch (Gpf_Exception $e) {
            $parentTransaction = null;
        }
        foreach ($comissionEntry->loadCollection() as $comissionEntry) {
            if (!$this->isExistsUser($comissionEntry->getUserId())) {
                Gpf_log::error('Recurring commissions - createCommissions: user does not exist: ' . $comissionEntry->getUserId());
                if ($comissionEntry->getTier() == '1') {
                    return;
                } else {
                    continue;
                }
            }
            $transaction = new Pap_Common_Transaction();
            $transaction->setDateInserted(Gpf_Common_DateUtils::now());
            $transaction->setType(Pap_Common_Constants::TYPE_RECURRING);
            $transaction->setTier($comissionEntry->getTier());
            $transaction->setUserId($comissionEntry->getUserId());
            $transaction->setCommissionTypeId($this->getCommissionTypeId());
            $transaction->setParentTransactionId($this->getTransactionId());
            $transaction->setCommission($comissionEntry->getCommission());
            $transaction->setPayoutStatus(Pap_Common_Transaction::PAYOUT_UNPAID);
            $transaction->setStatus(Pap_Common_Constants::STATUS_APPROVED);
            $transaction->setOrderId($this->getOrderId());

            if ($parentTransaction != null) {
                if ($transaction->getOrderId() == '') {
                    $transaction->setOrderId($parentTransaction->getOrderId());
                }
                $transaction->setProductId($parentTransaction->getProductId());
                $transaction->setTotalCost($parentTransaction->getTotalCost());
                $transaction->setCampaignId($parentTransaction->getCampaignId());
                $transaction->setBannerId($parentTransaction->getBannerId());
                $transaction->setParentBannerId($parentTransaction->getParentBannerId());
                $transaction->setCountryCode($parentTransaction->getCountryCode());
                $transaction->setData1($parentTransaction->getData1());
                $transaction->setData2($parentTransaction->getData2());
                $transaction->setData3($parentTransaction->getData3());
                $transaction->setData4($parentTransaction->getData4());
                $transaction->setData5($parentTransaction->getData5());
            }

            $transaction->save();
        }
    }
 protected function evaluate($value) {
     if ($value === null) {
         $value = 0;
     }
     switch ($this->rule->getEquation()) {
         case Pap_Features_PerformanceRewards_Condition::EQUATION_BETWEEN :
             Gpf_log::info('Rule condition: '.$value.' BETWEEN '.$this->rule->getEquationValue1().' and '.$this->rule->getEquationValue2());
             if ($this->rule->getEquationValue1() < $value && $value < $this->rule->getEquationValue2()) {
                 return true;
             }
             break;
         case Pap_Features_PerformanceRewards_Condition::EQUATION_EQUAL_TO :
             Gpf_log::info('Rule condition: '.$value.' EQUAL TO '.$this->rule->getEquationValue1());
             if ($this->rule->getEquationValue1() == $value) {
                 return true;
             }
             break;
         case Pap_Features_PerformanceRewards_Condition::EQUATION_HIGHER_THAN :
             Gpf_log::info('Rule condition: '.$value.' HIGHER THAN '.$this->rule->getEquationValue1());
             if ($this->rule->getEquationValue1() < $value) {
                 return true;
             }
             break;
         case Pap_Features_PerformanceRewards_Condition::EQUATION_LOWER_THAN :
             Gpf_log::info('Rule condition: '.$value.' LOWER THAN '.$this->rule->getEquationValue1());
             if ($this->rule->getEquationValue1() > $value) {
                 return true;
             }
             break;
         default : throw new Gpf_Exception('Unsupported equation');
     }
     return false;
 }
 public final function isInMaintenanceMode()
 {
     try {
         return !$this->isInstalled() || !$this->isUpdated();
     } catch (Gpf_DbEngine_Exception $e) {
         Gpf_log::debug('Database error occured while computing latest installed application version: ' . $e->getMessage());
         return false;
     }
 }