Index: sandbox/workflow/trunk/setup/tables_current.inc.php
===================================================================
--- sandbox/workflow/trunk/setup/tables_current.inc.php	(revision 1229)
+++ sandbox/workflow/trunk/setup/tables_current.inc.php	(revision 3060)
@@ -190,9 +190,8 @@
 				'fd' => array(
 					'wf_parent_instance_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
-					'wf_parent_activity_id'	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
 					'wf_child_instance_id' 	=> array('type' => 'int', 'precision' => '4', 'nullable' => False),
 					'wf_parent_lock' 		=> array('type' => 'int', 'precision' => '2', 'nullable' => True)
 				),
-				'pk' => array('wf_parent_instance_id', 'wf_parent_activity_id', 'wf_child_instance_id'),
+				'pk' => array('wf_parent_instance_id', 'wf_child_instance_id'),
 				'fk' => array(),
 				'ix' => array(),
Index: sandbox/workflow/trunk/setup/tables_update.inc.php
===================================================================
--- sandbox/workflow/trunk/setup/tables_update.inc.php	(revision 2858)
+++ sandbox/workflow/trunk/setup/tables_update.inc.php	(revision 3060)
@@ -1278,4 +1278,13 @@
 			/* reconnect to the previous database */
 			$GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']);
+
+			/* removing primary key of egw_wf_interinstance_relations */
+			$GLOBALS['phpgw']->ADOdb->query('ALTER TABLE egw_wf_interinstance_relations DROP CONSTRAINT egw_wf_interinstance_relations_pkey');
+
+			/* removing wf_parent_activity_id column from egw_wf_interinstance_relations table */
+			$GLOBALS['phpgw']->ADOdb->query('ALTER TABLE egw_wf_interinstance_relations DROP COLUMN wf_parent_activity_id');
+
+			/* adding primary key without the column removed */
+			$GLOBALS['phpgw']->ADOdb->query('ALTER TABLE egw_wf_interinstance_relations ADD CONSTRAINT egw_wf_interinstance_relations_pkey PRIMARY KEY (wf_parent_instance_id, wf_child_instance_id)');
 		}
 
Index: sandbox/workflow/trunk/doc/change_log.txt
===================================================================
--- sandbox/workflow/trunk/doc/change_log.txt	(revision 2886)
+++ sandbox/workflow/trunk/doc/change_log.txt	(revision 3060)
@@ -17,8 +17,16 @@
 pedroerp is Pedro Eugênio Rocha Pedreira
 fabianok is Fabiano Sardenberg Kuss
+pereira.jair is Jair Gonçalves Pereira Junior
+adeildosantos is Adeildo Fernandes dos Santos
 
 [2.2.000]
 
+	#1143 - Refinição da função apache_request_headers, caso não exista no ambiente apache-php (viani)
+	#1139 - Modificação na função wf_upload_file para possibilitar a remoção de arquivos (fabianok)
+	#1131 - Modificação na exportação de processos para permitir templates com nomes aleatórios (viani)
+	#1120 - Moficado plugin wf_select_ldap_users para retornar atributos adicionais (adeildosantos)
+	#1119 - Implementado método getSupervisorAreas em class.wf_orgchart.php (pereira.jair)
 	#1089 - Melhoria em query sql na inserção de instancias. (fabianok)
+	#1082 - Removida coluna wf_parent_activity_id da tabela egw_wf_interinstance_relations (asaikawa)
 	#1080 - Modificada string (excluído) para (inativo) quando um registro de usuário no cache não existe mais no ldap. (viani)
 	#1069 - Inclusão de log de tempo de execução de atividades. (gbisotto/rufino)
Index: sandbox/workflow/trunk/inc/class.bo_utils.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.bo_utils.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.bo_utils.inc.php	(revision 3060)
@@ -64,5 +64,5 @@
 	 */
 	function search_ldap_users_by_cn($params)
-	{
+	{ 
 		// parâmetro a ser procurado no ldap
 		$cn = trim(ereg_replace(' +', ' ', $params['cn']));
@@ -86,4 +86,6 @@
 			$ret_name = empty($params['name']) ? 'cn' : $params['name'];
 
+			$ret_complement = empty($params['complement']) ? '' : $params['complement'];
+
 			$ajaxConfig = &Factory::newInstance('ajax_config', 'contactcenter');
 			$config = $ajaxConfig->read_repository();
@@ -103,5 +105,9 @@
 
 				$filter     = '(&(uid=*)(phpgwAccountType=u)(!(phpgwAccountVisible=-1))(cn=*' . $cn . '*))';
-				$attrib_ret = array('cn', $ret_id, $ret_name);
+
+				if($ret_complement != '')
+					$attrib_ret = array('cn', $ret_id, $ret_name, $ret_complement);
+				else
+					$attrib_ret = array('cn', $ret_id, $ret_name);
 
 				$r = ldap_search($ds, $ldapconfig['basedn'], $filter, $attrib_ret, 0, 0, 5);
@@ -112,11 +118,30 @@
 					}
 					elseif(ldap_count_entries($ds, $r) < 200){
+
 						$result = ldap_get_entries($ds, $r);
-						foreach($result as $value){
-							$output['values'][] = array(
-								'id'   => $value[$ret_id],
-								'name' => trim(ucwords(strtolower($value[$ret_name][0]))));
+
+						foreach($result as $value){ 
+							if( ($value[$ret_name][0] != '') && ($value[$ret_complement][0] != '') ){
+									$complement = " >> " . $value[$ret_complement][0];
+									$output['values'][] = array(
+																 'id'   => $value[$ret_id],
+																 'name' => trim(ucwords(strtolower($value[$ret_name][0]))) . $complement
+															   ); 
+
+							}
+						elseif($value[$ret_name][0] != ''){
+								$output['values'][] = array(
+															 'id'   => $value[$ret_id],
+															 'name' => trim(ucwords(strtolower($value[$ret_name][0])))
+														   ); 
+							}
+						else{
+								$output['values'][] = array(
+															 'id'   => '',
+															 'name' => "-- Selecione uma Opção --"
+														   ); 
+							}
+
 						}
-
 
 						foreach ($output['values'] as $key => $value){
@@ -140,5 +165,5 @@
 		else{
 			$output['msg'] = 'Não digite caracteres especiais nem números. Apenas letras e espaços são permitidos.';
-		}
+		} 
 		return $output;
 	}
Index: sandbox/workflow/trunk/inc/local/functions/function.wf_create_object.php
===================================================================
--- sandbox/workflow/trunk/inc/local/functions/function.wf_create_object.php	(revision 795)
+++ sandbox/workflow/trunk/inc/local/functions/function.wf_create_object.php	(revision 3060)
@@ -5,5 +5,5 @@
  * @return mixed
  * @license http://www.gnu.org/copyleft/gpl.html GPL
- * @deprecated 1.4.00.000 - 08/03/2007
+ * @deprecated 2.2.00.000
  * @package Workflow 
  * @subpackage local 
@@ -12,4 +12,5 @@
 function wf_create_object($class_name)
 {
+	wf_warn_deprecated_method('Factory', 'getInstance');
 	$obj = null;
 	$file_name = PHPGW_SERVER_ROOT.SEP.'workflow'.SEP.'inc'.SEP.'local'.SEP.'classes'.SEP.'class.'.$class_name.'.php';
Index: sandbox/workflow/trunk/inc/local/classes/class.wf_engine.php
===================================================================
--- sandbox/workflow/trunk/inc/local/classes/class.wf_engine.php	(revision 2858)
+++ sandbox/workflow/trunk/inc/local/classes/class.wf_engine.php	(revision 3060)
@@ -86,8 +86,9 @@
 	* @return bool true caso a instância tenha sido continuada e false caso contrário.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function continueInstance($activityID, $instanceID)
 	{
+		wf_warn_deprecated_method('wf_instance', 'continueInstance');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->continueInstance($activityID, $instanceID);
@@ -99,8 +100,9 @@
 	* @return boolean true se foi possível abortar a instância e false caso contrário.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function abortInstance($instanceID)
 	{
+		wf_warn_deprecated_method('wf_instance', 'abort');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->abort($instanceID);
@@ -113,8 +115,9 @@
 	* @return boolean true se foi possível mudar o nome da instância e false caso contrário.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function setInstanceName($instanceID, $name)
 	{
+		wf_warn_deprecated_method('wf_instance', 'setName');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->setName($instanceID, $name);
@@ -127,8 +130,9 @@
 	* @return boolean true se foi possível mudar a prioridade da instância e false caso contrário.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function setInstancePriority($instanceID, $priority)
 	{
+		wf_warn_deprecated_method('wf_instance', 'setPriority');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->setPriority($instanceID, $priority);
@@ -141,8 +145,9 @@
 	* @return array As instâncias que satisfazem o critério de seleção.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getIdleInstances($numberOfDays, $activities = null)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getIdle');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getIdle($numberOfDays, $activities);
@@ -154,8 +159,9 @@
 	* @return array As instâncias que satisfazem o critério de seleção.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getInstances($activities = null)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getIdle');
 		return $this->getIdleInstances(0, $activities);
 	}
@@ -166,8 +172,9 @@
 	* @return array As instâncias que satisfazem o critério de seleção.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getInstancesByName($name)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getByName');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		$preOutput = $WFInstance->getByName($name);
@@ -187,8 +194,9 @@
 	* @return array As instâncias filhas do par instância/atividade atual
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getChildInstances($instanceID = null, $activityID = null)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getChildren');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		$preOutput = $WFInstance->getChildren($instanceID);
@@ -206,8 +214,9 @@
 	* @return mixed Uma array contento as propriedades da instância (no formato "nome_da_propriedade" => "valor"). Ou false em caso de erro.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getInstanceProperties($instanceID)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getProperties');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getProperties($instanceID);
@@ -219,8 +228,9 @@
 	* @return array Propriedades da instância filha. Array no formato "nome_da_propriedade" => "valor".
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getChildInstanceProperties($instanceID)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getProperties');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getProperties($instanceID);
@@ -333,8 +343,9 @@
 	* @return array As instâncias que satisfazem o critério de seleção.
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function getUserInstances($users, $activities = null, $status = null)
 	{
+		wf_warn_deprecated_method('wf_instance', 'getByUser');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->getByUser($users, $activities, $status);
@@ -346,8 +357,9 @@
 	* @return bool true caso a propriedade tenha sido alterada com sucesso
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function setInstanceProperty($instanceID, $nameProperty, $value)
 	{
+		wf_warn_deprecated_method('wf_instance', 'setProperty');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->setProperty($instanceID, $nameProperty, $value);
@@ -362,8 +374,9 @@
 	* @return bool true se o usuário tiver acesso à instância (levando em consideração $writeAccess) ou false caso contrário
 	* @access public
-	* @deprecated 1.7.00.000
+	* @deprecated 2.2.00.000
 	*/
 	function checkUserAccessToInstance($userID, $instanceID, $activityID, $writeAccess = true)
 	{
+		wf_warn_deprecated_method('wf_instance', 'checkUserAccess');
 		$WFInstance = &Factory::getInstance('wf_instance');
 		return $WFInstance->checkUserAccess($userID, $instanceID, $activityID, $writeAccess);
Index: sandbox/workflow/trunk/inc/local/classes/class.wf_orgchart.php
===================================================================
--- sandbox/workflow/trunk/inc/local/classes/class.wf_orgchart.php	(revision 2466)
+++ sandbox/workflow/trunk/inc/local/classes/class.wf_orgchart.php	(revision 3060)
@@ -480,4 +480,38 @@
 		return $output;
 	}
+	
+	/**
+	 * Return all areas that the employee is a supervisor.
+	 * 
+	 * Search in the organization for all areas that the employee is a supervisor.
+	 * @param int $employeeID The ID of employee
+	 * @return array Array containing all the areas that the employeee is a supervisor.
+	 * @access public
+	 */
+	function getSupervisorAreas($employeeID) {
+
+		if (!$employeeID) {
+			return false;
+		}
+
+		$query = "SELECT 
+						a.area_id
+					FROM 
+						area a 
+						LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) 
+						AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) 
+					WHERE 
+						a.titular_funcionario_id = ? OR 
+						s.funcionario_id = ?
+					GROUP BY
+						a.area_id";
+		
+		$result = $this->db->query($query, array($employeeID,$employeeID));
+		if (!$result)
+			return false;
+		
+		$output = $result->GetArray(-1);
+		return $output;
+	}
 
 	/**
Index: sandbox/workflow/trunk/inc/class.workflow_processmanager.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.workflow_processmanager.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.workflow_processmanager.inc.php	(revision 3060)
@@ -226,14 +226,4 @@
 			  fclose($fp);
 			  $out.='      ]]></code>';
-			  if($res['wf_is_interactive']=='y') {
-				$out.='      <template><![CDATA[';
-				$fp=fopen(GALAXIA_PROCESSES.SEP."$wf_procname".SEP."code".SEP."templates".SEP."$name.tpl","r");
-				//while(!feof($fp)) {
-				//	$line=fread($fp,8192);
-					$out.=''; //all templatess will be exported in another section
-				//}
-				fclose($fp);
-				$out.='      ]]></template>';
-			  }
 			  $out.='    </activity>'."\n";    
 			}
Index: sandbox/workflow/trunk/inc/class.so_move_instances.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.so_move_instances.inc.php	(revision 2466)
+++ sandbox/workflow/trunk/inc/class.so_move_instances.inc.php	(revision 3060)
@@ -318,23 +318,4 @@
 		}
 
-		/* format the array elements for use in a SELECT SQL statement, e.g. [iid => 12, aid = 27] would produce (12, 27) */
-		$instanceActivityList = array_map(create_function('$e', 'return \'(\' . $e[\'iid\'] . \', \' . $e[\'aid\'] . \')\';'), $instanceActivityList);
-
-		/* update the interinstance relations of the modified rows of the instance_activities table */
-		$resultSet = $this->db->query("SELECT wf_parent_instance_id, wf_parent_activity_id FROM egw_wf_interinstance_relations WHERE ((wf_parent_instance_id, wf_parent_activity_id) IN (" . implode(', ', $instanceActivityList) . "))");
-		$rows = $resultSet->GetArray(-1);
-		if (is_array($rows))
-		{
-			foreach ($rows as $row)
-			{
-				/* update the activity ID */
-				if (!$this->db->query("UPDATE egw_wf_interinstance_relations SET wf_parent_activity_id = ? WHERE (wf_parent_instance_id = ?) AND (wf_parent_activity_id = ?)", array($activitiesConvert[$row['wf_parent_activity_id']], $row['wf_parent_instance_id'], $row['wf_parent_activity_id'])))
-				{
-					$this->db->FailTrans();
-					return array('error' => 'Erro atualizando a tabela de relacionamento inter-instância. Nenhuma modificação foi salva');
-				}
-			}
-		}
-
 		/* in case of success, commit the modifications */
 		$this->db->CompleteTrans();
Index: sandbox/workflow/trunk/inc/log/Log/observer.php
===================================================================
--- sandbox/workflow/trunk/inc/log/Log/observer.php	(revision 795)
+++ sandbox/workflow/trunk/inc/log/Log/observer.php	(revision 3060)
@@ -79,5 +79,5 @@
          */
         if (class_exists($class)) {
-            $object = &new $class($priority, $conf);
+            $object = new $class($priority, $conf);
             return $object;
         }
@@ -103,7 +103,7 @@
             /* Support both new-style and old-style construction. */
             if ($newstyle) {
-                $object = &new $class($priority, $conf);
+                $object = new $class($priority, $conf);
             } else {
-                $object = &new $class($priority);
+                $object = new $class($priority);
             }
             return $object;
Index: sandbox/workflow/trunk/inc/log/Log.php
===================================================================
--- sandbox/workflow/trunk/inc/log/Log.php	(revision 795)
+++ sandbox/workflow/trunk/inc/log/Log.php	(revision 3060)
@@ -167,5 +167,5 @@
         /* If the class exists, return a new instance of it. */
         if (Log::_classExists($class)) {
-            $obj = &new $class($name, $ident, $conf, $level);
+            $obj = new $class($name, $ident, $conf, $level);
             return $obj;
         }
Index: sandbox/workflow/trunk/inc/class.basemodel.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.basemodel.inc.php	(revision 795)
+++ sandbox/workflow/trunk/inc/class.basemodel.inc.php	(revision 3060)
@@ -167,9 +167,10 @@
     * @param string $obj Class name
     * @return mixed
-    * @deprecated
+    * @deprecated 2.2.00.000
     * @access public
     */
 	function &getInstance($obj)
-    {
+	{
+		wf_warn_deprecated_method('Factory', 'getInstance');
 		return(wf_create_object(strtolower($obj)));
 	}
Index: sandbox/workflow/trunk/inc/engine/src/ProcessMonitor/ProcessMonitor.php
===================================================================
--- sandbox/workflow/trunk/inc/engine/src/ProcessMonitor/ProcessMonitor.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/engine/src/ProcessMonitor/ProcessMonitor.php	(revision 3060)
@@ -59,7 +59,8 @@
 
   /**
-   * @deprecated
+   * @deprecated 2.2.00.000
    */
   function update_instance_status($iid,$status) {
+	wf_warn_deprecated_method();
     return;
     $query = "update `".GALAXIA_TABLE_PREFIX."instances` set `wf_status`=? where `wf_instance_id`=?";
@@ -69,7 +70,8 @@
   
   /**
-   * @deprecated
+   * @deprecated 2.2.00.000
    */
   function update_instance_activity_status($iid,$activityId,$status) {
+	wf_warn_deprecated_method();
     return;
     $query = "update `".GALAXIA_TABLE_PREFIX."instance_activities` set `wf_status`=? where `wf_instance_id`=? and `wf_activity_id`=?";
Index: sandbox/workflow/trunk/inc/engine/src/common/WfRuntime.php
===================================================================
--- sandbox/workflow/trunk/inc/engine/src/common/WfRuntime.php	(revision 2858)
+++ sandbox/workflow/trunk/inc/engine/src/common/WfRuntime.php	(revision 3060)
@@ -1089,5 +1089,4 @@
     $run_activity = Factory::newInstance('run_activity');
     $run_activity->runtime->instance->parentInstanceId = $this->instance_id;
-    $run_activity->runtime->instance->parentActivityId = $this->activity_id;
     $output = $run_activity->goChildInstance($activityID, $properties, $user, $parentLock);
     $_REQUEST['iid'] = $iid;
@@ -1128,7 +1127,7 @@
   function getParent()
   {
-    $resultSet = $this->query("SELECT wf_parent_instance_id, wf_parent_activity_id, wf_parent_lock FROM egw_wf_interinstance_relations WHERE (wf_child_instance_id = ?)", array($this->getInstanceId()));
+    $resultSet = $this->query("SELECT wf_parent_instance_id, wf_parent_lock FROM egw_wf_interinstance_relations WHERE (wf_child_instance_id = ?)", array($this->getInstanceId()));
     if (($row = $resultSet->fetchRow()))
-      return array('instance_id' => $row['wf_parent_instance_id'], 'activity_id' => $row['wf_parent_activity_id'], 'lock' => ($row['wf_parent_lock'] == 1));
+      return array('instance_id' => $row['wf_parent_instance_id'], 'lock' => ($row['wf_parent_lock'] == 1));
     else
       return false;
Index: sandbox/workflow/trunk/inc/engine/src/API/Instance.php
===================================================================
--- sandbox/workflow/trunk/inc/engine/src/API/Instance.php	(revision 2886)
+++ sandbox/workflow/trunk/inc/engine/src/API/Instance.php	(revision 3060)
@@ -84,9 +84,4 @@
    */
   var $parentLock = false;
-  /**
-   * @var int $parentActivityId The activity ID of the parent instance
-   * @access public
-   */
-  var $parentActivityId;
   /**
    * @var int $parentInstanceId The instance ID of the parent instance
@@ -490,5 +485,5 @@
     return '';
   }
- 
+
   /**
    * Creates a new instance.
@@ -503,5 +498,5 @@
   function _createNewInstance($activityId,$user) {
     // Creates a new instance setting up started, ended, user, status and owner
-    $pid = $this->getOne('select wf_p_id from '.GALAXIA_TABLE_PREFIX.'activities where wf_activity_id=?',array((int)$activityId));
+    $pid = $this->getOne('SELECT wf_p_id FROM '.GALAXIA_TABLE_PREFIX.'activities WHERE wf_activity_id=?',array((int)$activityId));
     $this->pId = $pid;
     $this->setStatus('active');
@@ -515,26 +510,32 @@
     $iid=$this->instanceId;
 
-    $query = 'insert into '.GALAXIA_TABLE_PREFIX.'instances
-      (wf_instance_id, wf_started,wf_ended,wf_status,wf_p_id,wf_owner,wf_properties) 
-      values(?,?,?,?,?,?,?)';
-
-   $this->query($query,array((int)$iid, $now,0,'active',$pid,$user,$this->security_cleanup(Array(),false)));
- 
+    $query = 'INSERT INTO '.GALAXIA_TABLE_PREFIX.'instances
+                (wf_instance_id, wf_started,wf_ended,wf_status,wf_p_id,wf_owner,wf_properties)
+              VALUES
+                (?,?,?,?,?,?,?)';
+
+    $this->query($query,array((int)$iid, $now,0,'active',$pid,$user,$this->security_cleanup(Array(),false)));
+
     // Then add in ".GALAXIA_TABLE_PREFIX."instance_activities an entry for the
     // activity the user and status running and started now
-    $query = 'insert into '.GALAXIA_TABLE_PREFIX.'instance_activities (wf_instance_id,wf_activity_id,wf_user,
-            wf_started,wf_status) values(?,?,?,?,?)';
+    $query = 'INSERT INTO '.GALAXIA_TABLE_PREFIX.'instance_activities
+                (wf_instance_id,wf_activity_id,wf_user,wf_started,wf_status)
+              VALUES
+                (?,?,?,?,?)';
     $this->query($query,array((int)$iid,(int)$activityId,$user,(int)$now,'running'));
 
     if (($this->isChildInstance) && (!is_null($this->parentInstanceId)))
     {
-      $query = 'INSERT INTO '.GALAXIA_TABLE_PREFIX.'interinstance_relations(wf_parent_instance_id, wf_parent_activity_id, wf_child_instance_id, wf_parent_lock) VALUES(?,?,?,?)';
-      $this->query($query,array((int) $this->parentInstanceId, (int) $this->parentActivityId, (int) $iid, (int) (($this->parentLock) ? 1 : 0)));
-    }
-    
+      $query = 'INSERT INTO '.GALAXIA_TABLE_PREFIX.'interinstance_relations
+                  (wf_parent_instance_id, wf_child_instance_id, wf_parent_lock)
+                VALUES
+                  (?,?,?)';
+      $this->query($query,array((int) $this->parentInstanceId, (int) $iid, (int) (($this->parentLock) ? 1 : 0)));
+    }
+
     //update database with other datas stored in the object
     return $this->sync();
   }
-  
+
   /**
    * Sets the name of this instance
@@ -1142,9 +1143,9 @@
     return $this->__activity_completed;
   }
- 
+
   /**
    * This function can be called by the instance object himself (for automatic activities)
-   * or by the WfRuntime object. In interactive activities code users use complete() --without args-- 
-   * which refer to the WfRuntime->complete() function which call this one. 
+   * or by the WfRuntime object. In interactive activities code users use complete() --without args--
+   * which refer to the WfRuntime->complete() function which call this one.
    * In non-interactive activities a call to a complete() will generate errors because the engine
    * does it his own way as I said first.
@@ -1162,5 +1163,5 @@
   {
     //$this->db->
-    $result = $this->query("SELECT 1 FROM " . GALAXIA_TABLE_PREFIX . "instances i, " . GALAXIA_TABLE_PREFIX . "interinstance_relations ir WHERE (ir.wf_child_instance_id = i.wf_instance_id) AND (i.wf_status IN ('active', 'exception')) AND (ir.wf_parent_lock = 1) AND (ir.wf_parent_instance_id = ?) AND (ir.wf_parent_activity_id = ?)", array($this->instanceId, $activityId));
+    $result = $this->query("SELECT 1 FROM " . GALAXIA_TABLE_PREFIX . "instances i, " . GALAXIA_TABLE_PREFIX . "interinstance_relations ir WHERE (ir.wf_child_instance_id = i.wf_instance_id) AND (i.wf_status IN ('active', 'exception')) AND (ir.wf_parent_lock = 1) AND (ir.wf_parent_instance_id = ?)", array($this->instanceId));
     if ($result->numRows() > 0)
       die("Esta instância está aguardando que outras instâncias, das quais depende, sejam finalizadas.");
@@ -1170,5 +1171,5 @@
     //The complete() is in a transaction, it will be completly done or not at all
     $this->db->StartTrans();
-    
+
     //lock rows and ensure access is granted
     if (!(isset($this->security))) $this->security = &Factory::getInstance('WfSecurity');
Index: sandbox/workflow/trunk/inc/engine/src/API/BaseActivity.php
===================================================================
--- sandbox/workflow/trunk/inc/engine/src/API/BaseActivity.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/engine/src/API/BaseActivity.php	(revision 3060)
@@ -84,8 +84,9 @@
    * Seems to be the rest of a bad object architecture
    * 
-   * @deprecated
+   * @deprecated 2.2.00.000
    */
   function setDb(&$db)
   {
+	wf_warn_deprecated_method();
     $this->db =& $db;
   }
@@ -550,8 +551,9 @@
    * e.g. $isadmin = $activity->checkUserRole($user,'admin')
    * 
-   * @deprecated Unused function. Old API, do not use it. Return always false
+   * @deprecated 2.2.00.000 - Unused function. Old API, do not use it. Return always false
    */
   function checkUserRole($user,$rolename) 
   {
+	wf_warn_deprecated_method();
     $this->error[] = 'use of an old deprecated function checkUserRole, return always false';
     return false;
Index: sandbox/workflow/trunk/inc/common_functions.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/common_functions.inc.php	(revision 3060)
+++ sandbox/workflow/trunk/inc/common_functions.inc.php	(revision 3060)
@@ -0,0 +1,68 @@
+<?php
+/**************************************************************************\
+* eGroupWare                                                               *
+* http://www.egroupware.org                                                *
+* --------------------------------------------                             *
+*  This program is free software; you can redistribute it and/or modify it *
+*  under the terms of the GNU General Public License as published by the   *
+*  Free Software Foundation; either version 2 of the License, or (at your  *
+*  option) any later version.                                              *
+\**************************************************************************/
+
+
+/**
+ * Redefines the apache_request_headers function if it was not done before by a phpmodule
+ * This usually happens if php runs as cgi
+ * @return array HTTP info presents in $_SERVER array
+ * @package Workflow
+ * @access public
+ */
+if( !function_exists('apache_request_headers') ) {
+	///
+	function apache_request_headers() {
+		$arh = array();
+		$rx_http = '/\AHTTP_/';
+		foreach($_SERVER as $key => $val) {
+			if( preg_match($rx_http, $key) ) {
+				$arh_key = preg_replace($rx_http, '', $key);
+				$rx_matches = array();
+				// do some nasty string manipulations to restore the original letter case
+				// this should work in most cases
+				$rx_matches = explode('_', $arh_key);
+				if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
+					foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val);
+					$arh_key = implode('-', $rx_matches);
+				}
+				$arh[$arh_key] = $val;
+			}
+		}
+		return( $arh );
+	}
+	///
+}
+
+/**
+ * Generates warning message of deprecated methods executing PHP function trigger_error
+ * @author Anderson Tadayuki Saikawa
+ * @param string $new_class The name of the class that has the method that replaces the deprecated one
+ * @param string $new_method The name of the method that replaces the deprecated one
+ * @return boolean
+ * @license http://www.gnu.org/copyleft/gpl.html GPL
+ * @package Workflow
+ * @access public
+ */
+function wf_warn_deprecated_method($new_class = null, $new_method = null)
+{
+	$caller = next(debug_backtrace());
+	$old_class = !empty($caller['class']) ? " of <strong>" . $caller['class'] . "</strong> object" : "";
+	$deprecated_msg = sprintf("Deprecated method <strong>%s</strong>%s was called in <strong>%s</strong> on line <strong>%s</strong>. It MUST be replaced by its equivalent",
+								$caller['function'], $old_class, $caller['file'], $caller['line']);
+	if(!empty($new_class) && !empty($new_method)){
+		$new_class = !empty($new_class) ? " of <strong>" . $new_class . "</strong> object" : "";
+		$deprecated_msg .= sprintf(' <strong>%s</strong>%s', $new_method, $new_class);
+	}
+	$error_msg = $deprecated_msg . ".\n<br>Error handler";
+	return trigger_error("[WORKFLOW WARNING]: " . $error_msg, E_USER_WARNING);
+}
+
+?>
Index: sandbox/workflow/trunk/inc/class.bo_participants.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.bo_participants.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.bo_participants.inc.php	(revision 3060)
@@ -74,5 +74,5 @@
 		{
 			$preffix = ($usePreffix) ? 'u' : '';
-			$ents = $this->ldap->getUsers($params['context']);
+			$ents = $this->ldap->getUsers($params['context'], $params['onlyVisibleAccounts']);
 			foreach ($ents as $ent)
 				$output[$preffix . $ent[$id]] = $ent['name'];
@@ -162,7 +162,9 @@
 		$searchLists = (strpos($entities, 'l') !== false);
 
+		$onlyVisibleAccounts = $params['onlyVisibleAccounts'];
+
 		/* faz a busca */
 		$output = array();
-		$output['participants'] = $this->ldap->search($searchTerm, $searchUsers, $searchGroups, $searchLists);
+		$output['participants'] = $this->ldap->search($searchTerm, $searchUsers, $searchGroups, $searchLists, null, $onlyVisibleAccounts);
 
 		/* limita os resultados e define uma mensagem que será exibida */
Index: sandbox/workflow/trunk/inc/common.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/common.inc.php	(revision 2466)
+++ sandbox/workflow/trunk/inc/common.inc.php	(revision 3060)
@@ -70,3 +70,4 @@
 require_once WF_LIB_ROOT . 'factory/WorkflowFactory.php';
 require_once WF_LIB_ROOT . 'factory/ProcessFactory.php';
+require_once WF_INC_ROOT . 'common_functions.inc.php';
 ?>
Index: sandbox/workflow/trunk/inc/class.ui_adminroles.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.ui_adminroles.inc.php	(revision 2858)
+++ sandbox/workflow/trunk/inc/class.ui_adminroles.inc.php	(revision 3060)
@@ -276,5 +276,5 @@
 					$entry = $cachedLDAP->getEntryByID($mapping['wf_user']);
 					$cname = $GLOBALS['phpgw']->translation->convert($entry['cn'],'utf-8');
-					$glabel = "";
+					$glabel = (!empty($entry['uid'])) ? '[' . $entry['uid'] . ']' : '';
 					if (is_null($entry['last_update']))
 						$glabel = '<font color="red">(inativo)</font>';
Index: sandbox/workflow/trunk/inc/class.ui_participants.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.ui_participants.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.ui_participants.inc.php	(revision 3060)
@@ -92,4 +92,10 @@
 		$hideSectors = ($_REQUEST['hideSectors'] == '1') ? true : false;
 
+		// the default value of $onlyVisibleAccounts is true
+		if((isset($_REQUEST['onlyVisibleAccounts'])) && (empty($_REQUEST['onlyVisibleAccounts']) || $_REQUEST['onlyVisibleAccounts'] === 'false'))
+			$onlyVisibleAccounts = false;
+		else
+			$onlyVisibleAccounts = true;
+
 		/* define the initial organization */
 		$selectedOrganization = $ldap->getOrganizationFromDN($userDN);
@@ -117,7 +123,7 @@
 		$smarty->assign('organizations', $organizationList);
 		$smarty->assign('selectedOrganization', $selectedOrganization);
-		$smarty->assign('sectors', $this->bo->getSectors(array('organization' => $selectedOrganization), true));
+		$smarty->assign('sectors', $this->bo->getSectors(array('organization' => $selectedOrganization, 'onlyVisibleAccounts' => $onlyVisibleAccounts), true));
 		$smarty->assign('selectedSector', $selectedSector);
-		$smarty->assign('participants', $this->bo->getEntities(array('entities' => $entities, 'id' => $id, 'context' => $selectedSector, 'usePreffix' => $usePreffix), true));
+		$smarty->assign('participants', $this->bo->getEntities(array('entities' => $entities, 'id' => $id, 'context' => $selectedSector, 'onlyVisibleAccounts' => $onlyVisibleAccounts, 'usePreffix' => $usePreffix), true));
 		$smarty->assign('entities', $entities);
 		$smarty->assign('id', $id);
@@ -126,4 +132,5 @@
 		$smarty->assign('hideOrganizations', $hideOrganizations);
 		$smarty->assign('hideSectors', $hideSectors);
+		$smarty->assign('onlyVisibleAccounts', $onlyVisibleAccounts);
 		$smarty->assign('header', $smarty->expressoHeader);
 		$smarty->assign('txt_loading', lang("loading"));
Index: sandbox/workflow/trunk/inc/class.ui_adminactivities.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.ui_adminactivities.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.ui_adminactivities.inc.php	(revision 3060)
@@ -1035,35 +1035,54 @@
 		$image_name = $proc_info['wf_normalized_name'] . SEP . 'graph' . SEP . $proc_info['wf_normalized_name'] . '.png';
 		$image = GALAXIA_PROCESSES . SEP . $image_name;
-		if (Factory::getInstance('BrowserInfo')->isOpera())
-			$maximumDimension = 1000000;
+		if (file_exists($image))
+		{
+			if (Factory::getInstance('BrowserInfo')->isOpera())
+				$maximumDimension = 1000000;
+			else
+				$maximumDimension = 2500;
+
+			$dims = getimagesize($image);
+			list($originalWidth, $originalHeight) = $dims;
+
+			/* the image must be resized */
+			if (max($originalWidth, $originalHeight) > $maximumDimension)
+			{
+				/* define the new width and height */
+				$newWidth = $newHeight = $maximumDimension;
+				if ($originalWidth > $originalHeight)
+					$newHeight = $maximumDimension * ($originalHeight / $originalWidth);
+				else
+					$newWidth = $maximumDimension * ($originalWidth / $originalHeight);
+
+				/* create the new image and send to the browser */
+				$smallerImage = imagecreatetruecolor($newWidth, $newHeight);
+				imagecopyresampled($smallerImage, imagecreatefrompng($image), 0, 0, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);
+				header('content-disposition: inline; filename=' . $image_name);
+				header('content-type: ' . $dims['mime']);
+				imagepng($smallerImage);
+			}
+			else
+			{
+				header('content-disposition: inline; filename=' . $image_name);
+				header('content-type: ' . $dims['mime']);
+				header('content-length: ' . filesize($image));
+				readfile($image);
+			}
+		}
+		// if there is no graph, show "graph not found" message
 		else
-			$maximumDimension = 2500;
-
-		$dims = getimagesize($image);
-		list($originalWidth, $originalHeight) = $dims;
-
-		/* the image must be resized */
-		if (max($originalWidth, $originalHeight) > $maximumDimension)
-		{
-			/* define the new width and height */
-			$newWidth = $newHeight = $maximumDimension;
-			if ($originalWidth > $originalHeight)
-				$newHeight = $maximumDimension * ($originalHeight / $originalWidth);
-			else
-				$newWidth = $maximumDimension * ($originalWidth / $originalHeight);
-
-			/* create the new image and send to the browser */
-			$smallerImage = imagecreatetruecolor($newWidth, $newHeight);
-			imagecopyresampled($smallerImage, imagecreatefrompng($image), 0, 0, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);
-			header('content-disposition: inline; filename=' . $image_name);
-			header('content-type: ' . $dims['mime']);
-			imagepng($smallerImage);
-		}
-		else
-		{
-			header('content-disposition: inline; filename=' . $image_name);
-			header('content-type: ' . $dims['mime']);
-			header('content-length: ' . filesize($image));
-			readfile($image);
+		{
+			header ('Content-type: image/png');
+			$text = 'GRAFICO NAO ENCONTRADO';
+			$font_size = 5;
+			$width = imagefontwidth($font_size) * strlen($text);
+			$height = imagefontheight($font_size);
+			$im = imagecreate($width, $height);
+			$text_color = imagecolorallocate($im, 0, 0, 0);		// black
+			$bg_color = imagecolorallocate($im, 255, 255, 255);	// white
+			imagefill($im, 0, 0, $bg_color);
+			imagestring($im, $font_size, 0, 0, $text, $text_color);
+			imagepng($im);
+			imagedestroy($im);
 		}
 	}
Index: sandbox/workflow/trunk/inc/class.WorkflowLDAP.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.WorkflowLDAP.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.WorkflowLDAP.inc.php	(revision 3060)
@@ -377,7 +377,10 @@
 	 * @access public
 	 */
-	function getUsers($context)
-	{
-		$filter = '(&(phpgwaccounttype=u)(!(phpgwAccountVisible=-1)))';
+	function getUsers($context, $onlyVisibleAccounts = true)
+	{
+		$filter = '(phpgwaccounttype=u)';
+		if($onlyVisibleAccounts)
+			$filter = '(&' . $filter . '(!(phpgwAccountVisible=-1)))';
+
 		$elements = array('uidnumber', 'cn', 'mail');
 		return $this->getEntities($context, $filter, $elements, 'u', false);
@@ -561,5 +564,5 @@
 	 * @access public
 	 */
-	function search($searchTerm, $includeUsers = true, $includeGroups = false, $includeLists = false, $context = null)
+	function search($searchTerm, $includeUsers = true, $includeGroups = false, $includeLists = false, $context = null, $onlyVisibleAccounts = true)
 	{
 		if (!($includeUsers || $includeGroups || $includeLists))
@@ -586,5 +589,9 @@
 			$entityFilter = $entityFilter[0];
 
-		$filter = "(&{$entityFilter}(cn={$searchTerm})(!(phpgwAccountVisible=-1)))";
+		if($onlyVisibleAccounts)
+			$filter = "(&{$entityFilter}(cn={$searchTerm})(!(phpgwAccountVisible=-1)))";
+		else
+			$filter = "(&{$entityFilter}(cn={$searchTerm}))";
+
 		$resourceIdentifier = ldap_search($this->dataSource, $context, $filter, array('cn', 'uidnumber', 'gidnumber', 'phpgwaccounttype', 'mail'));
 		ldap_sort($this->dataSource, $resourceIdentifier, 'cn');
Index: sandbox/workflow/trunk/inc/smarty/plugins/function.html_options.php
===================================================================
--- sandbox/workflow/trunk/inc/smarty/plugins/function.html_options.php	(revision 795)
+++ sandbox/workflow/trunk/inc/smarty/plugins/function.html_options.php	(revision 3060)
@@ -96,4 +96,71 @@
 }
 
+function smarty_function_html_boxoptions($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    
+    $name = null;
+    $values = null;
+    $options = null;
+    $selected = array();
+    $output = null;
+    
+    $extra = '';
+    
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+                $$_key = (string)$_val;
+                break;
+            
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+                
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'selected':
+                $$_key = array_map('strval', array_values((array)$_val));
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = '';
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+
+    } else {
+
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+        }
+
+    }
+
+    if(!empty($name)) {
+        $_html_result = '<select name="' . $name . '"' . $extra . ' style="height: 100px;" size="5">' . "\n" . $_html_result . '</select>' . "\n";
+    }
+
+    return $_html_result;
+
+}
 function smarty_function_html_options_optoutput($key, $value, $selected) {
     if(!is_array($value)) {
Index: sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_user.php
===================================================================
--- sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_user.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_user.php	(revision 3060)
@@ -12,4 +12,5 @@
  * - email_as_textarea : indica se o campo que receberá os emails deve ser um textarea (valor true) ou input type text (valor false). Este parâmetro só tem validade se get_email for true.
  * - hide_groups : indica se deve-se omitir os grupos na tela de seleção.
+ * - onlyVisibleAccounts : indica se devem ser recuperadas apenas as contas visíveis, ou se as ocultas também devem ser listadas.
  * - organization : nome da organização que estará previamente selecionada.
  * - title : texto da tooltip que aparecerá quando o usuário colocar o mouse sobre o ícone para adicionar usuário.
@@ -35,4 +36,5 @@
 		'hide_organizations' => false,
 		'hide_sectors' => false,
+		'onlyVisibleAccounts' => true,
 		'rows'=> 2);
 	$extractParams = array(
@@ -42,5 +44,6 @@
 		'title',
 		'cols',
-		'rows');
+		'rows',
+		'onlyVisibleAccounts');
 
 	/* verifica se todos os parâmetros obrigatórios foram passados */
@@ -93,9 +96,13 @@
 	if ($params['hide_sectors'] == true)
 		$extraParams .= "&hideSectors=1";
+	if (empty($onlyVisibleAccounts) || $onlyVisibleAccounts === 'false')
+		$extraParams .= "&onlyVisibleAccounts=false";
+	else
+		$extraParams .= "&onlyVisibleAccounts=true";
 
 	$image = Factory::getInstance('TemplateServer')->generateImageLink('add_user.png');
 
-$output .= <<<EOF
-	<a alt="$title" title="$title" href="javascript:void(0)" onclick="openParticipants('$name', '$extraParams');"><img border="0" alt="" src="$image" /></a>
+	$output .= <<<EOF
+		<a alt="$title" title="$title" href="javascript:void(0)" onclick="openParticipants('$name', '$extraParams');"><img border="0" alt="" src="$image" /></a>
 EOF;
 	return $output;
Index: sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_ldap_users.php
===================================================================
--- sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_ldap_users.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_ldap_users.php	(revision 3060)
@@ -23,5 +23,5 @@
  */
 function smarty_function_wf_select_ldap_users($params, &$smarty)
-{
+{ 
     require_once $smarty->_get_plugin_filepath('function','html_options');
 	$imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1);
@@ -34,5 +34,6 @@
 		'size_input'            => '20',
 		'opt_id'                => 'dn',
-		'opt_name'              => 'cn');
+		'opt_name'              => 'cn',
+		'opt_complement'        => '');
 	$extractParams = array(
 		'name',
@@ -42,5 +43,6 @@
 		'class_btn',
 		'opt_id',
-		'opt_name');
+		'opt_name',
+		'opt_complement');
 
 	/* verifica se todos os parâmetros obrigatórios foram passados */
@@ -78,10 +80,10 @@
 	$output = <<<EOF
 		<input type="text" id="$name_input" name="$name_input" size="$size_input" />
-		<input type="button" class="$class_btn" value="$value_btn" onclick="search_ldap_users_by_cn(document.getElementById('$name_input').value, '$name', '$opt_id', '$opt_name', $handleExpiredSessions)" />
+		<input type="button" class="$class_btn" value="$value_btn" onclick="search_ldap_users_by_cn(document.getElementById('$name_input').value, '$name', '$opt_id', '$opt_name', $handleExpiredSessions, '$opt_complement')" />
 		&nbsp;<img id="$name_img" border="0" src="$imagesPath/loading.gif" style="display:none">
-		<span id="$name_span" style="display:none">&nbsp;&nbsp;&nbsp;&nbsp;<b>Selecione o nome: </b>
+		<span id="$name_span" style="display:none"><br><br><b>Selecione um nome abaixo: </b><br><br>
 EOF;
 
-	$output .= smarty_function_html_options(array_merge(array(
+	$output .= smarty_function_html_boxoptions(array_merge(array(
 											'name'    => $name,
 											'id'      => $name,
Index: sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_users.php
===================================================================
--- sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_users.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/smarty/wf_plugins/function.wf_select_users.php	(revision 3060)
@@ -8,4 +8,5 @@
  * - value : usuários e grupos previamente selecionados. Deve estar no formato de matriz, seguindo o seguinte padrão: ::$matriz["u123"]="Nome do usuário 123" ; $matriz["g321"]="Nome do grupo 321" e, assim por diante.
  * - hide_groups : indica se deve-se omitir os grupos na tela de seleção.
+ * - onlyVisibleAccounts : indica se devem ser recuperadas apenas as contas visíveis, ou se as ocultas também devem ser listadas.
  * - organization : nome da organização que estará previamente selecionada.
  * @param object &$smarty Instância do objeto smarty em uso
@@ -24,8 +25,10 @@
 		'hide_organizations' => false,
 		'hide_sectors' => false,
+		'onlyVisibleAccounts' => true,
 		'value' => array());
 	$extractParams = array(
 		'name',
-		'value');
+		'value',
+		'onlyVisibleAccounts');
 
 	/* verifica se todos os parâmetros obrigatórios foram passados */
@@ -54,4 +57,8 @@
 	if ($params['hide_sectors'] == true)
 		$extraParams .= "&hideSectors=1";
+	if (empty($onlyVisibleAccounts) || $onlyVisibleAccounts === 'false')
+		$extraParams .= "&onlyVisibleAccounts=false";
+	else
+		$extraParams .= "&onlyVisibleAccounts=true";
 
 	$output = '<table border="0"><tr><td>';
@@ -66,7 +73,7 @@
 	$output .= "</td><td>";
 	$output .= <<<EOF
-		<a href='javascript:void(0)' onclick="openParticipants(500, 270, '$name', '$extraParams');"><img border="0" src="$imagesPath/add_group.png"></a>
+		<a href='javascript:void(0)' onclick="openParticipants(500, 315, '$name', '$extraParams');"><img border="0" src="$imagesPath/add_group.png"></a>
 		<br />
-		<a href='javascript:void(0)' onclick="openParticipants(500, 270, '$name', '$extraParams');">Adicionar</a>
+		<a href='javascript:void(0)' onclick="openParticipants(500, 315, '$name', '$extraParams');">Adicionar</a>
 		<br /><br />
 		<a href='javascript:void(0)' onclick="delUsers('$name');"><img border="0" src="$imagesPath/delete_group.png"></a>
Index: sandbox/workflow/trunk/inc/class.bo_userinterface.inc.php
===================================================================
--- sandbox/workflow/trunk/inc/class.bo_userinterface.inc.php	(revision 2372)
+++ sandbox/workflow/trunk/inc/class.bo_userinterface.inc.php	(revision 3060)
@@ -91,10 +91,17 @@
 					$recset[$procname_ver]['useHTTPS'] = 0;
 			}
-			$recset[$procname_ver][] = array('wf_activity_id' 	=> $line['wf_activity_id'],
-										'wf_name' 			=> $line['wf_name'],
-										'wf_menu_path' 		=> $line['wf_menu_path'],
-										'wf_type' 			=> $line['wf_type'],
-										'wf_is_autorouted' 	=> $line['wf_is_autorouted'],
-										'wf_is_interactive' => $line['wf_is_interactive']);
+			if (!is_dir(GALAXIA_PROCESSES . '/' . $line['wf_normalized_name']))
+			{
+				$recset[$procname_ver]['wf_iconfile'] = $templateServer->generateImageLink('navbar_nocode.png');
+			}
+			else
+			{
+				$recset[$procname_ver][] = array('wf_activity_id' 	=> $line['wf_activity_id'],
+												'wf_name' 			=> $line['wf_name'],
+												'wf_menu_path' 		=> $line['wf_menu_path'],
+												'wf_type' 			=> $line['wf_type'],
+												'wf_is_autorouted' 	=> $line['wf_is_autorouted'],
+												'wf_is_interactive' => $line['wf_is_interactive']);
+			}
 		}
 
Index: sandbox/workflow/trunk/js/htmlarea/plugins/UploadImage/popups/ImageEditor/Transform.php
===================================================================
--- sandbox/workflow/trunk/js/htmlarea/plugins/UploadImage/popups/ImageEditor/Transform.php	(revision 795)
+++ sandbox/workflow/trunk/js/htmlarea/plugins/UploadImage/popups/ImageEditor/Transform.php	(revision 3060)
@@ -130,5 +130,5 @@
 
         $classname = "Image_Transform_Driver_{$driver}";
-        $obj =& new $classname;
+        $obj = new $classname;
         return $obj;
     }
Index: sandbox/workflow/trunk/js/jscode/wf_file_upload.js
===================================================================
--- sandbox/workflow/trunk/js/jscode/wf_file_upload.js	(revision 795)
+++ sandbox/workflow/trunk/js/jscode/wf_file_upload.js	(revision 3060)
@@ -149,4 +149,6 @@
 		};
 
+
+
 		// Set row value
 		new_row.innerHTML = element.value + '&nbsp;&nbsp;';
@@ -160,3 +162,9 @@
 	};
 
+	this.removeFile = function (me, nome){
+		me.parentNode.parentNode.removeChild(me.parentNode);
+		hd = document.getElementById("hd_remover_anexos");
+		hd.value += nome+"; ";
+	}
+
 };
Index: sandbox/workflow/trunk/js/jscode/wf_select_ldap_users.js
===================================================================
--- sandbox/workflow/trunk/js/jscode/wf_select_ldap_users.js	(revision 795)
+++ sandbox/workflow/trunk/js/jscode/wf_select_ldap_users.js	(revision 3060)
@@ -9,6 +9,11 @@
  * @param String opt_name Atributo que será atribuído ao name (innerHTML) das options da combo, por padrão é o 'cn'
  */
-function search_ldap_users_by_cn(cn, target, opt_id, opt_name, handleExpiredSessions)
-{
+function search_ldap_users_by_cn(cn, target, opt_id, opt_name, handleExpiredSessions, opt_complement)
+{  
+	// o parâmetro opt_complement foi acrescentado posteriormente a esta função, devido alguns métodos não utilizá-lo é
+	// necessário fazer o tratamento do mesmo caso não seja passado.
+	if(opt_complement == undefined)
+		opt_complement = '';
+
 /* Método que trata o retorno da chamada Ajax. Atribui os valores retornados à combobox */
 	function result_search_ldap_users_by_cn(data)
@@ -35,5 +40,5 @@
 			var container = document.getElementById(data["target"]);
 			container.innerHTML = "";
-			if(data['values'].length > 1){
+			if(data['values'].length >= 1){
 				container.disabled = true;
 				fill_combo_employee(data["target"], data["values"]);
@@ -44,8 +49,10 @@
 			}
 		}
+
+		return false;
 	}
 
 	var url = '$this.bo_utils.search_ldap_users_by_cn';
-	var param = "cn=" + cn + "&target=" + target + "&id=" + opt_id + "&name=" + opt_name;
+	var param = "cn=" + cn + "&target=" + target + "&id=" + opt_id + "&name=" + opt_name + "&complement=" + opt_complement;
 
 	document.getElementById(target + "_img").show();
Index: sandbox/workflow/trunk/js/jscode/participants.js
===================================================================
--- sandbox/workflow/trunk/js/jscode/participants.js	(revision 795)
+++ sandbox/workflow/trunk/js/jscode/participants.js	(revision 3060)
@@ -1,3 +1,4 @@
 var participantsClone = null;
+var chkOnlyVisibleAccountsClone = null;
 var searchTimer = null;
 var globalSearchEnter = true;
@@ -23,4 +24,5 @@
 	var params = {
 		organization: $F('organization'),
+		onlyVisibleAccounts: $F('onlyVisibleAccounts'),
 		entities: $F('entities'),
 		id: $F('id'),
@@ -34,4 +36,5 @@
 	var params = {
 		context: $F('sector'),
+		onlyVisibleAccounts: $F('onlyVisibleAccounts'),
 		entities: $F('entities'),
 		id: $F('id'),
@@ -46,4 +49,6 @@
 	setSelectValue($('participants'), data);
 	participantsClone = data;
+	if($('onlyVisibleAccounts'))
+		chkOnlyVisibleAccountsClone = $('onlyVisibleAccounts').checked;
 }
 
@@ -63,4 +68,6 @@
 	var reg = new RegExp("<option[^>]*>[^<]*" + searchString + "[^<]*<\/option>", "gi");
 	setSelectValue($('participants'), participantsClone.match(reg));
+	if($('onlyVisibleAccounts'))
+		$('onlyVisibleAccounts').checked = chkOnlyVisibleAccountsClone;
 
 	var participants = $('participants');
@@ -126,6 +133,9 @@
 
 		obj = $('participants');
-		if (obj)
+		if (obj){
 			participantsClone = obj.innerHTML;
+			if($('onlyVisibleAccounts'))
+				chkOnlyVisibleAccountsClone = $('onlyVisibleAccounts').checked;
+		}
 
 		obj = $('exitLink');
@@ -140,4 +150,8 @@
 		if (obj)
 			obj.focus();
+
+		obj = $('onlyVisibleAccounts');
+		if (obj)
+			obj.onclick = checkOnlyVisibleAccounts;
 
 		obj = $('useGlobalSearch');
@@ -149,4 +163,12 @@
 	});
 };
+
+function checkOnlyVisibleAccounts()
+{
+	if(!$('useGlobalSearch').checked)
+		getParticipants();
+	else
+		toggleFullSearch();
+}
 
 function participantsFilterName(name)
@@ -330,4 +352,5 @@
 	$('globalSearchWarnings').innerHTML = '';
 	var params = {
+		onlyVisibleAccounts: $F('onlyVisibleAccounts'),
 		searchTerm: $F('search'),
 		entities: $F('entities'),
@@ -341,5 +364,5 @@
 {
 	newWidth   = 500;
-	newHeight  = 290;
+	newHeight  = 315;
 	newScreenX = screen.width - newWidth;
 	newScreenY = 0;
Index: sandbox/workflow/trunk/templates/default/participants.tpl
===================================================================
--- sandbox/workflow/trunk/templates/default/participants.tpl	(revision 795)
+++ sandbox/workflow/trunk/templates/default/participants.tpl	(revision 3060)
@@ -32,4 +32,9 @@
 		<td colspan="2">
 			<p style="text-align: center; font-weight: bold; font-size: 130%;">Busca Global</p>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2">
+			<label><input type="checkbox" name="onlyVisibleAccounts" id="onlyVisibleAccounts" value="true" {if $onlyVisibleAccounts} checked {/if}/> Exibir apenas contas vis&iacute;veis</label>
 		</td>
 	</tr>
