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:
parent
bdc73ccc50
commit
b3558ee08f
|
|
@ -112,6 +112,7 @@ export default {
|
|||
type: "select",
|
||||
label: $__("Vendor type"),
|
||||
avCat: "av_vendor_types",
|
||||
fallbackType: "text",
|
||||
},
|
||||
{
|
||||
name: "aliases",
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue