Bugzilla – Attachment 51625 Details for
Bug 15878
C4::Barcodes::hbyymmincr inccorectly calculates max and should warn when no branchcode present
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 15878 - C4::Barcodes::hbyymmincr inccorectly calculates max and should warn when no branchcode present
SIGNED-OFF-Bug-15878---C4Barcodeshbyymmincr-inccor.patch (text/plain), 2.17 KB, created by
Bernardo Gonzalez Kriegel
on 2016-05-19 14:31:53 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 15878 - C4::Barcodes::hbyymmincr inccorectly calculates max and should warn when no branchcode present
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2016-05-19 14:31:53 UTC
Size:
2.17 KB
patch
obsolete
>From 576c372a9f555e52fbf28d8fa2aca1d71bc0bdb9 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 13 May 2016 14:03:37 -0400 >Subject: [PATCH] [SIGNED-OFF] Bug 15878 - C4::Barcodes::hbyymmincr inccorectly > calculates max and should warn when no branchcode present > >Test plan: > >1 - prove t/db_dependent/Barcodes.t >2 - All should pass >3 - Apply first patch (unit tests update) > 4 - Tests should fail on values and warnings > 5 - Apply second patch > 6 - All tests should now pass > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Work as described >Removed tab on line 47 of C4/Barcodes/hbyymmincr.pm >No more qa errors >--- > C4/Barcodes/hbyymmincr.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/C4/Barcodes/hbyymmincr.pm b/C4/Barcodes/hbyymmincr.pm >index 4942443..23280d7 100644 >--- a/C4/Barcodes/hbyymmincr.pm >+++ b/C4/Barcodes/hbyymmincr.pm >@@ -44,7 +44,7 @@ INIT { > > sub db_max { > my $self = shift; >- my $query = "SELECT MAX(SUBSTRING(barcode,-$width)), barcode FROM items WHERE barcode REGEXP ? GROUP BY barcode"; >+ my $query = "SELECT SUBSTRING(barcode,-$width) AS chunk, barcode FROM items WHERE barcode REGEXP ? ORDER BY chunk DESC LIMIT 1"; > $debug and print STDERR "(hbyymmincr) db_max query: $query\n"; > my $sth = C4::Context->dbh->prepare($query); > my ($iso); >@@ -75,6 +75,7 @@ sub initial { > my $self = shift; > # FIXME: populated branch? > my $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); # like "2008-07-02" >+ if ( $self->branch eq '' ) { warn "HBYYMM Barcode was not passed a branch, default is blank" } > return $self->branch . substr($iso,2,2) . substr($iso,5,2) . sprintf('%' . "$width.$width" . 'd',1); > } > >@@ -116,6 +117,7 @@ sub new_object { > my $self = $class_or_object->default_self('hbyymmincr'); > bless $self, $type; > $self->branch(@_ ? shift : $from_obj ? $class_or_object->branch : $branch); >+ if ( $self->branch() eq '' ) { warn "HBYYMM Barcode created with no branchcode, default is blank"; } > # take the branch from argument, or existing object, or default > use Data::Dumper; > $debug and print STDERR "(hbyymmincr) new_object: ", Dumper($self), "\n"; >-- >1.9.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 15878
:
51477
|
51478
|
51479
|
51624
|
51625
|
51688
|
51690
|
51691
|
51692
|
51694
|
51695