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

CIWEMB-389: Reword the frequency column for payment scheme recurring contributions #492

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

omarabuhussein
Copy link
Member

@omarabuhussein omarabuhussein commented Aug 8, 2023

Before

In this previous PR: #473 I improved the recurring contribution view page for recurring contributions that uses payment schemes, so they no longer show unnecessary information such as the "Frequency" and the "Cycle Day", though on the recurring contribution tab the "Frequency" tab still shows the frequency information for such recurring contributions.

2023-08-08 19_02_21-gfsfd dfssd _ compuclient22sspv3

After

For any recurring contribution linked to a payment scheme, I now replace the frequency information with the following: ~ Payment Scheme ~ to indicate that this recurring contribution uses a payment scheme.

2023-08-08 18_49_33-gfsfd dfssd _ compuclient22sspv3

2023-08-08 18_51_28-fdfdsfds fdsfsd _ compuclient22sspv3

2023-08-08 18_51_51-fdfdsfds fdsfsd _ compuclient22sspv3

Technical Details

The recurring contribution tab is part of the contribution tab and loads with it, so I:
1- Implemented the pageRun hook on the contribution tab.
2 - And from the existing template variables I fetch the contact's active and inactive recurring contributions (Civi core stores each in one variable).
3 - And then with a single API call for each I fetch the payment scheme id for these recurring contributions (in case there is any) and store them in new template variable.
4 - Then I use the CiviCRM .extra.tpl feature to append new template to the contribution tab, this template contains JS code that reads the values from step 3, and then goes through each frequency column (I can tell that by looking if the column contains the word "Every" which is hardcoded inside the recurring contribution tab template in Civi core) , and then I check if that frequency column belongs to a recurring contribution that is linked to a payment scheme, and if so I replace the value of this column with ~ Payment Scheme ~.

  • Hence that I fetch the payment scheme ids for the recurring contributions in the same order CiviCRM core shows them in the recurring contribution tab, so there is no need to index the payment scheme ids by their recurring contribution ids and then check for the id in the JS code.

@omarabuhussein omarabuhussein merged commit ca03279 into CIWEMB-84-workstream Aug 9, 2023
2 checks passed
@omarabuhussein omarabuhussein deleted the CIWEMB-389-hide-freq-for-ps branch August 9, 2023 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants