From 804cb1caa75eebe97700e429c526a2754ed9a913 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Tue, 7 Mar 2017 10:03:45 +0100
Subject: [PATCH] self rt

---
 .../opac/controllers/RechercheController.php       | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php
index c4f5031d951..49078d29709 100644
--- a/application/modules/opac/controllers/RechercheController.php
+++ b/application/modules/opac/controllers/RechercheController.php
@@ -119,7 +119,7 @@ class RechercheController extends ZendAfi_Controller_Action {
   protected function _runSearchAndRender($criteres_recherche) {
     $search_start_time = microtime(true);
 
-    $search_result = $this->moteur->lancerRecherche($criteres_recherche);
+    $this->view->search_result = $search_result = $this->moteur->lancerRecherche($criteres_recherche);
 
     $this->_logSearch();
 
@@ -131,21 +131,17 @@ class RechercheController extends ZendAfi_Controller_Action {
 
     $this->preferences['liste_format'] = $this->_getParam('liste_format', $this->preferences['liste_format']);
 
-    if (!$search_result->isError())
-      $this->addHistoRecherche($criteres_recherche);
-
     $this->view->titre = $this->getTitreRechercheSimple($criteres_recherche);
 
     if($criteres_recherche->getPertinence())
       $this->view->titre .= $this->_(' (recherche élargie triée par pertinence)');
 
-    $this->view->search_duration = microtime(true) - $search_start_time;
-
-    $this->view->search_result = $search_result
-      ->setDuration($this->view->search_duration)
+    $search_result
+      ->setDuration(microtime(true) - $search_start_time)
       ->setSettings($this->preferences);
 
-    $this->addHistoRecherche($criteres_recherche);
+    if (!$search_result->isError())
+      $this->addHistoRecherche($criteres_recherche);
   }
 
 
-- 
GitLab