/**
  *
  * @return Gpf_Db_Table_Tasks
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 function buildFrom() {
     $this->_selectBuilder->from->add(Pap_Db_Table_RecurringCommissions::getName(), 'rc');
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_RecurringCommissionEntries::getName(),
         "rce", "rce.recurringcommissionid = rc.recurringcommissionid AND rce.tier = 1");
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_Users::getName(), "pu", "rce.userid = pu.userid");
     $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_Users::getName(), "gu", "pu.accountuserid = gu.accountuserid");
     $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");
     
     $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_Transactions::getName(), "t", "t.transid = rc.transid");
     $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_RecurrencePresets::getName(), 'rp', 'rp.recurrencepresetid = rc.recurrencepresetid');
 }
Esempio n. 3
0
 /**
  * @return Gpf_SqlBuilder_SelectBuilder
  */
 protected function createSelectBuilder()
 {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add(Gpf_Db_Table_RecurrencePresets::ID, self::ID);
     $select->select->add(Gpf_Db_Table_RecurrencePresets::NAME, self::VALUE);
     $select->from->add(Gpf_Db_Table_RecurrencePresets::getName());
     $condition = new Gpf_SqlBuilder_CompoundWhereCondition();
     $condition->add(Gpf_Db_Table_RecurrencePresets::ACCOUNTID, 'is', 'NULL', 'OR', false);
     $condition->add(Gpf_Db_Table_RecurrencePresets::ACCOUNTID, '=', Gpf_Session::getAuthUser()->getAccountId(), 'OR');
     $select->where->addCondition($condition);
     $select->orderBy->add(Gpf_Db_Table_RecurrencePresets::NAME);
     return $select;
 }
 public function init()
 {
     $this->setTable(Gpf_Db_Table_RecurrencePresets::getInstance());
     parent::init();
 }