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) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Deduping rules
Pages: [1]

Author Topic: Deduping rules  (Read 919 times)

rebootl

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5
  • MySQL version: ?
  • PHP version: ?
Deduping rules
March 26, 2014, 09:06:45 am
Hello

We use a registration form that works ok. It creates a Joomla account.
This one has the fields User name, E-Mail and Password.

Now we have two supplementary forms that are used to register as "Supporter" or "Vendor".
In Joomla we use groups and CiviCRM Group Sync to sync them.

However I've got a problem with the Contact management in CiviCRM. I found that by default it uses the E-Mail to identify and merge duplicate contact. But we want to give the possibility to enter a different E-Mail address for the "Supporter/Vendor".
If I do that in the form the contacts are not recognized/merged as the same.

I didn't found a way to use e.g. The Joomla User name in the dedupe rules. That should be possible, not ?
Or is there another way to achieve this ?

Please tell if you need additional informations.

Thanks, I'll be back tomorrow morning CET.
Regards

Edit: Sorry for not providing better information, I'm a complete noob w/ this and was in a rush  :-\.
« Last Edit: March 26, 2014, 10:36:21 am by rebootl »

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Deduping rules
April 08, 2014, 03:42:10 am
I don't know a lot about Joomla, but some questions come to mind.

Do people have to be logged in to fill in the "supplementary forms" and exactly what are these supplementary forms? Are they web pages that only logged in users can see that contain civicrm profiles ( I am assuming "yes" )

Have you renamed/created two location types, Vendor and Supporter?

Does each profile contain the appropriate email location type?



rebootl

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5
  • MySQL version: ?
  • PHP version: ?
Re: Deduping rules
April 09, 2014, 02:57:10 pm
Ah, thanks a lot for your reply. As mentioned on the other thread I had to do something about this and wrote a custom hook that solves the problem. However it's a pretty hacky solution and I'm willing to give it another try cause I feel that there might be a better/native way to do this. I even had the replace the default email form field by a custom field to get it working, despite the settings for primary aso. were correct.

As for your questions.
Quote
Do people have to be logged in to fill in the "supplementary forms" and exactly what are these supplementary forms? Are they web pages that only logged in users can see that contain civicrm profiles ( I am assuming "yes" )
Yes exactly. The user registers once and can then log-in. Then two additional links to the websites containing the two profiles appear. These can then be filled if wanted. Here amongst other information an additional email address can be entered. The appearance is controlled by Joomla using groups.

Quote
Have you renamed/created two location types, Vendor and Supporter?
I'm not sure I understand what location types are. As mentioned we simply have two separate custom profiles. Is it what I can choose under "Visibility" in the profile edit? Would you mind explaining where to create these. I'll need to check tomorrow...
Same for email location type.

Thanks for your time.

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Deduping rules
April 09, 2014, 05:42:00 pm
I am not sure that your workflow is set up properly.  In Drupal a logged in user will not create a new account by filling in a profile, they will just modify their own existing account.  I don't know much about Joomla though so I can't be certain that you are doing something wrong.

I can help with location types though.

In CiviCRM you can store more than one address, email address, phone number etc. for each person. These are differentiated by location type, so on a standard install there are location types of home, work, billing etc.  You can find the list of location types for your install at Administer > Customize Data and Screens > Dropdown Options > Location Types.

 The Billing location is reserved as it is used by integrated payment processors, but you can alter the name of any of the other location types or create two new ones called Vendor and Supporter.  (I realise these are not "locations" but they are "types".)

When a person first registers I presume "somehow" (as I said, don't know much about Joomla! ) a linked CiviCRM contact record is created for them.  Probably (as you don't seem to know about location types) the email address they have entered is stored with location type = billing .  You can confirm that by looking at the CiviCRm contact record created for a new Joomla user. (Billing is the default primary location type)

Go to the profile you have created to collect vendor information and edit the email field.  To the right of the field selection box you will see a box that possible contains primary or billing.  This is where you set the location type for the email address this profile collects.  You will need to set it to Vendor. 

Repeat same for the Supporter profile setting location type to Supporter.

rebootl

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5
  • MySQL version: ?
  • PHP version: ?
Re: Deduping rules
April 14, 2014, 03:06:38 am
Hello, thanks for your explanation.

Quote
I am not sure that your workflow is set up properly.
It may well be that this is not the case... someone else started this project.

Quote
In Drupal a logged in user will not create a new account by filling in a profile, they will just modify their own existing account.
Yes that's how I'd imagine it to be too.

Quote
When a person first registers I presume "somehow" (as I said, don't know much about Joomla! ) a linked CiviCRM contact record is created for them.  Probably (as you don't seem to know about location types) the email address they have entered is stored with location type = billing .  You can confirm that by looking at the CiviCRm contact record created for a new Joomla user. (Billing is the default primary location type)
I noticed that actually the first registration is already using a CiviCRM profile.
Thinking that this might be the wrong way I replaced it by a default Joomla registration. But then the CiviCRM group sync does not create a respective contact... (I'll report that to the dev.)

Now, I checked for the location types:
In the first registration profile the E-Mail type is set to Primary (not Billing as it appears below).
When viewing a (CiviCRM) contact that get's created by this, it's then "Kontaktperson" (contact person in german, another type I assume it was created) w/ a radio selector where Primary is selected...
This all comes quiet messy to me...

In the second registration as Supporter the E-Mail type was set to "Kontaktperson" too. To avoid a possible conflict I created a new contact type "Supporter" and set it to this. But the result was the same. Contacts not merging.
(Maybe I'll check once more tomorrow what this one is when viewing.)

This is the hook I wrote to solve the issue:
Comments welcome!
Code: [Select]
<?php
/* CiviCRM custom hook

1) Automatically set main E-Mail address in formular field
Profiles --> Supporter

This should enable CiviCRM to find the matching contact.

Docs
====

        "your hooks will be implemented by calling the hook
        function prefaced by "joomla_". For example, you would
        call the buildForm hook (used to modify form rendering
        and functionality) by adding the following function to
        your hook file:

        function joomla_civicrm_buildForm( $formName, &$form ) {
            //your custom code
        }"
- http://book.civicrm.org/developer/current/techniques/hooks/

hook_civicrm_buildForm

        "This hook should also be used to set the default values
        of a form element"
- http://wiki.civicrm.org/confluence/display/CRMDOC41/CiviCRM+hook+$

*/

// 1)
function joomla_civicrm_buildForm( $formName, &$form ) {

        
// checking for the correct form
        // returning immediately when no match
        // (the better the form matches the longer it will
        // take to return)
        
if ($formName != 'CRM_Profile_Form_Edit') {
                return;
        }

        
// check for the correct _gid (identifies the form!)
        // "Supporter" has the ID 30
        // "Händler" has the ID 23
        
$form_id = $form->getVar( '_gid' );
        
print_r($form_id);
        if ( 
$form_id != 30 and $form_id != 23 ) {
                return;
        }

        
// check for the appropriate action
        /*print_r( $form->getAction() );
        if ($form->getAction() != CRM_Core_Action::ADD) {
                return;
        }*/
        // doesn't work for "Händler", need to test more...

        // get the e-mail address of the logged in user
        // (get it from Joomla)
        
$user = JFactory::getUser();
        
$email_address = $user->email;
        
//echo $email_address;

        // write the e-mail address into the form
        
$defaults['email-Primary'] = $email_address;
        
$form->setDefaults($defaults);

        
// this can be used to print the entire form array
        // (useful to find the correct field names)
        //print_r($form);

        // (print the form name)
        
echo $formName;

        
// testing/debug
        // (reference from the docs)
        //$myPid = CRM_Utils_Array::value('pid', $_GET, '0');  // setting 0 as default if 'pid' is not found
        //$myEid = CRM_Utils_Array::value('eid', $_GET, '0');  // setting 0 as default if 'pid' is not found
        // (above return empty here)

        // (get the gid)
        //$gid = $form->getVar( '_gid' );
        //print_r($gid);
        // returns the form ID!

}

Regards

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: Deduping rules
April 14, 2014, 03:00:48 pm
Quote from: rebootl on April 14, 2014, 03:06:38 am
I noticed that actually the first registration is already using a CiviCRM profile.
Thinking that this might be the wrong way I replaced it by a default Joomla registration. But then the CiviCRM group sync does not create a respective contact... (I'll report that to the dev.)

I haven't looked over the rest of this post thoroughly but the comment above suggests you are moving away from using civi as it is meant to be used

ie if you look here on demo site

http://joomla.demo.civicrm.org/administrator/?option=com_civicrm&task=civicrm/admin/uf/group&reset=1

you will see the Name and Address Profile is set to 'user registration' so that it gets used when a joomla user is created and hence pushes data in to civi
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

rebootl

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5
  • MySQL version: ?
  • PHP version: ?
Re: Deduping rules
April 16, 2014, 12:52:04 am
Quote
the comment above suggests you are moving away from using civi as it is meant to be used

That is not intended. But I don't understand/see the "correct workflow" for what we're trying to do. The documentation is not very extensive... ??? (about this)

Thanks for pointing me to the demo site, I hadn't seen it before. I can see that it's set to 'user registration'. But when I edit the profile this appears only as text like ' [ x ] user registration '.

When I go to our site it doesn't appear at all. Even when creating a new profile... Where am I supposed to enable this?

Edit: Sorry for being a bit upset.
« Last Edit: April 16, 2014, 01:56:26 am by rebootl »

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: Deduping rules
April 16, 2014, 02:09:18 am
it always helps if you can provide some advice on how the documentation can be improved - like i say i know v little about joomla

a google search for joomla "user registration" civicrm profile

gave this as its 5th link

http://en.flossmanuals.net/civicrm/organising-your-data/profiles/

which has

Quote
Website user registration: you can include a set of fields in the new account registration form (Drupal) or create a profile that includes website user registration fields (Joomla!)

and then I don't see much else for joomla newbies

and yes if i go here

http://joomla.demo.civicrm.org/administrator/?option=com_civicrm&task=civicrm/admin/uf/group/update&action=update&id=1&context=group

i see the field checked like some mysterious joomla factor is forcing this

In Adv Settings on the profile i see

Quote
If you are using this profile as a contact signup form, using it in an online contribution page OR an event registration page, anonymous users will be given the option to create a Joomla User Account as part of completing the form. This feature requires the 'Allow User Registration' setting to be 'Yes' in Joomla Global Configuration >> System Settings. In addition, you must include a Primary Email Address field in the profile.

and of the above help you guess the next bit?
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

rebootl

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 2.5
  • MySQL version: ?
  • PHP version: ?
Re: Deduping rules
April 22, 2014, 01:16:31 am
Thanks for the links you gave. I haven't yet read all of it (the floss manual).

Yes I had seen this under advanced settings already. I double checked the 'Allow user registration' and we have had it checked already. (For reference it is under "User Manager --> Options --> Component" I assume it has changed w/ the Joomla version.)
So, we also have the 'Account creation required' set already... it works I just don't have that mentioned field from the demo appearing.

The problem is what I described on the previous posts, which is solved by the hook I posted.

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: Deduping rules
April 22, 2014, 01:22:50 pm
i am just surprised that you need a hook to do what sounds like normal sign up behaviour but don't know joomla enough to really dig in to this to confirm.
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Deduping rules

This forum was archived on 2017-11-26.