From 9a85d4e83c8d27bd74c4de54a656a7e35668e938 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 24 Feb 2026 13:01:15 +0000 Subject: [PATCH] Bug 14962: (QA follow-up) Fix barcode handling and async form reset in batch components Two bugs in both batch add and batch remove Vue components: 1. Barcodes were coerced to Number via .map(n => Number(n)), which converts alphanumeric barcodes (e.g. BC-00012345) to NaN and strips leading zeros from numeric ones. Replace with trim+filter to keep barcodes as strings. 2. clearForm() was called synchronously after registering the .then() callback, so the form was always cleared before the API response arrived. On error the user lost all entered barcodes. Move clearForm() inside the success callback. Also clean up DisplaysBatchRemoveItems: remove unused useTemplateRef, storeToRefs, config, and setWarning; link success message to the specific background job ID. Sponsored-by: ByWater Solutions Signed-of-by: Martin Renvoize --- .../Display/DisplaysBatchAddItems.vue | 14 +++----- .../Display/DisplaysBatchRemoveItems.vue | 36 +++++++++---------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchAddItems.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchAddItems.vue index b6cf7000e11..25c7b3e3077 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchAddItems.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchAddItems.vue @@ -104,19 +104,15 @@ export default { const batchAdd = event => { event.preventDefault(); - barcodes.value = barcodes.value + const barcodeList = barcodes.value .split("\n") - .map(n => Number(n)) - .filter(n => { - if (n == "") return false; - - return true; - }); + .map(n => n.trim()) + .filter(n => n !== ""); const client = APIClient.display; const importData = { display_id: display_id.value, - barcodes: barcodes.value, + barcodes: barcodeList, }; if (date_remove.value != null) importData.date_remove = date_remove.value; @@ -136,6 +132,7 @@ export default { ), true ); + clearForm(); }, error => { setError( @@ -147,7 +144,6 @@ export default { console.error(error); } ); - clearForm(); }; const clearForm = () => { display_id.value = null; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchRemoveItems.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchRemoveItems.vue index 5b4a37d0670..2cbad7849a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchRemoveItems.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchRemoveItems.vue @@ -65,9 +65,8 @@