public function run() {
    	$time1 = microtime();
    	Pap3Compatibility_Migration_OutputWriter::logOnce("Deleting migrated data from existing PAP4 tables<br/>");

    	try {
    		$this->deleteTable(Pap_Db_Table_Campaigns::getName());
    		$this->deleteTable(Pap_Db_Table_CommissionGroups::getName());
    		$this->deleteTable(Pap_Db_Table_CommissionTypes::getName());
    		$this->deleteTable(Pap_Db_Table_Commissions::getName());
    		$this->deleteTable(Pap_Db_Table_UserInCommissionGroup::getName());
    		
    		$this->deleteTable(Gpf_Db_Table_FormFields::getName());
    		$this->deleteTable(Gpf_Db_Table_FieldGroups::getName());
    		
    		$this->deleteTable(Pap_Db_Table_Transactions::getName());
    		$this->deleteTable(Pap_Db_Table_Clicks::getName());
    		$this->deleteTable(Pap_Db_Table_RawClicks::getName());
    		$this->deleteTable(Pap_Db_Table_Impressions::getName());

    		$this->deleteTable(Pap_Db_Table_Banners::getName());
    		
    		$this->deleteTable(Gpf_Db_Table_FieldGroups::getName());
    		$this->deleteTable(Pap_Db_Table_PayoutsHistory::getName());
    		$this->deleteTable(Pap_Db_Table_Payouts::getName());
    		
    		$this->deleteTable(Gpf_Db_Table_Currencies::getName());
    		$this->deleteTable(Gpf_Db_Table_MailAccounts::getName());
    		
    	} catch(Exception $e) {
    		Pap3Compatibility_Migration_OutputWriter::log("&nbsp;&nbsp;Errror: ".$e->getMessage()."<br/>");
    	}

    	$time2 = microtime();
		Pap3Compatibility_Migration_OutputWriter::logDone($time1, $time2);
    }
 function buildFrom() {
     $this->_selectBuilder->from->add(Pap_Db_Table_Payouts::getName(), "p");
     $this->_selectBuilder->from->addInnerJoin(Pap_Db_Table_PayoutsHistory::getName(), "ph", "p.payouthistoryid = ph.payouthistoryid");
     $this->_selectBuilder->from->addInnerJoin(Pap_Db_Table_Users::getName(), "pu", "p.userid = pu.userid");
     $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "pu.accountuserid = gu.accountuserid");
     $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");
     $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_Currencies::getName(), "c", "p.currencyid = c.currencyid");
 }
	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"));
	}
 function buildFrom() {
     $this->_selectBuilder->from->add(Pap_Db_Table_Transactions::getName(), "t");
     $onCondition = "t.".Pap_Db_Table_Transactions::CAMPAIGN_ID." = c.".Pap_Db_Table_Campaigns::ID;
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_Campaigns::getName(), 'c', $onCondition);
     $this->_selectBuilder->from->addInnerJoin(Pap_Db_Table_Users::getName(), "pu", "t.userid = pu.userid");
     $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "pu.accountuserid = gu.accountuserid");
     $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_Channels::getName(), "ch", "t.channel = ch.channelid");
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_CommissionTypes::getName(), "ct", "t.commtypeid = ct.commtypeid");
     $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_Currencies::getName(), 'cs', 't.originalcurrencyid = cs.currencyid');
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_Banners::getName(), 'b', 'b.bannerid = t.bannerid');
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_PayoutsHistory::getName(), 'ph',
         'ph.'.Pap_Db_Table_PayoutsHistory::ID.' = t.'.Pap_Db_Table_Transactions::PAYOUTHISTORY_ID);
 }
 function buildFrom() {
     $this->_selectBuilder->from->add(Pap_Db_Table_PayoutsHistory::getName(), "ph");
 }
Ejemplo n.º 6
0
 public static function getInstance() {
     if(self::$instance === null) {
         self::$instance = new self;
     }
     return self::$instance;
 }
Ejemplo n.º 7
0
 function init() {
     $this->setTable(Pap_Db_Table_PayoutsHistory::getInstance());
     parent::init();
 }