Index: /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 7000)
+++ /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 7062)
@@ -114,6 +114,6 @@
 		$ID			= $params['ID'];
 		
-                $ldapService = ServiceLocator::getService('ldap');
-                $filter =  $ldapService->getSearchFilter($params['search_for']);
+		$ldapService = ServiceLocator::getService('ldap');
+		$filter =  $ldapService->getSearchFilter($params['search_for']);
 
 		$contacts_result = array();
@@ -132,42 +132,42 @@
 		if ($this->ds)
 		{
-                    $ldapService->connection = $this->ds;
-				if($extendedinfo)
-                                        $justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou");
-				else 
-					$justthese = array("cn", "mail", "telephoneNumber", "phpgwAccountVisible", "uidNumber","uid");
-                $types = false;
-
-                if( $field == 'null' || $ID == 'null' )
+			$ldapService->connection = $this->ds;
+			if($extendedinfo)
+				$justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou");
+			else 
+				$justthese = array("cn", "mail", "telephoneNumber", "phpgwAccountVisible", "uidNumber","uid");
+			$types = false;
+
+			if( $field == 'null' || $ID == 'null' )
  			{
-                    $justthese[] = "jpegphoto";
-                    $types = 'u';
-                }
+				$justthese[] = "jpegphoto";
+				$types = 'u';
+			}
 
 		$filter = $ldapService->getSearchFilter( $params['search_for'], $types );
 
 		$sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese, 0, $this->max_result);
-			
-				if(!$sr)
-					return null;
-
-				$count_entries = ldap_count_entries($this->ds,$sr);
-
-                $info = ldap_get_entries($this->ds, $sr);
+
+		if(!$sr)
+			return null;
+
+		$count_entries = ldap_count_entries($this->ds,$sr);
+
+		$info = ldap_get_entries($this->ds, $sr);
 
 	    // New search only on user sector
 	    if ($count_entries == $this->max_result)
 	    {
-                $overload = $count_entries;
-				}
-				else
-				{
-				$catalogsNum=count($this->external_srcs);
-		for ($i=0; $i<=$catalogsNum; $i++)	{
+			$overload = $count_entries;
+		}
+		else
+		{
+			$catalogsNum=count($this->external_srcs);
+				for ($i=0; $i<=$catalogsNum; $i++)	{
 					if ($this->external_srcs[$i]["quicksearch"]) { 
 						$this->ldapConnect(true,$i);
 						$filter="(|(cn=*$search_for*)(mail=*$search_for*))";
 						if($extendedinfo)
-                			$justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou");
+							$justthese = array("cn", "mail", "telephonenumber", "uid","uidNumber", "mobile", "phpgwaccountvisible", "employeenumber", "ou");
 						else 
 							$justthese = array("cn", "mail", "telephoneNumber", "phpgwAccountVisible","uidNumber", "uid");
@@ -185,19 +185,19 @@
 			}
 
-	    $tmp = array();
-	    $tmp_users_from_user_org = array();
-
-			for ($i=0; $i<$info["count"]; $i++)
+		$tmp = array();
+		$tmp_users_from_user_org = array();
+
+		for ($i=0; $i<$info["count"]; $i++)
+		{
+			$key = $info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count'] . '%' . $info[$i]["employeenumber"][0] . '%' . 	$info[$i]["ou"][0];
+
+			if (/*(!$quickSearch_only_in_userSector) &&*/ preg_match("/$user_sector_dn/i", $info[$i]['dn']))
 			{
-		$key = $info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count'] . '%' . $info[$i]["employeenumber"][0] . '%' . 	$info[$i]["ou"][0];
-
-		if (/*(!$quickSearch_only_in_userSector) &&*/ preg_match("/$user_sector_dn/i", $info[$i]['dn']))
-				{
-			$tmp_users_from_user_org[$key] = utf8_decode($info[$i]["cn"][0]);
-			continue;
-				}
-
-		$tmp[$key] = utf8_decode($info[$i]["cn"][0]);
-					}
+				$tmp_users_from_user_org[$key] = utf8_decode($info[$i]["cn"][0]);
+				continue;
+			}
+
+			$tmp[$key] = utf8_decode($info[$i]["cn"][0]);
+		}
 
 			natcasesort($tmp_users_from_user_org);
@@ -219,5 +219,5 @@
 				}
 				$contacts_result['quickSearch_only_in_userSector'] = $quickSearch_only_in_userSector;
-		    $contacts_result['maxResult'] = $ldapService->limit;
+				$contacts_result['maxResult'] = $ldapService->limit;
 			}
 			else
@@ -275,5 +275,4 @@
 
 		ldap_close($this->ds);
-
 		return $contacts_result;
 	}
@@ -329,5 +328,5 @@
 							return $this->quickSearch($params);
 						else
-							return $this->quickSearchAll($params);							
+							return $this->quickSearchAll($params);
                 }
             }
@@ -489,5 +488,5 @@
 			}
 			//---------------------------------------------------------------//
-			
+
             if($all == false)
                 $info_return['type_catalog'] = "G";
@@ -495,8 +494,14 @@
 			$info_return['extra_ldap_fields'] = $campos_extras; 
 			
-			foreach($info_return as $i=>$value)
-				$info_return[$i]['type_contact'] = "G";
-				
+			foreach($info_return as &$value){
+				$value['type_contact'] = "G";
+
+				//Converte a descrição dos filtros para ISO8859 corrigindo inconsitências com caractéres especiais
+				if(isset($value['vacationinfo']) && isset($value['vacationinfo'][0]) && $value['vacationinfo'][0] != '')
+					$value['vacationinfo'][0] = $this->toISO8859($value['vacationinfo'][0]);
+			}
+
 			$info_return['search_for'] = $params['search_for'];
+
             return $info_return; 
         } 
