Topic: How to Let FA Accept Classes/Types ID's Characters
Hello,
Find bellow a simple way to let the outstanding FA package support characters ID's in the Classes/Types Accounts.
1 - use en_US-Demo.sql & en_US-New.sql Supporting Classes/Types Characters
id's. This will be done easly by changing :
- all varchar(11) should be changed to varchar(15) in the .sql file
- CREATE TABLE `0_chart_class` (
`cid` varchar(3) NOT NULL default '',
`class_name` varchar(60) NOT NULL default '',
`ctype` tinyint(1) NOT NULL default '0',
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`cid`)
) TYPE=MyISAM ;
- CREATE TABLE `0_chart_master` (
`account_code` varchar(15) NOT NULL default '',
`account_code2` varchar(15) default '',
`account_name` varchar(60) NOT NULL default '',
`account_type` varchar(10) NOT NULL default '0',
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`account_code`),
KEY `account_code` (`account_code`),
KEY `account_name` (`account_name`)
) TYPE=MyISAM ;
- CREATE TABLE `0_chart_types` (
`id` varchar(10) NOT NULL default '',
`name` varchar(60) NOT NULL default '',
`class_id` varchar(3) NOT NULL default '0',
`parent` varchar(10) NOT NULL default '-1',
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `name` (`name`)
) TYPE=MyISAM;
2 - do those simple modifications in the bellow files :
* gl/includes/db/gl_db_account_types.inc
- function add_account_type
$sql = "INSERT INTO ".TB_PREF."chart_types (id, name, class_id, parent)
VALUES (".db_escape($id).", ".db_escape($name).", ".db_escape
($class_id).", ".db_escape($parent).")";
// FA original was : VALUES ( $id,.......
- function get_account_types
$sql .= " ORDER BY class_id, id, parent ";
// FA Original : " ORDER BY class_id, id"
- function get_account_classes
$sql .= " ORDER BY ctype,cid";
// FA Original : " ORDER BY cid"
* gl/manage/gl_account_classes.php
1. comment the following lines:
/* if (!is_numeric($_POST['id']))
{
display_error( _("The account class ID must be numeric."));
set_focus('id');
return false;
}
*/
2. in the delete check :
$sql= "SELECT COUNT(*) FROM ".TB_PREF."chart_types
WHERE class_id=".db_escape($selected_id)." ";
// FA Original: class_id=$selected_id
* gl/manage/gl_account_types.php
1. comment the following lines:
/* if (!input_num('id'))
{
display_error( _("The account id must be an integer and cannot
be empty."));
set_focus('id');
return false;
}
*/
2. minor changes:
- $th = array(_("Group ID"), _("Group Name"), _("Subgroup Of"),
_("Class Type"), "", ""); // khaled : ID ; Name
- if ($myrow["parent"] == "0")
//FA Original : if ($myrow["parent"]== ANY_NUMERIC)
* gl/manage/gl_accounts.php
- text_row_ex(_("Account Code:"), 'account_code', 15);
//FA Original was 11
- text_row_ex(_("Account Code 2:"), 'account_code2', 15);
//FA Original was 11
* includes/ui/ui_lists.inc
'order' => array('account_code','type.id'),
// FA Original : array('type.id','account_code'),
Should also change in config.php : $accounts_alpha = 1;
I hope you will find those modifications usefull.
Finally, This is how I use FA & in every new version I do those modifications.
Regards,
Khaled