From bf959a2589c95be49cba899a48d1b63a3d81827e Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 12 Feb 2024 13:45:34 -0100 Subject: [PATCH] Bug 34920: Default to using av.value is av.description is falsy Test plan: 1. Enable ERM module 2. Confirm that you can open the ERM module in the staff interface. 3. Go to the authorized values, select 'ERM_AGREEMENT_CLOSURE_REASON' and edit the 'Cancelled' authorized value by removing the description. Making this change with any of the ERM authorized values will result in an error. 4. Go back to the ERM module and notice that there is an error. 'Something went wrong: Error: Expected string - got null.' 5. Apply patch. Run yarn js:build. Repeat test plan --- .../prog/js/vue/fetch/authorised-values-api-client.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values-api-client.js index 1498cd7c98e..fc553b46c77 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values-api-client.js @@ -22,6 +22,15 @@ export class AVAPIClient extends HttpClient { headers: { "x-koha-embed": "authorised_values", }, + }).then(av_categories => { + av_categories.forEach(av_category => { + av_category.authorised_values = + av_category.authorised_values.map(av => ({ + ...av, + description: av.description || av.value, + })); + }); + return av_categories; }), }; } -- 2.30.2