public function toString()
 {
     if ($this->from->isEmpty()) {
         return '';
     }
     return "UPDATE " . $this->from->toString() . $this->set->toString() . $this->where->toString() . $this->limit->toString();
 }
    private function setSqlDateRange(Gpf_SqlBuilder_WhereClause $where, $transactionTableAlias = 't') {
        if ($this->getDate() == Pap_Features_PerformanceRewards_Rule::DATE_ALL_UNPAID_COMMISSIONS) {
            $where->add($transactionTableAlias.'.'.Pap_Db_Table_Transactions::PAYOUT_STATUS, '=', Pap_Common_Constants::PSTATUS_UNPAID);
        }

        //TODO: implement - use dateRange object
        //$where->addDateRange($transactionTableAlias.'.'.Pap_Db_Table_Transactions::DATE_INSERTED, $dateRange);
        
        $dateRange = $this->getDateRange(new Gpf_DateTime());
        if($dateRange->isAllTime()) {
            return;
        }
        $where->add($transactionTableAlias.'.'.Pap_Db_Table_Transactions::DATE_INSERTED, '>=', $dateRange->getFrom()->toDateTime());
        $where->add($transactionTableAlias.'.'.Pap_Db_Table_Transactions::DATE_INSERTED, '<=', $dateRange->getTo()->toDateTime());
    }
 private function setStatusWhere(Gpf_SqlBuilder_WhereClause $where) {
     $where->add(self::TRANSACTION_ALIAS.'.'.Pap_Db_Table_Transactions::R_STATUS, 'IN', $this->getStatuses());
 }
 private function initVisitsWhere(Gpf_SqlBuilder_WhereClause $where) {
     $visitorCondition = new Gpf_SqlBuilder_CompoundWhereCondition();
     $visitorCondition->add(Pap_Db_Table_Visits::VISITORID, '=', $this->visitorId);
     if ($this->ip != '') {
         $visitorCondition->add(Pap_Db_Table_Visits::IP, '=', $this->ip, 'OR');
     }
     $where->addCondition($visitorCondition);
     
     $accountCondition = new Gpf_SqlBuilder_CompoundWhereCondition();
     $accountCondition->add(Pap_Db_Table_Visits::ACCOUNTID, '=', $this->accountId);
     if ($this->accountId == Gpf_Db_Account::DEFAULT_ACCOUNT_ID) { 
         $accountCondition->add(Pap_Db_Table_Visits::ACCOUNTID, '=', '', 'OR');
     }
     $where->addCondition($accountCondition);
     
     $where->add(Pap_Db_Table_Visits::DATEVISIT, '<=', $this->toDate->toDateTime());
 }
Exemple #5
0
    private function addActionConditionsToWhere(Gpf_SqlBuilder_WhereClause $where, $commissionTypeId, $prefix = '') {
		$where->add($prefix . Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Common_Constants::TYPE_ACTION);
		$where->add($prefix . Pap_Db_Table_Transactions::COMMISSIONTYPEID, '=', $commissionTypeId);
    }
 private function addDatePresetTo(Gpf_SqlBuilder_WhereClause $whereClause)
 {
     $datePreset = $this->decodeDatePreset($this->value);
     if ($datePreset != null) {
         $whereClause->add($this->code, '>=', $datePreset["dateFrom"]);
         $whereClause->add($this->code, '<=', $datePreset["dateTo"]);
     }
 }
 public function equals(Gpf_SqlBuilder_WhereClause $where)
 {
     return $where->toString() == $this->toString();
 }
 public function toString()
 {
     return "DELETE " . $this->delete->toString() . "FROM " . $this->from->toString() . $this->where->toString() . $this->limit->toString();
 }
 public function toString()
 {
     return $this->select->toString() . ($this->from->isEmpty() ? '' : "FROM " . $this->from->toString()) . $this->where->toString() . $this->groupBy->toString() . $this->having->toString() . $this->orderBy->toString() . $this->limit->toString();
 }