<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — contact_name from crm_persons table]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5376</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5376&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in contact_name from crm_persons table.]]></description>
		<lastBuildDate>Mon, 08 Dec 2014 19:25:00 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[contact_name from crm_persons table]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21708#p21708</link>
			<description><![CDATA[<p>The file <strong>sales/includes/db/branches_db.inc</strong> has the following function:<br /></p><div class="codebox"><pre><code>function get_sql_for_customer_branches()
{
    $sql = &quot;SELECT &quot;
        .&quot;b.branch_code, &quot;
        .&quot;b.branch_ref, &quot;
        .&quot;b.br_name, &quot;
        .&quot;p.name as contact_name, &quot;
        .&quot;s.salesman_name, &quot;
        .&quot;a.description, &quot;
        .&quot;p.phone, &quot;
        .&quot;p.fax, &quot;
        .&quot;p.email, &quot;
        .&quot;t.name AS tax_group_name, &quot;
        .&quot;b.inactive
        FROM &quot;.TB_PREF.&quot;cust_branch b &quot;
        . &quot;LEFT JOIN &quot;.TB_PREF.&quot;crm_contacts c
            ON c.entity_id=b.branch_code AND c.type=&#039;cust_branch&#039; AND c.action=&#039;general&#039;
            LEFT JOIN &quot;.TB_PREF.&quot;crm_persons p on c.person_id=p.id,&quot;
            .TB_PREF.&quot;areas a, &quot;
            .TB_PREF.&quot;salesman s, &quot;
            .TB_PREF.&quot;tax_groups t
        WHERE b.tax_group_id=t.id
        AND b.area=a.area_code
        AND b.salesman=s.salesman_code
        AND b.debtor_no = &quot;.db_escape($_POST[&#039;customer_id&#039;]);

    if (!get_post(&#039;show_inactive&#039;)) $sql .= &quot; AND !b.inactive&quot;;
    $sql .= &quot; GROUP BY b.branch_code ORDER BY branch_ref&quot;;

    return $sql;
}</code></pre></div><p>The above function is called only in <strong>sales/manage/customer_branches.php</strong>.<br />The <strong>#_cust_branch</strong> table already contains a <strong>contact_name</strong> field that does not seem to be used here in FA now.<br />The <strong>name</strong> field from the <strong>#_crm_persons</strong> table seems be to be the preferred source of Contact Name in FA.</p><p>Is this the intended design?<br />If we now refrain from populating the <strong>#_cust_branch</strong> table&#039;s <strong>contact_name</strong> field, then it&#039;s use in the reports will suffer.</p><p>The <strong>#_cust_branch.contact_name</strong> field is used in <strong>rep103.php</strong> and <strong>rep106.php</strong> still in get_customer_details_for_report() in the former and in GetSalesmanTrans() and print_salesman_list() in the latter.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 08 Dec 2014 19:25:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21708#p21708</guid>
		</item>
	</channel>
</rss>
