Skip to content
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

[REF] Add in CiviCRM Status checks to check for inconsistencies betwe… #31538

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seamuslee001
Copy link
Contributor

…en the membership_payment participant_payment and line item tables

Overview

We have "soft" deprecated the civicrm_membership_payment and civicrm_participant_table in favour of the civicrm_line_item table. This aims to add a status check to see if there is data inconsistencies between the two tables at least as far as the _payment tables having records that are not present in the line_item table

Before

No check on consistency

After

Check and an alert if data is not matching

Technical Details

I would be open to closing this if people didn't think it was useful but I think it might be helpful if in a future CiviCRM we stop actually adding records to the _payment tables and or drop them. I have also put these in the extensions so that they would only be shown if the system is using memberships or events. I would also be open to fixing language as needed

ping @JoeMurray @KarinG @eileenmcnaughton @mattwire @artfulrobot

Copy link

civibot bot commented Nov 28, 2024

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Nov 28, 2024
@seamuslee001 seamuslee001 force-pushed the status_check_line_item_payment_tables branch 2 times, most recently from 1030109 to 37302f0 Compare November 28, 2024 23:42
@seamuslee001
Copy link
Contributor Author

also ping @demeritcowboy

$messages[] = new CRM_Utils_Check_Message(
'civi_event_participant_payments_missing',
ts('The Following Participant Payments do not have a corresponding line item record linking the contribution to participant. This should be corrected either by updating the relevant line item record or adding a line item record as appropriate.</p>
<p></p><table><thead><th>Contribution ID</th><th>Participant ID</th></thead><tbody>') . $strings . ts('</tbody></table></p>'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first ts should probably be split up. The very last one doesn't need ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now

@seamuslee001 seamuslee001 force-pushed the status_check_line_item_payment_tables branch from 37302f0 to 6270c97 Compare November 28, 2024 23:57
…en the membership_payment participant_payment and line item tables

Updates As per Dave
@seamuslee001 seamuslee001 force-pushed the status_check_line_item_payment_tables branch from 6270c97 to 8c816d1 Compare November 28, 2024 23:58
@KarinG
Copy link
Contributor

KarinG commented Nov 29, 2024

ts('The Following Membership Payments do not have a corresponding line item record linking the contribution to membership.') . ts('This should be corrected either by updating the relevant line item record or adding a line item record as appropriate.')

You can't do this with CiviCRM Core, right? So should the instructions include to download and install https://civicrm.org/extensions/line-item-editor

@seamuslee001
Copy link
Contributor Author

ts('The Following Membership Payments do not have a corresponding line item record linking the contribution to membership.') . ts('This should be corrected either by updating the relevant line item record or adding a line item record as appropriate.')

You can't do this with CiviCRM Core, right? So should the instructions include to download and install https://civicrm.org/extensions/line-item-editor

I think you could by using the API Explorer right but yes for more of a GUI approach you would need that

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 I would suggest linking to a page on gitlab or docs that is a 'living document' for the instructions

@artfulrobot
Copy link
Contributor

artfulrobot commented Nov 29, 2024

I've come across this in the wild.
I think status checks are the hammer we have that's generating a lot of nail shaped functionality, but I don't think it's the right place.

As it stands:

  • slow: I think you can do them in one SQL query for member and one for participants instead of a one query per entity loop. Maybe you're assuming there's only 1 or 2, but I think that assumption is wrong! Same problem with outputting them all.
  • one way: finds wrong line items but what if there's line items without member-payment records? Perhaps we don't care bc deprecated, but its the same inconsistency and causes similar trouble until m-p completely removed.
  • offers no way to fix. E.g. the UhOh extension includes other low level checks (utf8 collation mixes) and also offers a visualisation for the member/line item/contributed rrcorss. - might be better place.

Status checks:

  • can be slow to load, with no "loading" message (💭 is it broken) and this also makes login slow for the first person to do so in a day.
  • shown to too many people. Only high level admins need to see this. Otherwise peolplr get used to dismissing it without reading, I do this (💭 of course there are extension upgrades!)

I do like the idea of consistency checks but they must go hand in hand with helping fix these problems. Otherwise it makes CiviCRM look scrappy/buggy. IMO.

@demeritcowboy
Copy link
Contributor

I had similar thoughts to @artfulrobot where I wasn't sure where this belongs. And if it throws up a screen full of records but everything is still working then people will ignore it if they can't press a button to fix it. The price fields check currently has that problem.

$messages[] = new CRM_Utils_Check_Message(
'civi_event_participant_payments_missing',
ts('The Following Participant Payments do not have a corresponding line item record linking the contribution to participant.') . ts('This should be corrected either by updating the relevant line item record or adding a line item record as appropriate.') . '</p>
<p></p><table><thead><th>Contribution ID</th><th>Participant ID</th></thead><tbody>' . $strings . '</tbody></table></p>',
Copy link
Contributor

@demeritcowboy demeritcowboy Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I wasn't clear what I meant. The paragraph of text should be together (the translator won't know what the word "this" means otherwise, and these sentences aren't going to be re-used elsewhere), and then the table should be separate except the column headers ts'd.

'<p>' . ts('The Following Participant Payments do not have a corresponding line item record linking the contribution to participant. This should be corrected either by updating the relevant line item record or adding a line item record as appropriate.')
 . '</p><p><table><thead><th>' . ts('Contribution ID') . '</th><th>' . ts('Participant ID') . '</th></thead><tbody>' . $strings  . '</tbody></table></p>',

Also there's some mismatched p's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants