CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Do not allow relationship types (with data in) to be edited?
Pages: [1]

Author Topic: Do not allow relationship types (with data in) to be edited?  (Read 851 times)

John.K

  • I post occasionally
  • **
  • Posts: 75
  • Karma: 5
  • CiviCRM version: 4.x
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5
Do not allow relationship types (with data in) to be edited?
September 11, 2014, 09:33:55 am
I've just come across the situation where we had a relationship:
Label (for both): Affiliation
Contact Type A: Individual
Contact Type B: Organisation

We merrily added some relationships, and build a Drupal View to display them.

Then someone decided to reverse the relationship:
Contact Type A: Organisation
Contact Type B: Individual

We merrily carried on adding relationships.

Now all our data is confused! Some of our relationships have the organisation ID in the 'A' column, the other half in the 'B'.

I propose that once a relationship type has been created, and as long as relationships of that type exist in the database, the 'Contact Type A' and 'Contact Type B' fields should not be editable when editing a relationship type.

I know this could be avoided by setting the fields up correctly in the first place, that's why I'm suggesting this as a usability improvement rather than a bug.

I'm happy to create an issue for this if people think it is worthwhile.

--

Edit: This functionality is in fact implied in this issue https://issues.civicrm.org/jira/browse/CRM-3228, but must have since been changed.
« Last Edit: September 11, 2014, 09:49:45 am by .John »

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Do not allow relationship types (with data in) to be edited?
September 11, 2014, 03:29:19 pm
First - I agree that it wasn't always the case that you could change the contact types for relationship types.  It was as recently as...3.4/4.0?  I forget.

I think the reason it changed was to allow for situations necessitated by contact subtypes.  Consider the situation in which a relationship is created, and then later it's determined that a contact subtype is needed, but that relationship should only apply to folks with a certain contact subtype.  E.g. "contact_a is a funder of contact_b", both of which are Organizations, and later you add a contact subtype of "Funder".  I've also found myself in a similar situation when removing a contact subtype.  That said - you have a point, it's absolutely possible to create relationships that shouldn't exist.

I'm not sure what the absolute best approach to this is.  Perhaps when you try to change the relationship type, CiviCRM should call a function to ensure that there's no conflict with existing data, and only change the relationship type if it's compatible with existing relationships?  I guess my hesitance here is that Civi doesn't provide a way to mass-delete relationships from the GUI, so fixing a legit relationship could be painful!
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Do not allow relationship types (with data in) to be edited?
September 11, 2014, 04:46:32 pm
We definitley have situations where we do make 'tweaks' to the Contact Types but that is usually related to refining rather than wholesale slaughter of poor innocent data - and I agree that reversing, or switching from one Contact Type to another should at least present a Warning
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

John.K

  • I post occasionally
  • **
  • Posts: 75
  • Karma: 5
  • CiviCRM version: 4.x
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5
Re: Do not allow relationship types (with data in) to be edited?
September 12, 2014, 03:25:06 am
A fair point regarding contact sub-types. So in favour of flexibility how about:

If relationships of a certain type already exist, then when editing that relationship type the 'Contact type' inputs are hidden by default and a message says:
'Relationships of this type exist in the database. Changing the contact types now may cause issues in your site. <Edit the contact types> anyway.

Clicking 'Edit the contact types' would show the contact type fields again.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Do not allow relationship types (with data in) to be edited?
September 12, 2014, 01:09:42 pm
i think that is a good suggestion
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

John.K

  • I post occasionally
  • **
  • Posts: 75
  • Karma: 5
  • CiviCRM version: 4.x
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5
Re: Do not allow relationship types (with data in) to be edited?
September 22, 2014, 05:52:04 am
Trivial issue created in JIRA then, thanks folks: https://issues.civicrm.org/jira/browse/CRM-15349

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Do not allow relationship types (with data in) to be edited?

This forum was archived on 2017-11-26.