CRM-17339 Error when importing contributions matched on email

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.8
    • Fix Version/s: 4.6.10
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Importing contributions matching the primary donor (not soft credit) on name and email, gets the following error:

      Empty Contact and External ID. Row was skipped.

        Attachments

          Activity

          [CRM-17339] Error when importing contributions matched on email
          Naomi Rosenberg added a comment -

          Not sure if this is a duplicate of CRM-17163, but I tried applying the patch from that pull request associated with that issue and I still got the error. In fact I wonder if the PR is mislabelled, as it does not look like it relates to finding contacts by email

          Naomi Rosenberg added a comment -

          I've attached a patch, using the same rationale as the one I submitted for CRM-17333

          Naomi Rosenberg added a comment -

          If both patches are accepted I should probably factor out a function as they are very similar

          Naomi Rosenberg added a comment -

          Attached now, sorry

          Monish Deb added a comment - - edited

          Submitted the PR https://github.com/civicrm/civicrm-core/pull/6901

          Naomi Rosenberg we don't import contribution on contact name as the reason why for hard-contributor we got Internal Contact ID, Email and External Identifier option to choose and match while mapping. So the current PR handles only primary-email which was missing and return desired errors if invalid email/more then one contact found. Please verify my fix if it works for you?

          Thanks

          Naomi Rosenberg added a comment -

          Hi Monish,

          Thanks for looking at this.

          I applied the PR diff and I'm afraid it still doesn't work. I'm now getting the same error as I was getting for soft credits in CRM-17333 - "Invalid email address(doesn't exist) <email>. Row was skipped"

          Also, I am surprised that you don't think users should be able to look up on name as well as email. The import GUI allows this, and it is very useful because names help to distinguish between multiple contacts with the same email.

          Naomi Rosenberg added a comment -

          I have done some more investigation. I've discovered that is does not matter what you set $params['contribution_contact_id'] to because it is not returned from the function!

          The matching is actually done in the CRM/Contribution/Import/Parser/Contribution.php. It tries to match on what it can, and it manages well with a combination of first name, last name and email.

          So I have attached another patch, which simply lets through data without a contact or external id. This way the code that actually does the matching can decide if there is enough information there or not. If not, it has its own error system anyway.

          Monish Deb added a comment - - edited

          Naomi Rosenberg Apologies for late reply. First of all the reason why I am saying that other than 'Contact' Import, we don't have option to match contact(individual/househod/org.) on name basis from GUI, like here http://snag.gy/snXDA.jpg (screenshot for Contribution Import) as you can see there is only three option provided (under mapping fields) to match contact (Email, Internal Contact ID and/or External ID).

          Also using api, as per match_contact.patch we are only throwing error if there is a duplicate contact with matching params on Contribution import, otherwise it will pass which is wrong in certain scenarios that I have highlighted in my PR https://github.com/civicrm/civicrm-core/pull/6901 which includes -
          1) provided Contact ID or External ID don't exist
          2) provided email is wrong or there are multiple contacts with same email as primary
          (These validations can't be caught via Contact.get.api)
          And in this way user will get a clear picture what actually went wrong for which that particular row was skipped while Contribution import. Am I missing something ?

          Naomi Rosenberg added a comment -

          Hi Monish
          See my comment above; I no longer think import_contact.patch is correct and I've added another patch.
          I'n confused by your screenshot. I'm running 4.6.8 and that list definitely contains first and last name - I use them all the time.
          Cheers
          Naomi

          Monish Deb added a comment -

          If you are using 'Contact Import' then surely you will have name options under mapping fields but not in other kind of entity Imports e.g. 'Contribution Import' . So I am applying allow_missing_external_and_contact_ids.patch on top of my PR changes https://github.com/civicrm/civicrm-core/pull/6901 and it will cover both our points

          Monish Deb added a comment - - edited

          Updated https://github.com/civicrm/civicrm-core/pull/6901 with allow_missing_external_and_contact_ids.patch

          Jitendra Purohit added a comment -

          Checked the PR, works fine.

            People

            • Assignee:
              Jitendra Purohit
              Reporter:
              Naomi Rosenberg

              Dates

              • Created:
                Updated:
                Resolved: