MyField
Presentation
Depending on the type of myfield (fields of a form, list, tab, ...), several other options can be applied to the fields of the forms such as a background color, display/hide them, add an input mask, input in uppercase ...
The combined set of user permissions and myFields access rights allows you to configure user access to the view of fields, their content and their modification.
MyField also allows you to hide menus from groups of users and change their destination URL.
Settings
The module is configured from the module administration page accessible via the menus Home > Configuration > Modules by clicking on the
icon or the
icon at the end of the line.
Module Configuration Page
Activating the context for development
MyField allows you to display on certain Dolibarr pages the contexts that can be used to limit the customization actions of myFields. These contexts will be useful when creating myFields to limit the action of the module to only the pages that have in their code the context indicated on the myField sheet. Configuring the display of contexts on your pages will allow you to identify them to best configure your myfields.
|
Enabling the display of contexts results in messages like the one opposite |
Administrators are above access rules
You can also choose to disable the use of access rights for the administrator user.
If this setting is enabled, the administrator will see, outside of any group, the myfields in operation.
Background color of input areas
By default, input areas in dolibarr are transparent, which does not help readability It is possible to change the background color of input areas
Default button color
There are three types of buttons in Dolibarr:
- Buttons associated with an action
- Disabled buttons
- Buttons performing a deletion
myField allows you to change the color of these
Replacing native buttons
MyField allows replacing standard Dolibarr buttons with icons.
|
instead of |
Support Information
At the bottom of the configuration page you will find technical information related to your installation. This technical information will be useful and may be requested if you encounter a bug in using the module:
Permissions
Access to the module's features can be restricted to existing users and groups or those created after the module is installed.
Click on the – to add a permission.
A granted permission is symbolized by a green check mark (
).
| Warning: there are other settings that can impact access to fields, especially when using an administrator account |
User and group permissions
| Fichier:Myfield-Permissions-Utilisateur.png |
Access to the module's features can be restricted to users and groups, from their profile then Permissions tab, according to the permissions opposite |
Default Permissions
|
The default permissions (Home > Configuration > Security > Default Permissions), granted to any user created after the installation of the module, if he is not added to a group, are the following |
Startup
MyField features are accessible from the Patastools main menu tab. Your secondary menu then presents the following menu entries:
| MyField | The main entry displays a list of all myFields in your environment |
|
New mf Field |
These entries will display the page for creating a new myField according to its type:
|
| List of elements | This entry will also display the list of myFields saved on your environment |
| Access rights to elements | This page will allow you to configure the authorizations of user groups to the features of MyFields, tabs and menus. |
| Import XML | This entry will display a page to copy an import file of a myfield in XML format. |
Customizations
Menus
Creating the myField
The page for creating a menu-type myField is accessible from the secondary menu link Patas-tools > MyField > New myMenu.
|
|
Following the creation of a myField, it will be necessary to define the access rights by user groups from the secondary menu link of the same name (See further)
Let's customize the Home menu.
Let's customize the Commercial Proposals secondary menu and the New Proposal secondary menu entry.
| The secondary menu entry will be moved down one rank with the code -1 in the Move field of its record |
Following the application of these two customizations, the secondary menu becomes:
|
rather than |
Fichier:Myfield-menu-secondary.png |
To differentiate secondary menu entries of the same name, enter the top-level menu to which they are attached separated by a hash mark (#):
|
Add to the label the secondary menu: Commercial proposals#List |
To get |
Tabs
Creating the myField tab
The myField creation page is accessible from the secondary menu link Patastools > MyField > New MyTab.
| Indicate here only the part of the URL following /htdocs/ |
Display request: see Operation section, below
Following the creation of a myField, it will be necessary to define the access rights to the myFields by user groups from the secondary menu link of the same name (See section Configuring access rights).
Example of customizing a tab
Let's customize the tab sheet of the element sheets.
The sheet then becomes
| If the tab is active, the color will be displayed on its edges |
Fields
Creating myField
The myField creation page is accessible from the secondary menu link Patastools > MyField > New MyField.
|
|
| Moving a field in a form is only done within its table. It is therefore possible to move a field up or down, but not to change its column |
Following the creation of a field type myField, it will be necessary to define the access rights to the myFields by user groups from the secondary menu link of the same name (See section Configuring access rights).
Example of customizing a field
Let's customize the field Id. prof. 2 (SIRET) of third-party files.
| The field has been set to invisible with a number input mask (999 999 999 99999) | |
|
By clicking on the Show/Hide link above the table, the field will be displayed according to the settings saved on the myField sheet
|
Lists
It is possible to modify the fields of the native lists of dolibarr (the one with a field selection icon at the end of the list)
Creating myField
List myfields allow you to limit the display of fields. It is necessary to open the list page to retrieve information specific to this type of myField
- the activation context
- the untranslated label of the field
Example of setting
We will modify the "Third party" column on the list of interventions
Depending on the permissions, the field will also be inaccessible in the field selector.
| If you make a list myField invisible, it will be invisible to all users. To hide it only from one or more groups of users, leave it visible and then add access rights! |
Buttons
It is possible to modify the buttons present on the dolibarr files
Creation of myField
Button myfields allow you to make the button invisible, replace the label, the url associated with the button and make its access visible according to the result of an SQL query
| With the native Dolibarr theme, the button label is capitalized, so you must use the original text that you retrieve with the right click and the inspect menu. |
Conditional display SQL query
The processing query will condition the display of the fields according to the correspondence of the object to the query. It is then possible, for example, to display different fields depending on whether the object is a product or a service. It is possible to transmit two values as parameters:
- #ID#: the id of the main object of the page
- #USERID#: the id of the active user
How it works
Enter here the display query applicable to the fields in the following example:
#SEL# allows you to replace the SELECT of the SQL query which will be blocked by Dolibarr's native security (SQL Injection)
#SEL# IF(fk_product_type=1, 1, 0) AS `read`, IF(fk_product_type=1, 1, 0) AS `write` FROM llx_product WHERE rowid=#ID#;
read allows you to authorize or not the global display of the field write allows you to authorize or not its modification (not necessary in the case of a button or a tab...)
If the value is 0, the field is hidden, otherwise it is displayed Be careful, if we leave the field parameter hidden, it will not appear regardless of the value
Example
With the following myfield
| We obtain the following sheet on a product | While on the sheet of a service |
Configuring access rights
As an administrator user, all myFields are visible to you.
| On the MyField module home page, the application of customizations is disabled |
If you have not defined any user groups, myfields are displayed on all users' interfaces.
From the secondary menu entry Patas-Tools > MyField > tab access rights, configure the accesses of the user groups:
Il existe quatre droits d'accès :
| Le champ sera caché aux utilisateurs du groupe. Ils ne pourront pas l'afficher
le lien Show/Hide ne sera pas actif |
Accès en lecture mais bloqué en modification (
)
| Les utilisateurs du groupe pourront afficher le champ, mais ne pourront pas en modifier le contenu. |
Accès en lecture et Accès en modification (
)
|
Les utilisateurs du groupe pourront afficher le champ et le modifier si leurs permissions de groupe ou d'utilisateur le leur permettent. Les paramètres du champ s'appliquent alors (obligatoire, masque de saisie,...) |
Autres fonctionnalités
Import des myField
Il est possible d'enregistrer une liste de myfields et leurs paramétrages en important un fichier XML. Depuis la page Outils Patas-M > MyField > Importer un onglet, collez le fichier XML dans la zone de saisie et cliquez sur le bouton Lancer l'importation.
| Si vous cochez la case Écraser les données précédentes, votre liste de myfields se résumera à ceux présent dans le ficher que vous importez |
Paramétrer ensuite les droits d'accès des utilisateurs au myField.
Contexte d'activation
Une liste de tous les contextes disponible est présent sur le wiki de dolibarr: https://wiki.dolibarr.org/index.php?title=Syst%C3%A8me_de_Hooks#Liste_des_Contexts_disponibles_dans_Dolibarr
quelque uns des plus courants
|
|
Questions fréquentes
Général
Ce chapitre répertorie les difficultés rencontrées avec le module. Vous y trouverez donc des éléments de réponse quant à son utilisation. Si vous rencontrez une autre erreur que celles décrites ci-dessous lors de l'utilisation de ce module :
- Désactivez et réactivez le module,
- Vérifier sur le ChangeLog si une nouvelle version a été publiée,
- Ré-installez/mettez à jour le module,
- Vérifiez que le remplacement de fichiers natifs de Dolibarr ne soit pas nécessaire au bon fonctionnement du module.
- Vérifiez qu'aucune incompatibilité avec un autre module ne soit indiquée. Le cas échéant, suivez nos préconisations.
Si, malgré ces manipulations, l'erreur persiste, contactez-nous en utilisant le formulaire dédié (http://docs.patas-monkey.com/support/). Ce formulaire est le mode de contact à privilégier pour toute difficulté d'utilisation ou remontée de bug. Aussi, nous vous remercions de ne pas multiplier les canaux d'échange pour un même objet.
Affichage d'un message en haut des pages de Dolibarr
Si vos pages de Dolibarr affichent un message semblable à l'image suivante, il ne s'agit pas d'un message d'erreur, mais de l'affichage des contextes de la page courante. Pour ne plus voir ces lignes affichées, désactivez l'affichage du contexte (voir Configuration).
Message erreur d'ordonnancement
Certaines pages de certaines versions de Dolibarr présentent un erreur dans leur code empêchant la bonne application de la personnalisation des champs. MyField permet de les identifier pour les corriger.
Le message d'erreur s'affiche en bas de page et est le suivant
En vous aidant de l'URL de la page, ouvrez le fichier du noyau de Dolibarr pour le modifier. Par exemple, si la page qui comporte le message est http://.../htdocs/custom/myField/admin/extrafields.php, ouvrez successivement les dossiers htdocs, custom, myField, admin et ouvrez le fichier extrafields.php.
L'erreur vient de l'inversion des lignes llxFooter(); et $db->close(); en fin de fichier.







