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();
 }
示例#2
0
    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);
    }
示例#3
0
 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"));
         }
     }
 }
 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;
 }
示例#6
0
 public function setId($id)
 {
     return $this->user->setId($id);
 }