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

(-)a/C4/Circulation.pm (+2 lines)
Lines 61-66 use Koha::Config::SysPref; Link Here
61
use Koha::Checkouts::ReturnClaims;
61
use Koha::Checkouts::ReturnClaims;
62
use Koha::SearchEngine::Indexer;
62
use Koha::SearchEngine::Indexer;
63
use Koha::Exceptions::Checkout;
63
use Koha::Exceptions::Checkout;
64
use Koha::Plugins;
64
use Carp qw( carp );
65
use Carp qw( carp );
65
use List::MoreUtils qw( any );
66
use List::MoreUtils qw( any );
66
use Scalar::Util qw( looks_like_number );
67
use Scalar::Util qw( looks_like_number );
Lines 165-170 sub barcodedecode { Link Here
165
    my ($barcode, $filter) = @_;
166
    my ($barcode, $filter) = @_;
166
    my $branch = C4::Context::mybranch();
167
    my $branch = C4::Context::mybranch();
167
    $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;
168
    $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
169
	if ($filter eq 'whitespace') {
171
	if ($filter eq 'whitespace') {
170
		$barcode =~ s/\s//g;
172
		$barcode =~ s/\s//g;
(-)a/C4/ILSDI/Services.pm (+2 lines)
Lines 34-39 use C4::Auth; Link Here
34
use Koha::DateUtils qw( dt_from_string );
34
use Koha::DateUtils qw( dt_from_string );
35
use C4::AuthoritiesMarc qw( GetAuthorityXML );
35
use C4::AuthoritiesMarc qw( GetAuthorityXML );
36
36
37
use Koha::Plugins;
37
use Koha::Biblios;
38
use Koha::Biblios;
38
use Koha::Checkouts;
39
use Koha::Checkouts;
39
use Koha::Items;
40
use Koha::Items;
Lines 643-648 sub GetServices { Link Here
643
    # Issuing management
644
    # Issuing management
644
    my $barcode = $item->barcode || '';
645
    my $barcode = $item->barcode || '';
645
    $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;
646
    if ($barcode) {
648
    if ($barcode) {
647
        my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
649
        my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
648
650
(-)a/C4/Items.pm (+1 lines)
Lines 71-76 use Koha::SearchEngine; Link Here
71
use Koha::SearchEngine::Indexer;
71
use Koha::SearchEngine::Indexer;
72
use Koha::SearchEngine::Search;
72
use Koha::SearchEngine::Search;
73
use Koha::Libraries;
73
use Koha::Libraries;
74
use Koha::Plugins;
74
75
75
=head1 NAME
76
=head1 NAME
76
77
(-)a/Koha/Item.pm (+3 lines)
Lines 89-94 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;
93
    $self->barcode($transformed_barcode);
94
92
    my $today  = dt_from_string;
95
    my $today  = dt_from_string;
93
    my $action = 'create';
96
    my $action = 'create';
94
97
(-)a/cataloguing/additem.pl (+4 lines)
Lines 46-51 use Koha::ItemTypes; Link Here
46
use Koha::Libraries;
46
use Koha::Libraries;
47
use Koha::Patrons;
47
use Koha::Patrons;
48
use Koha::SearchEngine::Indexer;
48
use Koha::SearchEngine::Indexer;
49
use Koha::Plugins;
49
use List::MoreUtils qw( any );
50
use List::MoreUtils qw( any );
50
use C4::Search qw( enabled_staff_search_views );
51
use C4::Search qw( enabled_staff_search_views );
51
use Storable qw( freeze thaw );
52
use Storable qw( freeze thaw );
Lines 519-524 if ($op eq "additem") { Link Here
519
520
520
    my $addedolditem = TransformMarcToKoha( $record );
521
    my $addedolditem = TransformMarcToKoha( $record );
521
522
523
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'};
524
    $addedolditem->{'barcode'} = $new_barcode;
525
522
    # 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
523
    if ( $add_submit || $add_duplicate_submit ) {
527
    if ( $add_submit || $add_duplicate_submit ) {
524
528
(-)a/circ/circulation.pl (+2 lines)
Lines 46-51 use Koha::CsvProfiles; Link Here
46
use Koha::Patrons;
46
use Koha::Patrons;
47
use Koha::Patron::Debarments qw( GetDebarments );
47
use Koha::Patron::Debarments qw( GetDebarments );
48
use Koha::DateUtils qw( dt_from_string output_pref );
48
use Koha::DateUtils qw( dt_from_string output_pref );
49
use Koha::Plugins;
49
use Koha::Database;
50
use Koha::Database;
50
use Koha::BiblioFrameworks;
51
use Koha::BiblioFrameworks;
51
use Koha::Items;
52
use Koha::Items;
Lines 159-164 for my $barcode ( @$barcodes ) { Link Here
159
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
160
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
160
    $barcode = barcodedecode($barcode)
161
    $barcode = barcodedecode($barcode)
161
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
162
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
163
    ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
162
}
164
}
163
165
164
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
166
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
(-)a/circ/returns.pl (+3 lines)
Lines 55-60 use Koha::Holds; Link Here
55
use Koha::Items;
55
use Koha::Items;
56
use Koha::Item::Transfers;
56
use Koha::Item::Transfers;
57
use Koha::Patrons;
57
use Koha::Patrons;
58
use Koha::Plugins;
58
59
59
my $query = CGI->new;
60
my $query = CGI->new;
60
61
Lines 113-118 foreach ( $query->param ) { Link Here
113
114
114
    # 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??
115
    $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;
116
    $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
118
    $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
117
119
118
    ######################
120
    ######################
Lines 247-252 if ($transit) { Link Here
247
my $returnbranch;
249
my $returnbranch;
248
if ($barcode) {
250
if ($barcode) {
249
    $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;
250
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
253
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
251
    my $item = Koha::Items->find({ barcode => $barcode });
254
    my $item = Koha::Items->find({ barcode => $barcode });
252
255
(-)a/offline_circ/process_koc.pl (+9 lines)
Lines 35-40 use Koha::UploadedFiles; Link Here
35
use Koha::Account;
35
use Koha::Account;
36
use Koha::Checkouts;
36
use Koha::Checkouts;
37
use Koha::Patrons;
37
use Koha::Patrons;
38
use Koha::Plugins;
38
39
39
use Date::Calc qw( Date_to_Days );
40
use Date::Calc qw( Date_to_Days );
40
41
Lines 243-248 sub kocIssueItem { Link Here
243
    my $circ = shift;
244
    my $circ = shift;
244
245
245
    $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
248
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode};
249
    $circ->{barcode} = $new_barcode;
250
246
    my $branchcode = C4::Context->userenv->{branch};
251
    my $branchcode = C4::Context->userenv->{branch};
247
    my $patron = Koha::Patrons->find( { cardnumber => $circ->{cardnumber} } );
252
    my $patron = Koha::Patrons->find( { cardnumber => $circ->{cardnumber} } );
248
    my $borrower = $patron->unblessed;
253
    my $borrower = $patron->unblessed;
Lines 323-328 sub kocIssueItem { Link Here
323
sub kocReturnItem {
328
sub kocReturnItem {
324
    my ( $circ ) = @_;
329
    my ( $circ ) = @_;
325
    $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
332
    my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode};
333
    $circ->{barcode} = $new_barcode;
334
326
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
335
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
327
    my $biblio = $item->biblio;
336
    my $biblio = $item->biblio;
328
    my $borrowernumber = _get_borrowernumber_from_barcode( $circ->{'barcode'} );
337
    my $borrowernumber = _get_borrowernumber_from_barcode( $circ->{'barcode'} );
(-)a/opac/sco/sco-main.pl (+3 lines)
Lines 46-51 use Koha::Items; Link Here
46
use Koha::Patrons;
46
use Koha::Patrons;
47
use Koha::Patron::Images;
47
use Koha::Patron::Images;
48
use Koha::Patron::Messages;
48
use Koha::Patron::Messages;
49
use Koha::Plugins;
49
use Koha::Token;
50
use Koha::Token;
50
51
51
my $query = CGI->new;
52
my $query = CGI->new;
Lines 105-110 my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = Link Here
105
    $query->param("newissues")  || '',
106
    $query->param("newissues")  || '',
106
);
107
);
107
108
109
( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode;
110
108
my @newissueslist = split /,/, $newissues;
111
my @newissueslist = split /,/, $newissues;
109
my $issuenoconfirm = 1; #don't need to confirm on issue.
112
my $issuenoconfirm = 1; #don't need to confirm on issue.
110
my $issuer   = Koha::Patrons->find( $issuerid )->unblessed;
113
my $issuer   = Koha::Patrons->find( $issuerid )->unblessed;
(-)a/t/db_dependent/Koha/Plugins/Plugins.t (+2 lines)
Lines 211-216 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' );
215
ok( $plugin->can('barcode_generate'), 'Test plugin can barcode_generate' );
214
ok( $plugin->can('configure'), 'Test plugin can configure' );
216
ok( $plugin->can('configure'), 'Test plugin can configure' );
215
ok( $plugin->can('install'), 'Test plugin can install' );
217
ok( $plugin->can('install'), 'Test plugin can install' );
216
ok( $plugin->can('upgrade'), 'Test plugin can upgrade' );
218
ok( $plugin->can('upgrade'), 'Test plugin can upgrade' );
(-)a/t/lib/Koha/Plugin/Test.pm (+9 lines)
Lines 93-98 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 {
97
    my ( $self, $type, $barcode ) = @_;
98
    return "Koha::Plugin::Test::barcode_transform";
99
}
100
101
sub barcode_generate {
102
    my ( $self, $type, $object )
103
}
104
96
sub configure {
105
sub configure {
97
    my ( $self, $args ) = @_;
106
    my ( $self, $args ) = @_;
98
    return "Koha::Plugin::Test::configure";;
107
    return "Koha::Plugin::Test::configure";;
(-)a/tools/batchMod.pl (+4 lines)
Lines 50-55 use Koha::Items; Link Here
50
use Koha::ItemTypes;
50
use Koha::ItemTypes;
51
use Koha::Patrons;
51
use Koha::Patrons;
52
use Koha::SearchEngine::Indexer;
52
use Koha::SearchEngine::Indexer;
53
use Koha::Plugins;
53
54
54
my $input = CGI->new;
55
my $input = CGI->new;
55
my $dbh = C4::Context->dbh;
56
my $dbh = C4::Context->dbh;
Lines 372-377 if ($op eq "show"){ Link Here
372
        if ( my $list = $input->param('barcodelist') ) {
373
        if ( my $list = $input->param('barcodelist') ) {
373
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
374
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
374
            @barcodelist = uniq @barcodelist;
375
            @barcodelist = uniq @barcodelist;
376
377
            @barcodelist = map { ( Koha::Plugins->call( 'barcode_transform', 'item', $_ ) )[0] || $_ } @barcodelist;
378
375
            # Note: adding lc for case insensitivity
379
            # Note: adding lc for case insensitivity
376
            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 };
377
            @itemnumbers = map { exists $itemdata{lc $_} ? $itemdata{lc $_} : () } @barcodelist;
381
            @itemnumbers = map { exists $itemdata{lc $_} ? $itemdata{lc $_} : () } @barcodelist;
(-)a/tools/inventory.pl (-1 / +5 lines)
Lines 41-46 use Koha::AuthorisedValues; Link Here
41
use Koha::BiblioFrameworks;
41
use Koha::BiblioFrameworks;
42
use Koha::ClassSources;
42
use Koha::ClassSources;
43
use Koha::Items;
43
use Koha::Items;
44
use Koha::Plugins;
45
44
use List::MoreUtils qw( none );
46
use List::MoreUtils qw( none );
45
47
46
my $minlocation=$input->param('minlocation') || '';
48
my $minlocation=$input->param('minlocation') || '';
Lines 186-191 if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length Link Here
186
    }
188
    }
187
    for my $barcode (@uploadedbarcodes) {
189
    for my $barcode (@uploadedbarcodes) {
188
        next unless $barcode;
190
        next unless $barcode;
191
192
        ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode;
193
189
        ++$lines_read;
194
        ++$lines_read;
190
        if (length($barcode)>$barcode_size) {
195
        if (length($barcode)>$barcode_size) {
191
            $err_length += 1;
196
            $err_length += 1;
192
- 

Return to bug 26351