load() public method

public load ( Gpf_SqlBuilder_SelectBuilder $select )
$select Gpf_SqlBuilder_SelectBuilder
    public function getNumberOfSubaffiliates($userid = null) {
        $result = new Gpf_Data_RecordSet();
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('COUNT(u.userid)', 'amount');

        $selectBuilder->from->add(Pap_Db_Table_Users::getName(), "u");
        $selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "u.accountuserid = gu.accountuserid");
        $selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");

        $selectBuilder->where->add('u.deleted', '=', Gpf::NO);
        if ($userid === null) {
            $selectBuilder->where->add('u.parentuserid', '=', Gpf_Session::getAuthUser()->getPapUserId());
        } else {
            $selectBuilder->where->add('u.parentuserid', '=', $userid);
        }
        $selectBuilder->where->add('gu.rstatus', '<>', 'D');
        if ($this->params->isDateFromDefined()) {
            $selectBuilder->where->add('u.' . Pap_Stats_Table::DATEINSERTED, '>=', $this->params->getDateFrom()->toDateTime());
        }
        if ($this->params->isDateToDefined()) {
            $selectBuilder->where->add('u.' . Pap_Stats_Table::DATEINSERTED, '<=', $this->params->getDateTo()->toDateTime());
        }
        $selectBuilder->limit->set(0, 1);

        $result->load($selectBuilder);

        if($result->getSize() == 0) {
            return 0;
        }

        foreach($result as $record) {
            return $record->get('amount');
        }
    }
    private function getCampaignRecordSetForAffiliate() {
        $selectBuilder = $this->createSelectBuilder();
        $selectBuilder->select->add('c.'.Pap_Db_Table_Campaigns::STATUS, 'rstatus');
        $selectBuilder->select->add('c.'.Pap_Db_Table_Campaigns::TYPE, 'rtype');
        Gpf_Plugins_Engine::extensionPoint('Pap_Common_Campaign_CampaignForAffiliateRichListBox.getCampaignRecordSetForAffiliate', 
        new Pap_Affiliates_Promo_SelectBuilderCompoundFilter($selectBuilder));

        $result = new Gpf_Data_RecordSet();
        $result->load($selectBuilder);
        
        return $result;
    }
 /**
  * @param string $roleId
  * @return Gpf_Data_RecordSet
  */
 public function getAllPrivileges($roleId)
 {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add(self::ID, 'id');
     $select->select->add(self::OBJECT, 'object');
     $select->select->add(self::PRIVILEGE, 'privilege');
     $select->from->add(self::getName());
     $select->where->add(self::ROLE_ID, "=", $roleId);
     $privileges = new Gpf_Data_RecordSet();
     $privileges->load($select);
     return $privileges;
 }
 /**
  * @param String $viewtype
  *
  * @return Gpf_Data_RecordSet
  */
 public function getAllWallpapers()
 {
     $result = new Gpf_Data_RecordSet();
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add(self::ID, 'id');
     $selectBuilder->select->add(self::NAME, 'name');
     $selectBuilder->select->add(self::URL, 'url');
     $selectBuilder->select->add(self::FILEID, 'fileid');
     $selectBuilder->from->add(self::getName());
     $selectBuilder->where->add(self::ACCOUNTUSERID, '=', Gpf_Session::getAuthUser()->getAccountUserId());
     $result->load($selectBuilder);
     return $result;
 }
    /**
     * @param String commissionTypeId
     *
     * @return Gpf_Data_RecordSet
     */
    public function getAllCommissionTypeAttributes($commissionTypeId) {
        $result = new Gpf_Data_RecordSet('id');

        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add(self::ID, 'attributeid');
        $selectBuilder->select->add(self::COMMISSION_TYPE_ID, 'commtypeid');
        $selectBuilder->select->add(self::NAME, 'name');
        $selectBuilder->select->add(self::VALUE, 'value');
        $selectBuilder->from->add(self::getName());
        $selectBuilder->where->add(self::ID, '=', $commissionTypeId);

        $result->load($selectBuilder);
        return $result;
    }
示例#6
0
 /**
  * @param String $viewtype
  *
  * @return Gpf_Data_RecordSet
  */
 public function getAllViews($viewtype)
 {
     $result = new Gpf_Data_RecordSet('id');
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add(self::ID, 'id');
     $selectBuilder->select->add(self::NAME, self::NAME);
     $selectBuilder->select->add(self::ROWSPERPAGE, self::ROWSPERPAGE);
     $selectBuilder->select->add(self::ACCOUNTUSERID, self::ACCOUNTUSERID);
     $selectBuilder->from->add(self::getName());
     $selectBuilder->where->add(self::VIEWTYPE, '=', $viewtype);
     $condition = new Gpf_SqlBuilder_CompoundWhereCondition();
     $condition->add(self::ACCOUNTUSERID, '=', Gpf_Session::getAuthUser()->getAccountUserId(), 'OR');
     $condition->add(self::ACCOUNTUSERID, '=', '', 'OR');
     $selectBuilder->where->addCondition($condition);
     $selectBuilder->orderBy->add(self::ACCOUNTUSERID, false);
     $result->load($selectBuilder);
     return $result;
 }
    private function loadAffiliateSettings() {
    	$selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('code', 'code');
        $selectBuilder->select->add('value', 'value');

        $selectBuilder->from->add('wd_g_settings');

        $selectBuilder->where->add('code', 'LIKE', 'Aff_signup_%');
        $selectBuilder->where->add('code', '=', 'Aff_initial_min_payout', 'OR');

        $result = new Gpf_Data_RecordSet();
        $result->load($selectBuilder);

        $count = 0;
        foreach($result as $record) {
			$this->pap3AffSettings[$record->get('code')] = $record->get('value');
        	$count++;
        }
    }
示例#8
0
	private function loadCampaigns() {
        $result = new Gpf_Data_RecordSet('id');

        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::ID, 'id');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::NAME, 'name');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::STATUS, 'status');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::DESCRIPTION, 'description');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::LOGO_URL, 'logourl');
        
        $selectBuilder->from->add(Pap_Db_Table_Campaigns::getName());
        
        $selectBuilder->where->add(Pap_Db_Table_Campaigns::STATUS, 'IN', Pap_Affiliates_Promo_Campaigns::getCampaignAllowedStatuses());

        $selectBuilder->orderBy->add(Pap_Db_Table_Campaigns::ORDER);
        
        $result->load($selectBuilder);
        return $result;
	}
 /**
  * @return Gpf_Data_IndexedRecordSet
  */
 public function fillViewColumns(Gpf_Data_IndexedRecordSet $allColumns, $viewid)
 {
     $viewColumns = new Gpf_Data_RecordSet();
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('name', 'name');
     $selectBuilder->select->add('sorted', 'sorted');
     $selectBuilder->select->add('width', 'width');
     $selectBuilder->from->add(self::getName());
     $selectBuilder->where->add('viewid', '=', $viewid);
     $selectBuilder->orderBy->add('rorder');
     $viewColumns->load($selectBuilder);
     foreach ($viewColumns as $viewColumn) {
         try {
             $column = $allColumns->getRecord($viewColumn->get('name'));
             $column->set('sorted', $viewColumn->get('sorted'));
             $column->set('width', $viewColumn->get('width'));
             $column->set('visible', Gpf::YES);
         } catch (Exception $e) {
         }
     }
     return $allColumns;
 }
    public function checkUserApprovedDirectLinks($userId) {
        $result = new Gpf_Data_RecordSet();
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('COUNT('.Pap_Db_Table_DirectLinkUrls::ID.')', 'count');
        $selectBuilder->from->add(Pap_Db_Table_DirectLinkUrls::getName());
        $selectBuilder->where->add(Pap_Db_Table_DirectLinkUrls::USER_ID, '=', $userId);
        $selectBuilder->where->add(Pap_Db_Table_DirectLinkUrls::STATUS, '=', Pap_Common_Constants::STATUS_APPROVED);

        $result->load($selectBuilder);

        if($result->getSize() == 0) {
            return false;
        }

        foreach($result as $record) {
            if($record->get('count') > 0) {
                return true;
            }
            break;
        }

        return false;
    }
    public function regenerateDirectLinksFile() {
    	$rs = new Gpf_Data_RecordSet();
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('userid', 'userid');
        $selectBuilder->select->add('url', 'url');
        $selectBuilder->select->add('channelid', 'channelid');
        $selectBuilder->select->add('campaignid', 'campaignid');
        $selectBuilder->select->add('bannerid', 'bannerid');
        $selectBuilder->from->add(Pap_Db_Table_DirectLinkUrls::getName()); 
       	$selectBuilder->where->add('rstatus', '=', Pap_Common_Constants::STATUS_APPROVED);
		$selectBuilder->orderBy->add(Pap_Db_Table_DirectLinkUrls::MATCHES, false);

        $rs->load($selectBuilder);

    	$this->createTemporaryFile();

    	foreach($rs as $record) {
    		$this->addUrl($record->get('userid'), $record->get('url'),
    						$record->get('channelid'),
    						$record->get('campaignid'),
    						$record->get('bannerid'));
    	}
    	$this->commitTemporaryFile();
    }
示例#12
0
    /**
     * checks if user is in campaign, if yes, it will return valid commissionGroupID,
     * otherwise it returns false
     *
     * @param string $userId
     * @return string or false
     */
    public function checkUserIsInCampaign($userId) {
        $result = new Gpf_Data_RecordSet();
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('u.usercommgroupid', 'usercommgroupid');
        $selectBuilder->select->add('u.commissiongroupid', 'commissiongroupid');
        $selectBuilder->select->add('u.rstatus', 'rstatus');
        $selectBuilder->from->add('qu_pap_userincommissiongroup', 'u');
        $selectBuilder->from->addInnerJoin('qu_pap_commissiongroups', 'g',
            'u.commissiongroupid=g.commissiongroupid');

        $selectBuilder->where->add('g.campaignid', '=', $this->getId());
        $selectBuilder->where->add('u.userid', '=', $userId);
        $selectBuilder->limit->set(0, 1);

        $result->load($selectBuilder);

        if($result->getSize() == 0) {
            return false;
        }

        foreach($result as $record) {
            if($this->isUserCommissionGroupStatusAllowed($record->get('rstatus'))) {
                return $record->get('commissiongroupid');
            }
            break;
        }

        return false;
    }
示例#13
0
 /**
  * @param filterType
  * @service filter read
  */
 public function getFilterNames(Gpf_Rpc_Params $params)
 {
     $condition = new Gpf_SqlBuilder_CompoundWhereCondition();
     $condition->add('f.userid', '=', Gpf_Session::getAuthUser()->getUserId(), 'OR');
     $condition->add('f.userid', '=', null, 'OR');
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('f.filterid', 'id');
     $selectBuilder->select->add('f.name', 'name');
     $selectBuilder->from->add(Gpf_Db_Table_Filters::getName(), 'f');
     $selectBuilder->where->add('f.filtertype', '=', $params->get('filterType'));
     $selectBuilder->where->addCondition($condition);
     $selectBuilder->orderBy->add('f.name');
     $response = new Gpf_Data_RecordSet();
     $response->load($selectBuilder);
     return $response;
 }
    /**
     * @param String $campaignId
     * @param String $commissionType
     * @return Gpf_Data_RecordSet
     */
    public function getAllCommissionTypes($campaignId = null, $commissionType = null) {
        $result = new Gpf_Data_RecordSet('id');

        $selectBuilder = $this->getAllCommissionTypesSelect($campaignId, $commissionType);

        $result->load($selectBuilder);
        return $result;
    }
示例#15
0
    public function getNumberOfUsersFromSameIP($ip, $periodInSeconds) {
        $select = new Gpf_SqlBuilder_SelectBuilder();

        $select->select->add("count(au.authid)", "count");
        $select->from->add(Pap_Db_Table_Users::getName(),'pu');
        $select->from->addInnerJoin(Gpf_Db_Table_Users::getName(),'qu','pu.'.Pap_Db_Table_Users::ACCOUNTUSERID.'=qu.'.Gpf_Db_Table_Users::ID);
        $select->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(),'au','au.'.Gpf_Db_Table_AuthUsers::ID.'=qu.'.Gpf_Db_Table_Users::AUTHID. ' and qu.'.Gpf_Db_Table_Users::ROLEID."='".Pap_Application::DEFAULT_ROLE_AFFILIATE."'");
        $select->where->add('au.'.Gpf_Db_Table_AuthUsers::IP, "=", $ip);
        $dateFrom = new Gpf_DateTime();
        $dateFrom->addSecond(-1*$periodInSeconds);
        $select->where->add(Pap_Db_Table_Users::DATEINSERTED, ">", $dateFrom->toDateTime());

        $recordSet = new Gpf_Data_RecordSet();
        $recordSet->load($select);

        foreach($recordSet as $record) {
            return $record->get("count");
        }
        return 0;
    }
示例#16
0
    /**
     * returns latest undeclined click from the given IP address
     *
     * @param string $ip
     * @param int $periodInSeconds
     * @return unknown
     */
    public function getLatestClickFromIP($ip, $periodInSeconds) {
        $select = new Gpf_SqlBuilder_SelectBuilder();

        $select->select->add(Pap_Db_Table_RawClicks::USERID, "userid");
        $select->select->add(Pap_Db_Table_RawClicks::CHANNEL, "channel");
        $select->from->add(Pap_Db_Table_RawClicks::getName());
        $select->where->add(Pap_Db_Table_RawClicks::IP, "=", $ip);
        $select->where->add(Pap_Db_Table_RawClicks::RTYPE, "<>", Pap_Db_ClickImpression::STATUS_DECLINED);
        $dateFrom = new Gpf_DateTime();
        $dateFrom->addSecond(-1*$periodInSeconds);
        $select->where->add(Pap_Db_Table_RawClicks::DATETIME, ">", $dateFrom->toDateTime());
        $select->orderBy->add(Pap_Db_Table_RawClicks::DATETIME, false);
        $select->limit->set(0, 1);

        $recordSet = new Gpf_Data_RecordSet();
        $recordSet->load($select);

        foreach($recordSet as $record) {
        	return array('userid' => $record->get("userid"), 'channel' => $record->get("channel"));
        }
        return null;
    }
示例#17
0
 /**
  * Gets currency names for CurrencySearchListBox
  *
  * @service currency read
  * @param $search
  */
 public function getCurrencies(Gpf_Rpc_Params $params)
 {
     $searchString = $params->get('search');
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add(Gpf_Db_Table_Currencies::ID, "id");
     $select->select->add(Gpf_Db_Table_Currencies::NAME, "name");
     $select->from->add(Gpf_Db_Table_Currencies::getName());
     $select->where->add(Gpf_Db_Table_Currencies::NAME, "LIKE", "%" . $searchString . "%");
     $result = new Gpf_Data_RecordSet();
     $result->load($select);
     return $result;
 }
示例#18
0
 /**
  * checks if banner name is unique
  *
  * @return unknown
  */
 public function checkUniqueName($name, $bannerId, $accountId)
 {
     $result = new Gpf_Data_RecordSet('id');
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add(self::ID, 'bannerid');
     $selectBuilder->select->add('name', 'name');
     $selectBuilder->from->add(self::getName());
     $selectBuilder->where->add('name', '=', $name);
     $selectBuilder->where->add('accountid', '=', $accountId);
     if ($bannerId != '') {
         $selectBuilder->where->add('bannerid', '<>', $bannerId);
     }
     $result->load($selectBuilder);
     return $result;
 }
示例#19
0
    private function getNumberOfSalesActions($userId) {
        $select = new Gpf_SqlBuilder_SelectBuilder();

        $select->select->add('count(transid)', 'countColumn');
        $select->from->add(Pap_Db_Table_Transactions::getName());
        $select->where->add(Pap_Db_Table_Transactions::USER_ID, '=', $userId);
        $select->where->add(Pap_Db_Table_Transactions::TIER, '=', '1');
        $select->where->add(Pap_Db_Table_Transactions::R_STATUS, '=', Pap_Common_Constants::STATUS_APPROVED);

        $compoundWhere = new Gpf_SqlBuilder_CompoundWhereCondition();
        $compoundWhere->add(Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Common_Constants::TYPE_SALE, 'OR');
        $compoundWhere->add(Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Common_Constants::TYPE_ACTION, 'OR');

        $select->where->addCondition($compoundWhere);

        $recordSet = new Gpf_Data_RecordSet();
        $recordSet->load($select);

        foreach($recordSet as $record) {
            return $record->get('countColumn');
        }
        return 0;
    }
    private function getPayoutsForHistoryIds($payoutHistoryIds) {
        $result = new Gpf_Data_RecordSet();

        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add(Pap_Db_Table_Payouts::PAYOUT_HISTORY_ID, Pap_Db_Table_Payouts::PAYOUT_HISTORY_ID);
        $selectBuilder->select->add(Pap_Db_Table_Payouts::AMOUNT, Pap_Db_Table_Payouts::AMOUNT);
        $selectBuilder->select->add(Gpf_Db_Table_AuthUsers::USERNAME, Gpf_Db_Table_AuthUsers::USERNAME, 'au');
        $selectBuilder->select->add(Gpf_Db_Table_AuthUsers::FIRSTNAME, Gpf_Db_Table_AuthUsers::FIRSTNAME, 'au');
        $selectBuilder->select->add(Gpf_Db_Table_AuthUsers::LASTNAME, Gpf_Db_Table_AuthUsers::LASTNAME, 'au');
        $selectBuilder->select->add(Gpf_Db_Table_AuthUsers::NOTIFICATION_EMAIL, Gpf_Db_Table_AuthUsers::NOTIFICATION_EMAIL, 'au');
        $selectBuilder->select->add(Pap_Db_Table_Users::ID,  Pap_Db_Table_Users::ID, 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(3), Pap_Db_Table_Users::getDataColumnName(3), 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(4), Pap_Db_Table_Users::getDataColumnName(4), 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(5), Pap_Db_Table_Users::getDataColumnName(5), 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(6), Pap_Db_Table_Users::getDataColumnName(6), 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(7), Pap_Db_Table_Users::getDataColumnName(7), 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(8), Pap_Db_Table_Users::getDataColumnName(8), 'pu');
        $selectBuilder->select->add(Pap_Db_Table_Users::getDataColumnName(9), Pap_Db_Table_Users::getDataColumnName(9), 'pu');
        $selectBuilder->select->add(Gpf_Db_Table_Currencies::SYMBOL, Gpf_Db_Table_Currencies::SYMBOL, 'c');
        $selectBuilder->select->add(Gpf_Db_Table_Currencies::WHEREDISPLAY, Gpf_Db_Table_Currencies::WHEREDISPLAY, 'c');
        $selectBuilder->from->add(Pap_Db_Table_Payouts::getName(), 'p');
        $selectBuilder->from->addInnerJoin(Pap_Db_Table_Users::getName(), 'pu', 'p.userid = pu.userid');
        $selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'gu', 'pu.accountuserid = gu.accountuserid');
        $selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au', 'gu.authid = au.authid');
        $selectBuilder->from->addLeftJoin(Gpf_Db_Table_Currencies::getName(), 'c', 'p.currencyid = c.currencyid');

        $selectBuilder->where->add(Pap_Db_Table_Payouts::PAYOUT_HISTORY_ID, 'IN', $payoutHistoryIds);

        $result->load($selectBuilder);

        return $result;
    }
    private function getSubaffiliatesCounts($ids) {
        $results = array();
        $condition = '';

        $rs = new Gpf_Data_RecordSet();
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('count(u.'.Pap_Db_Table_Users::ID.')', 'count');
        $selectBuilder->select->add('u.'.Pap_Db_Table_Users::PARENTUSERID, Pap_Db_Table_Users::PARENTUSERID);

        $selectBuilder->from->add(Pap_Db_Table_Users::getName(), 'u');
        $selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'gu', 'u.'.Pap_Db_Table_Users::ACCOUNTUSERID.' = gu.'.Gpf_Db_Table_Users::ID);
        $selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au', 'gu.'.Gpf_Db_Table_Users::AUTHID .' = au.'.Gpf_Db_Table_AuthUsers::ID);

        $selectBuilder->where->add('u.'.Pap_Db_Table_Users::PARENTUSERID, 'in', $ids);
        $selectBuilder->where->add('u.'.Pap_Db_Table_Users::DELETED, '=', Gpf::NO);
		$selectBuilder->where->add('gu.'.Gpf_Db_Table_Users::STATUS, 'in', array(Gpf_Db_User::APPROVED, Gpf_Db_User::PENDING));
        $this->filterCollection->addTo($selectBuilder->where);

        $selectBuilder->groupBy->add('u.'.Pap_Db_Table_Users::PARENTUSERID);
        
        $rs->load($selectBuilder);

        foreach($rs as $record) {
            $results[$record->get(Pap_Db_Table_Users::PARENTUSERID)] = $record->get('count');
        }

        return $results;
    }
    protected function loadCampaignSettings() {
    	Pap3Compatibility_Migration_OutputWriter::log("&nbsp;&nbsp;Loading PAP3 campaign settings.....");

    	$selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('code', 'code');
        $selectBuilder->select->add('value', 'value');
        $selectBuilder->select->add('id1', 'campaignid');

        $selectBuilder->from->add('wd_g_settings');

        $selectBuilder->where->add('code', 'LIKE', 'Aff_camp_%');
        $selectBuilder->where->add('id1', '!=', 'null');

        $result = new Gpf_Data_RecordSet();
        $result->load($selectBuilder);

        $count = 0;
        foreach($result as $record) {
			$this->pap3CampaignSettings[$record->get('campaignid')][$record->get('code')] = $record->get('value');
        	$count++;
        }

    	Pap3Compatibility_Migration_OutputWriter::log(" ($count) ..... DONE<br/>");
    }
示例#23
0
	/**
	 *
	 * @param $campaignId
	 * @param $tier
	 * @return Gpf_Data_RecordSet
	 */
	public function getAllCommissionsInCampaign($campaignId = '', $tier = '1') {
		$result = new Gpf_Data_RecordSet();

		$selectBuilder = $this->getAllCommissionsInCampaignSelectBuilder($campaignId, $tier);
		$selectBuilder->orderBy->add(self::VALUE);

		$result->load($selectBuilder);
		return $result;
	}
    public static function getAllPayoutOptionNames() {
    	$result = new Gpf_Data_RecordSet('id');

    	$selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
    	$selectBuilder->select->add(Gpf_Db_Table_FieldGroups::ID, 'id');
    	$selectBuilder->select->add(Gpf_Db_Table_FieldGroups::NAME, 'name');
    	$selectBuilder->from->add(Gpf_Db_Table_FieldGroups::getName());
    	$selectBuilder->where->add(Gpf_Db_Table_FieldGroups::TYPE, '=', Pap_Common_Constants::FIELDGROUP_TYPE_PAYOUTOPTION);

    	$result->load($selectBuilder);
    	
    	$resultArray = array();
    	foreach($result as $record) {
    		$resultArray[$record->get('id')] = Gpf_Lang::_localizeRuntime($record->get('name'));
    	}
    	return $resultArray;
    }
示例#25
0
    public function getNumberOfRecordsWithSameOrderId($orderId, $transType, $periodInHours, $parentTransId, $visitDateTime) {
        $select = new Gpf_SqlBuilder_SelectBuilder();

        $select->select->add("count(transid)", "count");
        $select->from->add(Pap_Db_Table_Transactions::getName());
        if($orderId == '') {
            $condition = new Gpf_SqlBuilder_CompoundWhereCondition();
            $condition->add(Pap_Db_Table_Transactions::ORDER_ID, '=', '', 'OR');
            $condition->add(Pap_Db_Table_Transactions::ORDER_ID, '=', null, 'OR');
            $select->where->addCondition($condition);
        } else {
            $select->where->add(Pap_Db_Table_Transactions::ORDER_ID, "=", $orderId);
        }
        $select->where->add(Pap_Db_Table_Transactions::R_TYPE, "=", $transType);
        $select->where->add(Pap_Db_Table_Transactions::TIER, "=", "1");
        $select->where->add(Pap_Db_Table_Transactions::R_STATUS, "<>", Pap_Common_Constants::STATUS_DECLINED);
        if($periodInHours > 0) {
            $dateFrom = new Gpf_DateTime($visitDateTime);
            $dateFrom->addHour(-1*$periodInHours);
            $select->where->add(Pap_Db_Table_Transactions::DATE_INSERTED, ">", $dateFrom->toDateTime());
        }
        if($parentTransId != null && $parentTransId != '') {
            $select->where->add(Pap_Db_Table_Transactions::PARRENT_TRANSACTION_ID, "<>", $parentTransId);
        }

        $recordSet = new Gpf_Data_RecordSet();
        $recordSet->load($select);

        foreach($recordSet as $record) {
            return $record->get("count");
        }
        return 0;
    }