Bugzilla – Attachment 35734 Details for
Bug 13603
autoBarcode setting hbyymmincr not taking month into account when looking up next increment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13603 - autoBarcode setting hbyymmincr not taking month into account when looking up next increment
PASSED-QA-Bug-13603---autoBarcode-setting-hbyymmin.patch (text/plain), 2.84 KB, created by
Katrin Fischer
on 2015-02-08 20:09:09 UTC
(
hide
)
Description:
[PASSED QA] Bug 13603 - autoBarcode setting hbyymmincr not taking month into account when looking up next increment
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-02-08 20:09:09 UTC
Size:
2.84 KB
patch
obsolete
>From 638f014bed14b252ca791fef7c4653106f4383f7 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 20 Jan 2015 10:11:24 -0500 >Subject: [PATCH] [PASSED QA] Bug 13603 - autoBarcode setting hbyymmincr not > taking month into account when looking up next increment > >The hbyymmincr autoBarcode builder looks up all barcodes that begin with >any number of letters ( the branchcode ) and a two-digit year directly >afterward ( e.g. MPL15 ), then grabs the last four digits as the >increment counter. The problem is, this does not take months into >account, so unlike the description that says the system is limited to >10,000 items a month, it is limited to 10,000 items per *year*. > >This situation can easily be corrected my adding the month into the >lookup ( e.g. MPL1501 ). > >Test Plan: >1) Enable autoBarcode, set to hbyymmincr >2) Catalog an item, let the barcode.pl plugin generate > the next barcode. >3) Catalog an item with the barcode MPL15009999 >4) Catalog another item, use the barcode.pl plugin to > generate the next barcode. >5) Note the barcode is generated ends with '0001' instead of the > correct increment >6) Apply this patch >7) Repeat step 4 >8) Note the barcode now ends with the correct increment > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Jeanne Heicher <nppublib@pa.net> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Problem confirmed - the continuing number bit was not reset >to start counting from 1 again on the beginning of a new month. >--- > C4/Barcodes/ValueBuilder.pm | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > >diff --git a/C4/Barcodes/ValueBuilder.pm b/C4/Barcodes/ValueBuilder.pm >index 13c5792..341d339 100644 >--- a/C4/Barcodes/ValueBuilder.pm >+++ b/C4/Barcodes/ValueBuilder.pm >@@ -44,19 +44,20 @@ my $DEBUG = 0; > > sub get_barcode { > my ($args) = @_; >- my $nextnum; >+ my $nextnum = 0; > my $year = substr($args->{year}, -2); >+ my $month = $args->{mon}; > my $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) AS number FROM items WHERE barcode REGEXP ?"; > my $sth = C4::Context->dbh->prepare($query); >- $sth->execute("^[-a-zA-Z]{1,}$year"); >+ $sth->execute("^[-a-zA-Z]{1,}$year$month"); > while (my ($count)= $sth->fetchrow_array) { > $nextnum = $count if $count; >- $nextnum = 0 if $nextnum == 9999; # this sequence only allows for cataloging 10000 books per month >+ $nextnum = 0 if $nextnum == 9999; # this sequence only allows for cataloging 9999 items per month > warn "Existing incremental number = $nextnum" if $DEBUG; > } > $nextnum++; > $nextnum = sprintf("%0*d", "4",$nextnum); >- $nextnum = $year . $args->{mon} . $nextnum; >+ $nextnum = $year . $month . $nextnum; > warn "New hbyymmincr Barcode = $nextnum" if $DEBUG; > my $scr = " > for (i=0 ; i<document.f.field_value.length ; i++) { >-- >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 13603
:
35409
|
35450
| 35734