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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 176-182 sub barcodedecode { Link Here
176
    my ($barcode, $filter) = @_;
176
    my ($barcode, $filter) = @_;
177
    my $branch = C4::Context::mybranch();
177
    my $branch = C4::Context::mybranch();
178
    $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
178
    $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
179
    ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
179
    ($barcode) = Koha::Plugins->call('item_barcode_transform',  $barcode ) || $barcode;
180
    $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
180
    $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
181
	if ($filter eq 'whitespace') {
181
	if ($filter eq 'whitespace') {
182
		$barcode =~ s/\s//g;
182
		$barcode =~ s/\s//g;
(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 628-634 sub GetServices { Link Here
628
    # Issuing management
628
    # Issuing management
629
    my $barcode = $item->barcode || '';
629
    my $barcode = $item->barcode || '';
630
    $barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') );
630
    $barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') );
631
    ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
631
    ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode;
632
    if ($barcode) {
632
    if ($barcode) {
633
        my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
633
        my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
634
634
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 89-95 sub store { Link Here
89
        $self->itype($self->biblio->biblioitem->itemtype);
89
        $self->itype($self->biblio->biblioitem->itemtype);
90
    }
90
    }
91
91
92
    my ($transformed_barcode) = Koha::Plugins->call( 'barcode_transform', 'item', $self->barcode ) || $self->barcode;
92
    my ($transformed_barcode) = Koha::Plugins->call( 'item_barcode_transform', $self->barcode ) || $self->barcode;
93
    $self->barcode($transformed_barcode);
93
    $self->barcode($transformed_barcode);
94
94
95
    my $today         = dt_from_string;
95
    my $today         = dt_from_string;
(-)a/cataloguing/additem.pl (-1 / +1 lines)
Lines 517-523 if ($op eq "additem") { Link Here
517
517
518
    my $addedolditem = TransformMarcToKoha( $record );
518
    my $addedolditem = TransformMarcToKoha( $record );
519
519
520
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'};
520
    my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'};
521
    $addedolditem->{'barcode'} = $new_barcode;
521
    $addedolditem->{'barcode'} = $new_barcode;
522
522
523
    # If we have to add or add & duplicate, we add the item
523
    # If we have to add or add & duplicate, we add the item
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 166-172 for my $barcode ( @$barcodes ) { Link Here
166
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
166
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
167
    $barcode = barcodedecode($barcode)
167
    $barcode = barcodedecode($barcode)
168
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
168
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
169
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
169
    ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
170
}
170
}
171
171
172
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
172
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
(-)a/circ/returns.pl (-2 / +2 lines)
Lines 115-121 foreach ( $query->param ) { Link Here
115
115
116
    # decode barcode    ## Didn't we already decode them before passing them back last time??
116
    # decode barcode    ## Didn't we already decode them before passing them back last time??
117
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
117
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
118
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
118
    ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
119
    $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
119
    $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
120
120
121
    ######################
121
    ######################
Lines 245-251 if ($canceltransfer){ Link Here
245
my $returnbranch;
245
my $returnbranch;
246
if ($barcode) {
246
if ($barcode) {
247
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
247
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
248
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
248
    ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
249
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
249
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
250
    my $item = Koha::Items->find({ barcode => $barcode });
250
    my $item = Koha::Items->find({ barcode => $barcode });
251
251
(-)a/offline_circ/process_koc.pl (-2 / +2 lines)
Lines 248-254 sub kocIssueItem { Link Here
248
248
249
    $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
249
    $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
250
250
251
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode};
251
    my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode};
252
    $circ->{barcode} = $new_barcode;
252
    $circ->{barcode} = $new_barcode;
253
253
254
    my $branchcode = C4::Context->userenv->{branch};
254
    my $branchcode = C4::Context->userenv->{branch};
Lines 332-338 sub kocReturnItem { Link Here
332
    my ( $circ ) = @_;
332
    my ( $circ ) = @_;
333
    $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
333
    $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
334
334
335
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode};
335
    my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode};
336
    $circ->{barcode} = $new_barcode;
336
    $circ->{barcode} = $new_barcode;
337
337
338
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
338
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
(-)a/opac/sco/sco-main.pl (-1 / +1 lines)
Lines 110-116 my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = Link Here
110
    $query->param("newissues")  || '',
110
    $query->param("newissues")  || '',
111
);
111
);
112
112
113
( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
113
( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
114
114
115
my @newissueslist = split /,/, $newissues;
115
my @newissueslist = split /,/, $newissues;
116
my $issuenoconfirm = 1; #don't need to confirm on issue.
116
my $issuenoconfirm = 1; #don't need to confirm on issue.
(-)a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t (-1 / +1 lines)
Lines 70-76 subtest '() hook tests' => sub { Link Here
70
    $item_1->barcode('THISISATEST');
70
    $item_1->barcode('THISISATEST');
71
71
72
    warning_like { $item_1->store(); }
72
    warning_like { $item_1->store(); }
73
        qr/barcode_transform called with parameters: item, THISISATEST/,
73
        qr/item_barcode_transform called with parameter: THISISATEST/,
74
        'AddReserve calls the after_hold_create hook';
74
        'AddReserve calls the after_hold_create hook';
75
75
76
    $schema->storage->txn_rollback;
76
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t (-1 / +1 lines)
Lines 53-59 subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { Link Here
53
    my $plugin = Koha::Plugin::Test->new->enable;
53
    my $plugin = Koha::Plugin::Test->new->enable;
54
54
55
    my $test_plugin = Test::MockModule->new('Koha::Plugin::Test');
55
    my $test_plugin = Test::MockModule->new('Koha::Plugin::Test');
56
    $test_plugin->mock( 'barcode_transform', undef );
56
    $test_plugin->mock( 'item_barcode_transform', undef );
57
57
58
    my $biblio_id;
58
    my $biblio_id;
59
59
(-)a/t/db_dependent/Koha/Plugins/Circulation_hooks.t (-1 / +1 lines)
Lines 66-72 subtest 'after_circ_action() hook tests' => sub { Link Here
66
    my $test_plugin = Test::MockModule->new('Koha::Plugin::Test');
66
    my $test_plugin = Test::MockModule->new('Koha::Plugin::Test');
67
    $test_plugin->mock( 'after_item_action',   undef );
67
    $test_plugin->mock( 'after_item_action',   undef );
68
    $test_plugin->mock( 'after_biblio_action', undef );
68
    $test_plugin->mock( 'after_biblio_action', undef );
69
    $test_plugin->mock( 'barcode_transform', undef );
69
    $test_plugin->mock( 'item_barcode_transform', undef );
70
70
71
    my $biblio = $builder->build_sample_biblio();
71
    my $biblio = $builder->build_sample_biblio();
72
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
72
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
(-)a/t/db_dependent/Koha/Plugins/Plugins.t (-1 / +1 lines)
Lines 181-187 ok( $plugin->can('opac_head'), 'Test plugin can opac_head' ); Link Here
181
ok( $plugin->can('opac_js'), 'Test plugin can opac_js' );
181
ok( $plugin->can('opac_js'), 'Test plugin can opac_js' );
182
ok( $plugin->can('intranet_head'), 'Test plugin can intranet_head' );
182
ok( $plugin->can('intranet_head'), 'Test plugin can intranet_head' );
183
ok( $plugin->can('intranet_js'), 'Test plugin can intranet_js' );
183
ok( $plugin->can('intranet_js'), 'Test plugin can intranet_js' );
184
ok( $plugin->can('barcode_transform'), 'Test plugin can barcode_transform' );
184
ok( $plugin->can('item_barcode_transform'), 'Test plugin can barcode_transform' );
185
ok( $plugin->can('configure'), 'Test plugin can configure' );
185
ok( $plugin->can('configure'), 'Test plugin can configure' );
186
ok( $plugin->can('install'), 'Test plugin can install' );
186
ok( $plugin->can('install'), 'Test plugin can install' );
187
ok( $plugin->can('upgrade'), 'Test plugin can upgrade' );
187
ok( $plugin->can('upgrade'), 'Test plugin can upgrade' );
(-)a/t/lib/Koha/Plugin/Test.pm (-3 / +3 lines)
Lines 93-101 sub intranet_js { Link Here
93
    return "Koha::Plugin::Test::intranet_js";
93
    return "Koha::Plugin::Test::intranet_js";
94
}
94
}
95
95
96
sub barcode_transform {
96
sub item_barcode_transform {
97
    my ( $self, $type, $barcode ) = @_;
97
    my ( $self, $barcode ) = @_;
98
    Koha::Exceptions::Exception->throw("barcode_transform called with parameters: $type, $barcode");
98
    Koha::Exceptions::Exception->throw("item_barcode_transform called with parameter: $barcode");
99
}
99
}
100
100
101
sub configure {
101
sub configure {
(-)a/tools/batchMod.pl (-1 / +1 lines)
Lines 404-410 if ($op eq "show"){ Link Here
404
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
404
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
405
            @barcodelist = uniq @barcodelist;
405
            @barcodelist = uniq @barcodelist;
406
406
407
            @barcodelist = map { ( Koha::Plugins->call( 'barcode_transform', 'item', $_ ) )[0] || $_ } @barcodelist;
407
            @barcodelist = map { ( Koha::Plugins->call( 'item_barcode_transform', $_ ) )[0] || $_ } @barcodelist;
408
408
409
            # Note: adding lc for case insensitivity
409
            # Note: adding lc for case insensitivity
410
            my %itemdata = map { lc($_->{barcode}) => $_->{itemnumber} } @{ Koha::Items->search({ barcode => \@barcodelist }, { columns => [ 'itemnumber', 'barcode' ] } )->unblessed };
410
            my %itemdata = map { lc($_->{barcode}) => $_->{itemnumber} } @{ Koha::Items->search({ barcode => \@barcodelist }, { columns => [ 'itemnumber', 'barcode' ] } )->unblessed };
(-)a/tools/inventory.pl (-2 / +1 lines)
Lines 183-189 if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length Link Here
183
    for my $barcode (@uploadedbarcodes) {
183
    for my $barcode (@uploadedbarcodes) {
184
        next unless $barcode;
184
        next unless $barcode;
185
185
186
        ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
186
        ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode;
187
187
188
        ++$lines_read;
188
        ++$lines_read;
189
        if (length($barcode)>$barcode_size) {
189
        if (length($barcode)>$barcode_size) {
190
- 

Return to bug 26351