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(); } }