CRM-10152 Contact API v3: Return duplicate IDs in Create

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.1.1, 4.1.2
    • Fix Version/s: 4.3.0
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      In v2 of the API, we used to receive the Contact IDs of any duplicate found. Attached is a patch of api/v3/Contact.php to do the same in v3 of the API. See here for discussion: http://forum.civicrm.org/index.php/topic,24492.0.html

        Attachments

          Activity

          [CRM-10152] Contact API v3: Return duplicate IDs in Create
          Donald A. Lobo added a comment -


          I think u made some changes to this and hence assigning to you. Can you please ensure that we dont break import with these changes and/or fix import as needed

          Eileen McNaughton added a comment -

          Import doesn't use the API (It did share some functions with it but these should all have been divorced from the api functions now to prevent api changes affecting the import).

          I think we are going to look @ error codes in 4.3 - so unless you have time to write a test (that uses the api -ie. civicrm_api() - not calling the function directly) I'm going to push this to 4.3

          Eileen McNaughton added a comment -

          NB- I am pretty sure this aspect of the code has never worked in api v3 - as the calling v3 function doesn't pass in the relevant param!

          Eileen McNaughton added a comment -

          Hi Xavier - can see on orig forum you told the guy to assign to you

          This was an api v2 feature - not sure if it belongs in v3 or not - you decide - I think it was there to support import.

          But there is no unit test with it

          xavier dutoit added a comment -

          Hi,

          so on 4.3, the function throw errors, that's good.

          Don't think there is yet the option to give extra params to the exception, investigating it

          @Paul B: when you make a patch, can you do it from the root of your civicrm install? It's easier for the readers to be sure which file(s) you patched.

          xavier dutoit added a comment -

          @PaulB, can you confirm it works for you?

          + throw new API_Exception("Found matching contacts: ". implode(',',$ids),"duplicate",array("ids"=>$ids));

          test on is_error=1 && error_code="duplicate" ids contains the ids you could use it to get the duplicate details...

          X+

          xavier dutoit added a comment -

          with correct version 4.3

            People

            • Assignee:
              xavier dutoit
              Reporter:
              Paul B

              Dates

              • Created:
                Updated:
                Resolved: