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

Enforce is_primary field at db or dao level

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Currently is_primary is enforced at the form layer, but this is not 100% reliable and doesn't help at all from the API layer, etc.

      Desired behavior:
      1. When creating, updating, or deleting an entity with an is_primary field, ensure that one and only one record of this type per parent object contains is_primary = 1. In the case of deleting the primary, we will just have to pick another at random and assign it as primary.

      2. Find a clever way to automagically attach this behavior to any field in the db named is_primary so we are not creating and maintaining special cases for email, phone, address and any entities added in future.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kurund Kurund Jalmi
                Reporter:
                colemanw Coleman Watts
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: