use POSIX qw(strftime);
use C4::Branch; # GetBranches
use C4::Log; # logaction
+use Algorithm::CheckDigits;
use Data::Dumper;
# FIXME: $barcode could be "T1", causing warning: substr outside of string
# Why drop the nonzero digit after the T?
# Why pass non-digits (or empty string) to "T%07d"?
+ } elsif ($filter eq 'EAN13') {
+ my $ean = CheckDigits('ean');
+ if ( $ean->is_valid($barcode) ) {
+ if ( length($barcode) == 12 ) {
+ # upgrade UPC-A to EAN-13
+ $barcode = '0' . $barcode;
+ }
+ }
+ return "$barcode - not valid EAN-13/UPC-A"; # XXX comment-out to disable
}
return $barcode; # return barcode, modified or not
}
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choose the fines mode, \'off\', \'test\' (emails admin report) or \'production\' (accrue overdue fines). Requires accruefines cronjob.','off|test|production','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('globalDueDate','','If set, allows a global static due date for all checkouts','10','free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ceilingDueDate','','If set, date due will not be past this date. Enter date according to the dateformat System Preference',NULL,'free');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','whitespace|T-prefix|cuecat','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','whitespace|T-prefix|cuecat|EAN13','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('singleBranchMode',0,'Operate in Single-branch mode, hide branch selection in the OPAC',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('URLLinkText','','Text to display as the link anchor in the OPAC',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACViewOthersSuggestions',0,'If ON, allows all suggestions to be displayed in the OPAC',NULL,'YesNo');
SetVersion ($DBversion);
}
+$DBversion = "3.02.10.001"; # FIXME
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("UPDATE `systempreferences` SET options='whitespace|t-prefix|cuecat|libsuite8|ean13' WHERE variable='itembarcodeinputfilter'");
+ print "Upgrade to $dbversion done (Add itemBarcodeInputFilter choice EAN13)\n";
+ setversion($dbversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
whitespace: Remove spaces from
cuecat: Convert from CueCat form
T-prefix: Remove the first number from T-prefix style
+ EAN13: upgrade 12-digit UPC-A to EAN13 and check validity
- scanned patron barcodes.
-
- Sort previous checkouts on the circulation page from
use strict;
sub kohaversion {
- our $VERSION = '3.02.10.000';
+ our $VERSION = '3.02.10.001';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 18;
BEGIN {
use_ok('C4::Circulation');
'q.C3nZC3nZC3nWDNzYDxf2CNnY.fHmc.C3DWC3nZCNjXD3nW.', '.C3nZC3nZC3nWCxjWE3D1C3nX.cGf2.ENr7C3v7D3T3ENj3C3zYDNnZ.' ],
whitespace => [" 26002315", "26002315 ", "\n\t26002315\n"],
'T-prefix' => [qw(T0031472 T32)],
+ EAN13 => [qw(892685001928 000000695152)],
other => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
);
our %outputs = (
cuecat => ["26002315", "046675000808", "046675000808", "043000112403", "978068484914051500"],
whitespace => [qw(26002315 26002315 26002315)],
'T-prefix' => [qw(T0031472 T0000002 )],
+ EAN13 => [qw(0892685001928 0000000695152)],
other => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
);