stable
Clone or download
This is a part of story #12634 Add custom metadata in modal In the REST representation of the metadata the value of the "is_required" key is always false. Why? The class attribute $isRequired of the Docman_Metdata.php class is always false. When the metadata is stored in the database the 'required' column of plugin_docman_metadata table is always false! (= 0) It's always false (=0) because at the metadata creation we always init the row 'required' parameter to false ($mdrow['required'] = false) See Docman_Actions.class.php L 1253 To know if a metadata is required or not we had to rely on $isEmptyValueAllowed from the Docman_Metadata.php You can the test fix via the API explorer: => GET /projects/docman_metadata => GET /docman_items/:id => When a metadata is required the "is_required" should be true You can also test via the new document UI: => When a custom metadata is required an asterisk should be displayed next to the label Change-Id: I93ba93b57d53a1646933e92a1eadf8716d9dc2f2
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/docman/include/REST/v1/Metadata/CustomMetadataCollectionBuilder.php | +1 | −1 | Go to diff View file |
M | plugins/docman/include/REST/v1/Metadata/DocmanMetadataRepresentation.php | +2 | −2 | Go to diff View file |
M | plugins/docman/include/REST/v1/Metadata/MetadataRepresentation.php | +4 | −2 | Go to diff View file |
M | plugins/docman/include/REST/v1/Metadata/MetadataRepresentationBuilder.php | +1 | −1 | Go to diff View file |
M | plugins/docman/phpunit/REST/v1/Metadata/CustomMetadataCollectionBuilderTest.php | +4 | −4 | Go to diff View file |
M | plugins/docman/phpunit/REST/v1/MetadataRepresentationBuilderTest.php | +10 | −10 | Go to diff View file |
M | plugins/document/scripts/document/components/Folder/Metadata/CustomMetadata/CustomMetadataString.spec.js | +2 | −0 | Go to diff View file |
M | plugins/document/scripts/document/components/Folder/Metadata/CustomMetadata/CustomMetadataString.vue | +1 | −1 | Go to diff View file |
M | plugins/document/scripts/document/components/Folder/Metadata/CustomMetadata/CustomMetadataText.spec.js | +2 | −0 | Go to diff View file |
M | plugins/document/scripts/document/components/Folder/Metadata/CustomMetadata/CustomMetadataText.vue | +1 | −1 | Go to diff View file |
M | plugins/document/scripts/document/components/Folder/ModalNewItem/NewItemModal.spec.js | +6 | −3 | Go to diff View file |
M | plugins/document/scripts/document/helpers/metadata-helpers/data-transformatter-helper.js | +2 | −1 | Go to diff View file |
M | plugins/document/scripts/document/helpers/metadata-helpers/data-transformatter-helper.spec.js | +8 | −4 | Go to diff View file |