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

Copy Profile should assign a new 'name' value when inserting the new row in uf_group table. Newly created profiles should have ID appended to generated name value.

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.2, 3.4.3, 3.4.4, 3.4.5
    • Fix Version/s: 4.1.0
    • Component/s: CiviCRM Profile
    • Labels:
      None

      Description

      Currently when a profile is copied, a new title is assigned ('Copy of $ufGroupTitle'), but the copied record is inserted with the same name as the original. This can cause "already exists" errors when editing profile settings.

      Fix is to assign a new unique name value whenever creating a new profile AND whenever inserting a copy using the existing munge (with max length 60) PLUS the uf_group.id:

      $name = CRM_Utils_String::munge( $title, '_', 60 );
      $name = $name . '_' . $ufId

      EXAMPLE: Name and Address profile w/ uf_group.id = 1, title = 'name_and_address_1'

      Reuse or centralize existing code which does this for custom fields.

      ---- Original Post --------
      Originally filed in the forum: http://forum.civicrm.org/index.php?topic=21033.new;topicseen#new

      Have seen this error in 3.4.2 thru 3.4.5. I get "Profile already exists in Database" error when I try to change something on an existing profile.

      When I browse the UF_Group table I see that there are 3 rows that contain the same name. I think this is happening when I copy an existing profile. Instead of assigning the profile the new name, it's using the name of the copied profile for the name value.

      To fix it for now, I had to manually edit the name in the uf_group table.

        Attachments

          Activity

            People

            • Assignee:
              ashwini Ashwini Poharkar
              Reporter:
              annaleevk Annalee Van Kleeck
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: