Lines 1-8
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
# $Id: barcode.pl,v 1.1.2.2 2006/09/20 02:24:42 kados Exp $ |
4 |
|
5 |
# Copyright 2000-2002 Katipo Communications |
2 |
# Copyright 2000-2002 Katipo Communications |
|
|
3 |
# Parts copyright 2008-2010 Foundations Bible College |
6 |
# |
4 |
# |
7 |
# This file is part of Koha. |
5 |
# This file is part of Koha. |
8 |
# |
6 |
# |
Lines 19-28
Link Here
|
19 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
20 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 |
|
19 |
|
22 |
#use strict; |
20 |
use strict; |
23 |
#use warnings; FIXME - Bug 2505 |
21 |
use warnings; |
|
|
22 |
no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings |
23 |
|
24 |
use C4::Context; |
24 |
use C4::Context; |
25 |
require C4::Dates; |
25 |
require C4::Dates; |
|
|
26 |
|
26 |
my $DEBUG = 0; |
27 |
my $DEBUG = 0; |
27 |
|
28 |
|
28 |
=head1 |
29 |
=head1 |
Lines 97-107
sub plugin_javascript {
Link Here
|
97 |
} |
98 |
} |
98 |
elsif ($autoBarcodeType eq 'hbyymmincr') { # Generates a barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number, reset yearly -fbcit |
99 |
elsif ($autoBarcodeType eq 'hbyymmincr') { # Generates a barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number, reset yearly -fbcit |
99 |
$year = substr($year, -2); |
100 |
$year = substr($year, -2); |
100 |
$query = "SELECT MAX(CAST(SUBSTRING(barcode,7,4) AS signed)) FROM items WHERE barcode REGEXP ?"; |
101 |
$query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) AS number FROM items WHERE barcode REGEXP ?"; |
101 |
my $sth = $dbh->prepare($query); |
102 |
my $sth = $dbh->prepare($query); |
102 |
$sth->execute("^[a-zA-Z]{1,}$year"); |
103 |
$sth->execute("^[a-zA-Z]{1,}$year"); |
103 |
while (my ($count)= $sth->fetchrow_array) { |
104 |
while (my ($count)= $sth->fetchrow_array) { |
104 |
$nextnum = $count if $count; |
105 |
$nextnum = $count if $count; |
|
|
106 |
$nextnum = 0 if $nextnum == 9999; # this sequence only allows for cataloging 10000 books per month |
105 |
warn "Existing incremental number = $nextnum" if $DEBUG; |
107 |
warn "Existing incremental number = $nextnum" if $DEBUG; |
106 |
} |
108 |
} |
107 |
$nextnum++; |
109 |
$nextnum++; |
108 |
- |
|
|