$filename = $_POST['form']['PRO_FILENAME']; $ObjUid = $_POST['form']['OBJ_UID']; $path = PATH_DOCUMENT . 'input' . PATH_SEP; $oData = $oProcess->getProcessDataXpdl($path . $filename); $Fields['PRO_FILENAME'] = $filename; $sProUid = $oData->process['PRO_UID']; $oData->process['PRO_UID_OLD'] = $sProUid; if (!isset($oData->tasks)) { $oData->tasks = array(); } $tasks = $oData->tasks; // code added by gustavo cruz gustavo-at-colosa-dot-com // evaluate actions or import options switch ($action) { case "none": $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); break; case "rename": $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); break; case "merge": $oBaseGroup = $oData->groupwfs; $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); $oData->groupwfs = $oNewGroup; $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); break; default: $groupsDuplicated = $oProcess->checkExistingGroups($oData->groupwfs); break; }
$result->ExistGroupsInDatabase = 1; if ( !is_null($optionGroupExistInDatabase)) { if ($optionGroupExistInDatabase == 1){ $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs); } else if ($optionGroupExistInDatabase == 2) { $oBaseGroup = $oData->groupwfs; $oNewGroup = $oProcess->mergeExistingGroups($oData->groupwfs); $oData->groupwfs = $oNewGroup; $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers); } $result->ExistGroupsInDatabase = 0; } else { if ( !($oProcess->checkExistingGroups($oData->groupwfs) > 0) ) { $result->ExistGroupsInDatabase = 0; } } if ($result->ExistGroupsInDatabase == 0) { //Update the current Process, overwriting all tasks and steps if ( $option == 1 ) { $oProcess->updateProcessFromData ($oData, $path . $filename ); if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) { $oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid); while ($sObjectName = $oDirectory->read()) { if (($sObjectName != '.') && ($sObjectName != '..')) { unlink(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid . PATH_SEP . $sObjectName); } }