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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 166-172 sub barcodedecode { Link Here
166
    my ($barcode, $filter) = @_;
166
    my ($barcode, $filter) = @_;
167
    my $branch = C4::Context::mybranch();
167
    my $branch = C4::Context::mybranch();
168
    $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
168
    $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter;
169
    ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
169
    ($barcode) = Koha::Plugins->call('item_barcode_transform',  $barcode ) || $barcode;
170
    $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
170
    $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
171
	if ($filter eq 'whitespace') {
171
	if ($filter eq 'whitespace') {
172
		$barcode =~ s/\s//g;
172
		$barcode =~ s/\s//g;
(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 644-650 sub GetServices { Link Here
644
    # Issuing management
644
    # Issuing management
645
    my $barcode = $item->barcode || '';
645
    my $barcode = $item->barcode || '';
646
    $barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') );
646
    $barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') );
647
    ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
647
    ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode;
648
    if ($barcode) {
648
    if ($barcode) {
649
        my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
649
        my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
650
650
(-)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 520-526 if ($op eq "additem") { Link Here
520
520
521
    my $addedolditem = TransformMarcToKoha( $record );
521
    my $addedolditem = TransformMarcToKoha( $record );
522
522
523
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'};
523
    my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'};
524
    $addedolditem->{'barcode'} = $new_barcode;
524
    $addedolditem->{'barcode'} = $new_barcode;
525
525
526
    # If we have to add or add & duplicate, we add the item
526
    # If we have to add or add & duplicate, we add the item
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 160-166 for my $barcode ( @$barcodes ) { Link Here
160
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
160
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
161
    $barcode = barcodedecode($barcode)
161
    $barcode = barcodedecode($barcode)
162
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
162
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
163
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
163
    ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
164
}
164
}
165
165
166
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
166
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
(-)a/circ/returns.pl (-2 / +2 lines)
Lines 114-120 foreach ( $query->param ) { Link Here
114
114
115
    # decode barcode    ## Didn't we already decode them before passing them back last time??
115
    # decode barcode    ## Didn't we already decode them before passing them back last time??
116
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
116
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
117
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
117
    ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
118
    $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
118
    $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
119
119
120
    ######################
120
    ######################
Lines 249-255 if ($transit) { Link Here
249
my $returnbranch;
249
my $returnbranch;
250
if ($barcode) {
250
if ($barcode) {
251
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
251
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
252
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
252
    ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
253
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
253
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
254
    my $item = Koha::Items->find({ barcode => $barcode });
254
    my $item = Koha::Items->find({ barcode => $barcode });
255
255
(-)a/offline_circ/process_koc.pl (-2 / +2 lines)
Lines 245-251 sub kocIssueItem { Link Here
245
245
246
    $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
246
    $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
247
247
248
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode};
248
    my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode};
249
    $circ->{barcode} = $new_barcode;
249
    $circ->{barcode} = $new_barcode;
250
250
251
    my $branchcode = C4::Context->userenv->{branch};
251
    my $branchcode = C4::Context->userenv->{branch};
Lines 329-335 sub kocReturnItem { Link Here
329
    my ( $circ ) = @_;
329
    my ( $circ ) = @_;
330
    $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
330
    $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
331
331
332
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode};
332
    my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode};
333
    $circ->{barcode} = $new_barcode;
333
    $circ->{barcode} = $new_barcode;
334
334
335
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
335
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
(-)a/opac/sco/sco-main.pl (-1 / +1 lines)
Lines 106-112 my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = Link Here
106
    $query->param("newissues")  || '',
106
    $query->param("newissues")  || '',
107
);
107
);
108
108
109
( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
109
( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode;
110
110
111
my @newissueslist = split /,/, $newissues;
111
my @newissueslist = split /,/, $newissues;
112
my $issuenoconfirm = 1; #don't need to confirm on issue.
112
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 211-217 ok( $plugin->can('opac_head'), 'Test plugin can opac_head' ); Link Here
211
ok( $plugin->can('opac_js'), 'Test plugin can opac_js' );
211
ok( $plugin->can('opac_js'), 'Test plugin can opac_js' );
212
ok( $plugin->can('intranet_head'), 'Test plugin can intranet_head' );
212
ok( $plugin->can('intranet_head'), 'Test plugin can intranet_head' );
213
ok( $plugin->can('intranet_js'), 'Test plugin can intranet_js' );
213
ok( $plugin->can('intranet_js'), 'Test plugin can intranet_js' );
214
ok( $plugin->can('barcode_transform'), 'Test plugin can barcode_transform' );
214
ok( $plugin->can('item_barcode_transform'), 'Test plugin can barcode_transform' );
215
ok( $plugin->can('configure'), 'Test plugin can configure' );
215
ok( $plugin->can('configure'), 'Test plugin can configure' );
216
ok( $plugin->can('install'), 'Test plugin can install' );
216
ok( $plugin->can('install'), 'Test plugin can install' );
217
ok( $plugin->can('upgrade'), 'Test plugin can upgrade' );
217
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 374-380 if ($op eq "show"){ Link Here
374
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
374
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
375
            @barcodelist = uniq @barcodelist;
375
            @barcodelist = uniq @barcodelist;
376
376
377
            @barcodelist = map { ( Koha::Plugins->call( 'barcode_transform', 'item', $_ ) )[0] || $_ } @barcodelist;
377
            @barcodelist = map { ( Koha::Plugins->call( 'item_barcode_transform', $_ ) )[0] || $_ } @barcodelist;
378
378
379
            # Note: adding lc for case insensitivity
379
            # Note: adding lc for case insensitivity
380
            my %itemdata = map { lc($_->{barcode}) => $_->{itemnumber} } @{ Koha::Items->search({ barcode => \@barcodelist }, { columns => [ 'itemnumber', 'barcode' ] } )->unblessed };
380
            my %itemdata = map { lc($_->{barcode}) => $_->{itemnumber} } @{ Koha::Items->search({ barcode => \@barcodelist }, { columns => [ 'itemnumber', 'barcode' ] } )->unblessed };
(-)a/tools/inventory.pl (-2 / +1 lines)
Lines 189-195 if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length Link Here
189
    for my $barcode (@uploadedbarcodes) {
189
    for my $barcode (@uploadedbarcodes) {
190
        next unless $barcode;
190
        next unless $barcode;
191
191
192
        ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
192
        ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode;
193
193
194
        ++$lines_read;
194
        ++$lines_read;
195
        if (length($barcode)>$barcode_size) {
195
        if (length($barcode)>$barcode_size) {
196
- 

Return to bug 26351