Reports and vardefs.php
Today I spent the rest of the day to fix one problem with Reports. It gave a JavaScript error (I hate JavaScript!) when some filter was built. The problem appeared only in Quote reports. I realized that it may happend because I added two new fields in the file vardefs.php. This file contains descriptions of all fields belonged to specific class:
'tax_usdollar' =>
array (
'name' => 'tax_usdollar',
'vname' => 'LBL_TAX_USDOLLAR',
'type' => 'decimal',
'len' => '20,2',
),
I commented out them but it didn’t resolve the problem. I observed that the error appeared when I chose “money” fields: Tax, Total Amount, Subtotal etc. I checked out their types in the vardefs.php and found the bug. The type was ‘decimal’ but when Report form was built it couldn’t find any operation for this data type. I replaced all decimal types by float and after that Quote report started work fine.
We still use SugarCRM-Pro-3.0.1. It’s difficult to switch to the latest version because we did some customization and fixed many bugs. Regarding the bug with building the list of operations for data type ‘decimal’ – it was fixed in the version 4.0. Cool! The developer team spent six months to fix this simple bug.