Index: branches/2.2/workflow/inc/class.bo_orgchart.inc.php
===================================================================
--- branches/2.2/workflow/inc/class.bo_orgchart.inc.php	(revision 1245)
+++ branches/2.2/workflow/inc/class.bo_orgchart.inc.php	(revision 3167)
@@ -10,5 +10,4 @@
 \**************************************************************************/
 
-require_once('class.so_orgchart.inc.php');
 require_once('class.bo_ajaxinterface.inc.php');
 /**
@@ -47,5 +46,5 @@
 	{
 		parent::bo_ajaxinterface();
-		$this->so = new so_orgchart();
+		$this->so = &Factory::getInstance('so_orgchart');
 	}
 
@@ -524,5 +523,5 @@
 	function listArea($params)
 	{
-		$result = $this->so->getArea($params['organizacao_id']);
+		$result = $this->so->getArea($params['organizacao_id'], $params['area_id']);
 		$this->disconnect_all();
 
@@ -552,5 +551,5 @@
 	function addArea($params)
 	{
-		$result = $this->so->addArea($params['centro_custo_id'], $params['organizacao_id'], $params['area_status_id'], $this->_nullReplace($params['substituto_funcionario_id']), $this->_nullReplace($params['titular_funcionario_id']), $this->_nullReplace($params['superior_area_id']), $params['sigla'], $params['descricao'], $params['ativa'], $this->_nullReplace($params['auxiliar_funcionario_id']));
+		$result = $this->so->addArea($params['centro_custo_id'], $params['organizacao_id'], $params['area_status_id'], $this->_nullReplace($params['titular_funcionario_id']), $this->_nullReplace($params['superior_area_id']), $params['sigla'], $params['descricao'], $params['ativa'], $this->_nullReplace($params['auxiliar_funcionario_id']));
 		$this->disconnect_all();
 
@@ -566,5 +565,5 @@
 	function updateArea($params)
 	{
-		$result = $this->so->updateArea($params['centro_custo_id'], $params['organizacao_id'], $params['area_status_id'], $this->_nullReplace($params['substituto_funcionario_id']), $this->_nullReplace($params['titular_funcionario_id']), $this->_nullReplace($params['superior_area_id']), $params['sigla'], $params['descricao'], $params['ativa'], $this->_nullReplace($params['auxiliar_funcionario_id']), $params['area_id']);
+		$result = $this->so->updateArea($params['centro_custo_id'], $params['organizacao_id'], $params['area_status_id'], $this->_nullReplace($params['titular_funcionario_id']), $this->_nullReplace($params['superior_area_id']), $params['sigla'], $params['descricao'], $params['ativa'], $this->_nullReplace($params['auxiliar_funcionario_id']), $params['area_id']);
 		$this->disconnect_all();
 
@@ -669,4 +668,60 @@
 		return $result;
 	}
+
+	/**
+	 * Add a substitution to an specific area
+	 * @param array $params An array filled by the substitution parameters
+	 * @return bool TRUE if we are successfull, FALSE otherwise
+	 * @access public
+	 */
+	function addSubstitution( $params )
+	{
+		$result = $this -> so -> addSubstitution( $params[ 'organizacao_id' ], $params[ 'area_id' ], $params[ 'substituto_funcionario_id' ], $params[ 'data_inicio' ], $params[ 'data_fim' ] );
+		$this->disconnect_all( );
+
+		return $result;
+	}
+
+	/**
+	 * Update a substitution
+	 * @param array $params An array filled by the substitution parameters
+	 * @return bool TRUE if we are successfull, FALSE otherwise
+	 * @access public
+	 */
+	function updateSubstitution( $params )
+	{
+		$result = $this -> so -> updateSubstitution( $params[ 'organizacao_id' ], $params[ 'area_id' ], $params[ 'substituto_funcionario_id' ], $params[ 'data_inicio' ], $params[ 'data_fim' ], $params['substituicao_id'] );
+		$this->disconnect_all( );
+
+		return $result;
+	}
+
+	/**
+	 * List the substitutions for a given area.
+	 * @param array $params An array containing the areaID
+	 * @return array Substitution's list
+	 * @access public
+	 */
+	function listSubstitution( $params )
+	{
+		$result = $this -> so -> getSubstitutions( $params['organizacao_id'], $params[ 'area_id' ] );
+		$this -> disconnect_all( );
+
+		return $result;
+	}
+
+	/**
+	 * Remove a substitution
+	 * @param array $params An array containing a substitutionID
+	 * @return bool
+	 * @access public
+	 */
+	function removeSubstitution( $params )
+	{
+		$result = $this -> so -> removeSubstitution( $params['organizacao_id'], $params[ 'substituicao_id' ] );
+		$this -> disconnect_all( );
+
+		return $result;
+	}
 }
 ?>
