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

Fix: enable custom donor columns in csv export #7421

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

JoshuaHungDinh
Copy link
Contributor

@JoshuaHungDinh JoshuaHungDinh commented Jun 21, 2024

Resolves: GIVE-923
#7398

Description

This pull request enables the filtering of the donor export csv columns. In the past, users could introduce custom columns via the give_export_donors_get_default_columns filter in the previous Donor export class. This filter was utilized in two methods:

  • Displaying Custom Columns on the Tools Page: One method would display the custom columns on the donor export section of the tools page to be checked.

  • Merging Custom Columns with Export Data: A second method, which incorporated custom columns into the export data.

By reintroducing this functionality in the new Donor export class, users can once again add custom donor information to the csv exports.

Affects

Donor Column Export

Visuals

donor-column-tools donor-csv

Testing Instructions

  • add the relevant filters to insert custom columns & data.
  • export csv and verify that the custom information is printed.

Example:

    add_filter( 'give_export_donors_get_default_columns', static function($columnData) {
        $columnData['test'] = 'test-column';
        return $columnData;
    }); 


   add_filter( 'give_export_get_data_donors', static function($exportData) {
        $exportData[0]['test'] = 'test-data';
        return $exportData;
    });

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@JoshuaHungDinh JoshuaHungDinh marked this pull request as ready for review June 21, 2024 17:22
@JoshuaHungDinh JoshuaHungDinh changed the title Fix: allow donor columns to be filtered Fix: enable filtering of donor columns Jun 21, 2024
@JoshuaHungDinh JoshuaHungDinh changed the title Fix: enable filtering of donor columns Fix: enable custom donor columns in export Jun 24, 2024
@JoshuaHungDinh JoshuaHungDinh changed the title Fix: enable custom donor columns in export Fix: enable custom donor columns in csv export Jun 24, 2024
Copy link
Contributor

@pauloiankoski pauloiankoski left a comment

Choose a reason for hiding this comment

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

Personally, I’m not a big fan of this approach for mainly two reasons:

  1. The new method does nothing other than call a function that could be called directly.
  2. Adding the hook directly to where it’s being applied helps developers easily identify it.

Regarding that, there’s nothing technically wrong, which is why I’m approving this PR.

Copy link
Member

@rickalday rickalday left a comment

Choose a reason for hiding this comment

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

Passed manual QA tests.

@JoshuaHungDinh JoshuaHungDinh merged commit f30da15 into develop Jul 9, 2024
20 checks passed
@JoshuaHungDinh JoshuaHungDinh deleted the fix/export-custom-donor-csv branch July 9, 2024 23:30
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.

3 participants