You are here

function UserpointsTransaction::__construct in User Points 7.2

Start a new transaction or update an existing one.

Parameters

$txn_id: Transaction id if an existing transaction should be loaded.

Overrides Entity::__construct

File

./userpoints.transaction.inc, line 110
Contains the UserpointsTransaction and related classes.

Class

UserpointsTransaction
A Userpoints transaction.

Code

function __construct($values = array()) {
  parent::__construct($values, 'userpoints_transaction');

  // Apply default status.
  if ($this->status === NULL) {
    $this->status = variable_get('userpoints_points_moderation', UserpointsTransaction::STATUS_APPROVED);
  }
  else {
    $this->orig_status = $this
      ->getStatus();
  }
  if ($this->tid === NULL) {
    $this->tid = userpoints_get_default_tid();
  }
  if ($this->expirydate === NULL) {
    $this->expirydate = userpoints_get_default_expiry_date();
  }
  if ($this->time_stamp === NULL) {
    $this->time_stamp = REQUEST_TIME;
  }
}