-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#735 Do not include product in search results if site has none #13638
Conversation
(Standard links)
|
c3613e8
to
761f381
Compare
@colemanw wanna check this? passing now |
\Civi::$statics[__CLASS__]['has_products'] = (bool) CRM_Core_DAO::singleValueQuery('SELECT id FROM civicrm_contribution_product LIMIT 1'); | ||
} | ||
return \Civi::$statics[__CLASS__]['has_products']; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out on the demo site by going to Search -> Find Contributions and found a couple issues:
- After clicking "Search" (with no criteria) I found no Premium column in the results even though a premium exists in the system (Coffee Mug).
- I tried the search again selecting 1 search criteria: Premium = Coffee Mug. This caused an error:
Notice: Undefined index: contribution_product_id in CRM_Contribute_BAO_Query::whereClauseSingle() (line 464 of /home/jenkins/bknix-dfl/build/core-13638-6jcaq/sites/all/modules/civicrm/CRM/Contribute/BAO/Query.php).
@colemanw I agree the enotice needs fixing but note that I used |
761f381
to
c8dd630
Compare
so I updated it so not show the premium field if the kitty is sad - I can update the criteria to a different table if you think it would be better - I figured it will never return results unless contribution_product has rows regardless |
test this please |
That makes sense. |
test this please |
@colemanw does 'approved' == merge on pass? |
Approval + cat pic = merge on pass |
@colemanw ah now I know :-) |
Overview
Suppress products from contribution queries where no products exist on the site.
This is mostly for performance but it does get rid of the 'Premium' column for sites that don't use it. Many people WOULD like to replace it but they have varied alternatives so hooks / future funded leap into configurability are the best place fotr that.
Before
After
No change if someone has purchase a product off the site & there is a db record of it - otherwise
Technical Details
@colemanw this turned out to be surprisingly easy due to earlier cleanup by @monishdeb & myself. Am expecting some test fails but I'll update the tests at that point
Comments
https://lab.civicrm.org/dev/core/issues/735