Lines 24-35
use t::lib::TestBuilder;
Link Here
|
24 |
use DateTime; |
24 |
use DateTime; |
25 |
|
25 |
|
26 |
use C4::Context; |
26 |
use C4::Context; |
27 |
use C4::Biblio; |
|
|
28 |
use C4::Reserves; |
27 |
use C4::Reserves; |
29 |
use C4::Items; |
|
|
30 |
|
28 |
|
31 |
use Koha::Database; |
29 |
use Koha::Database; |
32 |
use Koha::Patron; |
30 |
use Koha::Biblios; |
|
|
31 |
use Koha::Items; |
32 |
use Koha::Patrons; |
33 |
|
33 |
|
34 |
my $builder = t::lib::TestBuilder->new(); |
34 |
my $builder = t::lib::TestBuilder->new(); |
35 |
|
35 |
|
Lines 309-333
$dbh->rollback;
Link Here
|
309 |
sub create_biblio { |
309 |
sub create_biblio { |
310 |
my ($title) = @_; |
310 |
my ($title) = @_; |
311 |
|
311 |
|
312 |
my $record = new MARC::Record; |
312 |
my $biblio = Koha::Biblio->new( { title => $title } )->store; |
313 |
$record->append_fields( |
|
|
314 |
new MARC::Field('200', ' ', ' ', a => $title), |
315 |
); |
316 |
|
317 |
my ($biblionumber) = C4::Biblio::AddBiblio($record, ''); |
318 |
|
313 |
|
319 |
return $biblionumber; |
314 |
return $biblio->biblionumber; |
320 |
} |
315 |
} |
321 |
|
316 |
|
322 |
sub create_item { |
317 |
sub create_item { |
323 |
my ($biblionumber, $barcode) = @_; |
318 |
my ( $biblionumber, $barcode ) = @_; |
324 |
|
319 |
|
325 |
my $item = { |
320 |
Koha::Items->search( { barcode => $barcode } )->delete; |
326 |
barcode => $barcode, |
321 |
my $builder = t::lib::TestBuilder->new; |
327 |
}; |
322 |
my $item = $builder->build( |
328 |
$dbh->do("DELETE FROM items WHERE barcode='$barcode'") if $barcode; |
323 |
{ |
329 |
|
324 |
source => 'Item', |
330 |
my $itemnumber = C4::Items::AddItem($item, $biblionumber); |
325 |
value => { |
|
|
326 |
biblionumber => $biblionumber, |
327 |
barcode => $barcode, |
328 |
} |
329 |
} |
330 |
); |
331 |
|
331 |
|
332 |
return $itemnumber; |
332 |
return $item->{itemnumber}; |
333 |
} |
333 |
} |
334 |
- |
|
|