Bug 38201: Remove additional fields from resourceAttrs
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
6b12997218
commit
35bc45139a
|
|
@ -106,7 +106,7 @@ export default {
|
|||
this.extendedAttributesResourceType || null,
|
||||
addFiltersToList: this.addFiltersToList || null,
|
||||
formGroupsDisplayMode: this.formGroupsDisplayMode || null,
|
||||
appendToShow: this.appendToShow || null,
|
||||
appendToShow: this.appendToShow || (() => []),
|
||||
nameAttr: this.nameAttr || null,
|
||||
idAttr: this.idAttr || null,
|
||||
};
|
||||
|
|
@ -454,6 +454,14 @@ export default {
|
|||
},
|
||||
[]
|
||||
);
|
||||
if (this.extendedAttributesResourceType) {
|
||||
attributesToConsider.push({
|
||||
name: "additional_fields",
|
||||
type: "additional_fields",
|
||||
extended_attributes_resource_type:
|
||||
this.extendedAttributesResourceType,
|
||||
});
|
||||
}
|
||||
const groupings = attributesToConsider.reduce((acc, attr) => {
|
||||
if (
|
||||
attr.hasOwnProperty("group") &&
|
||||
|
|
@ -556,15 +564,8 @@ export default {
|
|||
acc[attr.name] = false;
|
||||
return acc;
|
||||
}
|
||||
if (
|
||||
attr.name === "additional_fields" ||
|
||||
attr.type === "relationshipWidget"
|
||||
) {
|
||||
acc[
|
||||
attr.name === "additional_fields"
|
||||
? "extended_attributes"
|
||||
: attr.name
|
||||
] = [];
|
||||
if (attr.type === "relationshipWidget") {
|
||||
acc[attr.name] = [];
|
||||
return acc;
|
||||
}
|
||||
acc[attr.name] = null;
|
||||
|
|
@ -572,6 +573,9 @@ export default {
|
|||
},
|
||||
{}
|
||||
);
|
||||
if (this.extendedAttributesResourceType) {
|
||||
this.resourceToBeGenerated.extended_attributes = [];
|
||||
}
|
||||
this.resourceToBeGenerated[this.idAttr] = null;
|
||||
return this.resourceToBeGenerated;
|
||||
},
|
||||
|
|
@ -581,9 +585,7 @@ export default {
|
|||
* @return {Boolean} true if the resource has additional fields, false otherwise.
|
||||
*/
|
||||
hasAdditionalFields() {
|
||||
return this.resourceAttrs.some(
|
||||
attr => attr.name === "additional_fields"
|
||||
);
|
||||
return !!this.extendedAttributesResourceType;
|
||||
},
|
||||
/**
|
||||
* Returns the plural form of the resource name.
|
||||
|
|
|
|||
|
|
@ -139,12 +139,6 @@ export default {
|
|||
label: this.$__("License info"),
|
||||
hideIn: ["List"],
|
||||
},
|
||||
{
|
||||
name: "additional_fields",
|
||||
extended_attributes_resource_type:
|
||||
this.extendedAttributesResourceType,
|
||||
hideIn: ["List"],
|
||||
},
|
||||
{
|
||||
name: "periods",
|
||||
type: "relationshipWidget",
|
||||
|
|
|
|||
|
|
@ -120,12 +120,6 @@ export default {
|
|||
type: "text",
|
||||
label: this.$__("Notes"),
|
||||
},
|
||||
{
|
||||
name: "additional_fields",
|
||||
extended_attributes_resource_type:
|
||||
this.extendedAttributesResourceType,
|
||||
hideIn: ["List"],
|
||||
},
|
||||
{
|
||||
name: "package_agreements",
|
||||
type: "relationshipWidget",
|
||||
|
|
|
|||
|
|
@ -127,12 +127,6 @@ export default {
|
|||
format: this.format_date,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "additional_fields",
|
||||
extended_attributes_resource_type:
|
||||
this.extendedAttributesResourceType,
|
||||
hideIn: ["List"],
|
||||
},
|
||||
{
|
||||
name: "user_roles",
|
||||
type: "relationshipWidget",
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@
|
|||
:resource="resource"
|
||||
></FormRelationshipSelect>
|
||||
</template>
|
||||
<template v-else-if="attr.name == 'additional_fields'">
|
||||
<template v-else-if="attr.type == 'additional_fields'">
|
||||
<AdditionalFieldsEntry
|
||||
:resource="resource"
|
||||
:additional_field_values="resource.extended_attributes"
|
||||
|
|
|
|||
|
|
@ -154,7 +154,6 @@ export default {
|
|||
idAttr: String,
|
||||
apiClient: Object,
|
||||
i18n: Object,
|
||||
resourceAttrs: Array,
|
||||
listComponent: String,
|
||||
newResource: Object,
|
||||
onSubmit: Function,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ export default {
|
|||
idAttr: String,
|
||||
apiClient: Object,
|
||||
i18n: Object,
|
||||
resourceAttrs: Array,
|
||||
listComponent: String,
|
||||
resourceNamePlural: String,
|
||||
getFieldGroupings: Function,
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
</template>
|
||||
<template
|
||||
v-else-if="
|
||||
attr.name == 'additional_fields' &&
|
||||
attr.type == 'additional_fields' &&
|
||||
resource._strings?.additional_field_values.length > 0
|
||||
"
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in New Issue