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(" 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"); }
function buildFrom() { $this->_selectBuilder->from->add(Pap_Db_Table_Payouts::getName(), "p"); $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_FieldGroups::getName(), "po", "pu.payoutoptionid = po.fieldgroupid"); $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")); }
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; }
function init() { $this->setTable(Pap_Db_Table_Payouts::getInstance()); parent::init(); }
public static function getInstance() { if(self::$instance === null) { self::$instance = new self; } return self::$instance; }
protected function getMaxInvoiceNumber(){ $selectBuilder = new Gpf_SqlBuilder_SelectBuilder(); $selectBuilder->select->add('MAX('.Pap_Db_Table_Payouts::INVOICENUMBER.')', 'invoiceNumberMax'); $selectBuilder->from->add(Pap_Db_Table_Payouts::getName(), 't'); $row = $selectBuilder->getOneRow(); if ($selectBuilder->getAllRows()->getSize() == 0) { return 0; } return $row->get('invoiceNumberMax'); }