Topic: person_id as tinyblob in some tables

The person_id field is either an int or a tinyblob field in FA's tables (Charts of Accounts).

The tables bank_trans, budget_trans, gl_trans have it as a tinyblob (the only ones to have tinyblob fields in FA) field type whilst the tables crm_contacts, stock_moves have it as an int type. In some instances like customers (debtors), branches, suppliers, etc., the respective id portion of the primary key references the person_id field of int type.

The tinyblob field stores the textual string as a hex number. Removing the leading 0x from it, is the hex_number which can be converted using UNHEX(hex_number) function in MySQL to it's original string value.

In includes/, the function payment_person_name() (and other payment functions therein) routes the person_id field according to the incoming context type it refers to. The usage of the tinyblob field is visible in line 213 of gl/includes/db/ in the function add_bank_transfer():

$person_id = _("From")." ".$fromact['bank_account_name']." "._("To")." ".$toact['bank_account_name'];

Also in lines 221 and 224 and others, the functions add_bank_trans() and add_gl_trans() use the variable $person_id assigned above.

Hence the tinyblob field can be changed to varchar or tinytext field without disturbing the code and obtaining clarity in the sql backups. We may need to deal with collations and character sets used in the database if such a change is made.