<div dir="ltr"><div dir="ltr">Hi Martin,</div><div dir="ltr"><br></div><div>Your comments and tests are very valuable. I think you should post that in the issue: <a href="https://code.vtiger.com/vtiger/vtigercrm/-/issues/1446" target="_blank">https://code.vtiger.com/vtiger/vtigercrm/-/issues/1446</a></div><div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr">Saludos<div><br></div><div>Rubén</div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 13, 2023 at 3:33 AM Martin Jurcisin <<a href="mailto:jurcisin@its4you.sk">jurcisin@its4you.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi Alan,</p>
<p>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:</p>
<p>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.</p>
<p>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. <br>
</p>
<p>All that said (well, written), my conclusion is that this table
should be removed, as it is not used anymore.<br>
</p>
<div><i>Best Regards / mit freundlichen
Grüssen<br>
Martin Jurčišin<br>
IT-Solutions4You s.r.o.</i><br>
</div>
<div>Dňa 10. 3. 2023 o 15:55 Alan Lord
napísal(a):<br>
</div>
<blockquote type="cite">Searching
the email archive I found this thread from July 2020 started by
Ruben:
<br>
<br>
<a href="http://lists.vtigercrm.com/pipermail/vtigercrm-developers/2020-July/038804.html" target="_blank">http://lists.vtigercrm.com/pipermail/vtigercrm-developers/2020-July/038804.html</a>
<br>
<br>
And this ticket:
<br>
<br>
<a href="https://code.vtiger.com/vtiger/vtigercrm/-/issues/1446" target="_blank">https://code.vtiger.com/vtiger/vtigercrm/-/issues/1446</a>
<br>
<br>
That I also commented on.
<br>
<br>
So I think we still have no idea what this table is actually for
;-)
<br>
<br>
Al
<br>
<br>
<br>
On 10/03/2023 11:02, Alan Lord wrote:
<br>
<blockquote type="cite">I had an odd thing happen recently...
<br>
<br>
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.
<br>
<br>
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...
<br>
<br>
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)!
<br>
<br>
I scratched my head...
<br>
<br>
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.
<br>
<br>
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?
<br>
<br>
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.
<br>
<br>
There are not many places where it is written to...
<br>
<br>
In the Profiles Record Model:
<br>
<br>
<a href="https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/modules/Settings/Profiles/models/Record.php#L873" target="_blank">https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/modules/Settings/Profiles/models/Record.php#L873</a>
<br>
<br>
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?
<br>
<br>
Same here:
<br>
<a href="https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/include/utils/utils.php#L679" target="_blank">https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/include/utils/utils.php#L679</a>
<br>
<br>
There is no way to update. A row in this table would need to be
deleted and then re-created.
<br>
<br>
<br>
TIA
<br>
<br>
Al
<br>
<br>
_______________________________________________
<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a>
<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________
<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
</blockquote>
</div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div></div>