Bugzilla – Attachment 95349 Details for
Bug 23992
Adding multiple items with barcode might end with infinite loop if same barcode will be next_value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23992: Items multi add - generate 'no_next_barcode' error if no barcode
Bug-23992-Items-multi-add---generate-nonextbarcode.patch (text/plain), 2.11 KB, created by
Andrii Nugged
on 2019-11-12 19:58:16 UTC
(
hide
)
Description:
Bug 23992: Items multi add - generate 'no_next_barcode' error if no barcode
Filename:
MIME Type:
Creator:
Andrii Nugged
Created:
2019-11-12 19:58:16 UTC
Size:
2.11 KB
patch
obsolete
>From 4344c59731a2078a06239e588fc0cd022fadbc0a Mon Sep 17 00:00:00 2001 >From: Andrew Nugged <nugged@gmail.com> >Date: Tue, 12 Nov 2019 19:50:58 +0000 >Subject: [PATCH] Bug 23992: Items multi add - generate 'no_next_barcode' error > if no barcode > >When multiple items added with barcode from the first, we expect for next >barcode to be generated. If it will be the same barcode or empty one, then >error 'no_next_barcode' will be generated to inform user/operator that >operation wasn't completed as expected. >--- > cataloguing/additem.pl | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 2c371def28..8838e768f0 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -575,8 +575,15 @@ if ($op eq "additem") { > # Getting a new barcode (if it is not the first iteration or the barcode we tried already exists) > $barcodevalue = $barcodeobj->next_value($oldbarcode) if ($i > 0 || $exist_itemnumber); > >- # Putting it into the record >- if ($barcodevalue) { >+ # if no barcode then let's generate the error "no_next_barcode", >+ # OR if barcode still the same after 'next_value', let's use this same error to prevent infinite loop: >+ if(! $barcodevalue or $barcodevalue eq $oldbarcode) { >+ push @errors, "no_next_barcode"; >+ $itemrecord = $record; >+ last; >+ } >+ # Putting it into the record >+ else { > if ( C4::Context->preference("autoBarcode") eq 'hbyymmincr' && $i > 0 ) { # The first copy already contains the homebranch prefix > # This is terribly hacky but the easiest way to fix the way hbyymmincr is working > # Contrary to what one might think, the barcode plugin does not prefix the returned string with the homebranch >@@ -614,7 +621,7 @@ if ($op eq "additem") { > # Preparing the next iteration > $oldbarcode = $barcodevalue; > } >- undef($itemrecord); >+ undef($itemrecord) if ! @errors; > } > } > if ($frameworkcode eq 'FA' && $fa_circborrowernumber){ >-- >2.17.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 23992
: 95349