[Vtigercrm-developers] Bug in Report Generator with vtlib modules?
Alan Lord (News)
alanslists at gmail.com
Sun Apr 21 12:40:13 UTC 2013
Hi all,
I've recently built some custom modules for a client and we've now
noticed that the report engine is broken.
If I create a new report that contains a UIType 10 field in my module,
the query that is generated gets totally mangled and this appears in the
middle of the report query:
> (CASE WHEN libertus_lscontracts.supplier NOT LIKE '' THEN (CASE WHEN vtiger_vendorRelLSContracts1094.vendorname NOT LIKE '' THEN vtiger_vendorRelLSContracts1094.vendorname ELSE '' END) ELSE '' END) AS LSContracts_LBL_LSSUPPLIER
(1094 is the fieldid in vtiger_field)
This seems to be linked to the fact I've used language files so the
field labels are translatable, In vtiger_field, in the above example,
the field vtiger_lscontracts.supplier has a label of LBL_LSSUPPLIER. The
translation is in my module dir in both an en_us and an en_gb language file:
'LBL_LSSUPPLIER' => 'Supplier',
Now oddly, when I am creating the report the left column where first you
select the fields is translated.
But in the vtiger_selectcolumn table, the columnname field is stored
like this:
libertus_lscontracts:supplier:LSContracts_LBL_LSSUPPLIER:supplier:V
And when you re-examine (customise) the report the right column of the
field selection is *not* translated nor are the columns of the report
output.
The non-UIType 10 fields seem to work OK when I run a report but if I
include a UItype 10 field, the report fails because of the mangled query
above.
If I edit the columnname field of the report of the database and change
the string to:
libertus_lscontracts:supplier:LSContracts_Supplier:supplier:V
Then the report runs fine and that CASE WHEN query string above doesn't
get generated at all.
Can someone explain what is going wrong here?
I'm not sure if it is a problem during the initial saving of the report
where the translation is not being saved, or in report retrieval whereby
the column is not getting translated properly.
I've been looking through some of the code in modules/Reports but it's
rather convoluted to say the least. I *think* the issue occurs in
ReportRun.php function getQueryColumnsList() but if this is the cause or
a symptom of something else I'm not sure.
Cheers
Al
--
Libertus Solutions
http://www.libertus.co.uk
More information about the vtigercrm-developers
mailing list