Bugzilla – Attachment 188752 Details for
Bug 41063
Additional fields are broken in Vue (values entered are not saved)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41063: Fix additional fields in Vue
Bug-41063-Fix-additional-fields-in-Vue.patch (text/plain), 4.25 KB, created by
Martin Renvoize (ashimema)
on 2025-10-31 07:32:11 UTC
(
hide
)
Description:
Bug 41063: Fix additional fields in Vue
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-10-31 07:32:11 UTC
Size:
4.25 KB
patch
obsolete
>From 61b666a17bcafee0224a558f9e60c266cfb34649 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Tue, 21 Oct 2025 11:26:09 +0100 >Subject: [PATCH] Bug 41063: Fix additional fields in Vue > >Additional fields added through Vue.js resource forms were not being >saved to the database. This was caused by using ref() instead of >reactive() for the current_additional_fields_values object. Since >ref() only provides shallow reactivity for objects, changes to nested >properties were not being tracked properly. > >This switches to reactive() which provides deep reactivity tracking, >ensuring that all changes to additional field values are properly >captured and submitted when the form is saved. > >Test plan: >1) Go to Administration > Additional fields and add an additional field > for erm_agreements >2) Enable ERM and navigate to ERM > Agreements >3) Click to add a new agreement and then fill out the form, making sure > to add something into your new additional field >4) Hit save and navigate to the agreement you have just added >5) There will be no additional field added >6) Apply patch and yarn js:build >7) Repeat steps 3 - 5 >8) The additional field should be added and displayed correctly > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > .../prog/js/vue/components/AdditionalFieldsEntry.vue | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/AdditionalFieldsEntry.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/AdditionalFieldsEntry.vue >index 5f77d405e28..e7d3dcc2636 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/AdditionalFieldsEntry.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/AdditionalFieldsEntry.vue >@@ -125,7 +125,7 @@ > </template> > > <script> >-import { onBeforeMount, watch, ref } from "vue"; >+import { onBeforeMount, watch, ref, reactive } from "vue"; > import { APIClient } from "../fetch/api-client.js"; > > export default { >@@ -133,7 +133,7 @@ export default { > const initialized = ref(false); > const available_fields = ref([]); > const av_options = ref([]); >- const current_additional_fields_values = ref({}); >+ const current_additional_fields_values = reactive({}); > > onBeforeMount(() => { > const client = APIClient.additional_fields; >@@ -154,7 +154,7 @@ export default { > }; > const cloneField = (available_field, current, event) => { > event.preventDefault(); >- current_additional_fields_values.value[ >+ current_additional_fields_values[ > available_field.extended_attribute_type_id > ].push({ > value: current.value, >@@ -231,7 +231,7 @@ export default { > // Iterate on available fields > newValue.forEach(available_field => { > // Initialize current field as empty array >- current_additional_fields_values.value[ >+ current_additional_fields_values[ > available_field.extended_attribute_type_id > ] = []; > >@@ -264,7 +264,7 @@ export default { > ? av_value[0].label > : ""; > } >- current_additional_fields_values.value[ >+ current_additional_fields_values[ > existing_field_value.field_id > ].push({ > value: existing_field_value.value, >@@ -278,7 +278,7 @@ export default { > if ( > !available_field.authorised_value_category_name > ) { >- current_additional_fields_values.value[ >+ current_additional_fields_values[ > available_field.extended_attribute_type_id > ] = [ > { >-- >2.51.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41063
:
188212
|
188216
|
188228
|
188363
|
188389
|
188390
| 188752 |
188753