/**
     * gets user by user id
     * @param $userId
     * @return Pap_Affiliates_User
     */
    public function getUserById($context, $id) {
        if($id == '') {
            return null;
        }

        if (isset($this->usersCache[$id])) {
            return $this->usersCache[$id];
        }

        try {
            $this->usersCache[$id] = $this->loadUserFromId($id);
            return $this->usersCache[$id];
        } catch (Gpf_Exception $e) {

            $context->debug("User with RefId/UserId: $id doesn't exist");

            $valueContext = new Gpf_Plugins_ValueContext(null);
            $valueContext->setArray(array($id, $context));

            Gpf_Plugins_Engine::extensionPoint('Tracker.RecognizeAffiliate.getUserById', $valueContext);

            $user = $valueContext->get();

            if (!is_null($user)) {
                $this->usersCache[$id] = $user;
                return $this->usersCache[$id];
            }

            return null;
        }
    }
	/**
	 * returns commission group for user (if not set already)
	 * Commission group can be set previously in the checkCampaignType() function
	 *
	 */
	protected function getCommissionGroup(Pap_Contexts_Tracking $context) {
		$context->debug('Recognizing commission group started');

		if (($user = $context->getUserObject()) == null) {
		    $context->debug('STOPPING, user is not set - cannot find commission group');
		    return;
		}
		
		$commGroupId = $this->getUserCommissionGroupFromCache($context->getCampaignObject(), $user->getId());
		if($commGroupId == false) {
			$context->debug("STOPPING, Cannot find commission group for this affiliate and campaign! ".$context->getCampaignObject()->getId().' - '.$user->getId());
			$context->setDoCommissionsSave(false);
			$context->setDoTrackerSave(false);
			return;
		}
			
		Gpf_Plugins_Engine::extensionPoint('PostAffiliate.RecognizeCommGroup.getCommissionGroup', $context);

        $commissionGroup = $this->getCommissionGroupFromCache($commGroupId);
        if ($commissionGroup == null) {
        	$context->debug('    Commission group with ID '.$commGroupId . ' does not exist');
        	return;
        }

		$context->setCommissionGroup($commissionGroup);
	    $context->debug('Received commission group ID = '.$commGroupId);
	}
 protected function initConstraints()
 {
     $this->addCascadeDeleteConstraint(self::ID, Gpf_Db_Table_PasswordRequests::AUTHUSERID, new Gpf_Db_PasswordRequest());
     Gpf_Plugins_Engine::extensionPoint('AuthUsers.initConstraints', $this);
     $this->addConstraint(new Gpf_DbEngine_Row_PasswordConstraint(self::PASSWORD));
     $this->addConstraint(new Gpf_DbEngine_Row_UniqueConstraint(array(self::USERNAME)));
 }
 private function initTransTypes() {
     $this->addTransType(Pap_Common_Constants::TYPE_CLICK);
     $this->addTransType(Pap_Common_Constants::TYPE_SALE);
     $this->addTransType(Pap_Common_Constants::TYPE_REFUND);
     $this->addTransType(Pap_Common_Constants::TYPE_CHARGEBACK);
     Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Stats.initTransactionTypes', $this);
 }
 public function show(Pap_Db_CachedBanner $cachedBanner) {
     try {
         $request = new Pap_Tracking_Request();
         $banner = $this->getBanner($cachedBanner->getBannerId(), $cachedBanner->getUserId(), $cachedBanner->getChannel());
         $req = new Pap_Tracking_BannerViewerRequest($banner->getBannerType());
         Gpf_Plugins_Engine::extensionPoint(self::EXT_POINT_NAME, $req);
         if($req->getViewer() != null) {
             $req->getViewer()->showBanner($request , $banner);
             return;
         }
         $this->prepareCachedBanner($banner, $cachedBanner);
         try {
             $cachedBanner->save();
         } catch (Gpf_DbEngine_Row_ConstraintException $e) {
             // cached banner was saved already by other script
         }
         if ($cachedBanner->getHeaders() != '') {
             header($cachedBanner->getHeaders(), true);
         }
         echo $cachedBanner->getCode();
     } catch (Exception $e) {
         $this->logMessage($e);
         echo $e;
     }
 }
 /**
  * @anonym
  * @service
  * @param $fields
  */
 public function load(Gpf_Rpc_Params $params) {
     $form = new Gpf_Rpc_Form($params);
     
     Gpf_Plugins_Engine::extensionPoint('PostAffiliate.CommissionTypeEditAdditionalForm.load', $form);
     
     return $form;
 }
	/**
	 *
	 * @service banner_stats read
	 * @param $data
	 */
	public function loadFullStatistics(Gpf_Rpc_Params $params) {
		$data = new Gpf_Rpc_Data($params);

		$select = new Gpf_SqlBuilder_SelectBuilder();
		$select->from->add(Pap_Db_Table_Banners::getName());
		$select->select->add("COUNT(".Pap_Db_Table_Banners::ID.")", "count");
		$select->select->add(Pap_Db_Table_Banners::TYPE, 'type');
		$select->groupBy->add(Pap_Db_Table_Banners::TYPE);
		
		Gpf_Plugins_Engine::extensionPoint('AffiliateNetwork.modifyWhere', 
        new Gpf_Common_SelectBuilderCompoundRecord($select, new Gpf_Data_Record(array(), array())));
		
        $result = $select->getAllRowsIndexedBy('type');
		$bannerTypes = explode(',', $data->getParam('bannerTypes'));		
		
		$bannersCount = 0;
		foreach ($bannerTypes as $bannerType) {
			$bannerTypeCount = 0;
			try {
				$bannerTypeCount = $result->getRecord($bannerType)->get('count');
			} catch (Gpf_Data_RecordSetNoRowException $e) {				
			}
			$data->setValue($bannerType, "$bannerTypeCount");
			$bannersCount += $bannerTypeCount;
		}
		$data->setValue("bannersCount", "$bannersCount");		

		return $data;
	}
Example #8
0
 /**
  * returns instance of plugins Engine class
  *
  * @return Gpf_Plugins_Engine
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new Gpf_Plugins_Engine();
     }
     return self::$instance;
 }
    /**
     * @service fraud_protection write
     * @param $fields
     */
    public function save(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        Gpf_Settings::set(Pap_Settings::BANNEDIPS_LIST_SIGNUPS,
        $form->getFieldValue(Pap_Settings::BANNEDIPS_LIST_SIGNUPS));

        Gpf_Settings::set(Pap_Settings::BANNEDIPS_SIGNUPS,
        $form->getFieldValue(Pap_Settings::BANNEDIPS_SIGNUPS));

        Gpf_Settings::set(Pap_Settings::BANNEDIPS_SIGNUPS_ACTION,
        $form->getFieldValue(Pap_Settings::BANNEDIPS_SIGNUPS_ACTION));

        Gpf_Settings::set(Pap_Settings::REPEATING_SIGNUPS_SETTING_NAME,
        $form->getFieldValue(Pap_Settings::REPEATING_SIGNUPS_SETTING_NAME));

        Gpf_Settings::set(Pap_Settings::REPEATING_SIGNUPS_SECONDS_SETTING_NAME,
        $form->getFieldValue(Pap_Settings::REPEATING_SIGNUPS_SECONDS_SETTING_NAME));

        Gpf_Settings::set(Pap_Settings::REPEATING_SIGNUPS_ACTION_SETTING_NAME,
        $form->getFieldValue(Pap_Settings::REPEATING_SIGNUPS_ACTION_SETTING_NAME));

        Gpf_Plugins_Engine::extensionPoint('FraudProtectionSignupsForm.save', $form);

        $form->setInfoMessage($this->_("Fraud protections saved"));
        return $form;
    }
	protected function buildGroupBy($groupColumn) {
		$this->statsSelect->groupBy->add(self::TRANSACTIONS_PREFIX.'.groupColumn');
        $this->transactionsSelect->groupBy->add(Pap_Db_Table_Transactions::TRANSACTION_ID);
        $this->transactionsSelect->groupBy->add(Pap_Db_Table_Transactions::TIER);
        $transactionsStatsBuilderContext = new Pap_Stats_Computer_TransactionsStatsBuilderContext($this, $groupColumn);
        Gpf_Plugins_Engine::extensionPoint('Pap_Stats_Computer_TransactionsStatsBuilder.buildGroupBy', $transactionsStatsBuilderContext);
	}
 protected function buildWhere()
 {
     parent::buildWhere();
     $this->_selectBuilder->where->add('l.logout', 'is', 'NULL', 'AND', false);
     $this->_selectBuilder->where->add(Gpf_Db_Table_LoginsHistory::LAST_REQUEST, '>', "('" . $this->createDatabase()->getDateString() . "' - INTERVAL 1800 SECOND)", 'AND', false);
     Gpf_Plugins_Engine::extensionPoint('Gpf_Report_OnlineUsers.buildWhere', $this->_selectBuilder->where);
 }
Example #12
0
	public function createMenu() {
		$this->addItem('Home', $this->_('Home'));

		$item = $this->addItem('Campaigns-Overview', $this->_('Campaigns'));
		$item->addItem('Campaigns-Overview', $this->_('Overview'));
		$item->addItem('Campaigns-Manager', $this->_('Campaigns Manager'));

		$item = $this->addItem('Banners-Overview', $this->_('Banners'));
		$item->addItem('Banners-Overview', $this->_('Overview'));
		$item->addItem('Banner-Manager', $this->_('Banners Manager'));

		$item = $this->addItem('Affiliates-Overview', $this->_('Affiliates'));
		$item->addItem('Affiliates-Overview', $this->_('Overview'));
		$item->addItem('Affiliate-Tree', $this->_('Affiliate tree'));
		$item->addItem('Affiliate-Manager', $this->_('Affiliates Manager'));
		$item->addItem('Direct-Links-Manager', $this->_('DirectLinks Urls'));

		$item = $this->addItem('Transactions-Overview', $this->_('Transactions'));
		$item->addItem('Transactions-Overview', $this->_('Overview'));
		$item->addItem('Clicks-List', $this->_('Raw clicks list'));
		$item->addItem('Transaction-Manager', $this->_('Commissions'));

		$item = $this->addItem('Reports', $this->_('Reports'));
		$item->addItem('Reports', $this->_('Overview'));
		$item->addItem('Quick-Report', $this->_('Quick report'));
		$item->addItem('Trends-Report', $this->_('Trends report'));
		$item->addItem('Daily-Report', $this->_('Daily report'));
		$item->addItem('Transaction-Manager', $this->_('Commissions'));
		$item->addItem('Clicks-List', $this->_('Raw clicks list'));
		$item->addItem('Payouts-History', $this->_('Payouts history'));
		$item->addItem('Payouts-By-Affiliate', $this->_('Payouts by affiliate'));
		$item->addItem('Online-Users', $this->_('Online users'));
		$item->addItem('Top-Affiliates', $this->_('Top affiliates'));
		$item->addItem('Top-referring-URLs', $this->_('Top referring URLs'));

		$item = $this->addItem('Payouts', $this->_('Payouts'));
		$item->addItem('Payouts', $this->_('Overview'));
		$item->addItem('Pay-Affiliates', $this->_('Pay affiliates'));

		$item = $this->addItem('Communication', $this->_('Emails'));
		$item->addItem('Communication', $this->_('Overview'));
		$item->addItem('Send-Message', $this->_('Send message'));
		$item->addItem('Mail-Outbox', $this->_('Mail outbox'));

		$this->addItem('Configuration-Manager', $this->_('Configuration'));

		$item = $this->addItem('Tools', $this->_('Tools'));
		$item->addItem('Tools', $this->_('Overview'));
		$item->addItem('Integration', $this->_('Integration'));
		$item->addItem('Logs-History', $this->_('Event logs'));
		$item->addItem('Logins-History', $this->_('Logins history'));
		$item->addItem('Import-Export', $this->_('Import / Export'));
		$item->addItem('Getting-Started', $this->_('Getting started'));
		$item->addItem('Visitor-Affiliates', $this->_('Visitor affiliates'));
		$item->addItem('Views', $this->_('Views'));
		$item->addItem('ReportProblems', $this->_('Report problems'));

		Gpf_Plugins_Engine::extensionPoint('PostAffiliate.merchant.menu', $this);
	}
Example #13
0
 protected static function createActionsList() {
     $list = Pap_Features_PerformanceRewards_ActionList::getInstance(true);
     $list->addAction('a1', 'Pap_Features_PerformanceRewards_Action_AddBonusCommAction', self::ACTION_PUT_ADD_BONUS);
     $list->addAction('a2', 'Pap_Features_PerformanceRewards_Action_ChangeGroup', self::ACTION_PUT_AFFILIATE_INTO_COMMISSION_GROUP);
     $list->addAction('a3', 'Pap_Features_PerformanceRewards_Action_ChangeGroupRetroactively', self::ACTION_PUT_AFFILIATE_INTO_COMMISSION_GROUP_RETROACTIVELY);
     
     Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Features.PerformanceRewards.Action.createActionList', $list);
 }
 /**
  * @service country read
  * @anonym
  * @return Gpf_Rpc_Data
  */
 public function loadDefaultCountry(Gpf_Rpc_Params $params)
 {
     $data = new Gpf_Rpc_Data($params);
     $context = new Gpf_Plugins_ValueContext(Gpf_Settings::get(Gpf_Settings_Gpf::DEFAULT_COUNTRY));
     Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Countries.getDefaultCountry', $context);
     $data->setValue('default', $context->get());
     return $data;
 }
Example #15
0
 public function execute() {
     if(Gpf_Plugins_Engine::getInstance()->getConfiguration()->isPluginActive('AffiliateNetwork')){
         $Merchant = new Gpf_Db_Role();
         $Merchant->setId(Pap_Application::DEFAULT_ROLE_MERCHANT);
         $Merchant->load();
         $Merchant->setName('Network Owner');
         $Merchant->save();
     }
 }
Example #16
0
 public function __construct($name, $panelName = '')
 {
     Smarty::Smarty();
     $this->name = $name;
     $this->panelName = $panelName;
     $this->default_resource_type = 'template';
     $this->security = true;
     Gpf_Plugins_Engine::extensionPoint('Core.initSmarty', $this);
 }
    protected function initSelectClause() {
        $this->selectBuilder->select->add(Pap_Db_Table_Transactions::R_STATUS, "status", 't');
        $this->selectBuilder->select->add(Pap_Db_Table_Transactions::PAYOUT_STATUS, "payoutstatus", 't');
        $this->selectBuilder->select->add("sum(if(t.".Pap_Db_Table_Transactions::TIER.">1,1,0))", "cnt");
        $this->selectBuilder->select->add("sum(t.".Pap_Db_Table_Transactions::COMMISSION.")", "commission");
        $this->selectBuilder->select->add("sum(if(t.tier>1,t.".Pap_Db_Table_Transactions::TOTAL_COST.",0))", "totalcost");

        Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Pap_Stats_Computer_Transactions.initSelectClause', $this->selectBuilder->select);
    }
 protected function buildWhere() {
     parent::buildWhere();
     $this->_selectBuilder->where->add('u.deleted', '=', Gpf::NO);
     $this->_selectBuilder->where->add('u.rtype', '=', Pap_Application::ROLETYPE_MERCHANT);
     if ($this->accountId != null) {
         $this->_selectBuilder->where->add('a.accountid', '=', $this->accountId);
     }
     Gpf_Plugins_Engine::extensionPoint('AffiliateNetwork.modifyWhere',
     new Gpf_Common_SelectBuilderCompoundRecord($this->_selectBuilder, new Gpf_Data_Record(array('columnPrefix'), array('a'))));
 }
    /**
     * checks for click fraud rules...
     *
     * @param Pap_Contexts_Click $context
     */
    public function check(Pap_Contexts_Click $context) {
        $context->debug('FraudProtection started');

        $this->checkBannedIP($context);
        $this->checkMultipleClicksFromSameIP($context);

        Gpf_Plugins_Engine::extensionPoint('FraudProtection.Click.check', $context);

        $context->debug('FraudProtection ended');
    }
    /**
     * @return Gpf_SqlBuilder_SelectBuilder
     */
    protected function createSelectBuilder() {
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('b.'.Pap_Db_Table_Banners::ID, self::ID);
        $selectBuilder->select->add('b.'.Pap_Db_Table_Banners::NAME, self::VALUE);
        $selectBuilder->from->add(Pap_Db_Table_Banners::getName(), 'b');

        Gpf_Plugins_Engine::extensionPoint('PostAffiliate.BannerListbox.getBannerSelect', $selectBuilder);

        return $selectBuilder;
    }
Example #21
0
	private function initSelectBuilder() {
		$this->selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
		$this->initSelectClause();
		$this->initFrom();
		$this->initWhereConditions();
		$this->initGroupBy();
		
		$selectBuilderCompoundContext = new Pap_Common_Reports_SelectBuilderCompoundParams($this->selectBuilder, $this->params);
		
		Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Pap_Stats_Computer_Base.initSelectBuilder', $selectBuilderCompoundContext);
	}
 protected function saveCommissions(Pap_Contexts_Click $context) {
     Gpf_Plugins_Engine::extensionPoint('Tracker.click.beforeSaveCommissions', $context);
     if (!$context->getDoCommissionsSave()) {
         $context->debug('Click commissions save stopped by plugin.');
         return;
     }
     foreach ($this->commissionSavers as $commissionSaver) {
         $commissionSaver->process($context);
     }
     Gpf_Plugins_Engine::extensionPoint('Tracker.click.afterSaveCommissions', $context);
 }
    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;
    }
    /**
     * @return Gpf_SqlBuilder_SelectBuilder
     */
    protected function createSelectBuilder() {
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add('c.'.Pap_Db_Table_Campaigns::ID, self::ID);
        $selectBuilder->select->add('c.'.Pap_Db_Table_Campaigns::NAME, self::VALUE);
        $selectBuilder->from->add(Pap_Db_Table_Campaigns::getName(), 'c');
        if(Gpf_Session::getAuthUser()->getRoleTypeId() == Pap_Application::ROLETYPE_AFFILIATE) {
            $selectBuilder->where->add('c.' . Pap_Db_Table_Campaigns::STATUS, '!=', 'S');
        }
        Gpf_Plugins_Engine::extensionPoint('PostAffiliate.Campaigns.getCampaignsSelect', $selectBuilder);

        return $selectBuilder;
    }
    /**
     * checks for click fraud rules...
     *
     * @param Pap_Contexts_Click $context
     */
    public function check(Pap_Contexts_Action $context) {
        $context->debug('    FraudProtection started');

        $this->checkSalesFromBannedIP($context);
        $this->checkMultipleSalesFromSameIP($context);
        $this->checkMultipleSalesWithSameOrderID($context);

        Gpf_Plugins_Engine::extensionPoint('FraudProtection.Action.check', $context);

        $context->debug('    FraudProtection ended');
        $context->debug("");
    }
 /**
  * @return Gpf_SqlBuilder_SelectBuilder
  */
 protected function createSelectBuilder()
 {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add("users." . Gpf_Db_Table_Users::ID, self::ID);
     $select->select->add("authUsers." . Gpf_Db_Table_AuthUsers::USERNAME, 'username');
     $select->select->add("authUsers." . Gpf_Db_Table_AuthUsers::FIRSTNAME, 'firstname');
     $select->select->add("authUsers." . Gpf_Db_Table_AuthUsers::LASTNAME, 'lastname');
     $select->from->add(Gpf_Db_Table_Users::getName(), 'users');
     $select->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'authUsers', "users." . Gpf_Db_Table_Users::AUTHID . "=authUsers." . Gpf_Db_Table_AuthUsers::ID);
     Gpf_Plugins_Engine::extensionPoint('Gpf_Common_UserRichListBox.createSelectBuilder', $select->where);
     $select->orderBy->add("authUsers." . Gpf_Db_Table_AuthUsers::USERNAME);
     return $select;
 }
 protected function loadSetting()
 {
     $this->addValue("theme", Gpf_Session::getAuthUser()->getTheme());
     $this->addValue("date_time_format", 'MM/d/yyyy HH:mm:ss');
     $this->addValue("programVersion", Gpf_Application::getInstance()->getVersion());
     $this->addValue(Gpf_Settings_Gpf::NOT_FORCE_EMAIL_USERNAMES, Gpf_Settings::get(Gpf_Settings_Gpf::NOT_FORCE_EMAIL_USERNAMES));
     $quickLaunchSettings = new Gpf_Desktop_QuickLaunch();
     $this->addValue(Gpf_Desktop_QuickLaunch::SHOW_QUICK_LAUNCH, $quickLaunchSettings->getShowQuickLaunch());
     $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_THOUSANDS_SEPARATOR, Gpf_Settings_Regional::getInstance()->getThousandsSeparator());
     $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DECIMAL_SEPARATOR, Gpf_Settings_Regional::getInstance()->getDecimalSeparator());
     $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DATE_FORMAT, Gpf_Settings_Regional::getInstance()->getDateFormat());
     $this->addValue(Gpf_Settings_Gpf::REGIONAL_SETTINGS_TIME_FORMAT, Gpf_Settings_Regional::getInstance()->getTimeFormat());
     Gpf_Plugins_Engine::extensionPoint('Core.loadSetting', $this);
 }
 /**
  * Return count of online users per role
  *
  * @service online_user read
  * @param Gpf_Rpc_Params $params
  */
 public function getOnlineRolesCount(Gpf_Rpc_Params $params)
 {
     $sql = new Gpf_SqlBuilder_SelectBuilder();
     $sql->from->add(Gpf_Db_Table_Roles::getName(), 'r');
     $sql->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'u', 'u.roleid=r.roleid');
     $sql->from->addInnerJoin(Gpf_Db_Table_LoginsHistory::getName(), 'l', 'l.accountuserid=u.accountuserid');
     $sql->select->add(Gpf_Db_Table_Roles::NAME, Gpf_Db_Table_Roles::NAME, 'r');
     $sql->select->add('count(*)', 'usersCount');
     $sql->where->add(Gpf_Db_Table_LoginsHistory::LOGOUT, 'is', 'NULL', 'AND', false);
     $sql->where->add(Gpf_Db_Table_LoginsHistory::LAST_REQUEST, '>', "('" . $this->createDatabase()->getDateString() . "' - INTERVAL 1800 SECOND)", 'AND', false);
     Gpf_Plugins_Engine::extensionPoint('Gpf_Report_OnlineUsersGadget.getOnlineRolesCount', $sql->where);
     $sql->groupBy->add('r.' . Gpf_Db_Table_Roles::ID);
     return $this->translateRoleNames($sql->getAllRows());
 }
 /**
  * @return Gpf_SqlBuilder_SelectBuilder
  */
 protected function createSelectBuilder() {
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('DISTINCT('.'b.'.Pap_Db_Table_Banners::DESTINATION_URL.')', self::ID);
     $selectBuilder->select->add('b.'.Pap_Db_Table_Banners::DESTINATION_URL, self::VALUE);
     $selectBuilder->from->add(Pap_Db_Table_Banners::getName(), 'b');
     $selectBuilder->where->add('b.'.Pap_Db_Table_Banners::DESTINATION_URL, '<>', 'NULL');
     $selectBuilder->where->add('b.'.Pap_Db_Table_Banners::DESTINATION_URL, '<>', '');
     if (Gpf_Session::getAuthUser()->getRoleTypeId() == Pap_Application::ROLETYPE_AFFILIATE) {
         $selectBuilder->where->add('b.'.Pap_Db_Table_Banners::STATUS, '<>', Pap_Db_Banner::STATUS_HIDDEN);
     }
     $selectBuilder->orderBy->add(Pap_Db_Table_Banners::DESTINATION_URL);
     Gpf_Plugins_Engine::extensionPoint('PostAffiliate.BannerListbox.getBannerSelect', $selectBuilder);    
     return $selectBuilder;
 }
	private function getPaidData(Gpf_Rpc_FilterCollection $filters) {
		$select = new Gpf_SqlBuilder_SelectBuilder();
		$select->select->add("SUM(amount)", "paid");
		$select->from->add(Pap_Db_Table_Payouts::getName(), "p");
		$select->from->addInnerJoin(Pap_Db_Table_PayoutsHistory::getName(), "ph", "p.payouthistoryid = ph.payouthistoryid");
		$filters->addTo($select->where);		
		
		Gpf_Plugins_Engine::extensionPoint('AffiliateNetwork.modifyWhere', 
        new Gpf_Common_SelectBuilderCompoundRecord($select, new Gpf_Data_Record(array('columnPrefix'), array('ph'))));
		
		$row = $select->getOneRow();

		return $this->checkNullValue($row->get("paid"));
	}