Bugzilla – Attachment 193744 Details for
Bug 14962
Temp Shelving Location / On Display Module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14962: (QA follow-up) Fix barcode handling and async form reset in batch components
9a85d4e.patch (text/plain), 6.25 KB, created by
Martin Renvoize (ashimema)
on 2026-02-24 13:36:59 UTC
(
hide
)
Description:
Bug 14962: (QA follow-up) Fix barcode handling and async form reset in batch components
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-24 13:36:59 UTC
Size:
6.25 KB
patch
obsolete
>From 9a85d4e83c8d27bd74c4de54a656a7e35668e938 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >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 <martin.renvoize@openfifth.co.uk> >--- > .../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 @@ > </template> > > <script> >-import { ref, inject, useTemplateRef, onBeforeMount } from "vue"; >+import { ref, inject, onBeforeMount } from "vue"; > import ButtonSubmit from "../ButtonSubmit.vue"; >-import { storeToRefs } from "pinia"; > import { APIClient } from "../../fetch/api-client.js"; > import { $__ } from "@koha-vue/i18n"; > >@@ -78,9 +77,7 @@ export default { > embedEvent: Function, > }, > setup(props) { >- const DisplayStore = inject("DisplayStore"); >- const { config } = storeToRefs(DisplayStore); >- const { setMessage, setWarning, setError } = inject("mainStore"); >+ const { setMessage, setError } = inject("mainStore"); > > const displays = ref([]); > const display_id = ref(null); >@@ -89,27 +86,30 @@ export default { > const batchRemove = 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, > }; > > client.displayItems.batchDelete(importData).then( > success => { >- setMessage( >- `${$__("Batch job successfully queued.")} <a href="/cgi-bin/koha/admin/background_jobs.pl" target="_blank">${$__("Click here to view job progress")}</a>`, >- true >- ); >+ if (success && success.job_id) >+ setMessage( >+ `${$__("Batch job successfully queued.")} <a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=${success.job_id}" target="_blank">${$__("Click here to view job progress")}</a>`, >+ true >+ ); >+ else >+ setMessage( >+ `${$__("Batch job successfully queued.")} <a href="/cgi-bin/koha/admin/background_jobs.pl" target="_blank">${$__("Click here to view job progress")}</a>`, >+ true >+ ); >+ clearForm(); > }, > error => { > setError( >@@ -121,7 +121,6 @@ export default { > console.error(error); > } > ); >- clearForm(); > }; > const clearForm = () => { > display_id.value = null; >@@ -139,7 +138,6 @@ export default { > }); > return { > setMessage, >- setWarning, > displays, > display_id, > barcodes, >-- >2.53.0 >
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 14962
:
190216
|
190217
|
190218
|
190219
|
190220
|
190221
|
190222
|
190223
|
190224
|
190225
|
190226
|
190227
|
190228
|
190229
|
190230
|
190231
|
190232
|
190571
|
190572
|
193719
|
193720
|
193721
|
193722
|
193723
|
193724
|
193725
|
193726
|
193727
|
193728
|
193729
|
193730
|
193731
|
193732
|
193733
|
193734
|
193735
|
193736
|
193737
|
193738
|
193739
|
193740
|
193741
|
193742
|
193743
|
193744
|
193745
|
193746
|
193747
|
193748
|
193749
|
193750
|
193751
|
193752
|
193753
|
193754
|
193755
|
194285
|
194286
|
194287
|
194288
|
194289
|
194290
|
194291
|
194292
|
194293
|
194294
|
194295
|
194296
|
194297
|
194298
|
194299
|
194300
|
194301
|
194302
|
194303
|
194304
|
194305
|
194306
|
194307
|
194308
|
194309
|
194310
|
194311
|
194312
|
194313
|
194314
|
194315
|
194316
|
194317
|
194318
|
194320
|
194321
|
194322