Explorar o código

Data Exchange - forgot a change in the previous commit

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1065 a333f486-631f-4898-b8df-5754b55c2be0
romainq %!s(int64=14) %!d(string=hai) anos
pai
achega
d93e2f5546
Modificáronse 1 ficheiros con 14 adicións e 10 borrados
  1. 14 10
      synchro/synchrodatasource.class.inc.php

+ 14 - 10
synchro/synchrodatasource.class.inc.php

@@ -96,15 +96,7 @@ class SynchroDataSource extends cmdbAbstractObject
 
 		$sTable = $this->GetDataTable();
 
-		$sClass = $this->GetTargetClass();
-		$aAttCodes = array();
-		foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
-		{
-			if ($sAttCode == 'finalclass') continue;
-
-			$aAttCodes[] = $sAttCode;
-		}
-		$aColumns = $this->GetSQLColumns($aAttCodes);
+		$aColumns = $this->GetSQLColumns();
 		
 		$aFieldDefs = array();
 		// Allow '0', otherwise mysql will render an error when the id is not given
@@ -218,11 +210,23 @@ class SynchroDataSource extends cmdbAbstractObject
 	
 	/**
 	 * Get the list of SQL columns corresponding to a particular list of attribute codes
+	 * Defaults to the whole list of columns for the current task	 
 	 */
-	protected function GetSQLColumns($aAttributeCodes)
+	public function GetSQLColumns($aAttributeCodes = null)
 	{
 		$aColumns = array();
 		$sClass = $this->GetTargetClass();
+
+		if (is_null($aAttributeCodes))
+		{
+			$aAttributeCodes = array();
+			foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
+			{
+				if ($sAttCode == 'finalclass') continue;
+				$aAttributeCodes[] = $sAttCode;
+			}
+		}
+
 		foreach($aAttributeCodes as $sAttCode)
 		{
 			$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);