dev/core#2816: New contribution can't be saved when validation fails … #21512
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Steps to replicate:
Before
After
Technical Details
Regression is caused in 'New Contribution' backoffice form from 5.40 onward, when civicrm_contribution_product.product_id is set as a foreignkey of civicrm_product.id here. As a result the previously code used to insert product_id = 0 for back office contribution and now it ends up in a DB error due to nonexistent product_id = 0. Rest assured this doesn't break CiviCRM upgrade from 5.40 onward because of this DELETE SQL here which also delete entries with non-existent product_ids.
As per the fix is concern, I am not in support of changing the placeholder
- select -
value to '' from 0, because 0 serves as an indicator on the backoffice contribution edit screen, when one removes the previous product selection.Comments
ping @eileenmcnaughton @seamuslee001 @colemanw