Bugzilla – Attachment 3655 Details for
Bug 5213
Suffix number sequence not resetting properly in hmyymmincr barcode autogen pattern
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch (find on second comment) commit on git.koha-community.org 9 Sep 2010
koha-fbc.git-67a09248aff57d6016ad260e46adbdd54d4dcbcf.patch (text/plain), 2.67 KB, created by
Stéphane Delaune
on 2011-04-05 09:31:49 UTC
(
hide
)
Description:
patch (find on second comment) commit on git.koha-community.org 9 Sep 2010
Filename:
MIME Type:
Creator:
Stéphane Delaune
Created:
2011-04-05 09:31:49 UTC
Size:
2.67 KB
patch
obsolete
>From 67a09248aff57d6016ad260e46adbdd54d4dcbcf Mon Sep 17 00:00:00 2001 >From: Chris Nighswonger <cnighswonger@foundations.edu> >Date: Thu, 9 Sep 2010 14:28:37 -0400 >Subject: [PATCH] Bug 5213 - Suffix number sequence not resetting properly in hmyymmincr barcode autogen pattern > >Two things are happening. > >First, the SELECT does not account for a branchcode greater than 2 chars. > >This is fixed by just selecting the final four digits representing the >incremental suffix from the barcode field. > >Second, the incremental suffix (4 digits) is not rolling back over to zero when >reaching 9999. > >This pattern probably needs help. It should allow for cataloging of 10000 items >per month as is. I would not recommend doing barcode numbering this way, but >need to support it since it is in use in at least one library. > >This patch also impliments strict and warnings per Bug 2505 >--- > cataloguing/value_builder/barcode.pl | 14 ++++++++------ > 1 files changed, 8 insertions(+), 6 deletions(-) > >diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl >index e21105b..6403212 100755 >--- a/cataloguing/value_builder/barcode.pl >+++ b/cataloguing/value_builder/barcode.pl >@@ -1,8 +1,6 @@ > #!/usr/bin/perl >- >-# $Id: barcode.pl,v 1.1.2.2 2006/09/20 02:24:42 kados Exp $ >- > # Copyright 2000-2002 Katipo Communications >+# Parts copyright 2008-2010 Foundations Bible College > # > # This file is part of Koha. > # >@@ -19,10 +17,13 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-#use strict; >-#use warnings; FIXME - Bug 2505 >+use strict; >+use warnings; >+no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings >+ > use C4::Context; > require C4::Dates; >+ > my $DEBUG = 0; > > =head1 >@@ -97,11 +98,12 @@ sub plugin_javascript { > } > elsif ($autoBarcodeType eq 'hbyymmincr') { # Generates a barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number, reset yearly -fbcit > $year = substr($year, -2); >- $query = "SELECT MAX(CAST(SUBSTRING(barcode,7,4) AS signed)) FROM items WHERE barcode REGEXP ?"; >+ $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) AS number FROM items WHERE barcode REGEXP ?"; > my $sth = $dbh->prepare($query); > $sth->execute("^[a-zA-Z]{1,}$year"); > 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 > warn "Existing incremental number = $nextnum" if $DEBUG; > } > $nextnum++; >-- >1.7.0.4 >
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 5213
: 3655