uc_stock_handler_filter_below_threshold.inc 548 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * @file
  4. * Views handler: Filter on comparison of stock level to threshold.
  5. */
  6. /**
  7. * Filters nodes based on comparison of stock value to stock threshold.
  8. */
  9. class uc_stock_handler_filter_below_threshold extends views_handler_filter_boolean_operator {
  10. /**
  11. * Overrides views_handler_field::query().
  12. */
  13. function query() {
  14. $this->ensure_my_table();
  15. $this->query->add_where_expression($this->options['group'], "$this->table_alias.stock " . (empty($this->value) ? '>=' : '<') . " $this->table_alias.threshold");
  16. }
  17. }