protected function getCurrentUserId() { $userid = $this->rule->getCondition()->getCurrentUserId(); $user = new Pap_Db_User(); $user->setId($userid); try { $user->load(); } catch (Gpf_Exception $e) { return $userid; } return $user->getOriginalParentUserId(); }
public function generatePrimaryKey(Pap_Db_User $user) { $user2 = clone $user; //increment current userid $id = Gpf_Settings::get(SequenceAffiliateUserId_Main::SETTING_USERID_SEQUENCE) + 1; //save new userid Gpf_Settings::set(SequenceAffiliateUserId_Main::SETTING_USERID_SEQUENCE, $id); try { $user2->setId($id); $user2->load(); return; } catch (Gpf_DbEngine_NoRowException $e) { } $user->setId($id); }
private function validateUser(Pap_Db_User $user) { if ($user->getType() != Pap_Application::ROLETYPE_AFFILIATE) { return; } if ($user->getRefId() == "") { throw new Gpf_DbEngine_Row_ConstraintException(Pap_Db_Table_Users::REFID, $this->_("Referral ID can not be blank")); } if (Gpf_Session::getAuthUser()->isLogged() && Gpf_Session::getAuthUser()->isAffiliate()) { $userTmp = new Pap_Db_User(); $userTmp->setId($user->getId()); try { $userTmp->load(); } catch (Gpf_Exception $e) { return; } if ($userTmp->getRefId() != $user->getRefId()) { throw new Gpf_DbEngine_Row_ConstraintException(Pap_Db_Table_Users::REFID, $this->_("Referral ID can not be changed")); } } }
/** * * @return Gpf_DbEngine_Row_Collection */ public function getAffectedAffiliatesList($filters = null) { if (is_null($filters)) { $filters = array(); $filter = new Gpf_Data_Filter("reachedCondition", "E", Gpf::NO); $filters[] = $filter->toObject(); } $params = new Gpf_Rpc_Params(); $params->add('filters', $filters); $params->add('columns', array(array('id'),array('id'))); $params->add('limit', 100000); $grid = new Pap_Features_CompressedCommissionPlacementModel_PlacementOverviewGrid(); $response = $grid->getRows($params); $recordSet = new Gpf_Data_RecordSet(); $recordSet->loadFromObject($response->rows); $user = new Pap_Db_User(); return $user->loadCollectionFromRecordset($recordSet); }
public function getCurrentUserId() { $user = new Pap_Db_User(); $user->setId($this->rule->getTransaction()->getUserId()); $user->load(); return $user->getParentUserId(); }
/** * @throws Gpf_DbEngine_NoRowException * @throws Gpf_DbEngine_TooManyRowsException * @return Pap_Db_User */ protected function getUser($userId) { $user = new Pap_Db_User(); $user->setId($userId); $user->load(); return $user; }
function __construct(Gpf_DbEngine_Table $table) { $this->table = $table; parent::__construct(); }
public function setUseridRefid(Pap_Db_User $user) { $user->setRefId($user->getId()); }
public function getOriginalParentUserId() { return $this->user->getOriginalParentUserId(); }