Bug 43053: Fix display of vendor payment methods
Test plan: 1) Add multiple vendor payment method authorised values 2) Create a vendor and add multiple payment methods 3) Click to edit, the payment method will be displaying one option of a "|" concatenated string 4) Apply patch and run yarn js:build 5) Hard refresh the browser, the payment methods should now display correctly 6) Edit the payment methods and save, the saved changes should be correctly displayed on the vendor details page 7) Add a new vendor with multiple payment methods, it should save correctly Signed-off-by: David Nind <david@davidnind.com> 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
a077c111a8
commit
db56e2f581
|
|
@ -795,9 +795,25 @@ export default {
|
|||
componentData.resource.value.discount =
|
||||
componentData.resource.value.discount.toFixed(1);
|
||||
}
|
||||
componentData.resource.payment_method = resource.payment_method
|
||||
? resource.payment_method.split("|")
|
||||
: [];
|
||||
if (resource.payment_method) {
|
||||
const avs =
|
||||
componentData.instancedResource.authorisedValues
|
||||
.av_vendor_payment_methods;
|
||||
const paymentMethods = resource.payment_method.split("|");
|
||||
|
||||
resource.payment_method = paymentMethods.reduce(
|
||||
(acc, pm) => {
|
||||
const avMatch = avs.find(av => av.value === pm);
|
||||
if (!avMatch) return acc;
|
||||
acc.push({
|
||||
description: avMatch.description,
|
||||
value: avMatch.value,
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
if (caller === "show") {
|
||||
let physicalAddress = "";
|
||||
|
|
|
|||
|
|
@ -626,6 +626,10 @@ export function useBaseResource(resourceConfig) {
|
|||
return acc;
|
||||
}
|
||||
if (["text", "textarea", "select"].includes(attr.type)) {
|
||||
if (attr.allowMultipleChoices) {
|
||||
acc[attr.name] = [];
|
||||
return acc;
|
||||
}
|
||||
acc[attr.name] = "";
|
||||
return acc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue