protected function insertTransaction($affiliateId, $type, $commissionValue, $status, Gpf_Data_Record $commission = null) { if ($affiliateId == null) { return; } $transaction = new Pap_Common_Transaction(); $transaction->setUserId($affiliateId); $transaction->setType($type); if ($commission != null) { $transaction->setTier($commission->get(Pap_Db_Table_Commissions::TIER)); } else { $transaction->setTier('1'); } $transaction->setStatus($status); $transaction->setPayoutStatus('U'); $transaction->setDateInserted(Gpf_Common_DateUtils::now()); $transaction->setCommission($commissionValue); $transaction->setData5($this->user->getId()); $transaction->setIp(Gpf_Http::getRemoteIp()); $transaction->insert(); }