From 3189df3ac9ea5ebabc53be0c12eb192afbd68842 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 Feb 2019 17:26:33 +0000 Subject: [PATCH] Bug 22392: Allow barcode to be passed to build_sample_item Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- t/lib/TestBuilder.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index f452d66375..550d4e06ba 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -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, }, -- 2.39.5