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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Change to RelationshipType API in ver. 4.3 ?
Pages: [1]

Author Topic: Change to RelationshipType API in ver. 4.3 ?  (Read 2757 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Change to RelationshipType API in ver. 4.3 ?
June 14, 2013, 07:49:26 am
I have used the RelationshipType API to create new relationship types without issue in version 4.2.x. But the parameters are being rejected in 4.3.4

My code:
Code: [Select]
civicrm_api("RelationshipType","create", array (version => '3','sequential' =>'1', 'name_b_a' => 'sample 123', 'name_a_b' => 'sample 123 of'  ,
  'contact_type_a' => 'Contact', 'contact_type_b' =>'Contact));
Under 4.2, this creates a relationship type that can be used for any contact type in the system.

when running this code under ver. 4.3, I get the error message:  contact_type_a `Contact` is not valid.

I have tried leaving the parameter blank, and not including the parameter at all.  In those cases, I get the error:
Mandatory key(s) missing from params array: contact_type_a, contact_type_b

Any ideas on what to try next?

Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Change to RelationshipType API in ver. 4.3 ?
June 16, 2013, 07:22:08 pm
Is a relationship between a 'Contact' & a 'Contact' valid?

I took a look at the tests & only see relationships between Individual & Organization, Individual & Individual etc.

I never recall seeing Contact in the relationship type table on any site & suspect it might not be an option in the UI?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Change to RelationshipType API in ver. 4.3 ?
June 17, 2013, 12:02:05 am
I know that at least it used to be an option in the UI, let me check on the latest and greatest...yes 'All contacts' is still an option in the UI. In the database this translates to both fields having a value of null.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Change to RelationshipType API in ver. 4.3 ?
June 17, 2013, 02:22:50 pm
My experience with the UI is the same as Erik's experience:  In version 4.2.x and 4.3.4, if I create a new relationship type in the UI and choose "All Contacts" then a "null" is recorded in the database for the field "contact_type_a" and " contact_type_b"
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Change to RelationshipType API in ver. 4.3 ?
June 19, 2013, 03:26:51 pm
Then I think you should log it as a bug in JIRA
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jaapjansma

  • I post frequently
  • ***
  • Posts: 247
  • Karma: 9
    • CiviCoop
  • CiviCRM version: 4.4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.4
Re: Change to RelationshipType API in ver. 4.3 ?
July 04, 2013, 07:15:23 am
According to the User Interface it is possible to create relationship types between any contact type. Only according to the api the contact type should be set.

I have patched this in the issue tracker

http://issues.civicrm.org/jira/browse/CRM-12885?focusedCommentId=51704&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-51704
Developer at Edeveloper / CiviCoop

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Change to RelationshipType API in ver. 4.3 ?
July 04, 2013, 01:26:14 pm
Thanks for that - once I see the double blue light (https://test.civicrm.org/ - blue on 'CiviCRM-4.3-git' & blue on 'CiviCRM-master-git') I'm happy to pick that one up & work it into core
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jaapjansma

  • I post frequently
  • ***
  • Posts: 247
  • Karma: 9
    • CiviCoop
  • CiviCRM version: 4.4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.4
Re: Change to RelationshipType API in ver. 4.3 ?
July 10, 2013, 04:50:32 am
@Eileen could you pick it up to get this code into the core?  Thanks in advance.

ps. What do you mean by seeing the blue light in the civicrm versions?
Developer at Edeveloper / CiviCoop

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Change to RelationshipType API in ver. 4.3 ?
July 10, 2013, 01:56:42 pm
blue light in jenkins is success, no errors on the tests

These are the tests that need some love before we get the bandwidth to add your work into the core (hint, help more than welcome ;)

https://test.civicrm.org/job/CiviCRM-master-git/LABEL=debian6,SUITE=CRM_AllTests/249/testReport/

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Change to RelationshipType API in ver. 4.3 ?
July 10, 2013, 02:25:16 pm
Yeah - the focus on the blue lights is a personal thing. I found that I was spending over 60 hours (conservatively) each release just fixing tests so I decided that I needed to put some sanity around that & now I simply don't engage with fixing JIRA tickets unless the tests are passing or it has high importance to me or my customers.

(NB I have probably already spent close to 60 hours fixing tests for 4.4 - having got it up to the double blue light 3-4 times in the hope that once there it would stay there)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Change to RelationshipType API in ver. 4.3 ?

This forum was archived on 2017-11-26.