-
Notifications
You must be signed in to change notification settings - Fork 199
Open
Labels
keep-fresh"Keep Fresh" issues should not be marked as stale."Keep Fresh" issues should not be marked as stale.type: bugExisting functionality is brokenExisting functionality is broken
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
const PENDING = 'pending'; | |
const PROCESSING = 'processing'; | |
const COMPLETE = 'publish'; | |
const REFUNDED = 'refunded'; | |
const FAILED = 'failed'; | |
const CANCELLED = 'cancelled'; | |
const ABANDONED = 'abandoned'; | |
const PREAPPROVAL = 'preapproval'; | |
const REVOKED = 'revoked'; |
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.
Metadata
Metadata
Assignees
Labels
keep-fresh"Keep Fresh" issues should not be marked as stale."Keep Fresh" issues should not be marked as stale.type: bugExisting functionality is brokenExisting functionality is broken