dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] Question about dictionnary => id versus code


From: Destailleur Laurent
Subject: Re: [Dolibarr-dev] Question about dictionnary => id versus code
Date: Sun, 26 Oct 2014 00:52:27 +0200

The rowid is a technical information. Not used and not visible by
users. When deleting a record and recreating it into dictionnary, id
may have change.
Code is a business information, visible by users. It is the
"functionnal key". That's why we are using the code to forge the
translation and why we are using this to implement business rules(for
exemple "if code = 'ABC' then i do thing differently")
I thnk ther is no really good answer between 1 and 2. Both have
advantage and problems. I may depends on cas. For exemple, for
country, solution would be 2 (because it is cleaner to have "fr" into
child table instead of "1") but history did it with solution 1 and
most cases are using solution 1.
Currently, the better answer i can do is that best method is the one
that is currently coded because changing this create a lot of
regression and does not provide anything for user.


2014-10-24 14:13 GMT+02:00 Florian HENRY <address@hidden>:
> Hello all,
>     I wondering something about best practice with dictionnary dolibarr
> implementation.
>
>     I take two exemple about thirdparty.
>     llx_societe.fk_prospectlevel : a foreign key  on
> llx_c_prospectlevel.code
>         The dictionnay llx_c_prospectlevel don't have rowid column
>
>     llx_societe.fk_typent => a foreign key on llx_c_typent.id
>         The dictionnary  llx_c_typent have a id column (should be renamed
> into rowid by the way) but also get a code column
>
>     What is the best strategy, to your mind, with dictionnary :
>
>         1 :
>             llx_dictionnary_1 (rowid,code,label,active)
>             llx_table.fk_dict1 => llx_dictionnary_1.rowid
>
>         2 :
>             llx_dictionnary_1 (rowid,code,label,active)
>             llx_table.fk_dict1 => llx_dictionnary_1.code
>
> For me the best option is 1 but in this case what is the purpose of a "code"
> column ?
>
> Regards.
>
> --
> Florian Henry
> +33 6 03 76 48 07
> address@hidden
> http://www.open-concept.pro
> Twitter : @_Open_Concept_
> Google+ : https://www.google.com/+Open-conceptPro
>
>
> _______________________________________________
> Dolibarr-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
>



-- 
Laurent Destailleur (alias Eldy)
------------------------------------------------------------------------------------
Social networks of my OpenSource projects:
Dolibarr Google+: https://plus.google.com/+DolibarrOrg/
Dolibarr Facebook: https://www.facebook.com/dolibarr
Dolibarr Twitter: http://www.twitter.com/dolibarr
AWStats Google+: https://plus.google.com/+AWStatsOrgPoject/
AWStats Facebook: https://www.facebook.com/awstats.org
AWStats Twitter: http://www.twitter.com/awstats_project



reply via email to

[Prev in Thread] Current Thread [Next in Thread]