Yetiforcecrm: Custom fields not working in my developer installation.

Created on 25 Sep 2018  路  10Comments  路  Source: YetiForceCompany/YetiForceCRM

Issue

I have checked all php requirements, and accomplished most of them. Even so, adding custom fields fails silently (on the frontend).

Actual Behavior

When I add a custom field, I get stuck after pressing save (nothing happens)

Expected Behavior

Field should be created

How to trigger the error

Enter to any module field settings page (Software configuration
Standard modules
Edit fields), add a field, press save. Nothing happens (save stays greyed out, php-apache error happens in the background)
yeti_error

Screenshot of configuration

yetiforce_settings

PHP/Apache/Browser Logs

Apache error log:
[Tue Sep 25 20:47:32.645969 2018] [php7:error] [pid 6134] [client XXX.XXX.XXX.XXX:39728] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Vtiger_Block_Model::getInstanceFromBlockObject() must be an instance of vtlib\\Block, boolean given, called in /home/domain/web/domain.tld/public_html/modules/Vtiger/models/Block.php on line 187 and defined in /home/domain/web/domain.tld/public_html/modules/Vtiger/models/Block.php:199\nStack trace:\n#0 /home/domain/web/domain.tld/public_html/modules/Vtiger/models/Block.php(187): Vtiger_Block_Model::getInstanceFromBlockObject(false)\n#1 /home/domain/web/domain.tld/public_html/modules/Settings/LayoutEditor/models/Module.php(223): Vtiger_Block_Model::getInstance('', 'Contacts')\n#2 /home/domain/web/domain.tld/public_html/modules/Settings/LayoutEditor/actions/Field.php(32): Settings_LayoutEditor_Module_Model->addField('Text', '', Array)\n#3 [internal function]: Settings_LayoutEditor_Field_Action->add(Object(App\\Request))\n#4 /home/domain/web/domain.tld/public_html/app/Controller/ExposeMethod.php(63): ca in /home/domain/web/domain.tld/public_html/modules/Vtiger/models/Block.php on line 199, referer: https://domain.tld/index.php?parent=Settings&module=LayoutEditor&sourceModule=Contacts
Chrome console log:
captura de pantalla de 2018-09-25 21-10-52

Your Environment

  • YetiForce Version used: Developer 4.4.44
  • Browser name and version: Google Chrome 67, Firefox 62.0 (64-bit)
  • Environment name and version: Debian 9
  • Operating System and version: Arch Linux
馃悰 bug

Most helpful comment

All 10 comments

By doing some further testing and comparison with http://gitdeveloper.yetiforce.com, I think the culprit is that the "blockid" parameter is not being set for some reason.

Here's gitdeveloper's request captured in Google Chrome's console/network/xhr tab:
captura de pantalla de 2018-09-26 09-52-31
My install:
captura de pantalla de 2018-09-26 09-52-21

Ok, I believe I have found the problem. It might happen on other areas as "blockId" is used on several places.
I think LayoutEditor.js should be updated to replace "blockId" references with "block-id". I only changed the reference within the registerAddCustomFieldEvent function, in order to test if it's the issue.
https://github.com/YetiForceCompany/YetiForceCRM/pull/8143

I can replace and check the other lines as well if you want (and if the solution is correct :) )

The same happens to me.
I made a new installation of version 4.4.0 and upgraded with Improved package 4.40_to_5.0.0.

Errors:
1 - Custom fields - create new.
2 - Filters - Error when creating and editing.

@MexasPT , yes, I believe it's the same problem, the reference is being made to "blockId" instead of "block-id".
There are several instances of this in LayoutEditor.js.
For instance, in line 568 (for the add custom field event):
let blockId = $(e.currentTarget).closest('.editFieldsTable').data('blockId'),
Should be
let blockId = $(e.currentTarget).closest('.editFieldsTable').data('block-id'),

@codibit
Did changing this solve your problem?
I changed the line in question and nothing ...
-> let blockId = $ (e.currentTarget) .closest ('. editFieldsTable'). data ('block-id')

I also changed all references to blockId to block-id but to no avail

:(

@MexasPT try to cleanup browser cache

@MexasPT
Make sure you also copy that file to LayoutEditor.min.js, as the browser is being pointed to that file (which is optimized, but for testing purposes, it's ok to use the original file). Then clear your browser cache or completely reload the page (for instance, by pressing "CTRL+SHIFT+R" in Google Chrome or Mozilla Firefox).

2 - Filters - Error when creating and editing.

I don't think the filters are directly related to this error though, at least not on the same source file.

@rskrzypczak
It worked!
Fields and filters ok. 馃憤

Was this page helpful?
0 / 5 - 0 ratings