<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — person_id as tinyblob in some tables]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6654&amp;type=atom" />
	<updated>2017-01-18T11:06:17Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=6654</id>
		<entry>
			<title type="html"><![CDATA[person_id as tinyblob in some tables]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27407#p27407" />
			<content type="html"><![CDATA[<p>The <strong>person_id</strong> field is either an <strong>int </strong> or a <strong>tinyblob</strong> field in FA&#039;s tables (Charts of Accounts). </p><p>The tables <strong>bank_trans, budget_trans, gl_trans</strong> have it as a <strong>tinyblob </strong>(the only ones to have tinyblob fields in FA)<strong> </strong>field type whilst the tables <strong>crm_contacts, stock_moves</strong> have it as an <strong>int</strong> type. In some instances like <strong>customers (debtors), branches, suppliers</strong>, etc., the respective <strong>id</strong> portion of the primary key references the <strong>person_id</strong> field of <strong>int</strong> type. </p><p>The <strong>tinyblob</strong> field stores the textual string as a <strong>hex</strong> number. Removing the leading <strong>0x</strong> from it, is the <strong>hex_number</strong> which can be converted using <strong>UNHEX(hex_number)</strong> function in MySQL to it&#039;s original string value.</p><p>In <strong>includes/types.inc</strong>, the <strong>function payment_person_name()</strong> (and other payment functions therein) routes the <em>person_id</em> field according to the incoming context <em>type</em> it refers to. The usage of the <strong>tinyblob</strong> field is visible in line 213 of <strong>gl/includes/db/gl_db_banking.inc</strong> in the <strong>function add_bank_transfer()</strong>:</p><div class="codebox"><pre><code>$person_id = _(&quot;From&quot;).&quot; &quot;.$fromact[&#039;bank_account_name&#039;].&quot; &quot;._(&quot;To&quot;).&quot; &quot;.$toact[&#039;bank_account_name&#039;];</code></pre></div><p>Also in lines 221 and 224 and others, the functions <strong>add_bank_trans()</strong> and <strong>add_gl_trans()</strong> use the variable <strong>$person_id</strong> assigned above.</p><p>Hence the <strong>tinyblob</strong> field can be changed to <strong>varchar</strong> or <strong>tinytext</strong> field without disturbing the code and obtaining <strong>clarity</strong> in the sql backups. We may need to deal with <strong>collations</strong> and <strong>character sets</strong> used in the database if such a change is made.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-01-18T11:06:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27407#p27407</id>
		</entry>
</feed>
