Comments

dealancer’s picture

This issue happens because there is specific logic for creation or syncing crm core contact in crm_core_profile_entry_form. If user is anonymous it creates new contact. But if he is not and he has no associated account (crm_user_sync) it is trying to call crm_core_sync_sync which still doesn't work perfect and returns empty contact.

However it is not a main issue. The big problem is that we can't not control what method to use to load or create contact, there should be 4 possibilities:

* Load contact associated with current user
* Find duplicate contact
* Create new contact and associate with current user
* Create new contact

So we need to be a able to chose, or even better allow to reorder them based on priority. I have spoken with Chang and he confirmed that it is a good solution.

dealancer’s picture

Status: Active » Needs review
StatusFileSize
new9.63 KB

Here is a patch that solves problems described above and fixed some formatting issues (indents).

dealancer’s picture

Fixed issues with spaces at the end of line.

dealancer’s picture

dealancer’s picture

Title: EntityMalformedException » Allow user to change priority of actions for creation/loading contact types in crm_core_profile form.
dealancer’s picture

Here is a patch without dpms ;)

dealancer’s picture

New patch with an important fix. See #1595212: Could not create second profile.

dealancer’s picture

Including all files to the patch.

dealancer’s picture

I has made complete testing of this patch.

Here is what works good:

a) Create new contact
b) Load contact associated with current user

Following works not good:
c) Create new contact and associate with current user. Does not work good because it generates contact every time the form is loaded even if no submitted. As I said before usage of crm_user_sync_sync what a bit wrong cause this function does not return the value.
d) Find duplicate contact is not working now, cause of the lack of the dedup framework, see #1530088: Contact matching framework.
e) More over there is could be another use case to search duplicate contact and then sync.

In order to solve c) and e) we need to remove" Create new contact and associate with current user" option from weight list and add new checkbox "Associated user account and contact", which will be triggered when the form is submitted.

dealancer’s picture

I also require following functionality:

* Ability to chose if I need to sync with a current user or create new one.

But this is not easy to implement, but it is possible to implement following functionality:

* Ability to chose if I need to sync with a current user or existing one (uid as argument).

dealancer’s picture

Here in this I have implemented the functionality described above.

This requires small patch to crm_user_sync module to be done.

dealancer’s picture

the patch is here.

dealancer’s picture

Ok, so here is another patch, with some formatting fixed across the module

dealancer’s picture

Status: Needs review » Fixed

Looks like ok, committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.