protected function getTransactionsList() { $types = array(Pap_Common_Constants::TYPE_SALE, Pap_Common_Constants::TYPE_ACTION, Pap_Common_Constants::TYPE_LEAD, Pap_Common_Constants::TYPE_RECURRING); $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Pap_Db_Table_Transactions::getInstance(), 't'); $select->from->add(Pap_Db_Table_Transactions::getName(), 't'); $select->from->addInnerJoin(Pap_Db_Table_CommissionTypeAttributes::getName(), 'cta', 'cta.'.Pap_Db_Table_CommissionTypeAttributes::COMMISSION_TYPE_ID.'=t.'.Pap_Db_Table_Transactions::COMMISSIONTYPEID. ' and (cta.'.Pap_Db_Table_CommissionTypeAttributes::NAME."='".AutoApprovalCommissions_Main::AUTO_APPROVAL_COMMISSIONS_DAYS."' and ".Pap_Db_Table_CommissionTypeAttributes::VALUE . '<>0) and (unix_timestamp(t.dateinserted) + (cta.'.Pap_Db_Table_CommissionTypeAttributes::VALUE.' * 86400)) <= unix_timestamp() '); $select->where->add(Pap_Db_Table_Transactions::R_TYPE, "IN", $types); $select->where->add(Pap_Db_Table_Transactions::R_STATUS, "=", Pap_Common_Constants::STATUS_PENDING); $transaction = new Pap_Common_Transaction(); return $transaction->loadCollectionFromRecordset($select->getAllRows()); }
/** * * @param $orderId * @param $includeRefund * @return Gpf_DbEngine_Row_Collection<Pap_Common_Transaction> */ private function getAllTransactionIdsWithOrderId($orderId, $includeRefund){ $status = array (Pap_Common_Constants::STATUS_APPROVED, Pap_Common_Constants::STATUS_PENDING); $types = array(Pap_Common_Constants::TYPE_SALE, Pap_Common_Constants::TYPE_ACTION, Pap_Common_Constants::TYPE_LEAD); if ($includeRefund == true) { $types[] = Pap_Common_Constants::TYPE_REFUND; } $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Pap_Db_Table_Transactions::getInstance()); $select->from->add(Pap_Db_Table_Transactions::getName()); $select->where->add(Pap_Db_Table_Transactions::ORDER_ID, "=", $orderId); $select->where->add(Pap_Db_Table_Transactions::R_TYPE, "IN", $types); $select->where->add(Pap_Db_Table_Transactions::R_STATUS, "IN", $status); $transaction = new Pap_Common_Transaction(); return $transaction->loadCollectionFromRecordset($select->getAllRows()); }
/** * @return Gpf_DbEngine_Row_Collection */ protected function getTransactionsCollection() { $selectBuilder = new Gpf_SqlBuilder_SelectBuilder(); $selectBuilder->select->addAll(Pap_Db_Table_Transactions::getInstance()); $selectBuilder->from->add(Pap_Db_Table_Transactions::getName()); $selectBuilder->where->add(Pap_Db_Table_Transactions::SALE_ID,'=',$this->saleId); $recordSet = $selectBuilder->getAllRows(); $transaction = new Pap_Common_Transaction(); return $transaction->loadCollectionFromRecordset($recordSet); }