[Vtigercrm-developers] Bug in Report Generator with vtlib modules?

Alan Lord (News) alanslists at gmail.com
Sun Apr 21 15:07:43 UTC 2013


I did some further digging.

It looks like I can't use "_" (or "-") in a field label string.

But changing the string to use either a space or nothing between words 
works fine!

It makes translatable labels look a bit odd for my liking but I can live 
with it I suppose. It would be nice if "_" worked though - it's a very 
commonly used string separator - even for vtiger's own labels like in 
module block names etc.

The problem stems from the amazingly convoluted bit of 
string-theory-type code (pun intended) between lines 124 and 139 in 
ReportRun.php that is working field labels...

Cheers

Al


On 21/04/13 13:40, Alan Lord (News) wrote:
> 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
>
> _______________________________________________
> http://www.vtiger.com/
>


-- 
Libertus Solutions
http://www.libertus.co.uk



More information about the vtigercrm-developers mailing list