Bugzilla – Attachment 124263 Details for
Bug 26351
Add plugin hooks to transform item barcodes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26351: (QA follow-up) Barcodes inputted into Koha should always pass though barcodedecode
Bug-26351-QA-follow-up-Barcodes-inputted-into-Koha.patch (text/plain), 7.25 KB, created by
Jonathan Druart
on 2021-08-31 07:05:47 UTC
(
hide
)
Description:
Bug 26351: (QA follow-up) Barcodes inputted into Koha should always pass though barcodedecode
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-08-31 07:05:47 UTC
Size:
7.25 KB
patch
obsolete
>From 121e63889ae03faf92fa0ce971bec05de6953610 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 16 Oct 2020 10:42:35 -0400 >Subject: [PATCH] Bug 26351: (QA follow-up) Barcodes inputted into Koha should > always pass though barcodedecode > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/ILSDI/Services.pm | 3 +-- > Koha/Item.pm | 3 +-- > cataloguing/additem.pl | 3 +-- > circ/circulation.pl | 4 +--- > circ/returns.pl | 6 ++---- > offline_circ/process_koc.pl | 9 ++------- > opac/sco/sco-main.pl | 2 +- > tools/batchMod.pl | 2 +- > tools/inventory.pl | 2 +- > 9 files changed, 11 insertions(+), 23 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index cd8cfdca368..61026ba1c8b 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -643,8 +643,7 @@ sub GetServices { > > # Issuing management > my $barcode = $item->barcode || ''; >- $barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') ); >- ($barcode) = Koha::Plugins->call('item_barcode_transform', $barcode ) || $barcode; >+ $barcode = barcodedecode($barcode) if $barcode; > if ($barcode) { > my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode ); > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 04748387b88..d7ee2737a52 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -89,8 +89,7 @@ sub store { > $self->itype($self->biblio->biblioitem->itemtype); > } > >- my ($transformed_barcode) = Koha::Plugins->call( 'item_barcode_transform', $self->barcode ) || $self->barcode; >- $self->barcode($transformed_barcode); >+ $self->barcode( barcodedecode( $self->barcode ) ); > > my $today = dt_from_string; > my $action = 'create'; >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index c81e1dc79ef..650a257bd15 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -520,8 +520,7 @@ if ($op eq "additem") { > > my $addedolditem = TransformMarcToKoha( $record ); > >- my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $addedolditem->{'barcode'} ) || $addedolditem->{'barcode'}; >- $addedolditem->{'barcode'} = $new_barcode; >+ $addedolditem->{barcode} = barcodedecode( $addedolditem->{barcode} ); > > # If we have to add or add & duplicate, we add the item > if ( $add_submit || $add_duplicate_submit ) { >diff --git a/circ/circulation.pl b/circ/circulation.pl >index a732b042a08..55fe588706c 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -158,9 +158,7 @@ if (C4::Context->preference("DisplayClearScreenButton")) { > > 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( 'item_barcode_transform', $barcode ) || $barcode; >+ $barcode = barcodedecode( $barcode ) if $barcode; > } > > my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate'); >diff --git a/circ/returns.pl b/circ/returns.pl >index 19825b625d4..7b48b6152c3 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -114,8 +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( 'item_barcode_transform', $barcode ) || $barcode; >- $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter')); >+ $barcode = barcodedecode($barcode) if $barcode; > > ###################### > #Are these lines still useful ? >@@ -249,8 +248,7 @@ if ($transit) { > my $returnbranch; > if ($barcode) { > $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace >- ( $barcode ) = Koha::Plugins->call( 'item_barcode_transform', $barcode ) || $barcode; >- $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter'); >+ $barcode = barcodedecode($barcode) if $barcode; > my $item = Koha::Items->find({ barcode => $barcode }); > > if ( $item ) { >diff --git a/offline_circ/process_koc.pl b/offline_circ/process_koc.pl >index 2c42872b066..6c1562ab3f9 100755 >--- a/offline_circ/process_koc.pl >+++ b/offline_circ/process_koc.pl >@@ -243,10 +243,7 @@ sub arguments_for_command { > sub kocIssueItem { > my $circ = shift; > >- $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter')); >- >- my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode}; >- $circ->{barcode} = $new_barcode; >+ $circ->{barcode} = barcodedecode( $circ->{barcode} ) if $circ->{barcode}; > > my $branchcode = C4::Context->userenv->{branch}; > my $patron = Koha::Patrons->find( { cardnumber => $circ->{cardnumber} } ); >@@ -327,10 +324,8 @@ sub kocIssueItem { > > sub kocReturnItem { > my ( $circ ) = @_; >- $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter')); > >- my ( $new_barcode ) = Koha::Plugins->call( 'item_barcode_transform', $circ->{barcode} ) || $circ->{barcode}; >- $circ->{barcode} = $new_barcode; >+ $circ->{barcode} = barcodedecode( $circ->{barcode} ) if $circ->{barcode}; > > my $item = Koha::Items->find({ barcode => $circ->{barcode} }); > my $biblio = $item->biblio; >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index a12e0e990d9..498e13f59c0 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( 'item_barcode_transform', $barcode ) || $barcode; >+$barcode = barcodedecode( $barcode ) if $barcode; > > my @newissueslist = split /,/, $newissues; > my $issuenoconfirm = 1; #don't need to confirm on issue. >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 29e7a48addb..e8c60d315e2 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( 'item_barcode_transform', $_ ) )[0] || $_ } @barcodelist; >+ @barcodelist = map { barcodedecode( $_ ) } @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 88d730f17f7..4d66352bca0 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('item_barcode_transform', $barcode ) || $barcode; >+ $barcode = barcodedecode($barcode); > > ++$lines_read; > if (length($barcode)>$barcode_size) { >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26351
:
109532
|
109548
|
109671
|
110844
|
110846
|
111575
|
111577
|
111578
|
111579
|
111862
|
111863
|
111894
|
111916
|
111917
|
111918
|
111919
|
111920
|
111921
|
111922
|
113571
|
113572
|
113573
|
113574
|
113575
|
113576
|
113577
|
113578
|
115172
|
115173
|
115174
|
115175
|
115176
|
115177
|
115178
|
115179
|
115180
|
118649
|
118650
|
118651
|
118652
|
118653
|
118654
|
118655
|
118656
|
118657
|
118658
|
118681
|
118682
|
118683
|
118684
|
118685
|
118686
|
118687
|
118688
|
118689
|
118690
|
122433
|
122434
|
122435
|
122436
|
122437
|
122438
|
122439
|
122440
|
122441
|
122442
|
124258
|
124259
|
124260
|
124261
|
124262
|
124263
|
124264
|
124265
|
124266
|
124313
|
125447
|
125763
|
125764
|
125765