Open
Description
User Story
As an admin, I want to set offline donations to Completed in the backend. If I mis-click in the date selector for some reason, I get a Fatal Error and an email is sent to the site administrator
Details
When you set the date of a donation to the future (most likely by accident), the follwing Fatal Error occurs:
Fatal error: Uncaught UnexpectedValueException: Value 'future' is not part of the enum Give\Donations\ValueObjects\DonationStatus in wp-content/plugins/give/vendor/myclabs/php-enum/src/Enum.php on line 50
Expected Behavior
- If you set an invalid (future) date, there should be a validation that prevents that.
- also, the datepicker should just disable future dates so that the user is less likely to make that mistake
- At the very least, no PHP-level error should be thrown.
Steps to Reproduce
- Go to the list of donations in the backend, click on one
- Set donation date to tomorrow
- Click "Save"
- View error
Additional Context
The easiest fix would probably be to add
const FUTURE = 'future';
to the constants here:
givewp/src/Donations/ValueObjects/DonationStatus.php
Lines 33 to 41 in 41a1b43
It does fix the Fatal Error, but I didn't test if it has any side effects
System Information
Details
Acceptance Criteria
- Something happens when an action is taken.
- Something does not happen when an action is taken.
- Fixing behavior in Component A does not affect existing behavior in Component B.