Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Option labels not visible on filters select boxes
#1
I have a weird error, that seems to have come from nowhere:

When I enter a filter (on any given module) and go to 'advanced filters' and then try to select fields to filter on, all custom fields are blank. At least, the shown values are blank. The HTML looks like:
Code:
<option value="vtiger_account:accountname:accountname:Accounts_Account_Name:V">Accountnaam</option>
<option value="vtiger_account:account_no:account_no:Accounts_Account_No:V">Account Nr</option>
<option value="vtiger_accountscf:cf_548:cf_548:Accounts_KI-nummer:V"></option>
<option value="vtiger_accountscf:cf_569:cf_569:Accounts_Account_Type:V"></option>
<option value="vtiger_account:phone:phone:Accounts_Phone:V">Telefoon</option>
<option value="vtiger_accountscf:cf_576:cf_576:Accounts_Actief_APK?:V"></option>
<option value="vtiger_account:email1:email1:Accounts_Email:V">E-mail</option>

Above code has been cut for readability. Take a look at the third option for example. The "value" attribute has been filled, but the HTML that should be in between the <option> and </option> is blank. This is the same for all filters and also comes back in reports. Does anyone have an idea of where these values are generated so I can start a search?
Reply
#2
I have a client informing of the same problem but I can't reproduce it.
Can you reproduce it on the online demo (I just updated to the latest version)?
The piece of code that does is:

https://github.com/tsolucio/corebos/blob/master/modules/CustomView/EditView.php#L75

the variable $modulecollist contains the options in the select, in my development install it works correctly.

In the end that seems to be translated here:

https://github.com/tsolucio/corebos/blob/master/modules/CustomView/CustomView.php#L364
Joe
TSolucio
Reply
#3
I've used the demo on http://corebos.org/demos/corebos/ and followed the following steps:
  • Created a field for Organizations in the layout editor.
  • Went to 'create filter' from the Organizations list view.
  • Went to 'Advanced Filters' and opened the dropdown for field select.

And yes, I can see my newly created field here. I will take a look at the files, hopefully I'll get around to that today but I have to create a test-copy of the production server for this. This may have been caused by an update and only discovered later on, it's one of those little things you don't test after an update so who knows...
Reply
#4
Ok, keep me informed and ask for help.
Joe
TSolucio
Reply
#5
First test:

Use "print_r" on the variable "$modulecollist" in Editview.php. Returns:

Code:
Array
(
    [Accounts] => Array
        (
            [Accountinformatie] => Array
                (
                    [vtiger_account:accountname:accountname:Accounts_Account_Name:V] => Accountnaam
                    [vtiger_account:account_no:account_no:Accounts_Account_No:V] => Account No
                    [vtiger_accountscf:cf_548:cf_548:Accounts_KI-nummer:V] => KI-nummer
                    [vtiger_accountscf:cf_569:cf_569:Accounts_Account_Type:V] => Account Type
                    [vtiger_account:phone:phone:Accounts_Phone:V] => Telefoon
                    [vtiger_accountscf:cf_576:cf_576:Accounts_Actief_APK?:V] => Actief APK?
                    [vtiger_account:email1:email1:Accounts_Email:V] => E-mail
                    [vtiger_account:fax:fax:Accounts_Fax:V] => Fax
                    [vtiger_crmentity:createdtime:createdtime:Accounts_Created_Time:DT] => Gemaakt
                    [vtiger_accountscf:cf_587:cf_587:Accounts_Via_Wederverkoper:V] => Via Wederverkoper
                    [vtiger_crmentity:modifiedtime:modifiedtime:Accounts_Modified_Time:DT] => Gewijzigd
                    [vtiger_accountscf:cf_583:cf_583:Accounts_Wordt_op_rekening_geleverd?:V] => Wordt op rekening geleverd?
                    [vtiger_account:emailoptout:emailoptout:Accounts_Email_Opt_Out:C] => E-mail optie uit
                    [vtiger_account:website:website:Accounts_Website:V] => Website
                    [vtiger_crmentity:smownerid:assigned_user_id:Accounts_Assigned_To:V] => Toegewezen aan
                    [vtiger_crmentity:modifiedby:modifiedby:Accounts_Last_Modified_By:V] => Last Modified By
                    [vtiger_accountscf:cf_736:cf_736:Accounts_BTW_/_Belasting_nummer:V] => BTW / Belasting nummer
                    [vtiger_accountscf:cf_742:cf_742:Accounts_Onderdeel_van:V] => Onderdeel van
                    [vtiger_accountscf:cf_883:cf_883:Accounts_Standaard_betalingstermijn:V] => Standaard betalingstermijn
                    [vtiger_accountscf:cf_884:cf_884:Accounts_Email_facturatie:E] => Email facturatie
                    [vtiger_account:exact_acc_vat:exact_acc_vat:Accounts_Exact_VAT_Code_for_Account:V] => Exact VAT Code for Account
                )

            [Adresinformatie] => Array
                (
                    [vtiger_accountbillads:bill_street:bill_street:Accounts_Billing_Address:V] => Postadres straat
                    [vtiger_accountshipads:ship_street:ship_street:Accounts_Shipping_Address:V] => Afleveradres straat
                    [vtiger_accountbillads:bill_code:bill_code:Accounts_Billing_Code:V] => Postadres Code
                    [vtiger_accountshipads:ship_code:ship_code:Accounts_Shipping_Code:V] => Afleveradres Code
                    [vtiger_accountbillads:bill_city:bill_city:Accounts_Billing_City:V] => Postadres Plaats
                    [vtiger_accountshipads:ship_city:ship_city:Accounts_Shipping_City:V] => Afleveradres Plaats
                    [vtiger_accountbillads:bill_country:bill_country:Accounts_Billing_Country:V] => Postadres Land
                    [vtiger_accountshipads:ship_country:ship_country:Accounts_Shipping_Country:V] => Afleveradres Land
                )

            [Omschrijving] => Array
                (
                    [vtiger_crmentity:description:description:Accounts_Description:V] => Omschrijving
                )

        )

)

Which is nice, since all the labels are intact at this point. Error occurs further down the line.

Which is in the function "getByModule_ColumnsList();". It produces a var called $choosecolslist, that looks like this excerp:
Code:
Array
(
    [Accounts - Accountinformatie] => Array
        (
            [0] => Array
                (
                    [value] => vtiger_account:accountname:accountname:Accounts_Account_Name:V
                    [text] => Accountnaam
                    [selected] =>
                )

            [1] => Array
                (
                    [value] => vtiger_account:account_no:account_no:Accounts_Account_No:V
                    [text] => Account Nr
                    [selected] =>
                )

            [2] => Array
                (
                    [value] => vtiger_accountscf:cf_548:cf_548:Accounts_KI-nummer:V
                    [text] =>
                    [selected] =>
                )

            [3] => Array
                (
                    [value] => vtiger_accountscf:cf_569:cf_569:Accounts_Account_Type:V
                    [text] =>
                    [selected] =>
                )

            [4] => Array
                (
                    [value] => vtiger_account:phone:phone:Accounts_Phone:V
                    [text] => Telefoon
                    [selected] =>
                )
Notice a lot of the values in the "test" keys are missing.

UPDATE
I've narrowed it down to this codeblock: https://github.com/tsolucio/corebos/blob/master/modules/CustomView/EditView.php#L191-L215

If I echo out the "$mod_strings[$fieldlabel]" value in the loop, I get the blank, missing values. If I echo out the "$fieldlabel", I get the correct values.

I think it has something to do with the "return_specified_module_language" function returning empty values. If I change the if statement on line 189 to
Code:
if(isset($mod_strings[$fieldlabel]) && $mod_strings[$fieldlabel] != "")
it's "solved", but the underlying issue is not detected yet..

By using
Code:
    echo "<pre>";
      print_r($mod_strings);
      echo "</pre>";

I can identify that the $mod_strings is missing the values, they're just empty.
Reply
#6
Possible Resolve?
I think I found the problem. The function "return_specified_module_language" loads the global variable "$mod_strings". The translation tool in coreBOS (I think this is the issue) adds empty keys to that array. So really, the system isn't doing anything wrong. It loads the current language file for the module in use and fills the $mod_strings array. The array keys are just empty, and currently, there's no way of fixing that in-system. I would therefor propose the following fix:

Change line https://github.com/tsolucio/corebos/blob/master/modules/CustomView/EditView.php#L189 to:

Code:
if(isset($mod_strings[$fieldlabel]) && $mod_strings[$fieldlabel] != "")
to make sure the array doesn't get filled with empty values.

This does not fix the issue in reports though Any ideas for a more sustainable solution or how we can apply the same fix in reports?
Reply
#7
Thank you very much for the debugging. It is essential in this case because I can't reproduce the problem.

Can you please try this patch:

https://github.com/tsolucio/corebos/commit/6947cfb85c419d0dd8397b5b4f9f11a74995c362 ?

and let me know if it fixes the problem both on filters and reports.
Joe
TSolucio
Reply
#8
Hi Joe,

This patch seems to work for filters, but not for reports. The problem occurs when creating a new report and selecting custom fields to be displayed, as well as when reports are already created, opened and a dropdown of the available fields is opened (also here, no custom field labels are present). If I have some time, I'll investigate this more. Let me know if you have some file pointers.
Reply
#9
For instance: I've narrowed this down to basically the same issue as filters:

In https://github.com/tsolucio/corebos/blob/master/modules/Reports/ReportColumns.php#L85, change that line to:

PHP Code:
if(isset($mod_strings[$fieldlabel]) && $mod_strings[$fieldlabel] != ""

And the problem during column selection is solved. The custom field labels are displayed correctly. Though I feel the better solution would be if the translation tool (when you click on the hammer icon on the language line in the modules section) would provide a way to translate the custom field labels. Right now, the keys are found in the array in the language file, but the values are empty. That's why the problem occurs: the if statement checks if the key is set, which it is. But there's nothing in it and no easy way to put something in it.

During displaying of previously created reports, the same thing happens here:

https://github.com/tsolucio/corebos/blob/master/modules/Reports/SaveAndRun.php#L354
Reply
#10
The translation tool shows the custom field labels and permits you to change them.
The problem isn't with the custom field labels being there but with them (and others) being empty. If you do not translate and label it will end up as an empty string in the translation file producing the problem you indicate.
I have added a change to fill in these labels with the same value as the key:

https://github.com/tsolucio/corebos/commit/bffa8203454d0287772a1a1908414883a6afc059

this way there will always be a value and the translation tool will still show them in red because it considers them as not translated even if they are.

This update and new save of the translation should fix the problem.
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)