[Vtigercrm-developers] Use of vtiger_def_org_field?

Vikas Jain vikas at vtiger.com
Thu Mar 23 13:53:08 GMT 2023


Hi,

vtiger_def_org_field was used to decide if fields are supposed to be shown
or hidden in the crm for non admins.
This was a global configuration(Settings > User Management > Field Access)
to avoid changing in each of the profiles, and affecting only non admins.
We have removed this(I think in 5.4 or 6.1) as this was redundant and
Profiles should be used for controlling field visibility.

I think we are safe to remove this table and its references from the source
code.



On Tue, 14 Mar 2023 at 13:33, Martin Jurcisin <jurcisin at its4you.sk> wrote:

> Hi Rubén,
>
> thank you for your appreciation. But I don't have an account on
> code.vtiger.com, so I can not comment there. Feel free to put my findings
> there by yourself.
>
>
> *Best Regards / mit freundlichen Grüssen Martin Jurčišin IT-Solutions4You
> s.r.o.*
> Dňa 13. 3. 2023 o 17:52 Rubén A. Estrada Orozco napísal(a):
>
> Hi Martin,
>
> Your comments  and tests are very valuable. I think you should post that
> in the issue: https://code.vtiger.com/vtiger/vtigercrm/-/issues/1446
>
> Saludos
>
> Rubén
>
>
> On Mon, Mar 13, 2023 at 3:33 AM Martin Jurcisin <jurcisin at its4you.sk>
> wrote:
>
>> Hi Alan,
>>
>> I think the thread from email archive and the ticket already describe the
>> case of vtiger_def_org_field accurately, I just want to add source code
>> perspective:
>>
>> I reviewed the code of vtiger 7.5 and found that whenever something is
>> inserted in that table, the columns "visible" and "readonly" are set to 0.
>> There is no update. When used, it always ask whether the value is 0, which
>> is obviously always true. So there is no need of this table, unless I am
>> missing something.
>>
>> Then I reviewed the source code of vtiger 5.0.4 (oh, I loved that one :)
>> ). This is quite different. When inserted, "visible" is set to 0 but
>> "readonly" to 1. And there is an update too - in file
>> modules/Settings/UpdateDefaultFieldLevelAccess.php - but it only updates
>> "visible". So it was definitely used - and had a purpose - in old version
>> of vtiger.
>>
>> All that said (well, written), my conclusion is that this table should be
>> removed, as it is not used anymore.
>>
>>
>> *Best Regards / mit freundlichen Grüssen Martin Jurčišin IT-Solutions4You
>> s.r.o.*
>> Dňa 10. 3. 2023 o 15:55 Alan Lord napísal(a):
>>
>> Searching the email archive I found this thread from July 2020 started by
>> Ruben:
>>
>>
>> http://lists.vtigercrm.com/pipermail/vtigercrm-developers/2020-July/038804.html
>>
>> And this ticket:
>>
>> https://code.vtiger.com/vtiger/vtigercrm/-/issues/1446
>>
>> That I also commented on.
>>
>> So I think we still have no idea what this table is actually for ;-)
>>
>> Al
>>
>>
>> On 10/03/2023 11:02, Alan Lord wrote:
>>
>> I had an odd thing happen recently...
>>
>> This is on a vtiger 7.4.0 system which had been migrated from a vtiger
>> 5.x system. At some point in the past, probably when it was v5,  the
>> customer had hidden the secondary email field in the Accounts module
>> (fieldname = email2) - using the layout editor.
>>
>> On Wednesday we needed to use that field again so using the layout editor
>> I re-activiated the field. As an admin, all was fine but non-admin users
>> couldn't see the field. Checking the Profiles, the field was hidden (black)
>> in the non-admin profiles so I made it green (read/write) and saved the
>> profile. The field still wasn't visible...
>>
>> Looking in the database the definition of the two fields
>> (vtiger_field.fieldid 9 & 11) they were pretty much the same configuration
>> (i.e. all the important values like "presence" etc.). And in
>> vtiger_profile2field they were both configured the same too (for all
>> Profiles)!
>>
>> I scratched my head...
>>
>> This morning I decided to take a better look around the database and
>> discovered the visible value was different between fieldid 9 & 11 in the
>> vtiger_def_org_field table. Changing the value fixed the problem and the
>> field was now visible.
>>
>> This isn't something I've seen before - in well over a decade - and to be
>> honest I've never really needed to delve into the vtiger_def_org_field
>> table. So I was just wondering if someone can tell me what it is really
>> for?
>>
>> Grepping the code I can see values are retrieved in CRMEntity, and in a
>> few other places, but it isn't really clear what it is for and why it
>> wasn't updated correctly when I changed the visibility of a field using the
>> normal Admin UI tools.
>>
>> There are not many places where it is written to...
>>
>> In the Profiles Record Model:
>>
>>
>> https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/modules/Settings/Profiles/models/Record.php#L873
>>
>> This method looks a bit wrong to me. It's only got an INSERT statement.
>> Shouldn't this really be an "INSERT ... ON DUPLICATE KEY UPDATE " instead?
>> Or else it will never get updated surely?
>>
>> Same here:
>>
>> https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/include/utils/utils.php#L679
>>
>> There is no way to update. A row in this table would need to be deleted
>> and then re-created.
>>
>>
>> TIA
>>
>> Al
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>>
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>> _______________________________________________
>> http://www.vtiger.com/
>
>
> _______________________________________________http://www.vtiger.com/
>
> _______________________________________________
> http://www.vtiger.com/



-- 
Regards
Vikas
Vtiger Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20230323/0d5730b3/attachment.html>


More information about the vtigercrm-developers mailing list