Bug 23463: Replace new occurrence of AddItem
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 16 Mar 2020 12:49:01 +0000 (13:49 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 23 Mar 2020 09:26:34 +0000 (09:26 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Illrequest.pm

index a11ff86..cd5a593 100644 (file)
@@ -39,7 +39,6 @@ use Koha::Biblios;
 use Koha::Items;
 use Koha::ItemTypes;
 use Koha::Libraries;
-use C4::Items qw( AddItem );
 use C4::Circulation qw( CanBookBeIssued AddIssue  );
 
 use base qw(Koha::Object);
@@ -1166,15 +1165,15 @@ sub check_out {
         my $itemnumber;
         if ($item_count == 0) {
             my $item_hash = {
+                biblionumber  => $self->biblio_id,
                 homebranch    => $params->{branchcode},
                 holdingbranch => $params->{branchcode},
                 location      => $params->{branchcode},
                 itype         => $params->{item_type},
                 barcode       => 'ILL-' . $self->illrequest_id
             };
-            my (undef, undef, $item_no) =
-                AddItem($item_hash, $self->biblio_id);
-            $itemnumber = $item_no;
+            my $item = Koha::Item->new($item_hash);
+            $itemnumber = $item->itemnumber;
         } else {
             $itemnumber = $items[0]->itemnumber;
         }