View | Details | Raw Unified | Return to bug 30409
Collapse All | Expand All

(-)a/C4/Circulation.pm (-3 / +3 lines)
Lines 153-158 Will do some manipulation of the barcode for systems that deliver a barcode Link Here
153
to circulation.pl that differs from the barcode stored for the item.
153
to circulation.pl that differs from the barcode stored for the item.
154
For proper functioning of this filter, calling the function on the 
154
For proper functioning of this filter, calling the function on the 
155
correct barcode string (items.barcode) should return an unaltered barcode.
155
correct barcode string (items.barcode) should return an unaltered barcode.
156
Barcode is going to be automatically trimmed of leading/trailing whitespaces.
156
157
157
The optional $filter argument is to allow for testing or explicit 
158
The optional $filter argument is to allow for testing or explicit 
158
behavior that ignores the System Pref.  Valid values are the same as the 
159
behavior that ignores the System Pref.  Valid values are the same as the 
Lines 166-177 System Pref options. Link Here
166
sub barcodedecode {
167
sub barcodedecode {
167
    my ($barcode, $filter) = @_;
168
    my ($barcode, $filter) = @_;
168
    my $branch = C4::Context::mybranch();
169
    my $branch = C4::Context::mybranch();
170
    $barcode =~ s/^\s+|\s+$//g;
169
    $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
171
    $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
170
    Koha::Plugins->call('item_barcode_transform',  \$barcode );
172
    Koha::Plugins->call('item_barcode_transform',  \$barcode );
171
    $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
173
    $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
172
	if ($filter eq 'whitespace') {
174
	if ($filter eq 'cuecat') {
173
		$barcode =~ s/\s//g;
174
	} elsif ($filter eq 'cuecat') {
175
		chomp($barcode);
175
		chomp($barcode);
176
	    my @fields = split( /\./, $barcode );
176
	    my @fields = split( /\./, $barcode );
177
	    my @results = map( C4::Circulation::_decode($_), @fields[ 1 .. $#fields ] );
177
	    my @results = map( C4::Circulation::_decode($_), @fields[ 1 .. $#fields ] );
(-)a/circ/circulation.pl (-1 lines)
Lines 159-165 if (C4::Context->preference("DisplayClearScreenButton")) { Link Here
159
}
159
}
160
160
161
for my $barcode ( @$barcodes ) {
161
for my $barcode ( @$barcodes ) {
162
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
163
    $barcode = barcodedecode( $barcode ) if $barcode;
162
    $barcode = barcodedecode( $barcode ) if $barcode;
164
}
163
}
165
164
(-)a/circ/renew.pl (-1 lines)
Lines 43-49 my $schema = Koha::Database->new()->schema(); Link Here
43
43
44
my $barcode        = $cgi->param('barcode') // '';
44
my $barcode        = $cgi->param('barcode') // '';
45
my $unseen         = $cgi->param('unseen') || 0;
45
my $unseen         = $cgi->param('unseen') || 0;
46
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae
47
$barcode = barcodedecode($barcode) if $barcode;
46
$barcode = barcodedecode($barcode) if $barcode;
48
my $override_limit = $cgi->param('override_limit');
47
my $override_limit = $cgi->param('override_limit');
49
my $override_holds = $cgi->param('override_holds');
48
my $override_holds = $cgi->param('override_holds');
(-)a/circ/returns.pl (-1 lines)
Lines 119-125 foreach ( $query->param ) { Link Here
119
    $counter++;
119
    $counter++;
120
120
121
    # decode barcode    ## Didn't we already decode them before passing them back last time??
121
    # decode barcode    ## Didn't we already decode them before passing them back last time??
122
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
123
    $barcode = barcodedecode($barcode) if $barcode;
122
    $barcode = barcodedecode($barcode) if $barcode;
124
123
125
    ######################
124
    ######################
(-)a/t/Circulation_barcodedecode.t (-5 / +2 lines)
Lines 29-47 t::lib::Mocks::mock_userenv({ branchcode => 'IMS' }); Link Here
29
our %inputs = (
29
our %inputs = (
30
    cuecat     => ["26002315", '.C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.', ".C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.\r\n",
30
    cuecat     => ["26002315", '.C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.', ".C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.\r\n",
31
                    'q.C3nZC3nZC3nWDNzYDxf2CNnY.fHmc.C3DWC3nZCNjXD3nW.', '.C3nZC3nZC3nWCxjWE3D1C3nX.cGf2.ENr7C3v7D3T3ENj3C3zYDNnZ.' ],
31
                    'q.C3nZC3nZC3nWDNzYDxf2CNnY.fHmc.C3DWC3nZCNjXD3nW.', '.C3nZC3nZC3nWCxjWE3D1C3nX.cGf2.ENr7C3v7D3T3ENj3C3zYDNnZ.' ],
32
    whitespace => [" 26002315", "26002315 ", "\n\t26002315\n"],
33
    'T-prefix' => [qw(T0031472 T32)],
32
    'T-prefix' => [qw(T0031472 T32)],
34
    'libsuite8' => ['b000126', 'b12', 'B0126', 'IMS-B-126', 'ims-b-126','CD0000024','00123','11998'],
33
    'libsuite8' => ['b000126', 'b12', 'B0126', 'IMS-B-126', 'ims-b-126','CD0000024','00123','11998'],
35
    EAN13      => [qw(892685001928 695152)],
34
    EAN13      => [qw(892685001928 695152)],
36
    other      => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
35
    other      => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345", " 26002315", "26002315 ", "\n\t26002315\n"],
37
);
36
);
38
our %outputs = (
37
our %outputs = (
39
    cuecat     => ["26002315", "046675000808", "046675000808", "043000112403", "978068484914051500"],
38
    cuecat     => ["26002315", "046675000808", "046675000808", "043000112403", "978068484914051500"],
40
    whitespace => [qw(26002315 26002315 26002315)],
41
    'T-prefix' => [qw(T0031472 T0000002         )],
39
    'T-prefix' => [qw(T0031472 T0000002         )],
42
    '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'],
40
    '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'],
43
    EAN13      => [qw(0892685001928 0000000695152)],
41
    EAN13      => [qw(0892685001928 0000000695152)],
44
    other      => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
42
    other      => [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345", "26002315", "26002315", "26002315"],
45
);
43
);
46
44
47
my @filters = sort keys %inputs;
45
my @filters = sort keys %inputs;
48
- 

Return to bug 30409