Bug 38201: Allow a fallbackType for av selects that have no values

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:
Matt Blenkinsop 2025-06-19 09:41:08 +01:00 committed by Lucas Gass
parent bdc73ccc50
commit b3558ee08f
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 8 additions and 3 deletions

View File

@ -112,6 +112,7 @@ export default {
type: "select",
label: $__("Vendor type"),
avCat: "av_vendor_types",
fallbackType: "text",
},
{
name: "aliases",

View File

@ -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 => {