35 lines
981 B
PHP
Executable File
35 lines
981 B
PHP
Executable File
<?php
|
|
include_once("../config.php");
|
|
include_once("../import/helper.php");
|
|
global $sugar_config;
|
|
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
|
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
|
|
|
$zap=mysql_query("SELECT ac.id,em.id as emid FROM accounts_contacts as c
|
|
inner join accounts as ac on ac.id=c.account_id
|
|
inner join email_addr_bean_rel as rel on rel.bean_id=c.contact_id
|
|
inner join email_addresses as em on em.id=rel.email_address_id
|
|
where c.deleted=0 and em.deleted=0 and rel.deleted=0;");
|
|
while($dane=mysql_fetch_array($zap)){
|
|
echo "INSERT INTO `crm`.`email_addr_bean_rel`
|
|
(`id`,
|
|
`email_address_id`,
|
|
`bean_id`,
|
|
`bean_module`,
|
|
`primary_address`,
|
|
`reply_to_address`,
|
|
`date_created`,
|
|
`date_modified`,
|
|
`deleted`)
|
|
VALUES
|
|
('".create_guid()."',
|
|
'".$dane['emid']."',
|
|
'".$dane['id']."',
|
|
'Accounts',
|
|
'0',
|
|
'0',
|
|
'".date("Y-m-d H:i:s")."',
|
|
'".date("Y-m-d H:i:s")."',
|
|
'0');
|
|
";
|
|
} |