Fix the new import methods.

This commit is contained in:
Gustavo Adolfo Cruz Laura
2016-03-28 14:48:33 -04:00
parent 616e24d32b
commit 7a2fd9a225
11 changed files with 183 additions and 16 deletions

View File

@@ -1466,6 +1466,18 @@ class Processes
return $oTask->updateTaskRows($aTasks);
}
/**
* Add New Task Rows from a $aTasks array data and returns those in an array.
*
* @param $aTasks array
* @return array $oTask array
*/
public function addNewTaskRows($aTasks)
{
$oTask = new Tasks();
return $oTask->addNewTaskRows($aTasks);
}
/**
* Gets all Route rows from a Process and returns those in an array.
*
@@ -1805,6 +1817,24 @@ class Processes
}
}
/**
* @param array $arrayData
*/
public function addNewProcessUser(array $arrayData)
{
try {
$processUser = new ProcessUser();
foreach ($arrayData as $value) {
$record = $value;
if (!$processUser->Exists($record["PU_UID"])) {
$result = $processUser->create($record);
}
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Create "Process Variables" records
*
@@ -1849,6 +1879,24 @@ class Processes
}
}
/**
* @param $arrayData
*/
public function addNewProcessVariables($arrayData)
{
try {
foreach ($arrayData as $value) {
$processVariables = new ProcessVariables();
$record = $value;
if (!$processVariables->Exists($record["VAR_UID"])) {
$processVariables->create($record);
}
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Gets Input Documents Rows from aProcess.
@@ -1912,6 +1960,20 @@ class Processes
return;
}
/**
* @param $aInput
*/
public function addNewInputRows($aInput)
{
foreach ($aInput as $key => $row) {
$oInput = new InputDocument();
if (!$oInput->InputExists($row['INP_DOC_UID'])) {
$oInput->create($row);
}
}
return;
}
/**
* change and Renew all Input GUID, because the process needs to have a new set of Inputs
*
@@ -2019,7 +2081,7 @@ class Processes
{
foreach ($aOutput as $key => $row) {
$oOutput = new OutputDocument();
if (!$oOutput->OutputExists($row['OUT_DOC_UID'])) {
if ($oOutput->OutputExists($row['OUT_DOC_UID'])) {
$oOutput->update($row);
} else {
$oOutput->create($row);
@@ -2028,6 +2090,20 @@ class Processes
return;
}
/**
* @param $aOutput
*/
public function addNewOutputRows($aOutput)
{
foreach ($aOutput as $key => $row) {
$oOutput = new OutputDocument();
if (!$oOutput->OutputExists($row['OUT_DOC_UID'])) {
$oOutput->create($row);
}
}
return;
}
/**
* change and Renew all Output GUID, because the process needs to have a new set of Outputs
*
@@ -2931,6 +3007,20 @@ class Processes
}
}
/**
* @param $aTrigger
* @throws Exception
*/
public function addNewTriggerRows($aTrigger)
{
$oTrigger = new Triggers();
foreach ($aTrigger as $key => $row) {
if (!$oTrigger->TriggerExists($row['TRI_UID'])) {
$oTrigger->create($row);
}
}
}
/**
* Get Groupwf Rows for a Process form an array
*
@@ -3615,6 +3705,35 @@ class Processes
}
}
/**
* Add new Connection rows if the passed ones are not existent
* @param $aConnections
*/
public function addNewDBConnectionsRows($aConnections)
{
try {
$oConnection = new DbSource();
foreach ($aConnections as $sKey => $aRow) {
if (!$oConnection->Exists($aRow['DBS_UID'], $aRow['PRO_UID'])) {
$oConnection->create($aRow);
}
// Update information in the table of contents
$oContent = new Content();
$ConCategory = 'DBS_DESCRIPTION';
$ConParent = '';
$ConId = $aRow['DBS_UID'];
$ConLang = SYS_LANG;
if ($oContent->Exists($ConCategory, $ConParent, $ConId, $ConLang)) {
$oContent->removeContent($ConCategory, $ConParent, $ConId);
}
$oContent->addContent($ConCategory, $ConParent, $ConId, $ConLang, $aRow['DBS_DESCRIPTION']);
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Create Report Tables from an array of data
@@ -3943,6 +4062,24 @@ class Processes
}
}
/**
* @param array $arrayData
* @throws Exception
*/
public function addNewFilesManager($processUid, array $arrayData)
{
try {
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
foreach ($arrayData as $value) {
if (!$filesManager->existsProcessFile($value['PRF_UID'])) {
$filesManager->addProcessFilesManagerInDb($value);
}
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Cleanup Report Tables References from an array of data
*