e4cbc4f421
In India a ILS product called Libsuite8 prints barcodes like b0007432. The barcode is not stored anywhere in libsuite8's database. Neither is barcode available in any of the reports generated by the software. The barcode 'b0007432' when scanned into the libsuite8 software is de-constructed like 'b' which is the itemtype i.e. Book in this instance, and '7432' which is the 'Accession Number'. The software then takes the logged in staff's branchcode and does a join on three tables 'Location', 'Media_Type', and 'Books' to retrieve the particular record from the database. There is no possibility of recreating the barcodes for insertion in Koha while doing a retrospective conversion, because of arbitrary length of the barcode string AND arbitrary number of zeros in the numeric part of the printed barcode AND the fact that there are no reports available from the software which contain barcodes AND the fact that the barcode is not stored in the database. But most importantly due to the simple fact that printed barcodes are duplicated among branches. Therefore this patch emulates the functionality of Libsuite8 software of converting the scanned barcode into one stored in Koha using the itemBarcodeInputFilter system preference. To use this new itemBarcodeInputFilter systempreference choice called 'libsuite8', the barcodes stored in Koha must match the pattern of <branchcode>-<itemtype_code>-<accession_number>. This is easy to achieve while doing retrospective conversion from Libsuite8 to Koha. As expected the itemBarcodeInputFilter will return unmodified barcode if presented with a barcode of pattern <branchcode>-<itemtype_code>-<accession_number> This revision corrects the way updatedatabase.pl is changed in order to correctly update version and insert the libsuite8 option in the database. Also kohaversion.pl is changed in the recommended format of 3.0X.0X.XXX to reflect database has changed. This revision also changes the erronorous itemBarcodeInputFilter description in koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref from 'scanned patron barcodes' to 'scanned item barcodes' there by eliminating need for a separate patch for bug 5417. Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> 1) applied patch to HEAD 2) set next database number in kohaversion.pl and updatedatabase.pl 3) webinstaller kicked in, update ok 4) typed the barcodes from test cases into check-in Barcodes used my local branch code, everything seemed ok to me. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
55 lines
2.1 KiB
Perl
55 lines
2.1 KiB
Perl
#!/usr/bin/perl
|
|
#
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Test::More tests => 24;
|
|
C4::Context->_new_userenv(123456);
|
|
C4::Context->set_userenv(1,'kmkale' , 1, 'kk1' , 'IMS', 0, 'kmkale@anantcorp.com');
|
|
|
|
BEGIN {
|
|
use_ok('C4::Circulation');
|
|
}
|
|
|
|
our %inputs = (
|
|
cuecat => ["26002315", '.C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.', ".C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.\r\n",
|
|
'q.C3nZC3nZC3nWDNzYDxf2CNnY.fHmc.C3DWC3nZCNjXD3nW.', '.C3nZC3nZC3nWCxjWE3D1C3nX.cGf2.ENr7C3v7D3T3ENj3C3zYDNnZ.' ],
|
|
whitespace => [" 26002315", "26002315 ", "\n\t26002315\n"],
|
|
'T-prefix' => [qw(T0031472 T32)],
|
|
'libsuite8' => ['b000126', 'b12', 'B0126', 'IMS-B-126', 'ims-b-126','CD0000024','00123','11998'],
|
|
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 )],
|
|
'libsuite8' => ['IMS-b-126', 'IMS-b-12', 'IMS-B-126', 'IMS-B-126', 'ims-b-126','IMS-CD-24','IMS-b-123','IMS-b-11998'],
|
|
other => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
|
|
);
|
|
|
|
my @filters = sort keys %inputs;
|
|
foreach my $filter (@filters) {
|
|
foreach my $datum (@{$inputs{$filter}}) {
|
|
my $expect = shift @{$outputs{$filter}} or die "Internal Test Error: missing expected output for filter '$filter' on input '$datum'";
|
|
my $output = C4::Circulation::barcodedecode($datum, $filter);
|
|
ok($output eq $expect, sprintf("%12s: %20s => %15s", $filter, "'$datum'", "'$expect'"));
|
|
($output eq $expect) or diag "Bad output: '$output'";
|
|
}
|
|
}
|
|
|
|
__END__
|
|
|
|
=head2 C4::Circulation::barcodedecode()
|
|
|
|
This tests avoids being dependent on the database by using the optional
|
|
second argument to barcodedecode.
|
|
|
|
T-prefix style is derived from zero-padded "Follett Classic Code 3 of 9". From:
|
|
www.fsc.follett.com/_file/File/pdf/Barcode%20Symbology%20Q%20%20A%203_05.pdf
|
|
|
|
~ 1 to 7 characters
|
|
~ T, P or X followed by numeric characters
|
|
~ No checkdigit
|
|
|
|
=cut
|