From db56e2f58172f2bf730a7c93fe4d2c0dc7b3aeb7 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 10 Jul 2026 16:50:18 +0100 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- .../vue/components/Vendors/VendorResource.vue | 22 ++++++++++++++++--- .../prog/js/vue/composables/base-resource.js | 4 ++++ 2 files changed, 23 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 1499c24080..96159fc967 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 @@ -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 = ""; 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 619d8d5e90..aba8e036a4 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 @@ -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; }