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

Export - small cleanup #12864

Merged
merged 3 commits into from
Oct 9, 2018
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Minor tidy up on export

Before

parameters $saveFile & $batchItems are passed in but never set in calling functions. Export mode passed in

After

unneeded params not passed in. processor object passed in instead of exportMode. This is part of a bigger picture effort to move processing off to that object rather than passing around parameters

Technical Details

getExportFileName appears to be called from 2 places. One is on the file where it always passed no params & gets the same result so this is now hard-coded. The second is moved to the ExportProcessor class, with some handling for the possibility that mode might be invalid - but I think that is never true.

Comments

Follow up on #12586

@@ -749,7 +710,7 @@ public static function exportCustom($customSearchClass, $formValues, $order) {
$rows[] = $row;
}

CRM_Core_Report_Excel::writeCSVFile(self::getExportFileName(), $header, $rows);
CRM_Core_Report_Excel::writeCSVFile(ts('CiviCRM Contact Search'), $header, $rows);
CRM_Utils_System::civiExit();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this change as it duplicates a string - do we need to make this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point is to stop it calling what is essentially an unrelated function for a different export process - ie. to break dumb interdependencies

Copy link
Contributor

Choose a reason for hiding this comment

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

Right. Totally makes sense then :-)

@mattwire
Copy link
Contributor

I've looked through this and made one trivial comment. The code looks good to me, it's cleanup and will make the code easier to maintain. @twomice are you able to run this?

@totten totten added the master label Oct 2, 2018
@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton eileenmcnaughton changed the title Export Export - small cleanup Oct 9, 2018
@homotechsual
Copy link
Contributor

CiviCRM Review Template DEL-1.1)

  • Explain (r-explain)
    • PASS : The goal/problem/solution have been adequately explained in the PR.
  • Test results (r-test)
    • PASS: The test results have failures, but these have been individually inspected and found to be irrelevant.
  • Code quality (r-code)
    • PASS: The functionality, purpose, and style of the code seems clear+sensible.
  • Documentation (r-doc)
    • PASS: The changes do not require documentation.
  • Maintainability (r-maint)
    • PASS: The change sufficiently improves test coverage, or the change is trivial enough that it does not require tests.
  • Run it (r-run)
    • PASS:
      1. Built CiviCRM-demo site - ran export of contacts/memberships and contributions - export works fine.
      2. Rebuilt with PR applied - ran export of contacts/memberships and contributions - export works fine.
  • User impact (r-user)
    • PASS: The change would be intuitive or unnoticeable for a majority of users who work with this feature.
  • Technical impact (r-tech)
    • PASS: The change preserves compatibility with existing callers/code/downstream.

@eileenmcnaughton
Copy link
Contributor Author

what a beautiful PR review :-) - merging

@eileenmcnaughton eileenmcnaughton merged commit c99c50d into civicrm:master Oct 9, 2018
@eileenmcnaughton eileenmcnaughton deleted the export branch October 9, 2018 20:38
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.

4 participants