getValidDiscounts SELECT SQL doesn't include expire_on and active_on in the WHERE clause
Created by: elkram
Hopefully someone more familiar with the code can confirm.
In getValidDiscounts, the SQL WHERE clause, only looks at the manual check box 'is_active' and the 'count_use'. The activation and expiration are handled elsewhere for some reason.
release: 3.1 in: /CRM/CiviDiscount/BAO/Item.php
@ line: 168
WHERE is_active = 1
AND (count_max = 0 OR count_max > count_use)
should probably be:
WHERE is_active = 1
AND active_on <= NOW()
AND expire_on > NOW()
AND (count_max = 0 OR count_max > count_use)