From bc0ae34098bfa336521691a801a669cdd48457a9 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 2 Mar 2026 15:29:34 -0100 Subject: [PATCH] Bug 37762: VueJS framework: Add attribute.format check in empty groups check This keeps the same functionality as before, i.e. hide the whole group if all attributes within are empty. However it now also checks for 'format' as some resources may want to format the display of empty attributes. Signed-off-by: Jason Robb Signed-off-by: Lisette Scheer Signed-off-by: Lucas Gass --- .../prog/js/vue/composables/base-resource.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js index 95056ec58d..3c6e250d44 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js @@ -507,11 +507,24 @@ export function useBaseResource(resourceConfig) { } if (component === "Show" && resource) { groupFields.forEach(field => { - if ( + const hasStandardData = resource[field.name] != null && (field.type !== "relationshipWidget" || - resource[field.name].length > 0) - ) { + resource[field.name].length > 0); + + let hasFormattedData = false; + if (field.format && typeof field.format === "function") { + const formatted = field.format( + resource[field.name], + resource + ); + hasFormattedData = + formatted !== null && + formatted !== undefined && + formatted !== ""; + } + + if (hasStandardData || hasFormattedData) { groupInfo.hasDataToDisplay = true; } });