cache GetFrameworkCode
[koha.git] / C4 / Biblio.pm
index 944c782..844c245 100644 (file)
@@ -1823,13 +1823,22 @@ sub GetMarcHosts {
 
 =cut
 
+our $_frameworkcode;
+
 sub GetFrameworkCode {
     my ($biblionumber) = @_;
+
+    my $frameworkcode;
+    if ( $frameworkcode = $_frameworkcode->{$biblionumber} ) {
+warn "# _frameworkcode hit $biblionumber\n";
+       return $frameworkcode;
+    }
+
     my $dbh            = C4::Context->dbh;
     my $sth            = $dbh->prepare("SELECT frameworkcode FROM biblio WHERE biblionumber=?");
     $sth->execute($biblionumber);
     my ($frameworkcode) = $sth->fetchrow;
-    return $frameworkcode;
+    return $_frameworkcode->{$biblionumber} = $frameworkcode;
 }
 
 =head2 TransformKohaToMarc