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

CRM-21524 - Fix merge contacts when one is deceased #11527

Merged
merged 1 commit into from
Jan 25, 2018

Conversation

lemacarl
Copy link
Contributor

@lemacarl lemacarl commented Jan 16, 2018

Overview

When exporting contacts and merge contacts with the same address is selected then contacts with the same address are still merged even though one is deceased.


@civicrm-builder
Copy link

Can one of the admins verify this patch?

@mlutfy
Copy link
Member

mlutfy commented Jan 16, 2018

jenkins, test this please

@seamuslee001
Copy link
Contributor

hi @lemacarl thanks for the patch. Can you please fix the style errors found https://test.civicrm.org/job/CiviCRM-Core-PR/18786/checkstyleResult/new/

@lemacarl
Copy link
Contributor Author

@seamuslee001 Please recheck. I think I've fixed them

@seamuslee001
Copy link
Contributor

Jenkins test this please

@eileenmcnaughton
Copy link
Contributor

There is still one reported - the warning says
ExportTest.php:352
Which is a file you didn't alter :-(

I have hit this before & while I don't recall all I would try rebasing & squashing ie .
git pull --rebase origin master

followed by

git rebase -i origin/master

in the second case you can squash the commits.

use the -f switch to force push to your branch after

@lemacarl
Copy link
Contributor Author

@eileenmcnaughton Thanks! I've done the rebase. Hope it works.

@lemacarl
Copy link
Contributor Author

Jenkins test this please

1 similar comment
@seamuslee001
Copy link
Contributor

Jenkins test this please

@lemacarl
Copy link
Contributor Author

@eileenmcnaughton Looks like the rebase hasn't worked. Please help

@eileenmcnaughton
Copy link
Contributor

At least it's clear the error is in a line you edited now - it seems to be saying there is a space after 'contact_type' => 'Individual', below

    $contactB = $this->callAPISuccess('contact', 'create', array(
      'first_name' => 'Jane',
      'last_name' => 'Doe',
      'contact_type' => 'Individual',   
      'is_deceased' => 1,
    ));

@lemacarl
Copy link
Contributor Author

@eileenmcnaughton Thanks! I've used a tool to remove the trailing white spaces as well as run the modified files through Civilint. Please help me test this

@eileenmcnaughton
Copy link
Contributor

jenkins add to whitelist

@lemacarl
Copy link
Contributor Author

@eileenmcnaughton Is this good to go now?

@eileenmcnaughton
Copy link
Contributor

@lemacarl I took a look at this & agree with your analysis & that the test demonstrates the fix. One thing though - the code you have added


      // if postalMailing option is checked, exclude contacts who are deceased, have
      // "Do not mail" privacy setting, or have no street address
      if (isset($exportParams['postal_mailing_export']['postal_mailing_export']) &&
        $exportParams['postal_mailing_export']['postal_mailing_export'] == 1
      ) {
        self::postalMailingFormat($exportTempTable, $headerRows, $sqlColumns, $exportMode);
      }

Is called a few lines further down - I believe it could be moved rather than duplicated? I believe the point of your change is to remove non-mailable people from the address table BEFORE concantenating the names of people at the same address but we won't need it AFTER as well

Also - any chance you could quash the 2 commits to one?

@lemacarl
Copy link
Contributor Author

@eileenmcnaughton Thanks for spotting that. I've removed the duplicate conditional and squashed the commits into one.

@lemacarl
Copy link
Contributor Author

Jenkins test this please

@eileenmcnaughton
Copy link
Contributor

Looks great - seems like a really solid fix with a test to lock it in. Adding merge on pass

@eileenmcnaughton eileenmcnaughton merged commit 56d3977 into civicrm:master Jan 25, 2018
@mlutfy mlutfy added this to the 4.7.31 milestone Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants