From b3558ee08fdeb8a38b0e8677939d36423d8aad84 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 19 Jun 2025 09:41:08 +0100 Subject: [PATCH] Bug 38201: Allow a fallbackType for av selects that have no values Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- .../prog/js/vue/components/Vendors/VendorResource.vue | 1 + .../prog/js/vue/composables/base-resource.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorResource.vue index 1d6a9c970c..8d9e51b2d0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorResource.vue @@ -112,6 +112,7 @@ export default { type: "select", label: $__("Vendor type"), avCat: "av_vendor_types", + fallbackType: "text", }, { name: "aliases", 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 7f2a39c447..4714c8ec45 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 @@ -320,9 +320,13 @@ export function useBaseResource(instancedResource) { if (attr.type === "select" && typeof attr.avCat === "string") { const avKey = attr.avCat; const avArray = authorisedValues[avKey]; - attr.options = avArray; - attr.requiredKey = "value"; - attr.selectLabel = "description"; + if ((!avArray || !avArray.length) && attr.fallbackType) { + attr.type = attr.fallbackType; + } else { + attr.options = avArray; + attr.requiredKey = "value"; + attr.selectLabel = "description"; + } } if (attr.type == "relationship" && attr.componentProps) { Object.keys(attr.componentProps).forEach(key => {