You are here

function pay_handler_field_amount::query in Pay 7

Same name and namespace in other branches
  1. 6 includes/views/pay_handler_field_amount.inc \pay_handler_field_amount::query()

Called to add the field to a query.

Overrides views_handler_field::query

File

includes/views/pay_handler_field_amount.inc, line 4

Class

pay_handler_field_amount

Code

function query() {
  $this
    ->ensure_my_table();

  // Construct a new join so we can add the field.
  $join = new views_join();
  $join
    ->construct('pay_transaction', 'pay_form', 'pfid', 'pfid');
  $pay_transaction_table = $this->query
    ->ensure_table('pay_transaction', $this->table_alias, $join);
  $sum = 'SUM(' . $pay_transaction_table . '.' . $this->real_field . ')';
  $field_alias = $this->query
    ->add_field('', $sum, $this->real_field . '_amount');
  $this->field_alias = $field = $field_alias;
  $this
    ->add_additional_fields();
}