uc_order_handler_filter_total.inc 910 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @file
  4. * Contains uc_order_handler_filter_total.
  5. */
  6. /**
  7. * Filter handler that handles fields generated by table.fieldname * table.qty.
  8. *
  9. * This extends views_handler_filter_group_by_numeric because the field is an
  10. * alias for a formula. WHERE clauses can't use aliases. Extending it this
  11. * way uses a HAVING clause instead, which does work.
  12. *
  13. * This filter handler is appropriate for any numeric formula that ends up
  14. * in the query with an alias like "table_field".
  15. */
  16. class uc_order_handler_filter_total extends views_handler_filter_group_by_numeric {
  17. /**
  18. * Overrides views_handler_filter_group_by_numeric::query().
  19. */
  20. function query() {
  21. $this->ensure_my_table();
  22. $field = $this->table . '_' . $this->field;
  23. $info = $this->operators();
  24. if (!empty($info[$this->operator]['method'])) {
  25. $this->{$info[$this->operator]['method']}($field);
  26. }
  27. }
  28. }