Bug 14496 : Improving opac-detail.pl performances
authorJulian FIOL <julian.fiol@biblibre.com>
Mon, 6 Jul 2015 10:27:08 +0000 (12:27 +0200)
committerMason James <mtj@kohaaloha.com>
Sat, 25 Jul 2015 13:20:18 +0000 (01:20 +1200)
Get notes and subjects from MARC record
ONLY when XSLT is not activated.

It's useless doing it when XSLT is activated,
because XSLT takes care of it by its own.

=> With this patch, we are saving precious
milliseconds

I compared the display of some records in XSLT view with and without patch, was the same (as expected).
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
On a slower server, I saw a time save of 0.0274 to 0.0908 seconds (with XSLT).
Signed-off-by: Mason James <mtj@kohaaloha.com>

opac/opac-detail.pl

index 01c801f..59099b6 100755 (executable)
@@ -669,24 +669,29 @@ if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
 }
 
 ## get notes and subjects from MARC record
-my $dbh              = C4::Context->dbh;
+if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) {
+    my $marcisbnsarray   = GetMarcISBN    ($record,$marcflavour);
+    my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
+    my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
+    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
+    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
+    my $marchostsarray   = GetMarcHosts($record,$marcflavour);
+
+    $template->param(
+        MARCSUBJCTS => $marcsubjctsarray,
+        MARCAUTHORS => $marcauthorsarray,
+        MARCSERIES  => $marcseriesarray,
+        MARCURLS    => $marcurlsarray,
+        MARCISBNS   => $marcisbnsarray,
+        MARCHOSTS   => $marchostsarray,
+    );
+}
+
 my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
-my $marcisbnsarray   = GetMarcISBN    ($record,$marcflavour);
-my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
-my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
-my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
-my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
-my $marchostsarray  = GetMarcHosts($record,$marcflavour);
 my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
 
     $template->param(
                      MARCNOTES               => $marcnotesarray,
-                     MARCSUBJCTS             => $marcsubjctsarray,
-                     MARCAUTHORS             => $marcauthorsarray,
-                     MARCSERIES              => $marcseriesarray,
-                     MARCURLS                => $marcurlsarray,
-                     MARCISBNS               => $marcisbnsarray,
-                     MARCHOSTS               => $marchostsarray,
                      norequests              => $norequests,
                      RequestOnOpac           => C4::Context->preference("RequestOnOpac"),
                      itemdata_ccode          => $itemfields{ccode},