Index: sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php
===================================================================
--- sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php	(revision 4544)
+++ sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php	(revision 4548)
@@ -83,4 +83,13 @@
 				$this -> typeContact = 'contacts';
 			$this->preferences = $_SESSION['phpgw_info']['user']['preferences']['contactcenter'];
+		}
+		
+		function lg( $message, $path = '/tmp/natan.log' )
+		{
+		    ob_start();
+		    print_r( $message );
+		    echo( "\n" );
+		    $output = ob_get_clean();
+		    file_put_contents( $path, file_get_contents( $path ) . $output );
 		}
 
@@ -263,50 +272,47 @@
 			$GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.'));
 			$GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name'));
+
+			/*
+			    * Monta Contactcenter Busca Avancada
+			    */
+			$c = CreateObject('phpgwapi.config','contactcenter');
+			$c->read_repository();
+			$current_config = $c->config_data;
+			$this->lg( $current_config );
+
+			$arraySearch = array();
+			foreach ($current_config as $index => $value)
+			{
+
+			    if(substr($index, 0, 24) == 'cc_attribute_searchable_')
+			    {
+				if($value == 'true')
+				    $arraySearch[] = substr($index, 24, strlen($index));
+			    }
+			}
+			$advanceSearchArray = array();
+			foreach ($arraySearch as $value)
+			{
+			    foreach ($current_config as $index => $value2)
+			    {
+				if($value == substr($index, 22, strlen($index)) && substr($index, 0, 22) == 'cc_attribute_ldapname_')
+				{
+				    foreach ($current_config as $index2 => $value3)
+				    {
+					if($value == substr($index2, 18, strlen($index2)) && substr($index2, 0, 18) == 'cc_attribute_name_')
+						$advanceSearchArray[$value2] =  $value3;
+				    }
+				}
+
+			    }
+			}
+
+			$advanceSearch = array();
+			foreach ($advanceSearchArray as $index => $value)
+			    $advanceSearch[] ='"'.$index.'":"'.$value.'"';
+
+			$advancedFields =  "{".implode(',',$advanceSearch)."}";
 			
-			
-
-
-                            /*
-                             * Monta Contactcenter Busca Avancada
-                             */
-                            $c = CreateObject('phpgwapi.config','contactcenter');
-                            $c->read_repository();
-                            $current_config = $c->config_data;
-
-                            $arraySearch = array();
-                            foreach ($current_config as $index => $value)
-                            {
-
-                                if(substr($index, 0, 24) == 'cc_attribute_searchable_')
-                                {
-                                    if($value == 'true')
-                                    {
-                                        $v = substr($index, 24, strlen($index));
-                                        $arraySearch[] = $v;
-                                    }
-                                }
-                            }
-                            $advanceSearchArray = array();
-                            foreach ($arraySearch as $value)
-                            {
-                                foreach ($current_config as $index => $value2)
-                                {
-                                    if($value == substr($index, 22, strlen($index)) && substr($index, 0, 22) == 'cc_attribute_ldapname_')
-                                    {
-                                        foreach ($current_config as $index2 => $value3)
-                                        {
-                                            if($value == substr($index2, 18, strlen($index2)) && substr($index2, 0, 18) == 'cc_attribute_name_')
-                                                 $advanceSearchArray[$value2] =  $value3;
-                                        }
-                                    }
-
-                                }
-                            }
-
-                            $advanceSearch = array();
-                            foreach ($advanceSearchArray as $index => $value)
-                                $advanceSearch[] ='"'.$index.'":"'.$value.'"';
-
-                            $advancedFields =  "{".implode(',',$advanceSearch)."}";
+			$this->lg( $advancedFields );
 
 
@@ -333,4 +339,5 @@
 				$GLOBALS['phpgw']->template->set_var('cc_contact_type', 'default');
 			}
+
 			$GLOBALS['phpgw']->template->parse('out','index');
 
