Bug 28854: (follow-up) Use barcodedecode in Koha::REST::V1::Items
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 24 Jun 2022 15:55:25 +0000 (16:55 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 13 Jul 2022 13:36:00 +0000 (10:36 -0300)
This removes any leading or trailing whitespace from the external id
passed

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/REST/V1/Items.pm

index 2e54787..88a0675 100644 (file)
@@ -19,6 +19,8 @@ use Modern::Perl;
 
 use Mojo::Base 'Mojolicious::Controller';
 
+use C4::Circulation qw( barcodedecode );
+
 use Koha::Items;
 
 use List::MoreUtils qw( any );
@@ -199,8 +201,8 @@ sub add_to_bundle {
         );
     }
 
-
     my $bundle_item_id = $c->validation->param('body')->{'external_id'};
+    $bundle_item_id = barcodedecode($bundle_item_id);
     my $bundle_item = Koha::Items->find( { barcode => $bundle_item_id } );
 
     unless ($bundle_item) {
@@ -253,6 +255,7 @@ sub remove_from_bundle {
     }
 
     my $bundle_item_id = $c->validation->param('bundled_item_id');
+    $bundle_item_id = barcodedecode($bundle_item_id);
     my $bundle_item = Koha::Items->find( { itemnumber => $bundle_item_id } );
 
     unless ($bundle_item) {