Example #1
0
 public static function factoryAll()
 {
     $db = Database::instantiate(Database::TYPE_READ);
     $tempArray = array();
     $query = SettingFactory::SELECTLIST . "\n\t\t\t\t\t\t\tFROM  pesapi_setting ";
     if ($result = $db->query($query)) {
         while ($foo = $db->fetchObject($result)) {
             $tempArray[] = new Setting($foo->id, $foo);
         }
         $db->freeResult($result);
     }
     return $tempArray;
 }
Example #2
0
 static function factoryAll()
 {
     $db = Database::instantiate(Database::TYPE_READ);
     $query = AccountFactory::SELECTLIST . "\n\t\t\t\t\t\t\tFROM  pesapi_account ";
     $tempArray = array();
     if ($result = $db->query($query)) {
         while ($foo = $db->fetchObject($result)) {
             $tempArray[] = AccountFactory::createEntry($foo->type, $foo->id, $foo);
         }
         $db->freeResult($result);
     }
     return $tempArray;
 }
Example #3
0
 protected function generateUpdateQuery()
 {
     $db = Database::instantiate(Database::TYPE_READ);
     $query = "";
     if ($this->typeUpdated) {
         $query .= " ,type='{$this->type}' ";
         $this->typeUpdated = false;
     }
     if ($this->nameUpdated) {
         $query .= " ,name='" . $db->dbIn($this->name) . "' ";
         $this->nameUpdated = false;
     }
     if ($this->identifierUpdated) {
         $query .= " ,identifier='" . $db->dbIn($this->identifier) . "' ";
         $this->identifierUpdated = false;
     }
     if ($this->pushInUpdated) {
         $query .= " ,push_in=" . ($this->pushIn ? 1 : 0);
         $this->pushInUpdated = false;
     }
     if ($this->pushOutUpdated) {
         $query .= " ,push_out=" . ($this->pushOut ? 1 : 0);
         $this->pushOutUpdated = false;
     }
     if ($this->pushNeutralUpdated) {
         $query .= " ,push_neutral=" . ($this->pushNeutral ? 1 : 0);
         $this->pushNeutralUpdated = false;
     }
     if ($this->settingsUpdated) {
         $query .= " ,settings='" . $db->dbIn(serialize($this->settings)) . "' ";
         $this->settingsUpdated = false;
     }
     return $query;
 }
 static function factoryByTimeInterval($account, $from, $until, $type)
 {
     $from = (int) $from;
     $until = (int) $until;
     $type = (int) $type;
     $tempArray = array();
     if (is_object($account) and $from > 0 and $until > 0) {
         $db = Database::instantiate(Database::TYPE_READ);
         $query = TransactionFactory::SELECTLIST . "\n\t\t\t\t\t\t\tFROM  pesapi_payment\n              WHERE time >= FROM_UNIXTIME('{$from}')\n              AND   account_id = '" . $account->getId() . "'\n              AND   time <= FROM_UNIXTIME('{$until}') ";
         if ($type > 0) {
             $query .= " AND type = '{$type}' ";
         }
         $query .= " ORDER BY time DESC ";
         if ($result = $db->query($query)) {
             while ($foo = $db->fetchObject($result)) {
                 $tempArray[] = $account->initTransaction($foo->id, $foo);
             }
             $db->freeResult($result);
         }
     }
     return $tempArray;
 }
Example #5
0
 protected function generateUpdateQuery()
 {
     $db = Database::instantiate(Database::TYPE_READ);
     $query = "";
     if ($this->typeUpdated) {
         $query .= " ,type='{$this->type}' ";
         $this->typeUpdated = false;
     }
     if ($this->nameUpdated) {
         $query .= " ,name='" . $db->dbIn($this->name) . "' ";
         $this->nameUpdated = false;
     }
     if ($this->identifierUpdated) {
         $query .= " ,identifier='" . $db->dbIn($this->identifier) . "' ";
         $this->identifierUpdated = false;
     }
     return $query;
 }
Example #6
0
 protected function generateUpdateQuery()
 {
     $db = Database::instantiate(Database::TYPE_READ);
     $query = "";
     if ($this->typeUpdated) {
         $query .= " ,type='{$this->type}' ";
         $this->typeUpdated = false;
     }
     if ($this->superTypeUpdated) {
         $query .= " ,super_type='{$this->superType}' ";
         $this->superTypeUpdated = false;
     }
     if ($this->receiptUpdated) {
         $query .= " ,receipt='{$this->receipt}' ";
         $this->receiptUpdated = false;
     }
     if ($this->timeUpdated) {
         $query .= " ,time=FROM_UNIXTIME('{$this->time}') ";
         $this->timeUpdated = false;
     }
     if ($this->phonenumberUpdated) {
         $query .= " ,phonenumber='{$this->phonenumber}' ";
         $this->phonenumberUpdated = false;
     }
     if ($this->nameUpdated) {
         $query .= " ,name='" . $db->dbIn($this->name) . "' ";
         $this->nameUpdated = false;
     }
     if ($this->accountUpdated) {
         $query .= " ,account='" . $db->dbIn($this->account) . "' ";
         $this->accountUpdated = false;
     }
     if ($this->statusUpdated) {
         $query .= " ,status='" . (string) $this->status . "' ";
         $this->statusUpdated = false;
     }
     if ($this->amountUpdated) {
         $query .= " ,amount='{$this->amount}' ";
         $this->amountUpdated = false;
     }
     if ($this->postBalanceUpdated) {
         $query .= " ,post_balance='{$this->postBalance}' ";
         $this->postBalanceUpdated = false;
     }
     if ($this->noteUpdated) {
         $query .= " ,note='" . $db->dbIn($this->note) . "' ";
         $this->noteUpdated = false;
     }
     if ($this->transactionCostUpdated) {
         $query .= " ,transaction_cost='{$this->transactionCost}' ";
         $this->transactionCostUpdated = false;
     }
     return $query;
 }
Example #7
0
 protected function generateUpdateQuery()
 {
     $db = Database::instantiate(Database::TYPE_READ);
     $query = "";
     if ($this->typeUpdated) {
         $query .= " ,type='{$this->type}' ";
         $this->typeUpdated = false;
     }
     if ($this->nameUpdated) {
         $query .= " ,name='" . $db->dbIn($this->name) . "' ";
         $this->nameUpdated = false;
     }
     if ($this->valueStringUpdated) {
         $query .= " ,value_string='" . $db->dbIn($this->valueString) . "' ";
         $this->valueStringUpdated = false;
     }
     if ($this->valueDateUpdated) {
         $query .= " ,value_date=FROM_UNIXTIME('{$this->valueDate}') ";
         $this->valueDateUpdated = false;
     }
     if ($this->valueIntUpdated) {
         $query .= " ,value_int='" . (string) $this->valueInt . "' ";
         $this->valueIntUpdated = false;
     }
     return $query;
 }