[Vtigercrm-developers] vtiger_entityfield.fieldname [WAS Re: Don't Change the entityfield for Users... [WAS Re: BUG: UI10 with more than 1 target breaking filters...?}]
Alan Lord (News)
alanslists at gmail.com
Thu Jul 2 19:36:15 GMT 2015
modules/Settings/LoginHistory/models/ListView.php also makes the same
assumption about the User entity field...
Al
On 02/07/15 20:00, Alan Lord (News) wrote:
> Dear vtiger developers,
>
> I've just come across another issue relating to use of the fieldname
> column in vtiger_entityfield.
>
> As we discussed in this thread a little while ago, vtiger makes some
> assumptions about this field in two ways. Both are wrong assumptions to
> make in my opinion and can be rectified.
>
> Assumption 1. The Users module entity fieldname will *always* be
> first_name, last_name. (We change this for several clients).
>
> Assumption 2. There will *never* be more than two field names used the
> vtiger_entityname.fieldname value. Although list views and UI10 field
> displays work with 3 or *4* fieldname values (which we have used more
> than once), the search/query generator code is broken so that you can't
> search on anything but the first two fieldname values.
>
> If you go back through this thread you will see that there is a fairly
> simple fix to both problems. (Although the functions are all over the
> place).
>
> I would like to suggest this goes into 6.4.0.
>
> Al
>
> On 02/06/15 11:41, Mariusz Krzaczkowski wrote:
>> Thanks Alan for your fix, I'm sure it will be useful, I have already
>> added it to the system
>>
>> ---
>>
>> Z poważaniem / Regards
>>
>> *Mariusz Krzaczkowski*
>> /Director of Product Development/
>> M: +48 884-998-123
>> E: m.krzaczkowski at yetiforce.com
>> <mailto:m.krzaczkowski at yetiforce.com>
>> ------------------------------------------------------------------------
>>
>> We created an innovative open source project called YetiForceCRM. You
>> can test it here <https://test.yetiforce.com/>, download
>> <https://github.com/YetiForceCompany/YetiForceCRM>it for free or read
>> its documentation <https://yetiforce.com/en/documentation.html>. Follow
>> us on Twitter <https://twitter.com/YetiForceEN>to get real-time info
>> about new functionalities and articles.
>>
>> W dniu 2015-06-02 11:42, Alan Lord napisał(a):
>>
>>> On 01/06/15 16:47, Mariusz Krzaczkowski wrote:
>>>> Alan had a good idea, suggested on your idea and I corrected it. see:
>>>>
>>>> https://github.com/YetiForceCompany/YetiForceCRM/blob/master/include/QueryGenerator/QueryGenerator.php#L721
>>>>
>>>
>>> Thanks for the cluebat :-)
>>>
>>> I have also fixed the bit just below it so that if you want to filter
>>> a column and the Users Module's entityfield is _not_ set to
>>> first_name,last_name works too (it's around line 744):
>>>
>>>
>>>> } elseif (in_array($fieldName, $this->ownerFields)) {
>>>> if($fieldName == 'created_user_id'){
>>>> $concatSql =
>>>> getSqlForNameInDisplayFormat(array('first_name'=>"vtiger_users$fieldName.first_name",'last_name'=>"vtiger_users$fieldName.last_name"),
>>>> 'Users');
>>>> $fieldSql .= "$fieldGlue (trim($concatSql) $valueSql)";
>>>> }else{
>>>> $entityFields =
>>>> Vtiger_Functions::getEntityModuleInfoFieldsFormatted('Users');
>>>> if(count($entityFields['fieldname']) > 1) {
>>>> $columns = array();
>>>> foreach($entityFields['fieldname'] as $i => $fieldname) {
>>>> $columns[$fieldname] = $entityFields['tablename']
>>>> . '.' . $fieldname;
>>>> }
>>>> $concatSql = getSqlForNameInDisplayFormat($columns,
>>>> 'Users');
>>>> $fieldSql .= "$fieldGlue (trim($concatSql) $valueSql OR
>>>> "."vtiger_groups.groupname $valueSql)";
>>>> } else {
>>>> $columnSql = $entityFields['tablename'] . '.' .
>>>> $entityFields['fieldname'];
>>>> $fieldSql .= "$fieldGlue (trim($columnSql) $valueSql OR
>>>> "."vtiger_groups.groupname $valueSql)";
>>>> }
>>>> }
>>>
>>> Cheers
>>>
>>> Al
>>>
>>>
>>> _______________________________________________
>>> http://www.vtiger.com/
>>
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>
>
--
Libertus Solutions
http://www.libertus.co.uk
More information about the vtigercrm-developers
mailing list