From 2c1690b0f04f309c456339b9c6fad3b3c4178aa8 Mon Sep 17 00:00:00 2001
From: jgaimard <jgaimard@git-test.afi-sa.fr>
Date: Tue, 21 Aug 2012 14:53:06 +0000
Subject: [PATCH] auteurs courts

---
 library/Class/Indexation.php | 13 +++++++++++--
 library/Class/Notice.php     |  3 ++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/library/Class/Indexation.php b/library/Class/Indexation.php
index 245d1732de4..442553563f8 100644
--- a/library/Class/Indexation.php
+++ b/library/Class/Indexation.php
@@ -35,7 +35,7 @@ class Class_Indexation
 	{
 		// Lire formes rejetées
 		$this->articles=array("L'","LE ","LA ","LES ","UN ","UNE ");
-		$this->inclu=array("AN","AS","OR","U2","AI","LU","XO");
+		$this->inclu=array("AN","AS","OR","U2","AI","LU","XO","DO","RE","MI","FA","SI","AC","DC","H","K","M","Z","L","YU","UT","LI","OC","PI","ZU","WU","TO","OZ","ZZ");
 		$this->exclu = array("LES","DES","MES","TES","ENTRE","CHEZ","SES","LEUR","MON","ENTRE","POUR","ELLE","ILS","COMME","DANS","EUX","CEUX","MAIS","MEME","SANS",
 		"TOME","VERS","VOUS","CECI","CES","ETC","PARCE","QUE","QUEL","QUELLE","QUELS","QUELLES","PAS","QUI","QUOI","VOS","AFIN","CECI","CELA","LUI","PAR","PUIS","SOI");
 		
@@ -175,6 +175,7 @@ class Class_Indexation
 			if( strLen($mot[$i]) < 3 And intVal($mot[$i])==false)
 			{
 				if( in_array( $mot[$i], $this->inclu) == false) continue;
+				if(strlen($mot[$i])==1) $mot[$i].=$mot[$i]; // mots d'1 lettre : on double la lettre
 			}
 			// Retirer mots vides
 			if( in_array($mot[$i], $this->exclu ) == true ) continue;
@@ -252,7 +253,15 @@ class Class_Indexation
 		return true;
 	}
 
-	// ---------------------------------------------------
+// ---------------------------------------------------
+// Rend true si mot inclu
+// ---------------------------------------------------
+	public function  isMotInclu($mot)
+	{
+		return in_array($mot, $this->inclu);
+	}
+
+// ---------------------------------------------------
 // Othographe approchante
 // ---------------------------------------------------
 	function phonetix($sIn)
diff --git a/library/Class/Notice.php b/library/Class/Notice.php
index 9cdef96509f..544691faebd 100644
--- a/library/Class/Notice.php
+++ b/library/Class/Notice.php
@@ -786,6 +786,7 @@ class Class_Notice extends Storm_Model_Abstract {
 // ----------------------------------------------------------------
 	public function getAuteurs($auteurPrincipal=false, $getFonction=false)
 	{
+		$indexation=new Class_Indexation();
 		$auteur = array();
 		$zones = array("700", "710", "720", "730", "701", "702", "711", "712", "721", "722");
 		foreach ($zones as $zone)
@@ -807,7 +808,7 @@ class Class_Notice extends Storm_Model_Abstract {
 				}
 				$nm = $nom . "|" . $prenom;
 				if ($getFonction == true) $nm.="|" . $fonction . "|" . $fonction_pergame;
-				if (strlen($nm) > 2 and striPos($nm, "ANONYME") === false) // On elimine les auteurs avec 1 seule lettre et les anonymes
+				if((strlen($nm) > 2 or $indexation->isMotInclu($nom))and striPos($nm,"ANONYME") === false) // On elimine les auteurs avec 1 seule lettre
 				{
 					$auteur[] = $nm;
 					if ($auteurPrincipal == true) return array(trim($prenom . " " . $nom));
-- 
GitLab