定制SugarCrm中潜在客户的潜在客户出口

时间:2013-01-09 12:44:17

标签: sugarcrm syntactic-sugar

我使用SugarCRM,当我导出潜在客户时,我可以获得所有字段,包括我添加的自定义字段。但是当我尝试从潜在客户列表中下载潜在客户时,只有少数字段从数据库中导出。我需要获得所有领域,如潜在客户下载

据我所知,Prospect_list.php文件包含导出此代码的代码,我更改了此代码,但发生数据库故障请帮我完成此操作。

$prospects_query = "SELECT p.id AS id, 'Prospects' AS related_type, '' AS \"name\", p.first_name AS first_name, p.last_name AS last_name,p.title AS title, p.salutation AS salutation, 
                p.primary_address_street AS primary_address_street,p.primary_address_city AS primary_address_city, p.primary_address_state AS primary_address_state,  p.primary_address_postalcode AS primary_address_postalcode, p.primary_address_country AS primary_address_country,
                p.account_name AS account_name,
                ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
                p.do_not_call AS do_not_call, p.phone_fax AS phone_fax, p.phone_other AS phone_other, p.phone_home AS phone_home, p.phone_mobile AS phone_mobile, p.phone_work AS phone_work , p.description As Description
                FROM prospect_lists_prospects plp
                INNER JOIN prospects p ON plp.related_id=p.id
                LEFT JOIN email_addr_bean_rel ear ON  ear.bean_id=p.id AND ear.deleted=0
                LEFT JOIN email_addresses ea ON ear.email_address_id=ea.id
                WHERE plp.prospect_list_id = $record_id  AND plp.deleted=0 
                AND p.deleted=0
                AND (ear.deleted=0 OR ear.deleted IS NULL)";

这里糖团队指定了要导出的字段,但我需要获取表格中的所有字段[前景]如何做到这一点。

1 个答案:

答案 0 :(得分:0)

尝试将查询更改为此...

$prospects_query = "SELECT p.id AS id, 'Prospects' AS related_type, '' AS 'name', p.first_name AS first_name, p.last_name AS last_name,p.title AS title, p.salutation AS salutation, 
            p.primary_address_street AS primary_address_street,p.primary_address_city AS primary_address_city, p.primary_address_state AS primary_address_state,  p.primary_address_postalcode AS primary_address_postalcode, p.primary_address_country AS primary_address_country,
            p.account_name AS account_name,
            ea.email_address AS email_address, ea.invalid_email AS invalid_email, ea.opt_out AS opt_out, ea.deleted AS ea_deleted, ear.deleted AS ear_deleted, ear.primary_address AS primary_address,
            p.do_not_call AS do_not_call, p.phone_fax AS phone_fax, p.phone_other AS phone_other, p.phone_home AS phone_home, p.phone_mobile AS phone_mobile, p.phone_work AS phone_work , p.description As Description
            FROM prospect_lists_prospects plp
            INNER JOIN prospects p ON plp.related_id=p.id
            LEFT JOIN email_addr_bean_rel ear ON  ear.bean_id=p.id AND ear.deleted=0
            LEFT JOIN email_addresses ea ON ear.email_address_id=ea.id
            WHERE plp.prospect_list_id = '$record_id'  AND plp.deleted=0 
            AND p.deleted=0
            AND (ear.deleted=0 OR ear.deleted IS NULL)";