Bug 22392: Allow barcode to be passed to build_sample_item
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 21 Feb 2019 17:26:33 +0000 (17:26 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 11 Mar 2019 12:36:01 +0000 (12:36 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

t/lib/TestBuilder.pm

index f452d66..550d4e0 100644 (file)
@@ -175,11 +175,16 @@ sub build_sample_item {
     my $itype = delete $args->{itype}
       || $self->build_object( { class => 'Koha::ItemTypes' } )->itemtype;
 
+    my $barcode =
+      exists( $args->{barcode} )
+      ? $args->{barcode}
+      : $self->_gen_text( { info => { size => SIZE_BARCODE } } );
+
     my ( undef, undef, $itemnumber ) = C4::Items::AddItem(
         {
             homebranch    => $library,
             holdingbranch => $library,
-            barcode       => $self->_gen_text( { info => { size => SIZE_BARCODE } } ),
+            barcode       => $barcode,
             itype         => $itype,
             %$args,
         },