In order to reduce the clutter on the backend:
- Discount code fields are no longer shown on New Contribution (standalone mode), as discount codes did nothing here anyways.
- For memberships and events, we first check if there are any valid discount codes for that entity type, and only then add the discount code field if there are any. So if you only use CiviDiscount for events, it won't show on memberships and vice versa. Or if you have no valid codes at the moment, nothing will be shown.
In the future, I may look into some AJAX to show/hide the field based on event or membership type selected (though it's a little more involved than it looks because of the filters on event type), and move the field down the form with the payment details, but this is a first step to making it a little less obtrusive.