Specific user preferences

159 views
Skip to first unread message

Nicolas Micoud

unread,
Sep 19, 2013, 2:06:21 PM9/19/13
to idem...@googlegroups.com
Hi,

I would like to add some specific user preference.
They will be used to define context values for display logics.

What is the best practice ?

Should I customize WPreference and UserPreference ?
Or is there a way to do it in a OSGI/plugin way ?


Thanks,

Nicolas

Jan Thielemann

unread,
Sep 20, 2013, 4:38:56 AM9/20/13
to idem...@googlegroups.com
You could use the session model validator to set context variables on login/logout.

Nicolas Micoud

unread,
Sep 20, 2013, 9:55:29 AM9/20/13
to idem...@googlegroups.com
So a good way would be to add a XX_UserPreference table where i could put a column/field per preference and then use a Event handler with IEventTopics.AFTER_LOGIN or IEventTopics.PREF_AFTER_LOAD ?
(as model validator seems deprecated ?)

WDYT ?

Carlos Antonio Ruiz Gomez

unread,
Sep 20, 2013, 10:17:28 AM9/20/13
to idem...@googlegroups.com
Nicolas, a possible way that I've think about this is to extend the MSysConfig table to include User level.

If we have a definition of the parameters, defining the level, the type and maybe the scope (valid values) we can develop a dynamic form that allows to configure these settings, so we can add preferences on the fly.

If adding User level to sysconfig is too hard, maybe we can think something similar on AD_User_Preference and making the Preference link dynamic according to a prefs definition.

WDYT?

BTW - the list is maintained here on Contributions section:
http://wiki.idempiere.org/en/System_Configurator_(Window_ID-50006)

Regards,

Carlos Ruiz




On 20/09/13 08:55, Nicolas Micoud wrote:

Nicolas Micoud

unread,
Sep 20, 2013, 10:30:05 AM9/20/13
to idem...@googlegroups.com
Hi,

I think it should be better to keep AD_SysConfig for System/Client/Org preferences.

For instance, this window is only accessible by admin and you can easily see preferences that are actually applied.


Create a AD_User_Preference table seems a good idea (or perhaps we can use AD_Preference ?).
So, we would also need a AD_PreferenceDefinition to store the preference name (eg AutoCommit / NewRecord / logMigrationScript /...), their type (list, checkbox, ...) and their default value.

Then, as you suggested, when clicking on UserPanel/Preference we should open a dynamic form which will display the preference.

WDYT ?

Regards,

Nicolas

Carlos Antonio Ruiz Gomez

unread,
Sep 22, 2013, 12:18:32 PM9/22/13
to idem...@googlegroups.com
Hi Nicolas, thinking in draft here that maybe we can do it very simple (maybe we can discuss more design options on next IRC meeting):

What if we create a table called "AD_User_Preference", the structure would be like:
- the 9 required columns (client/org/active/updated*/created*/id/uu)
- AD_User_ID
- AutoCommit (Yes/No)
- AutoNewRecord (Yes/No)
- one column per each preference we want to manage (here we have a restrictions of 1000 for oracle, and for postgresql 250-1600 depending on column types)

For official preferences we use normal names, but for custom preferences we would encourage users to use a CUST_ prefix or an extension prefix (like LCO_)

On login we read the record corresponding to the user and load context variables
@P|AutoCommit|Y@
so we can use the preferences in all parts where context is used.

If the user has not selected a preference and the column has a default then we can set the preference with the default value.

This sounds like a very straightforward approach, we simply define a window to manage the new table, all dictionary help us to define the scope and types of preferences, and we have the advantage to use field groups, and that users can extend this table with custom preferences easily.

Note there are some swing and zk preferences (like DictionaryMaintenance and LogMigrationScript) that are not persisted, so is better to keep them in the actual preference form, but we can add a link in the preference form to open the new preference window.


Regards,

Carlos Ruiz

Nicolas Micoud

unread,
Sep 23, 2013, 8:13:18 AM9/23/13
to idem...@googlegroups.com
hi Carlos,

Sounds nice.

Just one thing : the actual preference panel could have a link to 'My preference' window (based on AD_User_Preference) and 'My profile' window ?

See you on next wednesday :)

Regards,

Nicolas
Reply all
Reply to author
Forward
0 new messages