Feng Forum

Support => Feng Office 1 => Older versions => 1.4 final => : aportet May 30, 2009, 05:15:44 AM

: Create user from contact - not working
: aportet May 30, 2009, 05:15:44 AM
Hi to those who have an idea or a solution.

I'm pushing my OpenGoo users to first create contacts before creating users.

However, this is not working and I'm obliged later on, to correct it directly on the MySQL base. The user ID is not implemented in the contact so that there is no link between both.

Using 1.4 and 1.4.1 (same problem)

If someone has "THE" solution, in advance many thanks !!
: Re: Create user from contact - not working
: ignacio June 01, 2009, 04:56:50 PM
Hi,

To correct the problem you have to edit file 'application/controllers/UserController.class.php' and change lines 191 to 196, from:

:
// if contact with same email exists use it as user's contact, without changing it
$contact = Contacts::getByEmail($user->getEmail(), true);
if ($contact instanceof Contact) {
$contact->setUserId($user->getId());
if ($contact->isTrashed()) $contact->untrash();
}

to:

:
$contact_id = array_var($user_data, 'contact_id');
$contact = Contacts::findById($contact_id);
if ($contact instanceof Contact) {
// user created from a contact
$contact->setUserId($user->getId());
$contact->save();
} else {
// if contact with same email exists use it as user's contact, without changing it
$contact = Contacts::getByEmail($user->getEmail(), true);
if ($contact instanceof Contact) {
$contact->setUserId($user->getId());
if ($contact->isTrashed()) $contact->untrash();
$contact->save();
}
}

For version 1.5 this will be corrected along some small improvements like updating the contacts email and company when you change them for the user, and how the username is generated when creating a user from a contact.

Cheers.
: Re: Create user from contact - not working
: aportet June 02, 2009, 04:00:52 AM
As usual ignacio, great job, works perfectly !!

Thanks you "very much", please continue. I will try my best to forward you any kind of bugs and evolution possibility. (is there a page or a wish list  where we can write our proposal ?)

Looking forward seeing the 1.5 !!
: Re: Create user from contact - not working
: alvarotm01 June 08, 2009, 12:06:33 PM
Hi,

To propose new features, you can do it in this forum at boards "New Features" or "Ideas"

greetings