OK, I have an interesting dilemma. I would be more than happy to share this if it works, and I'll do the legwork, but I need some help figuring it out.
I have the VTiger Leads component integrated with ZC, allowing me to gather information into our CRM system from the site, but we are left with two instances of accounts, one in Vtiger and one in ZC. I would like to use the ZC to insert and maintain accounts in VTiger, and aside from the obvious problem of leads becoming contacts, I would rather have everything in one place.
The logic behind this is when the account is created, the create account action generates a lead in VTiger. The "activate" flag on the ZC account (I need to find the specific field) will set the table name for the account update when they modify their account. Here's the pseudo-process:
1) Visitor creates account in ZC. The createaccount.php file, once modified, will insert their information in the Leads database in VTiger.
2) The sales monkey will contact the person, and validate their account. Once verified, they will convert the Lead into a Contact in VTiger, and activate their ZC account.
3) If the user edits their account, and they are not activated, then the update is run against the VTiger lead table. If they ARE activated, the update is run against the VTiger Contact table.
From lines 292 to 305, here is the code where the SQL statement is built and run, either updating or inserting the account:
I don't see anything in the code on this page that checks to see whether it should do an update or an insert, am I missing something? I see it would be pretty easy to add an additional SQL query to insert into VTiger or update, I just want to make sure that I have this right :)Code:$sql = "update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$_SESSION['customer_id'] . "'"; $db->Execute($sql); $sql = "insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$_SESSION['customer_id'] . "', '0', now())"; $db->Execute($sql);
Any help is appreciated, and like I said, if I get this working, I would be more than happy to share it.
Thanks,
Bob



