Closed (fixed)
Project:
CRM Core Profile
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 May 2012 at 12:51 UTC
Updated:
6 Jun 2012 at 17:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
dealancer commentedThis 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.
Comment #2
dealancer commentedHere is a patch that solves problems described above and fixed some formatting issues (indents).
Comment #3
dealancer commentedFixed issues with spaces at the end of line.
Comment #4
dealancer commentedComment #5
dealancer commentedComment #6
dealancer commentedHere is a patch without dpms ;)
Comment #7
dealancer commentedNew patch with an important fix. See #1595212: Could not create second profile.
Comment #8
dealancer commentedIncluding all files to the patch.
Comment #9
dealancer commentedI 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.
Comment #10
dealancer commentedI 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).
Comment #11
dealancer commentedHere in this I have implemented the functionality described above.
This requires small patch to crm_user_sync module to be done.
Comment #12
dealancer commentedthe patch is here.
Comment #13
dealancer commentedOk, so here is another patch, with some formatting fixed across the module
Comment #14
dealancer commentedLooks like ok, committed.