Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to prevent modification/deletion for extrafields added by modules. #20085

Open
6 tasks
JohnXLivingston opened this issue Feb 16, 2022 · 2 comments
Open
6 tasks
Labels
Feature request This is a feature request

Comments

@JohnXLivingston
Copy link
Contributor

Feature Request

A Dolibarr plugin can create extrafields. Sometime, these extrafields are then required for the module to work.

But any admin can modify the extrafield definition, or event accidentally delete the field (and lose all data!).

It would be very nice to have a way to prevent extrafields modification/deletion.

Use case

Plugins that need extrafields that can't be modified/deleted.

Suggested implementation

For example, an argument for the addExtrafield method, that says that this extrafield can't be edited in the front-end.

So the module can create the extrafield on init. Eventually delete the extrafield on module->remove (or call updateExtrafield to make it editable).

Suggested steps

  • add a column on llx_extrafields table (for example def_editable)
  • add an argument on methods addExtrafield and updateExtrafield to change this new column value
  • admin_extrafields_view.tpl.php: remove delete and edit button if this flag is on
  • admin_extrafields_edit.tpl : check the flag to prevent the edition
  • actions_extrafields.inc.php : check this flag to prevent edition and deletion
  • modMyModule.class.php : update addExtrafields examples in init method. In remove method, add an example of updating the extrafield to set def_editable to false, and an example with deleteExtrafield

I think that's all.

@JohnXLivingston JohnXLivingston added the Feature request This is a feature request label Feb 16, 2022
@github-actions github-actions bot added the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Feb 16, 2023
@JohnXLivingston
Copy link
Contributor Author

In response to github bot: this request is still relevant

@github-actions github-actions bot removed the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Feb 17, 2023
@github-actions github-actions bot added the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Feb 17, 2024
@JohnXLivingston
Copy link
Contributor Author

In response to github bot: this request is still relevant

@github-actions github-actions bot removed the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request This is a feature request
Projects
None yet
Development

No branches or pull requests

1 participant