Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-981

Quest Preapplication: Delete Duplicated Organization (School) and Relationship Records

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: None
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      As we discussed, there are extraneous duplicate civicrm_contact, civicrm_organization and civicrm_relationship records representing students' High School and Other School info in the production data (due to bugs in Highschool.php and OtherSchool.php form logic).

      We need a PHP script we can run from command line against a production data set which locates duplicate records based on the following "key"
      civicrm_contact.id (type = Individual) +
      civicrm_relationship (WHERE relationship_type_id = 8 & contact_a_id = individual's contact_id & start and end dates are the same) +
      civicrm_organization.organization_name +
      civicrm_custom_value.char_data (WHERE entity_table=civicrm_contact & entity_id = school's contact_id & custom_field_id = 4)

      From the duplicate record set for a given Student (contact Individual) - delete all dupes except the set with the highest civicrm_relatiionship.id value (which is the last "set" to be inserted).

      NOTE: Script should be able to be run repeatedly against the same data w/o destroying NON-duplicate records.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: