Bugzilla – Attachment 169884 Details for
Bug 8425
Autobarcode generates duplicate barcodes with AcqCreateItems = on order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8425: Increment the barcode on each call of set_barcode()
Bug-8425-Increment-the-barcode-on-each-call-of-set.patch (text/plain), 3.12 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-07-31 10:12:58 UTC
(
hide
)
Description:
Bug 8425: Increment the barcode on each call of set_barcode()
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-07-31 10:12:58 UTC
Size:
3.12 KB
patch
obsolete
>From 98588fb977ccad495c7f0c1aa4dda703087d4bc6 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <bski@laposte.net> >Date: Wed, 31 Jul 2024 12:01:54 +0200 >Subject: [PATCH] Bug 8425: Increment the barcode on each call of set_barcode() > >Duplicate barcodes are generated when placing an Order in Acquisitions when AcqCreateItem = "placing an order" and Autobarcode is turned on. > >The problem is that you can accidentally attach 3 items to an order, but only 1 will be saved to the database. When you go to receive your order, you can only receive 1 item as the other two were never made, since the barcode wasn't unique. > >In 3.8.0, a software error comes up which prevent any item creation, I believe, but master (3.9.x) doesn't throw any warnings or errors. > >Yes.. This tries and solve a bug from 3.8.0 /o/ > >Test plan: >1 - set syspref "autoBarcode" to generated in the form <branchcode> yymm001 >2 - set the barcode field to "barcode.pl" in marc structure >3 - create a new basket >4 - add one item to this basket >5 - click on the barcode field -> it should have a barcode >6 - click on add item and click on the new barcode fiels, it should have > the same value > APPLY PATCH: >7 - click on the barcode field -> it should have a barcode >8 - click on add item and click on the new barcode fields, it should have > an higher barcode. > >Note : The barcode is incremented each time the barcode with an empty >value is clicked on and only on "hbyymmincr" mode. Therefore, if the >librarian removes the value from barcode and click again, they could get >another barcode. I do not know if it is an issue. >--- > cataloguing/value_builder/barcode.pl | 29 ++++++++++++++++++++++++---- > 1 file changed, 25 insertions(+), 4 deletions(-) > >diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl >index 5ec7dbe..f3b5bb3 100755 >--- a/cataloguing/value_builder/barcode.pl >+++ b/cataloguing/value_builder/barcode.pl >@@ -90,23 +90,44 @@ my $builder = sub { > # default js body (if not filled by hbyymmincr) > $scr or $scr = <<END_OF_JS; > if (\$('#' + id).val() == '' || force) { >- \$('#' + id).val('$nextnum'); >+ \$('#' + id).val('$nextnum' + offset); > }; > END_OF_JS > > my $js = <<END_OF_JS; > <script> >-function set_barcode(id, force) { >+if(typeof autobarcodetype == 'undefined') { >+ var autobarcodetype = "$autoBarcodeType"; >+ var attempt = -1; >+} >+ >+function set_barcode(id, force, offset=0) { > $scr > } > > function Focus$function_name(event) { >- set_barcode(event.data.id, false); >+ if (autobarcodetype == "hbyymmincr"){ >+ if (document.getElementById(event.data.id).value == ''){ >+ attempt += 1 >+ } >+ set_barcode(event.data.id, false, attempt); >+ } >+ else{ >+ set_barcode(event.data.id, false); >+ } > return false; > } > > function Click$function_name(event) { >- set_barcode(event.data.id, true); >+ if (autobarcodetype == "hbyymmincr"){ >+ if (document.getElementById(event.data.id).value == ''){ >+ attempt += 1 >+ } >+ set_barcode(event.data.id, false, attempt); >+ } >+ else{ >+ set_barcode(event.data.id, false); >+ } > return false; > } > </script> >-- >2.43.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 8425
:
169883
|
169884
|
171350
|
171351
|
174602
|
176586
|
176798