From 21a8137461061ec1f7e633d048382304934e12de Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 16 Oct 2020 07:36:31 -0400 Subject: [PATCH] Bug 26351: (QA follow-up) Rename barcode_transform to item_barcode_transform Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 2 +- C4/ILSDI/Services.pm | 2 +- Koha/Item.pm | 2 +- cataloguing/additem.pl | 2 +- circ/circulation.pl | 2 +- circ/returns.pl | 4 ++-- offline_circ/process_koc.pl | 4 ++-- opac/sco/sco-main.pl | 2 +- t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t | 2 +- t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t | 2 +- t/db_dependent/Koha/Plugins/Circulation_hooks.t | 2 +- t/db_dependent/Koha/Plugins/Plugins.t | 2 +- t/lib/Koha/Plugin/Test.pm | 6 +++--- tools/batchMod.pl | 2 +- tools/inventory.pl | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 3e64fd24493..c3277e43ca3 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -166,7 +166,7 @@ sub barcodedecode { my ($barcode, $filter) = @_; my $branch = C4::Context::mybranch(); $filter = C4::Context->preference('itemBarcodeInputFilter') unless $filter; - ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode; + ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode; $filter or return $barcode; # ensure filter is defined, else return untouched barcode if ($filter eq 'whitespace') { $barcode =~ s/\s//g; diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index f70100b263d..cd8cfdca368 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -644,7 +644,7 @@ sub GetServices { # Issuing management my $barcode = $item->barcode || ''; $barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') ); - ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode; + ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode; if ($barcode) { my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode ); diff --git a/Koha/Item.pm b/Koha/Item.pm index 3710525a59c..04748387b88 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -89,7 +89,7 @@ sub store { $self->itype($self->biblio->biblioitem->itemtype); } - my ($transformed_barcode) = Koha::Plugins->call( 'barcode_transform', 'item', $self->barcode ) || $self->barcode; + my ($transformed_barcode) = Koha::Plugins->call( 'item_barcode_transform', $self->barcode ) || $self->barcode; $self->barcode($transformed_barcode); my $today = dt_from_string; diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 246064870d0..c81e1dc79ef 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -520,7 +520,7 @@ if ($op eq "additem") { my $addedolditem = TransformMarcToKoha( $record ); - my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'}; + my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'}; $addedolditem->{'barcode'} = $new_barcode; # If we have to add or add & duplicate, we add the item diff --git a/circ/circulation.pl b/circ/circulation.pl index 0dfe8055acb..a732b042a08 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -160,7 +160,7 @@ for my $barcode ( @$barcodes ) { $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace $barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter')); - ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode; + ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode; } my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate'); diff --git a/circ/returns.pl b/circ/returns.pl index 1482a29828c..19825b625d4 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -114,7 +114,7 @@ foreach ( $query->param ) { # decode barcode ## Didn't we already decode them before passing them back last time?? $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace - ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode; + ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode; $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter')); ###################### @@ -249,7 +249,7 @@ if ($transit) { my $returnbranch; if ($barcode) { $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace - ( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode; + ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode; $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter'); my $item = Koha::Items->find({ barcode => $barcode }); diff --git a/offline_circ/process_koc.pl b/offline_circ/process_koc.pl index 27878f02104..2c42872b066 100755 --- a/offline_circ/process_koc.pl +++ b/offline_circ/process_koc.pl @@ -245,7 +245,7 @@ sub kocIssueItem { $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter')); - my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode}; + my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode}; $circ->{barcode} = $new_barcode; my $branchcode = C4::Context->userenv->{branch}; @@ -329,7 +329,7 @@ sub kocReturnItem { my ( $circ ) = @_; $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter')); - my ( $new_barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $circ->{barcode} ) || $circ->{barcode}; + my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode}; $circ->{barcode} = $new_barcode; my $item = Koha::Items->find({ barcode => $circ->{barcode} }); diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 54b4c53382c..a12e0e990d9 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -106,7 +106,7 @@ my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = $query->param("newissues") || '', ); -( $barcode ) = Koha::Plugins->call( 'barcode_transform', 'item', $barcode ) || $barcode; +( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode; my @newissueslist = split /,/, $newissues; my $issuenoconfirm = 1; #don't need to confirm on issue. diff --git a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t b/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t index 9f5fa9ededd..5a6b156f2aa 100755 --- a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t +++ b/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t @@ -70,7 +70,7 @@ subtest '() hook tests' => sub { $item_1->barcode('THISISATEST'); warning_like { $item_1->store(); } - qr/barcode_transform called with parameters: item, THISISATEST/, + qr/item_barcode_transform called with parameter: THISISATEST/, 'AddReserve calls the after_hold_create hook'; $schema->storage->txn_rollback; diff --git a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t index af49ef9563e..aaf43c2ee5c 100755 --- a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t +++ b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t @@ -53,7 +53,7 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { my $plugin = Koha::Plugin::Test->new->enable; my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); - $test_plugin->mock( 'barcode_transform', undef ); + $test_plugin->mock( 'item_barcode_transform', undef ); my $biblio_id; diff --git a/t/db_dependent/Koha/Plugins/Circulation_hooks.t b/t/db_dependent/Koha/Plugins/Circulation_hooks.t index 62cf23b583b..990481a0f20 100755 --- a/t/db_dependent/Koha/Plugins/Circulation_hooks.t +++ b/t/db_dependent/Koha/Plugins/Circulation_hooks.t @@ -66,7 +66,7 @@ subtest 'after_circ_action() hook tests' => sub { my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); $test_plugin->mock( 'after_item_action', undef ); $test_plugin->mock( 'after_biblio_action', undef ); - $test_plugin->mock( 'barcode_transform', undef ); + $test_plugin->mock( 'item_barcode_transform', undef ); my $biblio = $builder->build_sample_biblio(); my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); diff --git a/t/db_dependent/Koha/Plugins/Plugins.t b/t/db_dependent/Koha/Plugins/Plugins.t index 581503895bd..5a1752cd611 100755 --- a/t/db_dependent/Koha/Plugins/Plugins.t +++ b/t/db_dependent/Koha/Plugins/Plugins.t @@ -211,7 +211,7 @@ ok( $plugin->can('opac_head'), 'Test plugin can opac_head' ); ok( $plugin->can('opac_js'), 'Test plugin can opac_js' ); ok( $plugin->can('intranet_head'), 'Test plugin can intranet_head' ); ok( $plugin->can('intranet_js'), 'Test plugin can intranet_js' ); -ok( $plugin->can('barcode_transform'), 'Test plugin can barcode_transform' ); +ok( $plugin->can('item_barcode_transform'), 'Test plugin can barcode_transform' ); ok( $plugin->can('configure'), 'Test plugin can configure' ); ok( $plugin->can('install'), 'Test plugin can install' ); ok( $plugin->can('upgrade'), 'Test plugin can upgrade' ); diff --git a/t/lib/Koha/Plugin/Test.pm b/t/lib/Koha/Plugin/Test.pm index d7abc7550ab..46980056986 100644 --- a/t/lib/Koha/Plugin/Test.pm +++ b/t/lib/Koha/Plugin/Test.pm @@ -93,9 +93,9 @@ sub intranet_js { return "Koha::Plugin::Test::intranet_js"; } -sub barcode_transform { - my ( $self, $type, $barcode ) = @_; - Koha::Exceptions::Exception->throw("barcode_transform called with parameters: $type, $barcode"); +sub item_barcode_transform { + my ( $self, $barcode ) = @_; + Koha::Exceptions::Exception->throw("item_barcode_transform called with parameter: $barcode"); } sub configure { diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 90f9b3bb36d..29e7a48addb 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -374,7 +374,7 @@ if ($op eq "show"){ my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list ); @barcodelist = uniq @barcodelist; - @barcodelist = map { ( Koha::Plugins->call( 'barcode_transform', 'item', $_ ) )[0] || $_ } @barcodelist; + @barcodelist = map { ( Koha::Plugins->call( 'item_barcode_transform', $_ ) )[0] || $_ } @barcodelist; # Note: adding lc for case insensitivity my %itemdata = map { lc($_->{barcode}) => $_->{itemnumber} } @{ Koha::Items->search({ barcode => \@barcodelist }, { columns => [ 'itemnumber', 'barcode' ] } )->unblessed }; diff --git a/tools/inventory.pl b/tools/inventory.pl index 4f692596aa6..88d730f17f7 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -189,7 +189,7 @@ if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length for my $barcode (@uploadedbarcodes) { next unless $barcode; - ($barcode) = Koha::Plugins->call('barcode_transform', 'item', $barcode ) || $barcode; + ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode; ++$lines_read; if (length($barcode)>$barcode_size) { -- 2.25.1