[Koha-bugs] [Bug 19884] Improve performance of GetItem

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jan 3 16:55:27 CET 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19884

--- Comment #22 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
David, I was talking about something like that:
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index b26c767ef8..373d9f8330 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -2840,7 +2840,7 @@ sub EmbedItemsInMarcBiblio {
         && ( C4::Context->preference('OpacHiddenItems') !~ /^\s*$/ );
     require C4::Items;

-    my $items = C4::Items::GetItems($itemnumbers);
+    my $items = Koha::Items->search({ itemnumber => { -in => $itemnumbers }
})->unblessed;
     if ($opachiddenitems) {
         my %hidden_items = map { $_ => undef }
C4::Items::GetHiddenItemnumbers(@{$items});
         # Reduce items to non hidden items
diff --git a/Koha/Item.pm b/Koha/Item.pm
index bea05f8317..73306f54a2 100644
--- a/Koha/Item.pm
+++ b/Koha/Item.pm
@@ -235,6 +235,14 @@ sub current_holds {
     return Koha::Holds->_new_from_dbic($hold_rs);
 }

+sub unblessed {
+    my ($self) = @_;
+    my $itype = $self->effective_itemtype;
+    my $h = $self->SUPER->unblessed;
+    $h->{itype} = $itype;
+    return $h;
+}

Can you share the script you use to benchmark, I could use it to compare
different situations.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list