Codes Redeemed panel not showing event name or code used
Created by: MicheleM68
In class CRM_CiviDiscount_Utils, the getEvents function uses the following query:
$query = "SELECT id, title FROM civicrm_event WHERE (is_template = 0 OR is_template IS NULL) AND (start_date > NOW() OR end_date > NOW() OR end_date IS NULL) ";
Changing this to use start_date < NOW() made event names show up in the panel.
static function getUsage in BAO/Track.php uses this:
if ($cid) {
$where .= " WHERE t.contact_id = " . CRM_Utils_Type::escape($cid, 'Integer');
}
Changing this to the following made the discount codes show up:
if ($cid) {
$sql .= ", i.code ";
$where = " LEFT JOIN cividiscount_item AS i ON (i.id = t.item_id) ";
$where .= " WHERE t.contact_id = " . CRM_Utils_Type::escape($cid, 'Integer');
}