/** * Constructor * @param string $entity * @param integer $entity_id * @param integer $contact_id * @param string $code * @param boolean $is_anonymous - ie are we trying to calculate whether it would be possible to find a discount cod */ function __construct($entity, $entity_id, $contact_id, $code, $is_display_field_mode) { if (empty($code) && empty($contact_id) && !$is_display_field_mode) { $this->discounts = array(); } else { $this->discounts = CRM_CiviDiscount_BAO_Item::getValidDiscounts(); } $this->entity = $entity; $this->contact_id = $contact_id; $this->entity_id = $entity_id; $this->code = trim($code); $this->is_display_field_mode = $is_display_field_mode; }
/** * Returns an array of all discount codes. */ function _cividiscount_get_discounts() { return CRM_CiviDiscount_BAO_Item::getValidDiscounts(); }