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 (Moderator: Dave Greenberg) »
  • CiviCRM automatic relationship creation
Pages: [1]

Author Topic: CiviCRM automatic relationship creation  (Read 1488 times)

Matthias de MAUROY - CYIM

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 4
  • Working at CYIM
    • CYIM
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: 5.1.66-community-log
  • PHP version: 5.3
CiviCRM automatic relationship creation
July 30, 2013, 07:36:42 am
Hi !

I'm trying to create an extension which should give the possibility to specify a relationship for a membership type.

That way it should be possible to activate a relationship on contact creation like this :
  • new individual with junior membership type => relationship member of ...
or
  • new individual with senior membership type => relationship special member of ...

I think that creating an API could be useful but even before being able to display what I get, my DAO gives me nothing in return when using execute_query().

From what I see, the problem comes from the schema structure table which doesn't contain my table.

First of all, am I right to think that creating an API is usefull and secondly, can anyone help me and tell me which files need to be modified to make it work properly ?

By the way the table I want to add contains just 3 column : id, membership_id, relationship_id. Works just like the _UF_ tables

thank's folks !
Matthias de MAUROY
Analyste Web Developpeur
BU WEB
Tél. : +33 (0)2 99 22 83 40
Fax : +33 (0)2 99 22 83 41
Mail : m.mauroy@cyim.com
CYIM
31, rue de la Frébardière
35135 CHANTEPIE
FRANCE

Matthias de MAUROY - CYIM

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 4
  • Working at CYIM
    • CYIM
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: 5.1.66-community-log
  • PHP version: 5.3
Re: CiviCRM automatic relationship creation
July 30, 2013, 08:31:36 am
I just added an Upgrader based on this : http://wiki.civicrm.org/confluence/display/CRMDOC42/Create+a+Module+Extension#CreateaModuleExtension-Addadatabaseupgrader

Is it enough to make the API works with my new table ?
Matthias de MAUROY
Analyste Web Developpeur
BU WEB
Tél. : +33 (0)2 99 22 83 40
Fax : +33 (0)2 99 22 83 41
Mail : m.mauroy@cyim.com
CYIM
31, rue de la Frébardière
35135 CHANTEPIE
FRANCE

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviCRM automatic relationship creation
July 30, 2013, 08:42:59 am
Hi,

On 4.3, it needs some hacking to add an api on a new extension and use the generic basis functions.

Have you considered using custom fields rather than a specific custom entity?

Otherwise, not sure I understand the aim of your extension, what's the benefit of a relationship over a membership?

If you start having a lot of members, you'll end up having a lot of relationships, but the interface might not deal too well with that case (eg. the relationship tab doesn't have pagination I think)

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

Matthias de MAUROY - CYIM

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 4
  • Working at CYIM
    • CYIM
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: 5.1.66-community-log
  • PHP version: 5.3
Re: CiviCRM automatic relationship creation
July 30, 2013, 08:49:15 am
We work essentially with health organisations, so we need to create for each member a relation to the correct organisation.

It can be made by hand, but what we were asked is this : Create a relationship when a non member pays his contribution and becomes a member.

That is why I think a _UF_ table is better than a custom data.
Matthias de MAUROY
Analyste Web Developpeur
BU WEB
Tél. : +33 (0)2 99 22 83 40
Fax : +33 (0)2 99 22 83 41
Mail : m.mauroy@cyim.com
CYIM
31, rue de la Frébardière
35135 CHANTEPIE
FRANCE

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviCRM automatic relationship creation
July 30, 2013, 02:49:25 pm
Quote from: Matthias de MAUROY - CYIM on July 30, 2013, 08:49:15 am
We work essentially with health organisations, so we need to create for each member a relation to the correct organisation.

But isn't a membership to the correct organisation already good enough to capture that relation?

Quote
It can be made by hand, but what we were asked is this : Create a relationship when a non member pays his contribution and becomes a member.

That is why I think a _UF_ table is better than a custom data.

You lost me: What is this _UF_ table thing is this your custom entity?

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

Matthias de MAUROY - CYIM

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 4
  • Working at CYIM
    • CYIM
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • MySQL version: 5.1.66-community-log
  • PHP version: 5.3
Re: CiviCRM automatic relationship creation
July 31, 2013, 12:13:01 am
Sorry  ;D

The membership alone isn't enough because a membership can have many relationships, such as :
  • membership : Senior => relationship : president of
  • membership : Senior => relationship : member of
  • membership : Senior => relationship : honor member of
    • The UF table I'm talking about makes reference to these tables :
      • civicrm_uf_match
      • civicrm_uf_join
      • etc

      This is why I thought building an API could be nice. But if it's too much work or too complicated I'll just use my DAO & BAO and work with that.
Matthias de MAUROY
Analyste Web Developpeur
BU WEB
Tél. : +33 (0)2 99 22 83 40
Fax : +33 (0)2 99 22 83 41
Mail : m.mauroy@cyim.com
CYIM
31, rue de la Frébardière
35135 CHANTEPIE
FRANCE

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • CiviCRM automatic relationship creation

This forum was archived on 2017-11-26.