I personally think Dimension should be dynamic so we can have as many as we want. But as of now Dimension is hardcoded to only have a maximum of two.
We can set the amount of Dimension used in Company setup. You can see this in /admin/company_preferences.php
number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2);
The limit number 2 is hardcoded, like a "magic number". I don't think this is a good practice.
Even if you change that number (for example I tried 4) and set the company Dimension to larger than 2 (for example 3), many codes that deal with Dimension usually only check whether the Dimension is 1, 2, or neither. So any number of Dimension larger than 2 (or whatever beside 1 and 2) is treated as 0 (use no Dimension).
For example, let's take a look at the function used to generate the table in Journal Entry
/gl/includes/ui/gl_journal_ui.inc
function display_gl_items($title, &$order)
{
...
$dim = get_company_pref('use_dimension');
...
if ($dim == 2)
$th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1",
_("Dimension")." 2", _("Debit"), _("Credit"), _("Memo"), "");
else if ($dim == 1)
$th = array(_("Account Code"), _("Account Description"), _("Dimension"),
_("Debit"), _("Credit"), _("Memo"), "");
else
$th = array(_("Account Code"), _("Account Description"),
_("Debit"), _("Credit"), _("Memo"), "");
...
if ($dim >= 1)
label_cell(get_dimension_string($item->dimension_id, true));
if ($dim > 1)
label_cell(get_dimension_string($item->dimension2_id, true));
...
In the above code we can see that the function only handle up to 2 Dimension, beside that will be treated as no Dimension.
So, if you want to change this behavior, you have to change every code that uses
get_company_pref('use_dimension');
I don't know why the FA developer decides to use a maximum of 2 Dimension instead of preparing for dynamic number of Dimensions. Could somebody please explain to us?
Thanks.
kuro
Regards, [url=http://captainkuro.com]captain_kuro[/url]