[Vtigercrm-developers] Found a bug in the function userCurrencyId (vtiger 6 beta)

sww scottearle at gmail.com
Sun Oct 13 06:03:00 UTC 2013


It's a simple bug, with a simple fix, I know ... but it has a pretty
catastrophic effect when (for example) creating a new product.

I searched in the list to see if anyone else had previously mentioned this
function, but nobody seems to so far. I don't know if there is a bug
tracker, so I thought it best to post here. Apologies if I just broke some
super-strict rule.

In vtlib/Vtiger/Functions.php, line 68:

        static function userCurrencyId($userid) {
                global $current_user, $adb;

                if (!isset(self::$userIdCurrencyIdCache[$userid])) {
                        $result = $adb->pquery('SELECT currency_id FROM
vtiger_users', array());
                        while ($row = $adb->fetch_array($result)) {
                                self::$userIdCurrencyIdCache[$row['id']] =
$row['currency_id'];
                        }
                }
                return self::$userIdCurrencyIdCache[$userid];
        }

Should be:

        static function userCurrencyId($userid) {
                global $current_user, $adb;

                if (!isset(self::$userIdCurrencyIdCache[$userid])) {
                        $result = $adb->pquery('SELECT id, currency_id FROM
vtiger_users', array());
                        while ($row = $adb->fetch_array($result)) {
                                self::$userIdCurrencyIdCache[$row['id']] =
$row['currency_id'];
                        }
                }
                return self::$userIdCurrencyIdCache[$userid];
        }

Best regards,

Scott



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Found-a-bug-in-the-function-userCurrencyId-vtiger-6-beta-tp8477.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.


More information about the vtigercrm-developers mailing list