diff --git a/VERSIONS b/VERSIONS
index ee6f2e3895ad019f08c29522465c1236facedfad..51d52a946cf7dd912932e64f47f12b92aeb8c2b6 100644
--- a/VERSIONS
+++ b/VERSIONS
@@ -1,3 +1,15 @@
+18/05/2017 - v7.9.19
+
+ - ticket #60547 : Cosmogramme : correction d'erreurs dans les écrans de configuration des intégrations, d'analyse de fichier unimarc et de modifications des codifications Dewey et PCDM4
+
+
+11/05/2017 - v7.9.18
+
+ - ticket #60290 : Administration des articles : correction du mauvais affichage du statut de publication
+
+ - ticket #60040 : Correction d'un bug lors de l'intégration des fichiers d'abonnés Nanook
+
+
 09/05/2017 - v7.9.17
 
  - ticket #59718 : Intégration de l'enregistrement d'applications et d'authentification via OAuth
diff --git a/application/modules/admin/controllers/CmsController.php b/application/modules/admin/controllers/CmsController.php
index 941b408137830edb899cd92b76f382f6a86eacde..0b3bc852f6b718e194b68e4debc331a6386d0507 100644
--- a/application/modules/admin/controllers/CmsController.php
+++ b/application/modules/admin/controllers/CmsController.php
@@ -59,7 +59,7 @@ class Admin_CmsController extends ZendAfi_Controller_Action {
                      }, $bibs);
 
     $search = $this->_getParam('title_search', '');
-    $status = $this->_getParam('status', '');
+    $status = $this->_getParam(ZendAfi_Controller_Action_Helper_ArticleListViewMode::STATUS_SEARCH, '');
 
     $id_bib = $this->_getParam('id_bib',
                                $this->identity->isRoleLibraryLimited()
@@ -69,7 +69,7 @@ class Admin_CmsController extends ZendAfi_Controller_Action {
 
     $params = ['page' => $this->_getParam('page', 0),
                'search_value' => $search,
-               'status' => $status,
+               ZendAfi_Controller_Action_Helper_ArticleListViewMode::STATUS_SEARCH => $status,
                'bib' => $this->_bib,
                'id_bib' => $id_bib,
                'id_cat' => $id_cat];
@@ -95,7 +95,7 @@ class Admin_CmsController extends ZendAfi_Controller_Action {
     if($this->_request->isPost())
       return $this->_redirectToRefererWithNewParams(['title_search' => $this->_getPost()['title_search'],
                                                      'page' => $this->_getParam('page'),
-                                                     'status' => $this->_getPost()['status']]);
+                                                     ZendAfi_Controller_Action_Helper_ArticleListViewMode::STATUS_SEARCH => $this->_getPost()[ZendAfi_Controller_Action_Helper_ArticleListViewMode::STATUS_SEARCH]]);
 
     if (Class_AdminVar::isArticlesListMode())
       return $this->_renderList();
@@ -173,4 +173,3 @@ class Admin_CmsController extends ZendAfi_Controller_Action {
     $this->getResponse()->setBody((new Class_ArticleCategorie())->getCategoriesJson());
   }
 }
-?>
\ No newline at end of file
diff --git a/cosmogramme/php/classes/classe_dewey.php b/cosmogramme/php/classes/classe_dewey.php
index 166f43b3218517159a81af4f92b2cd6fbe82f467..407d1301679969607c447f2d677aaa09557134bc 100644
--- a/cosmogramme/php/classes/classe_dewey.php
+++ b/cosmogramme/php/classes/classe_dewey.php
@@ -16,152 +16,143 @@
  *
  * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
  * along with BOKEH; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
-////////////////////////////////////////////////////////////////////////////////////////
-// INDICES DEWEY
-///////////////////////////////////////////////////////////////////////////////////////
-
-class dewey
-{
-	
-// ----------------------------------------------------------------
-// Dewey sans libelle
-// ----------------------------------------------------------------
-	public function getIndicesSanslibelle($indice, $limite)
-	{
+
+class dewey {
+
+	public function getIndicesSanslibelle($indice, $limite) {
 		global $sql;
-		$liste=array();
-		if($indice) $where = "and id_dewey like '$indice%'";
-		$handle=$sql->prepareListe("Select id_dewey from codif_dewey Where LENGTH(id_dewey)=$limite and libelle ='' ".$where." order by id_dewey");
-		while( $indice=$sql->fetchNext($handle,true)) $liste[]=$this->formatIndice($indice);
+		$liste = [];
+		if ($indice)
+      $where = "and id_dewey like '$indice%'";
+
+		$handle = $sql->prepareListe("Select id_dewey from codif_dewey Where LENGTH(id_dewey)=$limite and libelle ='' ".$where." order by id_dewey");
+		while ($indice = $sql->fetchNext($handle,true))
+      $liste[] = $this->formatIndice($indice);
+
 		return $liste;
 	}
-	
-// ----------------------------------------------------------------
-// Rend une liste d'indices par niveau
-// ----------------------------------------------------------------
+
+
 	static function getIndices($pere)	{
 		global $sql;
-		if ($pere == "root") 
-			$liste=$sql->fetchAll("select * from codif_dewey where LENGTH(id_dewey)=1 order by id_dewey");
-		else 
-		{
-			$long=strlen($pere)+1;
-			$req="select * from codif_dewey where id_dewey like '$pere%' and LENGTH(id_dewey)=$long order by id_dewey";
-			$liste =$sql->fetchAll($req);
-		}
-		return $liste;
+		if ($pere == "root")
+			return $sql->fetchAll("select * from codif_dewey where LENGTH(id_dewey)=1 order by id_dewey");
+
+    $long = strlen($pere)+1;
+    $req = "select * from codif_dewey where id_dewey like '$pere%' and LENGTH(id_dewey)=$long order by id_dewey";
+    return $sql->fetchAll($req);
 	}
-	
-// ----------------------------------------------------------------
-// Ponctue un indice dewey
-// ----------------------------------------------------------------
-	static function formatIndice($indice)
-	{
-		if(strlen($indice)< 4) return $indice;
-		$new="";
-		while(strlen($indice)>3)
-		{
-			$new.=substr($indice,0,3).".";
-			$indice=substr($indice,3,strlen($indice));
+
+
+	static function formatIndice($indice) {
+		if(strlen($indice)< 4)
+      return $indice;
+
+		$new = '';
+		while(strlen($indice) > 3) {
+			$new .= substr($indice,0,3) . ".";
+			$indice = substr($indice, 3, strlen($indice));
 		}
-		$new.=$indice;
-		return $new;
+
+		return $new . $indice;
 	}
-// ----------------------------------------------------------------
-// Analyse et rend l'indice s'il est valide
-// ----------------------------------------------------------------
-	static function filtreIndice($indice)
-	{
-		$indice=trim($indice);
-		if(strlen($indice)>18) return false;
-		if(substr($indice,1,1) == ".") return "";  // si c'est de la pcdm4 on dégage
-		$new="";
-		for($i=0; $i<strlen($indice); $i++)
-		{
-			$car=$indice[$i];
-			if($car >="0" and $car<="9") $new.=$car;
+
+
+	static function filtreIndice($indice) {
+		$indice = trim($indice);
+		if(strlen($indice) > 18)
+      return false;
+
+		if(substr($indice,1,1) == ".")
+      return '';  // si c'est de la pcdm4 on dégage
+
+		$new = '';
+		for($i=0; $i < strlen($indice); $i++) {
+			$car = $indice[$i];
+			if ($car >= "0" and $car <= "9")
+        $new .= $car;
 		}
+
 		return $new;
 	}
-// ----------------------------------------------------------------
-// Rend le libelle ou le code si le libelle est vide
-// ----------------------------------------------------------------
-	static function getLibelle($indice)
-	{
+
+
+	static function getLibelle($indice)	{
 		global $sql;
-		$libelle=$sql->fetchOne("select libelle from codif_dewey where id_dewey='$indice'");
-		if(!$libelle) $libelle=dewey::formatIndice($indice)." - intitulé non renseigné";
+		$libelle = $sql->fetchOne("select libelle from codif_dewey where id_dewey='$indice'");
+		if(!$libelle)
+      $libelle = dewey::formatIndice($indice) . " - intitulé non renseigné";
+
 		return $libelle;
 	}
-	
-// ----------------------------------------------------------------
-// Ecrit un indice dewey
-// ----------------------------------------------------------------
-	public function ecrire($indice, $libelle)
-	{
+
+
+	public function ecrire($indice, $libelle) {
 		global $sql;
-		
-		$indice=trim($indice);
-		$indice=str_replace(".","",$indice);
-		$libelle=trim(str_replace("'","''",$libelle));
-		if($indice=="") return false;
-		$controle=$sql->fetchOne("select count(*) from codif_dewey where id_dewey='$indice'");
-		if($controle > 0)
-		{ 
-			// Maj du libelle
-			$sql->execute("Update codif_dewey set libelle='$libelle' Where id_dewey='$indice'");
-			// Maj des mots-recherche pour le nouveau libelle
-			$this->majFulltext($indice);
-		}
-		else $sql->execute("insert into codif_dewey (id_dewey,libelle) Values('$indice','$libelle')");
+
+		$indice = trim($indice);
+		$indice = str_replace(".", "", $indice);
+		$libelle = trim(str_replace("'", "''", $libelle));
+		if($indice == "")
+      return false;
+
+		$controle = $sql->fetchOne("select count(*) from codif_dewey where id_dewey='$indice'");
+    if (0 == $controle) {
+      $sql->execute("insert into codif_dewey (id_dewey,libelle) Values('$indice','$libelle')");
+      return 1;
+    }
+
+    // Maj du libelle
+    $sql->execute("Update codif_dewey set libelle='$libelle' Where id_dewey='$indice'");
+    // Maj des mots-recherche pour le nouveau libelle
+    $this->majFulltext($indice);
 		return 1;
 	}
-	
-// ----------------------------------------------------------------
-// Maj des mots facettes pour 1 indice
-// ----------------------------------------------------------------
-	public function majFulltext($indice)
-	{
+
+
+	public function majFulltext($indice) {
 		global $sql;
-		require_once("classe_indexation.php");
+
+    require_once("classe_indexation.php");
 		$ix = new indexation();
-		
-		// Verif parametres 
-		$indice=trim($indice);
-		$indice=str_replace(".","",$indice);
-		$code="+D".$indice;
-		
-		// Get notices de cet indice
-		$liste=$sql->prepareListe("select id_notice,facettes from notices where match(facettes) against('".$code."' IN BOOLEAN MODE)");
-		if(!$liste) return;
-		while($ligne=$sql->fetchNext($liste))
-		{
-			$id_notice=$ligne["id_notice"];
-			// recup id dewey et pcdm4 des facettes
-			$facette=explode(" ",$ligne["facettes"]);
-			for($i=0; $i < count($facette); $i++)
-			{
-				if(!$facette[$i]) continue;
-				if(substr($facette[$i],0,1) == "D")
-				{
-					$clef=substr($facette[$i],1);
-					$libelle=$sql->fetchOne("select libelle from codif_dewey where id_dewey='$clef'");
-					$fulltext.=" ".$libelle;
-				}
-				elseif(substr($facette[$i],0,1) == "P")
-				{
-					$clef=substr($facette[$i],1);
-					$libelle=$sql->fetchOne("select libelle from codif_pcdm4 where id_pcdm4='$clef'");
-					$fulltext.=" ".$libelle;
-				}
-			}
-			// Calcul nouveau fulltext et maj notice
-			$fulltext=$ix->getFulltext($fulltext);
-			$sql->execute("update notices set dewey='$fulltext' where id_notice=$id_notice");
-		}
+
+		$indice = trim($indice);
+		$indice = str_replace(".","",$indice);
+		$code = "+D".$indice;
+
+		$liste = $sql->prepareListe("select id_notice,facettes from notices where match(facettes) against('".$code."' IN BOOLEAN MODE)");
+		if(!$liste)
+      return;
+
+		while($ligne = $sql->fetchNext($liste))
+      $this->_updateRecord($ligne, $ix);
 	}
+
+
+  protected function _updateRecord($ligne, $ix) {
+    global $sql;
+
+    $id_notice = $ligne["id_notice"];
+    $facets = explode(" ", $ligne["facettes"]);
+    foreach ($faces as $facet) {
+      if (!$facet)
+        continue;
+
+      $code = substr($facet, 0, 1);
+      $map = ['D' => 'dewey', 'P' => 'pcdm4'];
+      if (!array_key_exists($code, $map))
+        continue;
+
+      $value = substr($facet, 1);
+      if ($libelle = $sql->fetchOne("select libelle from codif_". $map[$code] . " where id_" . $map[$code] . "='" . $value ."'"))
+        $fulltext .= ' ' . $libelle;
+    }
+
+    $fulltext = $ix->getFulltext($fulltext);
+    $sql->execute("update notices set dewey='$fulltext' where id_notice=$id_notice");
+  }
 }
 
 ?>
\ No newline at end of file
diff --git a/cosmogramme/php/classes/classe_log.php b/cosmogramme/php/classes/classe_log.php
index ccf44072dac8f0dfad884a1620f200355654bf88..bd55d6684e42df3e9559cb1de0820c2600faef4f 100644
--- a/cosmogramme/php/classes/classe_log.php
+++ b/cosmogramme/php/classes/classe_log.php
@@ -30,34 +30,33 @@ class log {
   private $afficher;          // Afficher à l'écran ou pas
   private $entete;            // Entetes pour les logs de type tableau
 
-// ----------------------------------------------------------------
-// Contructeur
-// ----------------------------------------------------------------
-  function __construct($typeLog,$afficher=true)
-  {
+
+  public function __construct($typeLog,$afficher=true) {
     $this->typeLog = $typeLog;
     $this->afficher=$afficher;
     $this->path = getVariable("log_path");
-    if(!$this->path) afficherErreur("La variable : log_path n'est pas définie.");
-    if( strRight($this->path,1) != "/" ) $this->path .="/";
-    $this->maxLog=getVariable("log_max");
-    if(!$this->maxLog) $this->maxLog=100;
+    if(!$this->path)
+      afficherErreur("La variable : log_path n'est pas définie.");
+
+    if (strRight($this->path,1) != "/" )
+      $this->path .="/";
+
+    $this->maxLog = getVariable("log_max");
+    if(!$this->maxLog)
+      $this->maxLog=100;
 
     // Entetes
-    if($typeLog=="erreur") $this->entete=array("n°","Bibliothèque","Type d'opération","Erreur");
-    elseif($typeLog=="warning") $this->entete=array("n°","Bibliothèque","Type d'opération","Alerte","Valeur");
+    if($typeLog=="erreur")
+      $this->entete = ["n°", "Bibliothèque", "Type d'opération", "Erreur"];
+    elseif($typeLog=="warning")
+      $this->entete = ["n°", "Bibliothèque", "Type d'opération", "Alerte", "Valeur"];
   }
 
-// ----------------------------------------------------------------
-// Ouverture fichier
-// ----------------------------------------------------------------
+
   public function open($append=0) {
-    // Controle de l'historique
-    if($append==0) {
+    if($append==0)
       $this->_removeOldLogs();
-    }
 
-    // Ouverture du nouveau log
     $nom = $this->path . $this->typeLog . "_" . dateDuJour(0) .".log";
     $mode='a'; // test en mode append systematique
     umask(0002);
@@ -67,62 +66,68 @@ class log {
 
 
   protected function _removeOldLogs() {
-    @$dir = opendir( $this->path) or AfficherErreur("Impossible d'ouvrir le dossier des logs : " .$this->path);
+    @$dir = opendir($this->path) or afficherErreur("Impossible d'ouvrir le dossier des logs : " .$this->path);
 
-    while (($file = readdir($dir)) !== false)  {
-      if(strLeft($file, strLen($this->typeLog))== $this->typeLog) $liste[]=$file;
-    }
+    while (($file = readdir($dir)) !== false)
+      if(strLeft($file, strLen($this->typeLog))== $this->typeLog)
+        $liste[]=$file;
 
     closedir( $dir);
 
-    if( count($liste) > $this->maxLog ) {
-      $nb_destroy=count($liste)-$this->maxLog;
-      sort($liste);
-      for($i=0; $i < $nb_destroy; $i++) {
-        unlink($this->path .$liste[$i]);
-        if($this->typeLog != "sql") @unlink($this->path.str_replace($this->typeLog,"notice",$liste[$i]));
-      }
-    }
+    if (count($liste) <= $this->maxLog)
+      return;
+
+    $nb_destroy = count($liste)-$this->maxLog;
+    sort($liste);
+    for ($i=0; $i < $nb_destroy; $i++)
+      $this->_removeLog($liste[$i]);
   }
 
-// ----------------------------------------------------------------
-// Ecrire
-// ----------------------------------------------------------------
+
+  protected function _removeLog($file) {
+    unlink($this->path . $file);
+    if($this->typeLog != "sql")
+      @unlink($this->path . str_replace($this->typeLog, "notice", $file));
+  }
+
+
   public function log($texte) {
     global $mode_cron;
-    fwrite($this->fic, $texte ."\n");
-    if($this->afficher == false) return false;
 
-    if($mode_cron) {
-      $texte=strip_tags($texte);
-      if(trim($texte)) print($texte ."\n");
-    }
-    else
+    fwrite($this->fic, $texte . "\n");
+    if (!$this->afficher)
+      return false;
+
+    if (!$mode_cron) {
       print($texte);
+      flush();
+      return;
+    }
+
+    $texte = strip_tags($texte);
+    if(trim($texte))
+      print($texte ."\n");
 
     flush();
   }
 
 
-// ----------------------------------------------------------------
-// Taille des logs
-// ----------------------------------------------------------------
-  public function getTailleLogs()
-  {
-    // Parse directory
-    @$dir = opendir( $this->path) or AfficherErreur("Impossible d'ouvrir le dossier des logs : " .$this->path);
-    $taille=0;
-    $nb_fic=0;
-    while (($file = readdir($dir)) !== false)
-      {
-        $fic=$this->path.$file;
-        if(!is_file($fic)) continue;
-        $nb_fic++;
-        $taille+=filesize($fic);
-      }
-    $ret["nb_fic"]=$nb_fic;
-    $ret["taille"]=(int)($taille / 1024);
-    $ret["taille"]=number_format($ret["taille"], 0, ',', ' ')." ko";
+  public function getTailleLogs() {
+    @$dir = opendir( $this->path) or afficherErreur("Impossible d'ouvrir le dossier des logs : " . $this->path);
+    $taille = 0;
+    $nb_fic = 0;
+    while (($file = readdir($dir)) !== false) {
+      $fic = $this->path . $file;
+      if(!is_file($fic))
+        continue;
+
+      $nb_fic++;
+      $taille += filesize($fic);
+    }
+
+    $ret["nb_fic"] = $nb_fic;
+    $ret["taille"] = (int)($taille / 1024);
+    $ret["taille"] = number_format($ret["taille"], 0, ',', ' ')." ko";
     return $ret;
   }
 
diff --git a/cosmogramme/php/classes/classe_pcdm4.php b/cosmogramme/php/classes/classe_pcdm4.php
index 6ab4724e9e1518dd29ef38aad21d6e75e3f2d195..7ea29b3e683ffb57d105777e7d2b1943132f7cea 100644
--- a/cosmogramme/php/classes/classe_pcdm4.php
+++ b/cosmogramme/php/classes/classe_pcdm4.php
@@ -16,143 +16,139 @@
  *
  * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
  * along with BOKEH; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
-////////////////////////////////////////////////////////////////////////////////////////
-// INDICES PCDM4
-///////////////////////////////////////////////////////////////////////////////////////
-
-class pcdm4
-{
-	
-// ----------------------------------------------------------------
-// Pcdm4 sans libelle
-// ----------------------------------------------------------------
-	public function getIndicesSanslibelle($indice, $limite)
-	{
+
+class pcdm4 {
+	public function getIndicesSanslibelle($indice, $limite) {
 		global $sql;
-		$liste=array();
-		if($indice) $where = "and id_pcdm4 like '$indice%'";
-		$handle=$sql->prepareListe("Select distinct SUBSTRING(id_pcdm4, 1, $limite) from codif_pcdm4 Where libelle ='' ".$where." order by id_pcdm4");
-		while( $indice=$sql->fetchNext($handle,true)) $liste[]=$this->formatIndice($indice);
+
+		$liste=[];
+		if($indice)
+      $where = "and id_pcdm4 like '$indice%'";
+
+		$handle = $sql->prepareListe("Select distinct SUBSTRING(id_pcdm4, 1, $limite) from codif_pcdm4 Where libelle ='' ".$where." order by id_pcdm4");
+		while( $indice=$sql->fetchNext($handle,true))
+      $liste[]=$this->formatIndice($indice);
+
 		return $liste;
 	}
-// ----------------------------------------------------------------
-// Rend une liste d'indices par niveau
-// ----------------------------------------------------------------
-	static function getIndices($pere)
-	{
+
+
+	static function getIndices($pere) {
 		global $sql;
-		if($pere == "root") $liste=$sql->fetchAll("select * from codif_pcdm4 where LENGTH(id_pcdm4)=1 order by id_pcdm4");
-		else 
-		{
-			$long=strlen($pere)+1;
-			$req="select * from codif_pcdm4 where id_pcdm4 like '$pere%' and LENGTH(id_pcdm4)=$long order by id_pcdm4";
-			$liste =$sql->fetchAll($req);
-		}
-		return $liste;
+
+		if ($pere == "root")
+      return $sql->fetchAll("select * from codif_pcdm4 where LENGTH(id_pcdm4)=1 order by id_pcdm4");
+
+    $long = strlen($pere)+1;
+    $req = "select * from codif_pcdm4 where id_pcdm4 like '$pere%' and LENGTH(id_pcdm4)=$long order by id_pcdm4";
+    return $sql->fetchAll($req);
 	}
-// ----------------------------------------------------------------
-// Ponctue un indice pcdm4
-// ----------------------------------------------------------------
-	static function formatIndice($indice)
-	{
-		if(strlen($indice)< 2) return $indice;
-		$new=substr($indice,0,1).".".substr($indice,1);
+
+
+	static function formatIndice($indice) {
+		if(strlen($indice)< 2)
+      return $indice;
+
+		$new = substr($indice,0,1).".".substr($indice,1);
 		return $new;
 	}
-// ----------------------------------------------------------------
-// Analyse et rend l'indice s'il est valide
-// ----------------------------------------------------------------
-	static function filtreIndice($indice)
-	{
-		$indice=trim($indice);
-		if(!is_numeric(substr($indice,0,1))) return "";
-		if(strlen($indice) > 1 and substr($indice,1,1) != ".") return "";
-		$new="";
-		for($i=0; $i<strlen($indice); $i++)
-		{
+
+
+	static function filtreIndice($indice) {
+		$indice = trim($indice);
+		if(!is_numeric(substr($indice,0,1)))
+      return "";
+
+		if(strlen($indice) > 1 and substr($indice,1,1) != ".")
+      return "";
+
+		$new = "";
+		for($i=0; $i<strlen($indice); $i++) {
 			$car=$indice[$i];
-			if($car >="0" and $car<="9") $new.=$car;
+			if($car >="0" and $car<="9")
+        $new.=$car;
 		}
+
 		return $new;
 	}
-// ----------------------------------------------------------------
-// Rend le libelle ou le code si le libelle est vide
-// ----------------------------------------------------------------
-	static function getLibelle($indice)
-	{
+
+
+	static function getLibelle($indice) {
 		global $sql;
-		$libelle=$sql->fetchOne("select libelle from codif_pcdm4 where id_pcdm4='$indice'");
-		if(!$libelle) $libelle=pcdm4::formatIndice($indice);
+
+		if(!$libelle = $sql->fetchOne("select libelle from codif_pcdm4 where id_pcdm4='$indice'"))
+      $libelle = pcdm4::formatIndice($indice);
+
 		return $libelle;
 	}
-// ----------------------------------------------------------------
-// Ecrit un indice pcdm4
-// ----------------------------------------------------------------
-	public function ecrire($indice, $libelle)
-	{
+
+
+	public function ecrire($indice, $libelle) {
 		global $sql;
-		
-		$indice=trim($indice);
-		$indice=str_replace(".","",$indice);
-		$libelle=trim(str_replace("'","''",$libelle));
-		if($indice=="") return false;
-		$controle=$sql->fetchOne("select count(*) from codif_pcdm4 where id_pcdm4='$indice'");
-		if($controle > 0)
-		{ 
-			// Maj du libelle
-			$sql->execute("Update codif_pcdm4 set libelle='$libelle' Where id_pcdm4='$indice'");
-			// Maj des mots-recherche pour le nouveau libelle
-			$this->majFulltext($indice);
-		}
-		else $sql->execute("insert into codif_pcdm4 (id_pcdm4,libelle) Values('$indice','$libelle')");
+
+		$indice = trim($indice);
+		$indice = str_replace(".","",$indice);
+		$libelle = trim(str_replace("'","''",$libelle));
+		if($indice=="")
+      return false;
+
+		$controle = $sql->fetchOne("select count(*) from codif_pcdm4 where id_pcdm4='$indice'");
+    if (0 == $controle) {
+      $sql->execute("insert into codif_pcdm4 (id_pcdm4,libelle) Values('$indice','$libelle')");
+      return 1;
+    }
+
+    $sql->execute("Update codif_pcdm4 set libelle='$libelle' Where id_pcdm4='$indice'");
+    $this->majFulltext($indice);
+
 		return 1;
 	}
-	
-// ----------------------------------------------------------------
-// Maj des mots facettes pour 1 indice
-// ----------------------------------------------------------------
-	public function majFulltext($indice)
-	{
+
+
+	public function majFulltext($indice) {
 		global $sql;
+
 		require_once("classe_indexation.php");
 		$ix = new indexation();
-		
-		// Verif parametres 
-		$indice=trim($indice);
-		$indice=str_replace(".","",$indice);
-		$code="+P".$indice;
-		
-		// Get notices de cet indice
-		$liste=$sql->prepareListe("select id_notice,facettes from notices where match(facettes) against('".$code."' IN BOOLEAN MODE)");
-		if(!$liste) return;
-		while($ligne=$sql->fetchNext($liste))
-		{
-			$id_notice=$ligne["id_notice"];
-			// recup id dewey et pcdm4 des facettes
-			$facette=explode(" ",$ligne["facettes"]);
-			for($i=0; $i < count($facette); $i++)
-			{
-				if(!$facette[$i]) continue;
-				if(substr($facette[$i],0,1) == "D")
-				{
-					$clef=substr($facette[$i],1);
-					$libelle=$sql->fetchOne("select libelle from codif_dewey where id_dewey='$clef'");
-					$fulltext.=" ".$libelle;
-				}
-				elseif(substr($facette[$i],0,1) == "P")
-				{
-					$clef=substr($facette[$i],1);
-					$libelle=$sql->fetchOne("select libelle from codif_pcdm4 where id_pcdm4='$clef'");
-					$fulltext.=" ".$libelle;
-				}
-			}
-			// Calcul nouveau fulltext et maj notice
-			$fulltext=$ix->getFulltext($fulltext);
-			$sql->execute("update notices set dewey='$fulltext' where id_notice=$id_notice");
-		}
+
+		// Verif parametres
+		$indice = trim($indice);
+		$indice = str_replace(".","",$indice);
+		$code = "+P" . $indice;
+
+    $liste = $sql->prepareListe("select id_notice,facettes from notices where match(facettes) against('".$code."' IN BOOLEAN MODE)");
+		if(!$liste)
+      return;
+
+		while($ligne = $sql->fetchNext($liste))
+      $this->_updateRecord($ligne, $ix);
 	}
+
+
+  protected function _updateRecord($ligne, $ix) {
+    global $sql;
+
+    $id_notice = $ligne["id_notice"];
+    $facets = explode(" ", $ligne["facettes"]);
+    foreach ($faces as $facet) {
+      if (!$facet)
+        continue;
+
+      $code = substr($facet, 0, 1);
+      $map = ['D' => 'dewey', 'P' => 'pcdm4'];
+      if (!array_key_exists($code, $map))
+        continue;
+
+      $value = substr($facet, 1);
+      if ($libelle = $sql->fetchOne("select libelle from codif_". $map[$code] . " where id_" . $map[$code] . "='" . $value ."'"))
+        $fulltext .= ' ' . $libelle;
+    }
+
+    $fulltext = $ix->getFulltext($fulltext);
+    $sql->execute("update notices set dewey='$fulltext' where id_notice=$id_notice");
+  }
 }
 
 ?>
\ No newline at end of file
diff --git a/cosmogramme/php/codif_dewey.php b/cosmogramme/php/codif_dewey.php
index 647743cb3d0285c8c83d88ceb86f24d33d21a6a8..e2099430c4bce827af23775c7e016d0961c41b68 100644
--- a/cosmogramme/php/codif_dewey.php
+++ b/cosmogramme/php/codif_dewey.php
@@ -16,7 +16,7 @@
  *
  * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
  * along with BOKEH; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
 ///////////////////////////////////////////////////////////////////
 //
@@ -26,7 +26,7 @@
 include("_init_frame.php");
 
 require_once("classe_dewey.php");
-$dewey=new dewey();
+$dewey = new dewey();
 extract($_POST);
 
 ?>
@@ -41,9 +41,9 @@ extract($_POST);
 	{
 		oChampRetour=document.getElementById("indice_a_ecrire");
 		chaine="";
-		for (var i=0;i<document.getElementsByName("selection").length;i++) 
+		for (var i=0;i<document.getElementsByName("selection").length;i++)
 		{
-			if (document.getElementsByName("selection")[i].checked==true) 
+			if (document.getElementsByName("selection")[i].checked==true)
 			{
          	if(chaine > '') chaine=chaine+";";
          	chaine=chaine+document.getElementsByName("selection")[i].id;
@@ -77,7 +77,7 @@ if($_REQUEST["action"]=="")
 	print('<td><input type ="text" name="nbdec" value="3" size="3" align="left"></td>');
 	print('</tr>');
 	print('</table></form>'.BR);
-	
+
 	$url="codif_dewey.php?action=MAJ";
 	print('<form id="suppression" method="post" action="'.$url.'">');
 	print('<table width="60%" cellspacing="0">');
@@ -93,7 +93,7 @@ if($_REQUEST["action"]=="")
 	print('<td><input type ="text" name="commencepar" value="" size="7" align="left"></td>');
 	print('</tr>');
 	print('</table></form>'.BR);
-	
+
 	$url="codif_dewey.php?action=SUPPRESSION";
 	print('<form id="suppression" method="post" action="'.$url.'">');
 	print('<table width="60%" cellspacing="0">');
@@ -109,7 +109,7 @@ if($_REQUEST["action"]=="")
 	print('<td><input type ="text" name="commencepar" value="" size="7" align="left"></td>');
 	print('</tr>');
 	print('</table></form>'.BR);
-	
+
 	$url="codif_dewey.php?action=CONSOLIDATION";
 	print('<form id="consolidation" method="post" action="'.$url.'">');
 	print('<table width="60%" cellspacing="0">');
@@ -131,7 +131,7 @@ if($_REQUEST["action"]=="")
 	print('<td colspan="2">Cette fonction créee les niveaux intermédiaires pour un bon fonctionnement de la recherche guidée</td>');
 	print('</tr>');
 	print('</table></form>'.BR);
-	
+
 }
 
 // ----------------------------------------------------------------
@@ -171,13 +171,13 @@ if($_REQUEST["action"]=="ECRIRE_LISTE")
 			$controle=$sql->fetchOne("select count(*) from codif_dewey where id_dewey='$indice'");
 			if($controle)
 			{
-				if($_REQUEST["remplacer"] == "on") 
+				if($_REQUEST["remplacer"] == "on")
 				{
-					$mode="Remplacement"; 
-					$majs+=$dewey->log($indice,$libelle);
+					$mode="Remplacement";
+					$majs+=$dewey->ecrire($indice,$libelle);
 				}
 				else {$mode="Pas de traitement car existe déjà"; $pas_traites++;}
-			} 
+			}
 			else {$mode="Création"; $creations++; $sql->insert("codif_dewey",array("id_dewey"=>$indice,"libelle"=>$libelle));}
 			print('<span class="violet" style="margin-left:20px"><b>'.$indice.' : </b></span><span>'.$mode.'</span>'.BR);
 		}
@@ -198,7 +198,7 @@ if($_REQUEST["action"]=="MAJ")
 	print('<form method="POST" action="'.$url.'">');
 	print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
 	print('<table>');
-	
+
 	$req="Select id_dewey,libelle from codif_dewey ";
 	if($nbdec >0) $where=" Where LENGTH(id_dewey)<= $nbdec";
 	if($commencepar > "")
@@ -209,7 +209,7 @@ if($_REQUEST["action"]=="MAJ")
 	$req.= $where." order by id_dewey";
 	$result=$sql->prepareListe($req);
 	if($result)
-	{ 
+	{
 		While($ret=$sql->fetchNext($result))
 		{
 			print('<tr><td>'.$dewey->formatIndice($ret["id_dewey"]).'</td><td><input type="text" size="70" onblur="give_libelle(\''.$ret["id_dewey"].'\',this.value)" value="'.$ret["libelle"].'"></td></tr>');
@@ -232,7 +232,7 @@ if($_REQUEST["action"]=="SUPPRESSION")
 	print('<form method="POST" action="'.$url.'">');
 	print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
 	print('<table>');
-	
+
 	$req="Select id_dewey,libelle from codif_dewey";
 	if($nbdec >0) $where=" Where LENGTH(id_dewey)<= $nbdec";
 	if($commencepar > "")
@@ -243,7 +243,7 @@ if($_REQUEST["action"]=="SUPPRESSION")
 	$req.= $where;
 	$result=$sql->prepareListe($req);
 	if($result)
-	{ 
+	{
 		While($ret=$sql->fetchNext($result))
 		{
 			print('<tr>');
@@ -287,7 +287,7 @@ if($_REQUEST["action"]=="NOLIB")
 	print('<form method="POST" action="'.$url.'">');
 	print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
 	print('<table>');
-	
+
 	$ret=$dewey->getIndicesSanslibelle("",$nbdec);
 	for($i=0; $i<count($ret); $i++)
 	{
@@ -299,7 +299,7 @@ if($_REQUEST["action"]=="NOLIB")
 }
 
 // ----------------------------------------------------------------
-// ECRITURE DES LIBELLES 
+// ECRITURE DES LIBELLES
 // ----------------------------------------------------------------
 if($_REQUEST["action"]=="ECRIRE")
 {
@@ -316,7 +316,7 @@ if($_REQUEST["action"]=="ECRIRE")
 		{
 			$elem=explode("#",$liste[$i]);
 			print($elem[0]." - " .$elem[1]."<br>");
-			$nb+=$dewey->log($elem[0],$elem[1]);
+			$nb+=$dewey->ecrire($elem[0],$elem[1]);
 		}
 		print("<br><h3>".$nb. " indice(s) ont été mis à jour avec succès.</h3>");
 	}
@@ -354,4 +354,3 @@ if($_REQUEST["action"]=="NIVEAUX")
 </center></div>
 </body>
 </html>
-
diff --git a/cosmogramme/php/codif_pcdm4.php b/cosmogramme/php/codif_pcdm4.php
index 86fb173e8115881a2a93b541a005aac49daea128..ae148ad61b42959beb73c91db2c121d14cb9f092 100644
--- a/cosmogramme/php/codif_pcdm4.php
+++ b/cosmogramme/php/codif_pcdm4.php
@@ -16,7 +16,7 @@
  *
  * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
  * along with BOKEH; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
 ///////////////////////////////////////////////////////////////////
 //
@@ -41,9 +41,9 @@ extract($_POST);
 	{
 		oChampRetour=document.getElementById("indice_a_ecrire");
 		chaine="";
-		for (var i=0;i<document.getElementsByName("selection").length;i++) 
+		for (var i=0;i<document.getElementsByName("selection").length;i++)
 		{
-			if (document.getElementsByName("selection")[i].checked==true) 
+			if (document.getElementsByName("selection")[i].checked==true)
 			{
          	if(chaine > '') chaine=chaine+";";
          	chaine=chaine+document.getElementsByName("selection")[i].id;
@@ -64,7 +64,7 @@ if($_REQUEST["action"]=="")
 	$nb1=$sql->fetchOne("Select count(*) from codif_pcdm4 where libelle=''" );
 	print('<span class="orange"><b>La base contient '.number_format($nb, 0, ',', ' ').' fiches pcdm4</b></span>'.BR);
 	print('<span class="orange"><b>Libellés non renseignés : '.number_format($nb1, 0, ',', ' ').'</b></span>'.BR.BR);
-	
+
 	print('<div class="liste">');
 
 	$url="codif_pcdm4.php?action=NOLIB";
@@ -77,8 +77,8 @@ if($_REQUEST["action"]=="")
 	print('<td align="right">Nombre de décimales:&nbsp;</td>');
 	print('<td><input type ="text" name="nbdec" value="3" size="3" align="left"></td>');
 	print('</tr>');
-	print('</table></form>');	
-	
+	print('</table></form>');
+
 	$url="codif_pcdm4.php?action=MAJ";
 	print('<tr><form id="suppression" method="post" action="'.$url.'">');
 	print('<table width="60%" cellspacing="0">');
@@ -93,8 +93,8 @@ if($_REQUEST["action"]=="")
 	print('<td align="right">Indices commencent par:&nbsp;</td>');
 	print('<td><input type ="text" name="commencepar" value="" size="7" align="left"></td>');
 	print('</tr>');
-	print('</table></form>');	
-	
+	print('</table></form>');
+
 	$url="codif_pcdm4.php?action=SUPPRESSION";
 	print('<tr><form id="suppression" method="post" action="'.$url.'">');
 	print('<table width="60%" cellspacing="0">');
@@ -110,7 +110,7 @@ if($_REQUEST["action"]=="")
 	print('<td><input type ="text" name="commencepar" value="" size="7" align="left"></td>');
 	print('</tr>');
 	print('</table></form>');
-	
+
 	$url="codif_pcdm4.php?action=CONSOLIDATION";
 	print('<tr><form id="consolidation" method="post" action="'.$url.'">');
 	print('<table width="60%" cellspacing="0">');
@@ -121,7 +121,7 @@ if($_REQUEST["action"]=="")
 	print('<td colspan="2" align="center"><input type ="checkbox" name="remplacer">Remplacer les libellés présents dans la base</td>');
 	print('</tr>');
 	print('</table></form>');
-	
+
 }
 
 // ----------------------------------------------------------------
@@ -161,13 +161,13 @@ if($_REQUEST["action"]=="ECRIRE_LISTE")
 			$controle=$sql->fetchOne("select count(*) from codif_pcdm4 where id_pcdm4='$indice'");
 			if($controle)
 			{
-				if($_REQUEST["remplacer"] == "on") 
+				if($_REQUEST["remplacer"] == "on")
 				{
-					$mode="Remplacement"; 
-					$majs+=$pcdm4->log($indice,$libelle);
+					$mode="Remplacement";
+					$majs+=$pcdm4->ecrire($indice,$libelle);
 				}
 				else {$mode="Pas de traitement car existe déjà"; $pas_traites++;}
-			} 
+			}
 			else {$mode="Création"; $creations++; $sql->insert("codif_pcdm4",array("id_pcdm4"=>$indice,"libelle"=>$libelle));}
 			print('<span class="violet" style="margin-left:20px"><b>'.$indice.' : </b></span><span>'.$mode.'</span>'.BR);
 		}
@@ -188,7 +188,7 @@ if($_REQUEST["action"]=="MAJ")
 	print('<form method="POST" action="'.$url.'">');
 	print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
 	print('<table>');
-	
+
 	$req="Select id_pcdm4,libelle from codif_pcdm4";
 	if($nbdec >0) $where=" Where LENGTH(id_pcdm4)<= $nbdec";
 	if($commencepar > "")
@@ -199,7 +199,7 @@ if($_REQUEST["action"]=="MAJ")
 	$req.= $where ." order by id_pcdm4";
 	$result=$sql->prepareListe($req);
 	if($result)
-	{ 
+	{
 		While($ret=$sql->fetchNext($result))
 		{
 			print('<tr><td>'.$pcdm4->formatIndice($ret["id_pcdm4"]).'</td><td><input type="text" size="70" onblur="give_libelle(\''.$ret["id_pcdm4"].'\',this.value)" value="'.$ret["libelle"].'"></td></tr>');
@@ -222,7 +222,7 @@ if($_REQUEST["action"]=="SUPPRESSION")
 	print('<form method="POST" action="'.$url.'">');
 	print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
 	print('<table>');
-	
+
 	$req="Select id_pcdm4,libelle from codif_pcdm4";
 	if($nbdec >0) $where=" Where LENGTH(id_pcdm4)<= $nbdec";
 	if($commencepar > "")
@@ -233,7 +233,7 @@ if($_REQUEST["action"]=="SUPPRESSION")
 	$req.= $where." order by id_pcdm4";
 	$result=$sql->prepareListe($req);
 	if($result)
-	{ 
+	{
 		While($ret=$sql->fetchNext($result))
 		{
 			print('<tr>');
@@ -277,7 +277,7 @@ if($_REQUEST["action"]=="NOLIB")
 	print('<form method="POST" action="'.$url.'">');
 	print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
 	print('<table>');
-	
+
 	$ret=$pcdm4->getIndicesSanslibelle("",$nbdec);
 	for($i=0; $i<count($ret); $i++)
 	{
@@ -289,7 +289,7 @@ if($_REQUEST["action"]=="NOLIB")
 }
 
 // ----------------------------------------------------------------
-// ECRITURE DES LIBELLES 
+// ECRITURE DES LIBELLES
 // ----------------------------------------------------------------
 if($_REQUEST["action"]=="ECRIRE")
 {
@@ -306,7 +306,7 @@ if($_REQUEST["action"]=="ECRIRE")
 		{
 			$elem=explode("#",$liste[$i]);
 			print($elem[0]." - " .$elem[1]."<br>");
-			$nb+=$pcdm4->log($elem[0],$elem[1]);
+			$nb+=$pcdm4->ecrire($elem[0],$elem[1]);
 		}
 		print("<br><h3>".$nb. " indice(s) ont été mis à jour avec succès.</h3>");
 	}
@@ -317,4 +317,3 @@ if($_REQUEST["action"]=="ECRIRE")
 </center></div>
 </body>
 </html>
-
diff --git a/cosmogramme/php/config_integrations.php b/cosmogramme/php/config_integrations.php
index 270a4991705e19954c932308eee251802c574876..ba9ec0f99c545db5bad5647784bf734d25cad029 100644
--- a/cosmogramme/php/config_integrations.php
+++ b/cosmogramme/php/config_integrations.php
@@ -66,7 +66,7 @@ if($_REQUEST["action"]=="VALIDER")
 		// ecriture
 		require_once("classe_bib.php");
 		$ficheBib = new bibliotheque();
-		$ficheBib->log($id_bib,$nom_court,$mail,$qualite,$ecart_ajouts,$sigb,$comm_sigb,$comm_params,$pas_exporter);
+		$ficheBib->ecrire($id_bib,$nom_court,$mail,$qualite,$ecart_ajouts,$sigb,$comm_sigb,$comm_params,$pas_exporter);
 		$id_prog=0;
 	}
 
@@ -74,7 +74,7 @@ if($_REQUEST["action"]=="VALIDER")
 	else
 	{
 		$id_prog=$_REQUEST["id"];
-		$maj->log($id_prog,$id_bib,$libelle,$profil,$type_operation,$fichier,$rang,$type_doc,(int)$taille_min_import_total);
+		$maj->ecrire($id_prog,$id_bib,$libelle,$profil,$type_operation,$fichier,$rang,$type_doc,(int)$taille_min_import_total);
 		if($id_prog == 0 )
 		{
 			$ret=$maj->getDerniereCreation();
diff --git a/cosmogramme/php/integre_analyse_fichier_unimarc.php b/cosmogramme/php/integre_analyse_fichier_unimarc.php
index 446c2a0ed4d65993b84dde6c354f7d23bc51095d..78278d93c84021d6df55f8773e2a3976b7b5ddf8 100644
--- a/cosmogramme/php/integre_analyse_fichier_unimarc.php
+++ b/cosmogramme/php/integre_analyse_fichier_unimarc.php
@@ -1,4 +1,4 @@
-<?PHP
+<?php
 /**
  * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
  *
@@ -18,28 +18,26 @@
  * along with BOKEH; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
-/////////////////////////////////////////////////////////////////////////
-// TEST D'UN FICHIER UNIMARC
-/////////////////////////////////////////////////////////////////////////
+
 include("_init_frame.php");
 print('<h1>Analyse de fichier unimarc</h1>');
 
 // Redirection pour le mode synthèse
 if($_POST["test_level"]==3)
 {
-	setVariable("test_level",3);
-	redirection(URL_BASE."php/integre_analyse_fichier_synthese.php?action=INIT&fichier=".$_POST["fichier"]."&profil=".$_POST["profil_unimarc"]);
+  setVariable("test_level",3);
+  redirection(URL_BASE."php/integre_analyse_fichier_synthese.php?action=INIT&fichier=".$_POST["fichier"]."&profil=".$_POST["profil_unimarc"]);
 }
 // Redirection pour le mode : valeurs distinctes
 if($_POST["test_level"]==4)
 {
-	setVariable("test_level",4);
-	if(controleChampsDistinct()==false)
-	{
-		afficherErreur('Les champs a analyser sont mal définis !',false);
-		$_REQUEST["action"]="PARAM";
-	}
-	else redirection(URL_BASE."php/integre_analyse_fichier_valeurs_distinctes.php?action=INIT&fichier=".$_POST["fichier"]."&profil=".$_POST["profil_unimarc"]."&distinct=".$_POST["distinct"]);
+  setVariable("test_level",4);
+  if(controleChampsDistinct()==false)
+  {
+    afficherErreur('Les champs a analyser sont mal définis !',false);
+    $_REQUEST["action"]="PARAM";
+  }
+  else redirection(URL_BASE."php/integre_analyse_fichier_valeurs_distinctes.php?action=INIT&fichier=".$_POST["fichier"]."&profil=".$_POST["profil_unimarc"]."&distinct=".$_POST["distinct"]);
 }
 
 // Includes
@@ -59,33 +57,33 @@ $buffer = new buffer();
 // ----------------------------------------------------------------
 if($_REQUEST["action"]=="PARAM")
 {
-	require("fonctions/objets_saisie.php");
-	//print(BR.'<div class="liste"><p>NB : Les fichiers à analyser doivent être téléchargés dans le sous-dossier "test" du dossier de transfert ftp des notices.</p></div>'.BR);
-	print('<div class="liste">');
-	print('<form method="post" action="'.URL_BASE.'php/integre_analyse_fichier_unimarc.php">');
-	print('<table class="form" width="100%" cellspacing="0" cellpadding="5">');
-	print('<tr><th class="form" colspan="2" align="left">Fichier à analyser</th></tr>');
-	print('<tr><td class="form_first" align="right" width="40%">Fichier</td><td class="form_first">'.getComboFichiers().'</td></tr>');
-	print('<tr><td class="form" align="right" width="40%">Profil unimarc</td><td class="form_first">'.getComboTable("profil_unimarc","profil_donnees","id_profil",1,"where format in(0,6)").'</td></tr>');
-	print('<tr><td class="form" align="right" width="40%">Mode d\'affichage</td><td class="form_first">'.getComboCodif("test_level","test_level",getVariable("test_level")).'</td></tr>');
-	print('<tr><td class="form" align="right" width="40%">Valeurs distinctes (ex: 995$a;210$b)</td><td class="form_first">'.getChamp("distinct",$_REQUEST["distinct"],"60").'</td></tr>');
+  require("fonctions/objets_saisie.php");
+  //print(BR.'<div class="liste"><p>NB : Les fichiers à analyser doivent être téléchargés dans le sous-dossier "test" du dossier de transfert ftp des notices.</p></div>'.BR);
+  print('<div class="liste">');
+  print('<form method="post" action="'.URL_BASE.'php/integre_analyse_fichier_unimarc.php">');
+  print('<table class="form" width="100%" cellspacing="0" cellpadding="5">');
+  print('<tr><th class="form" colspan="2" align="left">Fichier à analyser</th></tr>');
+  print('<tr><td class="form_first" align="right" width="40%">Fichier</td><td class="form_first">'.getComboFichiers().'</td></tr>');
+  print('<tr><td class="form" align="right" width="40%">Profil unimarc</td><td class="form_first">'.getComboTable("profil_unimarc","profil_donnees","id_profil",1,"where format in(0,6)").'</td></tr>');
+  print('<tr><td class="form" align="right" width="40%">Mode d\'affichage</td><td class="form_first">'.getComboCodif("test_level","test_level",getVariable("test_level")).'</td></tr>');
+  print('<tr><td class="form" align="right" width="40%">Valeurs distinctes (ex: 995$a;210$b)</td><td class="form_first">'.getChamp("distinct",$_REQUEST["distinct"],"60").'</td></tr>');
 
-	print('<tr><th class="form" colspan="2" align="left">Piéger des notices</th></tr>');
+  print('<tr><th class="form" colspan="2" align="left">Piéger des notices</th></tr>');
 
-	$liste[""]="";
-	$tdocs=getCodifsVariable("types_docs");
-	foreach($tdocs as $td)$liste[$td["code"]]=$td["libelle"];
-	unset($liste["0"]);
-	$liste["100"]="article de périodique";
-	print('<tr><td class="form_first" align="right" width="40%">Type de document</td><td class="form_first">'.getComboSimple("piege_type_doc","",$liste,"").'</td></tr>');
-	print('<tr><td class="form_first" align="right" width="40%">n° de notice</td><td class="form_first">'.getChamp("piege_numero","","5").'</td></tr>');
-	print('<tr><td class="form_first" align="right" width="40%">Titre</td><td class="form_first">'.getChamp("piege_titre","","50").'</td></tr>');
-	print('<tr><td class="form_first" align="right" width="40%">Code-barres</td><td class="form_first">'.getChamp("piege_code_barres","","30").'</td></tr>');
-	print('<tr><td class="form_first" align="right" width="40%">Isbn</td><td class="form_first">'.getChamp("piege_isbn","","30").'</td></tr>');
-	print('<tr><td class="form_first" align="right" width="40%">Mémoriser l\'unimarc</td><td class="form_first"><input type="checkbox" name="pave_unimarc" value="1"></td></tr></td></tr>');
-	print('<tr><th class="form" colspan="2" align="center"><input type="submit" class="bouton" value="Lancer"></th></tr>');
-	print('</table></form></div></div>');
-	exit;
+  $liste[""]="";
+  $tdocs=getCodifsVariable("types_docs");
+  foreach($tdocs as $td)$liste[$td["code"]]=$td["libelle"];
+  unset($liste["0"]);
+  $liste["100"]="article de périodique";
+  print('<tr><td class="form_first" align="right" width="40%">Type de document</td><td class="form_first">'.getComboSimple("piege_type_doc","",$liste,"").'</td></tr>');
+  print('<tr><td class="form_first" align="right" width="40%">n° de notice</td><td class="form_first">'.getChamp("piege_numero","","5").'</td></tr>');
+  print('<tr><td class="form_first" align="right" width="40%">Titre</td><td class="form_first">'.getChamp("piege_titre","","50").'</td></tr>');
+  print('<tr><td class="form_first" align="right" width="40%">Code-barres</td><td class="form_first">'.getChamp("piege_code_barres","","30").'</td></tr>');
+  print('<tr><td class="form_first" align="right" width="40%">Isbn</td><td class="form_first">'.getChamp("piege_isbn","","30").'</td></tr>');
+  print('<tr><td class="form_first" align="right" width="40%">Mémoriser l\'unimarc</td><td class="form_first"><input type="checkbox" name="pave_unimarc" value="1"></td></tr></td></tr>');
+  print('<tr><th class="form" colspan="2" align="center"><input type="submit" class="bouton" value="Lancer"></th></tr>');
+  print('</table></form></div></div>');
+  exit;
 }
 
 // ----------------------------------------------------------------
@@ -93,9 +91,9 @@ if($_REQUEST["action"]=="PARAM")
 // ----------------------------------------------------------------
 if($_REQUEST["action"]=="AFFICHER")
 {
-	$buffer->afficher($_REQUEST["page"]);
-	print('</body></html>');
-	exit;
+  $buffer->afficher($_REQUEST["page"]);
+  print('</body></html>');
+  exit;
 }
 // ----------------------------------------------------------------
 // Initialisations
@@ -124,19 +122,19 @@ $avance=-1;
 if($_REQUEST["reprise"]=="oui") restaureContext();
 else
 {
-	$buffer->open(false);
-	$timeStart = time();
-	$buffer->log('<h4>Début de l\'analyse</h4>');
-	$buffer->log('Fichier : '.$fichier.BR);
-	$buffer->log('Profil unimarc : '.$sql->fetchOne("select libelle from profil_donnees where id_profil=$profil_unimarc").BR);
-	$buffer->log('Affichage : '.getLibCodifVariable("test_level",$test_level).BR);
-	$buffer->log('Heure :  '.date("G:i:s").BR.BR);
+  $buffer->open(false);
+  $timeStart = time();
+  $buffer->ecrire('<h4>Début de l\'analyse</h4>');
+  $buffer->ecrire('Fichier : '.$fichier.BR);
+  $buffer->ecrire('Profil unimarc : '.$sql->fetchOne("select libelle from profil_donnees where id_profil=$profil_unimarc").BR);
+  $buffer->ecrire('Affichage : '.getLibCodifVariable("test_level",$test_level).BR);
+  $buffer->ecrire('Heure :  '.date("G:i:s").BR.BR);
 }
 
 if( false == $parseur->open($fichier,0,$pointeur_reprise) )
 {
-	afficherErreur('Impossible d\'ouvrir le fichier : '. $fichier);
-	exit;
+  afficherErreur('Impossible d\'ouvrir le fichier : '. $fichier);
+  exit;
 }
 
 // Jauge
@@ -159,63 +157,63 @@ $notice->setParamsIntegration(0,0,$profil_unimarc);
 
 while(true)
 {
-  	if($chrono->tempsPasse() > $timeout) sauveContexte();
-  	$ret=$parseur->nextEnreg();
-  	$pointeur_reprise=$ret["pointeur_reprise"];
-  	$adresse=$ret["adresse"];
-  	afficherAvance($ret["pct"]);
-  	if($ret["statut"]=="ok")
-  	{
-  		if($test_level==1 and $nb_notices == 100) break;
-  		$nb_notices++;
-  		$ret_test=$notice->testNotice($ret["data"],$piege_numero,$piege_titre,$piege_code_barres,$piege_isbn,$piege_type_doc);
-  		$nb_ex+=$ret_test["nb_ex"];
+    if($chrono->tempsPasse() > $timeout) sauveContexte();
+    $ret=$parseur->nextEnreg();
+    $pointeur_reprise=$ret["pointeur_reprise"];
+    $adresse=$ret["adresse"];
+    afficherAvance($ret["pct"]);
+    if($ret["statut"]=="ok")
+    {
+      if($test_level==1 and $nb_notices == 100) break;
+      $nb_notices++;
+      $ret_test=$notice->testNotice($ret["data"],$piege_numero,$piege_titre,$piege_code_barres,$piege_isbn,$piege_type_doc);
+      $nb_ex+=$ret_test["nb_ex"];
 
-			// Mode piege
-  		if($mode_piege == true)
-  		{
-  			if($nb_notices == $piege_numero or $ret_test["statut"]==1)
-  			{
-  				$url_notice='<a class="notice" href="'.URL_BASE."php/analyse_afficher_notice.php?fichier=".$fichier."&adresse=".$adresse .'&profil_unimarc='.$profil_unimarc.'">';
-  				$buffer->log('<b>'.$url_notice.'Notice n° '.$nb_notices.' : '.$ret_test["titre"].'</a></b>'.BR);
-  				if($pave_unimarc > 0)
-  				{
-  					if($pave_unimarc == 1) $mf="w"; else $mf="a";
-  					$pave_unimarc++;
-  					$ficmemo="test/analyse_unimarc.txt";
-  					$handle=fopen(getVariable("ftp_path").$ficmemo,$mf);
-  					fwrite($handle,$ret["data"]);
-  					fclose($handle);
-  					$buffer->log("La notice a été écrite dans le fichier : ".$ficmemo.BR);
-  				}
-  				// Si le piege est sur le n° on quitte
-  				if($piege_numero) break;
-  			}
-  			continue;
-  		}
-  		// Mode analyse
-  		$type_doc[$ret_test["type_doc"]]++;
-  		if($test_level > 0 or $ret_test["statut"]>0)
-  		{
-  			if($ret_test["statut"]==1) $nb_warnings++;
-  			if($ret_test["statut"]==2) $nb_rejets++;
-  			if($ret_test["statut"]==3) $nb_suppr++;
-  			$url_notice='<a class="notice" href="'.URL_BASE."php/analyse_afficher_notice.php?fichier=".$fichier."&adresse=".$adresse .'&profil_unimarc='.$profil_unimarc.'">';
-  			$buffer->log('<b>'.$url_notice.'Notice n° '.$nb_notices.' : '.$ret_test["titre"].'</a></b>'.BR);
-  			$buffer->log('<table class="blank" cellspacing="0" cellpadding="5px" style="margin-left:15px;margin-bottom:10px;">');
-  			foreach($ret_test["lig"] as $item)
-  			{
-  				$item[1]=str_replace(" ","&nbsp;",$item[1]);
-  				if(! $item[2]) $item[2]="&nbsp;";
-  				if(! $item[3]) $item[3]="&nbsp;";
-  				$buffer->log('<tr><td class="blank"><span class="vert">'.$item[1].'</span></td>');
-  				if($item[0] > 0 and $item[0] < 3) $buffer->log('<td class="blank"><span class="rouge">'.$item[2].'</span></td>');
-  				else $buffer->log('<td class="blank">'.$item[2].'</td>');
-  				$buffer->log('<td class="blank">'.$item[3].'</td>');
-  				$buffer->log('</tr>');
-  			}
-  			$buffer->log('</table>');
-  		}
+      // Mode piege
+      if($mode_piege == true)
+      {
+        if($nb_notices == $piege_numero or $ret_test["statut"]==1)
+        {
+          $url_notice='<a class="notice" href="'.URL_BASE."php/analyse_afficher_notice.php?fichier=".$fichier."&adresse=".$adresse .'&profil_unimarc='.$profil_unimarc.'">';
+          $buffer->ecrire('<b>'.$url_notice.'Notice n° '.$nb_notices.' : '.$ret_test["titre"].'</a></b>'.BR);
+          if($pave_unimarc > 0)
+          {
+            if($pave_unimarc == 1) $mf="w"; else $mf="a";
+            $pave_unimarc++;
+            $ficmemo="test/analyse_unimarc.txt";
+            $handle=fopen(getVariable("ftp_path").$ficmemo,$mf);
+            fwrite($handle,$ret["data"]);
+            fclose($handle);
+            $buffer->ecrire("La notice a été écrite dans le fichier : ".$ficmemo.BR);
+          }
+          // Si le piege est sur le n° on quitte
+          if($piege_numero) break;
+        }
+        continue;
+      }
+      // Mode analyse
+      $type_doc[$ret_test["type_doc"]]++;
+      if($test_level > 0 or $ret_test["statut"]>0)
+      {
+        if($ret_test["statut"]==1) $nb_warnings++;
+        if($ret_test["statut"]==2) $nb_rejets++;
+        if($ret_test["statut"]==3) $nb_suppr++;
+        $url_notice='<a class="notice" href="'.URL_BASE."php/analyse_afficher_notice.php?fichier=".$fichier."&adresse=".$adresse .'&profil_unimarc='.$profil_unimarc.'">';
+        $buffer->ecrire('<b>'.$url_notice.'Notice n° '.$nb_notices.' : '.$ret_test["titre"].'</a></b>'.BR);
+        $buffer->ecrire('<table class="blank" cellspacing="0" cellpadding="5px" style="margin-left:15px;margin-bottom:10px;">');
+        foreach($ret_test["lig"] as $item)
+        {
+          $item[1]=str_replace(" ","&nbsp;",$item[1]);
+          if(! $item[2]) $item[2]="&nbsp;";
+          if(! $item[3]) $item[3]="&nbsp;";
+          $buffer->ecrire('<tr><td class="blank"><span class="vert">'.$item[1].'</span></td>');
+          if($item[0] > 0 and $item[0] < 3) $buffer->ecrire('<td class="blank"><span class="rouge">'.$item[2].'</span></td>');
+          else $buffer->ecrire('<td class="blank">'.$item[2].'</td>');
+          $buffer->ecrire('<td class="blank">'.$item[3].'</td>');
+          $buffer->ecrire('</tr>');
+        }
+        $buffer->ecrire('</table>');
+      }
    }
    else break;
 }
@@ -224,63 +222,63 @@ while(true)
 // ----------------------------------------------------------------
 if($mode_piege == true)
 {
-	$page=$buffer->close();
-	redirection("integre_analyse_fichier_unimarc.php?action=AFFICHER&page=1");
+  $page=$buffer->close();
+  redirection("integre_analyse_fichier_unimarc.php?action=AFFICHER&page=1");
 }
 
 $chrono->timeStart=$timeStart;
-$buffer->log("<h4>Fin de l'analyse</h4>",true);
-$buffer->log("Heure :  ".date("G:i:s").BR);
-$buffer->log("temps de traitement ".$chrono->end().BR.BR);
+$buffer->ecrire("<h4>Fin de l'analyse</h4>",true);
+$buffer->ecrire("Heure :  ".date("G:i:s").BR);
+$buffer->ecrire("temps de traitement ".$chrono->end().BR.BR);
 
 if($ret["statut"]=="erreur")
 {
-	$buffer->log('<span class="rouge">Le fichier ne respecte pas la norme unimarc</span><br>');
-	if($nb_notices > 0)
-	{
-		$buffer->log($nb_notices . " notices ont pu être analysées.".BR);
-	}
-	else
-	{
-		$buffer->log("aucune notice n'a pu être analysée.".BR);
-	}
+  $buffer->ecrire('<span class="rouge">Le fichier ne respecte pas la norme unimarc</span><br>');
+  if($nb_notices > 0)
+  {
+    $buffer->ecrire($nb_notices . " notices ont pu être analysées.".BR);
+  }
+  else
+  {
+    $buffer->ecrire("aucune notice n'a pu être analysée.".BR);
+  }
 }
 else
 {
-	if($nb_notices == 0 ) $buffer->log('<span class="rouge">Le fichier ne contenait aucune notice</span><br>');
-	else
-	{
-		$buffer->log('<b><span class="vert">Le fichier respecte la norme unimarc</span></b>'.BR);
-		$buffer->log($nb_notices.' notices on été analysées.'.BR);
-	}
+  if($nb_notices == 0 ) $buffer->ecrire('<span class="rouge">Le fichier ne contenait aucune notice</span><br>');
+  else
+  {
+    $buffer->ecrire('<b><span class="vert">Le fichier respecte la norme unimarc</span></b>'.BR);
+    $buffer->ecrire($nb_notices.' notices on été analysées.'.BR);
+  }
 }
 if($nb_notices > 0 )
 {
-	if(!$nb_suppr > 0) $nb_suppr="aucune";
-	$buffer->log("Notices à supprimer : " . $nb_suppr.BR);
-	$buffer->log("Notices à mettre à jour : " . ($nb_notices - ($nb_rejets + $nb_suppr)).BR);
-	$buffer->log("Exemplaires à insérer : " . $nb_ex.BR);
-	$buffer->log('Anomalies non bloquantes : '. $nb_warnings.BR);
-	if($nb_rejets>0) $buffer->log('<span class="rouge">Notices non exploitables : '. $nb_rejets.'</span>'.BR);
-	else $buffer->log('Notices non exploitables : aucune'.BR);
-	$buffer->log("Moyenne : ".$chrono->moyenne($nb_notices,"notices").BR);
+  if(!$nb_suppr > 0) $nb_suppr="aucune";
+  $buffer->ecrire("Notices à supprimer : " . $nb_suppr.BR);
+  $buffer->ecrire("Notices à mettre à jour : " . ($nb_notices - ($nb_rejets + $nb_suppr)).BR);
+  $buffer->ecrire("Exemplaires à insérer : " . $nb_ex.BR);
+  $buffer->ecrire('Anomalies non bloquantes : '. $nb_warnings.BR);
+  if($nb_rejets>0) $buffer->ecrire('<span class="rouge">Notices non exploitables : '. $nb_rejets.'</span>'.BR);
+  else $buffer->ecrire('Notices non exploitables : aucune'.BR);
+  $buffer->ecrire("Moyenne : ".$chrono->moyenne($nb_notices,"notices").BR);
 
-	// Types de docs
-	$buffer->log(BR."<b>Types de documents :</b>".BR);
-	$buffer->log('<table class="blank" cellpadding="5px" style="margin-left:15px;margin-top:5px;">');
-	$td=$sql->fetchOne("select liste from variables where clef='types_docs'");
-	$td=explode(chr(13).chr(10),$td);
-	$td[]="100:articles de périodiques";
-	for($i=0; $i<count($td); $i++)
-	{
-		$elem=explode(":",$td[$i]);
-		if(!$type_doc[$elem[0]]) $type_doc[$elem[0]]=0;
-		$buffer->log('<tr>');
-		$buffer->log('<td class="blank">'.$elem[1].'</td>');
-		$buffer->log('<td class="blank" align="right">'.$type_doc[$elem[0]].'</td>');
-		$buffer->log('</tr>');
-	}
-	$buffer->log('</table>'.BR);
+  // Types de docs
+  $buffer->ecrire(BR."<b>Types de documents :</b>".BR);
+  $buffer->ecrire('<table class="blank" cellpadding="5px" style="margin-left:15px;margin-top:5px;">');
+  $td=$sql->fetchOne("select liste from variables where clef='types_docs'");
+  $td=explode(chr(13).chr(10),$td);
+  $td[]="100:articles de périodiques";
+  for($i=0; $i<count($td); $i++)
+  {
+    $elem=explode(":",$td[$i]);
+    if(!$type_doc[$elem[0]]) $type_doc[$elem[0]]=0;
+    $buffer->ecrire('<tr>');
+    $buffer->ecrire('<td class="blank">'.$elem[1].'</td>');
+    $buffer->ecrire('<td class="blank" align="right">'.$type_doc[$elem[0]].'</td>');
+    $buffer->ecrire('</tr>');
+  }
+  $buffer->ecrire('</table>'.BR);
 }
 // Réafficher le debut si + d'1 page en buffer
 $page=$buffer->close();
@@ -292,126 +290,124 @@ print('</body></html>');
 // ----------------------------------------------------------------
 function sauveContexte()
 {
-	global $buffer;
-	global $fichier,$timeStart,$pointeur_reprise,$nb_notices,$nb_ex,$nb_warnings,$nb_rejets,$nb_suppr,$type_doc,$test_level,$profil_unimarc;
-	global $mode_piege,$piege_numero,$piege_titre,$piege_code_barres,$piege_isbn,$piege_type_doc,$pave_unimarc;
-	$page=$buffer->close();
-	$data=compact("page","fichier","timeStart","pointeur_reprise","nb_notices","nb_ex","nb_warnings","nb_rejets"
-			,"type_doc","test_level","profil_unimarc","mode_piege","piege_numero","piege_titre","piege_code_barres","piege_type_doc","piege_isbn","pave_unimarc");
-	$_SESSION["reprise"]=$data;
-	redirection( "integre_analyse_fichier_unimarc.php?reprise=oui");
+  global $buffer;
+  global $fichier,$timeStart,$pointeur_reprise,$nb_notices,$nb_ex,$nb_warnings,$nb_rejets,$nb_suppr,$type_doc,$test_level,$profil_unimarc;
+  global $mode_piege,$piege_numero,$piege_titre,$piege_code_barres,$piege_isbn,$piege_type_doc,$pave_unimarc;
+  $page=$buffer->close();
+  $data=compact("page","fichier","timeStart","pointeur_reprise","nb_notices","nb_ex","nb_warnings","nb_rejets"
+      ,"type_doc","test_level","profil_unimarc","mode_piege","piege_numero","piege_titre","piege_code_barres","piege_type_doc","piege_isbn","pave_unimarc");
+  $_SESSION["reprise"]=$data;
+  redirection( "integre_analyse_fichier_unimarc.php?reprise=oui");
 }
 function restaureContext()
 {
-	global $buffer;
-	global $fichier,$timeStart,$pointeur_reprise,$nb_notices,$nb_ex,$nb_warnings,$nb_rejets,$nb_suppr,$type_doc,$fichier,$test_level,$profil_unimarc;
-	global $mode_piege,$piege_numero,$piege_titre,$piege_code_barres,$piege_isbn,$piege_type_doc,$pave_unimarc;
-	extract($_SESSION["reprise"]);
-	unset($_SESSION["reprise"]);
-	$buffer->open($page);
+  global $buffer;
+  global $fichier,$timeStart,$pointeur_reprise,$nb_notices,$nb_ex,$nb_warnings,$nb_rejets,$nb_suppr,$type_doc,$fichier,$test_level,$profil_unimarc;
+  global $mode_piege,$piege_numero,$piege_titre,$piege_code_barres,$piege_isbn,$piege_type_doc,$pave_unimarc;
+  extract($_SESSION["reprise"]);
+  unset($_SESSION["reprise"]);
+  $buffer->open($page);
 }
 function afficherAvance($pct)
 {
-	global $avance;
-	if($pct > $avance)
-	{
-		$avance=$pct;
-		print('<script>');
-		print("document.getElementById('pct').innerHTML='".$pct."%';");
-		$jauge="document.getElementById('jauge').style.width='".$pct."%';";
-		print($jauge);
-		print('</script>');
-		flush();
-	}
+  global $avance;
+  if($pct > $avance)
+  {
+    $avance=$pct;
+    print('<script>');
+    print("document.getElementById('pct').innerHTML='".$pct."%';");
+    $jauge="document.getElementById('jauge').style.width='".$pct."%';";
+    print($jauge);
+    print('</script>');
+    flush();
+  }
 }
 function getComboFichiers()
 {
-	// dossiers a parser
-	$paths[]=getVariable("integration_path");
-	$paths[]=getVariable("ftp_path");
-	if(!file_exists($paths[0])) afficherErreur("Impossible d'ouvrir le dossier : ".$paths[0]);
+  // dossiers a parser
+  $paths[]=getVariable("integration_path");
+  $paths[]=getVariable("ftp_path");
+  if(!file_exists($paths[0])) afficherErreur("Impossible d'ouvrir le dossier : ".$paths[0]);
 
-	// recup des dossiers
-	$dossiers = array();
-	foreach($paths as $path)
-	{
-		$dossiers[]=$path;
-		$ret=parseDossiers($path);
-		$dossiers=array_merge($dossiers,$ret);
-	}
+  // recup des dossiers
+  $dossiers = array();
+  foreach($paths as $path)
+  {
+    $dossiers[]=$path;
+    $ret=parseDossiers($path);
+    $dossiers=array_merge($dossiers,$ret);
+  }
 
-	// recup des fichiers
-	$files = [];
-	foreach($dossiers as $dossier) {
-		$ret=parseFichiers($dossier);
-		$files = array_merge($files, $ret);
-	}
-	sort($files);
+  // recup des fichiers
+  $files = [];
+  foreach($dossiers as $dossier) {
+    $ret=parseFichiers($dossier);
+    $files = array_merge($files, $ret);
+  }
+  sort($files);
 
-	$combo='<select name="fichier">';
-	foreach($files as $file) {
-		$combo .= "<option value='$file'>$file</option>";
-	}
-	$combo.='</select>';
-	return $combo;
+  $combo='<select name="fichier">';
+  foreach($files as $file) {
+    $combo .= "<option value='$file'>$file</option>";
+  }
+  $combo.='</select>';
+  return $combo;
 }
 
 function parseDossiers($racine)
 {
-	if(strRight($racine,1) != "/") $racine.="/";
-	@$dir = opendir($racine);
-	if(!$dir) return array();
-	$paths = array();
-	while (($file = readdir($dir)) !== false)
-	{
-		if(is_dir($racine.$file) and substr($file,0,1) != "." and $file !="etalon")
-		{
-			$paths[]=$racine.$file;
-			$ret=parseDossiers($racine.$file);
-			$paths=array_merge($paths,$ret);
-		}
-	}
-	closedir($dir);
-	return $paths;
+  if(strRight($racine,1) != "/") $racine.="/";
+  @$dir = opendir($racine);
+  if(!$dir) return array();
+  $paths = array();
+  while (($file = readdir($dir)) !== false)
+  {
+    if(is_dir($racine.$file) and substr($file,0,1) != "." and $file !="etalon")
+    {
+      $paths[]=$racine.$file;
+      $ret=parseDossiers($racine.$file);
+      $paths=array_merge($paths,$ret);
+    }
+  }
+  closedir($dir);
+  return $paths;
 }
 
 function parseFichiers($dossier)
 {
-	$rejet=array(".gitignore","test.txt");
-	if(strRight($dossier,1) != "/") $dossier.="/";
-	@$dir = opendir($dossier);
-	if(!$dir) return [];
+  $rejet=array(".gitignore","test.txt");
+  if(strRight($dossier,1) != "/") $dossier.="/";
+  @$dir = opendir($dossier);
+  if(!$dir) return [];
 
-	$combo_lignes = [];
-	while(($file = readdir($dir)) !== false)
-	{
-		if(in_array($file, $rejet)) continue;
-		if(is_file($dossier.$file))
-		{
-			$combo_lignes []= $dossier.$file;
-		}
-	}
+  $combo_lignes = [];
+  while(($file = readdir($dir)) !== false)
+  {
+    if(in_array($file, $rejet)) continue;
+    if(is_file($dossier.$file))
+    {
+      $combo_lignes []= $dossier.$file;
+    }
+  }
 
-	closedir( $dir);
-	return $combo_lignes;
+  closedir( $dir);
+  return $combo_lignes;
 }
 
 function controleChampsDistinct()
 {
-	$champs=trim($_POST["distinct"]);
-	if(!$champs) return false;
-	$champs=explode(";",$champs);
-	foreach($champs as $champ)
-	{
-		if(strlen($champ) !=5) return false;
-		if(!intVal(substr($champ,0,3))) return false;
-		if(substr($champ,3,1) != "\$") return false;
-		$car=substr($champ,-1);
-		if($car >="0" and $car <="9") continue;
-		if($car >="a" and $car <="z") continue;
-		return false;
-	}
-	return true;
-}
-
-?>
+  $champs=trim($_POST["distinct"]);
+  if(!$champs) return false;
+  $champs=explode(";",$champs);
+  foreach($champs as $champ)
+  {
+    if(strlen($champ) !=5) return false;
+    if(!intVal(substr($champ,0,3))) return false;
+    if(substr($champ,3,1) != "\$") return false;
+    $car=substr($champ,-1);
+    if($car >="0" and $car <="9") continue;
+    if($car >="a" and $car <="z") continue;
+    return false;
+  }
+  return true;
+}
\ No newline at end of file
diff --git a/library/Class/User/DoubleFinder.php b/library/Class/User/DoubleFinder.php
index 94987266d6d4fc6bfcd70ca3fdd3f5e8fdfab4cd..64cfe9b8402e9471a77171711aa5ebfa09632bf6 100644
--- a/library/Class/User/DoubleFinder.php
+++ b/library/Class/User/DoubleFinder.php
@@ -147,7 +147,7 @@ class Class_User_DoubleFinder_NanookStrategy
   }
 
 
-  protected function _matchByLoginAndIdSigbAndIdSite() {
+  protected function _matchByLoginAndIdSigbAndLibrary() {
     return $this->_matchRestrictedToSite(['login' => $this->getPatronLogin(),
                                           'id_sigb' => $this->getPatronIdSigb()]);
   }
diff --git a/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php b/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php
index 02874402f4369a3e45973f8dc0681576e9f94925..7c0ca7cd59ed2303b6d5d9520d860cc330a3e524 100644
--- a/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php
+++ b/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php
@@ -22,6 +22,7 @@
 
 class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Controller_Action_Helper_AbstractListViewMode {
   const STRATEGY = 'article';
+  const STATUS_SEARCH = 'status_search';
 
   protected
     $_filtred_categories_ids = [],
@@ -55,7 +56,7 @@ class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Contr
             'id_cat' => $this->getParam('id_cat'),
             'id_bib' => $this->getParam('id_bib'),
             'title_search' => $this->getSearch(),
-            'status' => $this->getParam('status')];
+            static::STATUS_SEARCH => $this->getStatus()];
   }
 
 
@@ -64,7 +65,7 @@ class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Contr
                                   'id_bib' => $this->getBibId(),
                                   'title_search' => '',
                                   'page' => '1',
-                                  'status' => ''];
+                                  static::STATUS_SEARCH => ''];
   }
 
 
@@ -364,14 +365,14 @@ class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Contr
   public function _getSearchForm($view) {
     $form = parent::_getSearchForm($view);
 
-    if(!Class_AdminVar::isWorkflowEnabled())
+    if (!Class_AdminVar::isWorkflowEnabled())
       return $form;
 
-    Class_ScriptLoader::getInstance()->addJQueryReady('$("form select[name=\'status\']").on("change", function() {$(this).closest("form").submit();});');
+    Class_ScriptLoader::getInstance()->addJQueryReady('$("form select[name=\''. static::STATUS_SEARCH .'\']").on("change", function() {$(this).closest("form").submit();});');
 
     $form->removeDisplayGroup('list_search_group');
     return $form->addElement('select',
-                             'status',
+                             static::STATUS_SEARCH,
                              ['multiOptions' => [0 => $this->_('Tous statuts')] + Class_Article::getKnownStatus(),
                               'value' => $this->getStatus()])
                 ->addUniqDisplayGroup('list_search_group');
@@ -379,7 +380,7 @@ class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Contr
 
 
   public function getStatus() {
-    return $this->getParam('status');
+    return $this->getParam(static::STATUS_SEARCH);
   }
 
 
diff --git a/library/startup.php b/library/startup.php
index f1ec92849cb24b5f2462e68d25973b1c8dcfcb45..5b5f10e4a7f107e7da0579ddf68d244f5095bb64 100644
--- a/library/startup.php
+++ b/library/startup.php
@@ -82,7 +82,7 @@ class Bokeh_Engine {
 
   function setupConstants() {
     defineConstant('BOKEH_MAJOR_VERSION','7.9');
-    defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.17');
+    defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.19');
 
     defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/');
 
diff --git a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php
index 8cc84198819688b53c9b7829bea32c1748383b91..f671b32847290a3f7efda2868d401926eeedb1e1 100644
--- a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php
+++ b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php
@@ -98,7 +98,7 @@ class CmsControllerListModeAdminBibRootTest extends CmsControllerListModeTestCas
 
   /** @test */
   public function shouldDisplayRootCategory() {
-    $this->assertXPathContentContains('//td/a[contains(@href, "cms/index/page/1/id_cat/1/id_bib/1/title_search//status/")]',
+    $this->assertXPathContentContains('//td/a[contains(@href, "cms/index/page/1/id_cat/1/id_bib/1/title_search//status_search/")]',
                                       'Root');
   }
 }
@@ -446,7 +446,7 @@ class CmsControllerListModeSearchFormTest extends CmsControllerListModeTestCase
 
   /** @test */
   public function statusSelectorShouldBeDisplay() {
-    $this->assertXPath('//form//select[@name="status"]');
+    $this->assertXPath('//form//select[@name="status_search"]');
   }
 
 
@@ -471,12 +471,12 @@ class CmsControllerListModeSearchPostFormTest extends CmsControllerListModeTestC
     $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '1']);
     $_SERVER['HTTP_REFERER'] = 'http://mybokeh.fr/admin/cms/index';
     $this->postDispatch('/admin/cms/index/id_cat/1', ['title_search' => 'abc',
-                                                      'status' => 1]);
+                                                      'status_search' => 1]);
   }
 
 
   /** @test */
   public function shouldRedirectToCms() {
-    $this->assertRedirectTo('/admin/cms/index/title_search/abc/status/1');
+    $this->assertRedirectTo('/admin/cms/index/title_search/abc/status_search/1');
   }
 }
diff --git a/tests/library/Class/UserDoubleFinderTest.php b/tests/library/Class/UserDoubleFinderTest.php
index 4309d8eabe522df6561c0a25c210fe98e814aba6..c9832ef6a4b09d5f1a80a96e624c8ca7b4093baa 100644
--- a/tests/library/Class/UserDoubleFinderTest.php
+++ b/tests/library/Class/UserDoubleFinderTest.php
@@ -70,7 +70,7 @@ class UserDoubleFinderWithSingleNanookTest extends ModelTestCase {
                      'ROLE' => 'abonne_sigb',
                      'ROLE_LEVEL' => 2,
                      'IDABON' => '0046158',
-                     'ORDREABON' => 1,
+                     'ORDREABON' => 3,
                      'pseudo' => '',
                      'DATE_DEBUT' => '',
                      'ID_SIGB' => '6308',
diff --git a/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php b/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php
index 21838fe180dab1a7589e83d00cc7e16faae20302..fecdf79d8f82519b96a651561bd3f70258ac51d5 100644
--- a/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php
+++ b/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php
@@ -108,7 +108,7 @@ class ArticleListViewModeTest extends ModelTestCase {
     $this->_list = (new ZendAfi_Controller_Action_Helper_ArticleListViewMode())
       ->articleListViewMode(['page' => 0,
                              'search_value' => $search,
-                             'status' => 3,
+                             'status_search' => 3,
                              'bib' => $this->_bib,
                              'id_bib' => null,
                              'id_cat' => 0]);