From 1223d7c3d01aa3f4e4e0b53814cc3962567ea57b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 27 Jun 2013 18:37:09 +0200
Subject: [PATCH] Fix: Civility field must be blank if not defined.

---
 htdocs/adherents/class/adherent.class.php | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 733e8cfdf74..f6be9c02807 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1500,11 +1500,12 @@ class Adherent extends CommonObject
      */
     function getCivilityLabel()
     {
-        global $langs;
-        $langs->load("dict");
-
-        $code=$this->civilite_id;
-        return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
+    	global $langs;
+    	$langs->load("dict");
+    	
+    	$code=(! empty($this->civilite_id)?$this->civilite_id:(! empty($this->civility_id)?$this->civility_id:''));
+    	if (empty($code)) return '';
+    	return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
     }
 
     /**
-- 
GitLab