huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
240 stars 80 forks source link

Required properties on templates don't allow editing multiple entities #7236

Open roirobo opened 1 month ago

roirobo commented 1 month ago

Describe the bug In a scenario where you have to edit one single property on several entities, required properties on templates don't allow editing multiple entities, which makes the feature itself useless, unless you deactivate first the mandatory field for all properties within the template, making the workflow tedious and, in template with lot of properties, the feature impractical.

To Reproduce

  1. Go to Settings > Templates and edit a template (e.g.: Admission to the UN).
  2. Turn ON the "Required property" function on any property (e.g.: State and Date of UN Membership Application)
  3. Save and go to Library.
  4. Select several entities from the modified template) and click on Edit.
  5. Change the value of a property different from the ones that are Required properties (e.g.: Uwazi Features).
  6. See error: "An entry is required or has an invalid value. Please correct and try again."

Expected behavior Editing multiple edits should bypass required properties, regardless of whether or not they have values.

Screenshots imagen

Device (please select all that apply)

Browser Firefox 128.2.0esr (64-bit)

Additional context A workaround to this kind of issue has been to:

  1. go to settings of the template: turn OFF the Required property function to all properties that have this feature enabled;
  2. save the template and go to Library;
  3. multiple edit the entities desired; and then
  4. go back to settings of the template and turn ON again the Required property function to all properties that had this feature enabled.

This workflow makes very impractical, specially for those cases where you have templates with lot of properties and most of them are required, as there is no way to know which one are required or not, but to opening each property setting on the template.

RafaPolit commented 1 month ago

This is indeed a bug. Required fields is a feature that is not fully woven into the Uwazi flow. For example, you can bypass it via CSV import and all the required fields missing would still create the entities, but then trying to save them via other flows would prevent the saving.

Indeed, multi-edit with required fields is not something we have tackled but there are things to consider: if one of the multi-edited entities actually DOESN'T have a value for the required field, it should actually throw an error. So this is not as simple as "allowing multi-edit to ignore the required properties".

I would honestly remove the required functionality as it is only meant to enforce users to fill out certain properties. We need to look into this feature as a whole. cc @aphilop