HOR-4921
This commit is contained in:
@@ -152,6 +152,7 @@ class Applications
|
||||
if ($columnSearch === 'APP_NUMBER' || $columnSearch === 'APP_TITLE') {
|
||||
$sqlSearch = "SELECT APPLICATION.APP_NUMBER FROM APPLICATION";
|
||||
$sqlSearch .= " WHERE APPLICATION.{$columnSearch} LIKE '%{$search}%'";
|
||||
$orderByColumnSearch = " ORDER BY APPLICATION.{$columnSearch} " . $dir;
|
||||
switch ($columnSearch) {
|
||||
case 'APP_TITLE':
|
||||
break;
|
||||
@@ -166,6 +167,7 @@ class Applications
|
||||
}
|
||||
break;
|
||||
}
|
||||
$sqlSearch .= $orderByColumnSearch;
|
||||
if (!empty($start)) {
|
||||
$sqlSearch .= " LIMIT $start, " . $limit;
|
||||
} else {
|
||||
|
||||
@@ -912,7 +912,7 @@ class Cases
|
||||
$appDataWithoutDynContentHistory = serialize($FieldsDifference);
|
||||
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
|
||||
$appHistory->insertHistory($aFieldsHistory);
|
||||
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$type = isset($Fields['OBJECT_TYPE']) ?
|
||||
$Fields['OBJECT_TYPE'] : ChangeLog::getChangeLog()->getObjectNameById(ChangeLog::DYNAFORM);
|
||||
@@ -1152,12 +1152,13 @@ class Cases
|
||||
$nameFiles .= $node['file'] . ":" . $node['function'] . "(" . $node['line'] . ")\n";
|
||||
}
|
||||
}
|
||||
$dataLog = \Bootstrap::getDefaultContextLog();
|
||||
$dataLog['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : G::LoadTranslation('UID_UNDEFINED_USER');
|
||||
$dataLog['appUid'] = $sAppUid;
|
||||
$dataLog['request'] = $nameFiles;
|
||||
$dataLog['action'] = 'DeleteCases';
|
||||
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $dataLog, $dataLog['workspace'], 'processmaker.log');
|
||||
|
||||
/** ProcessMaker log*/
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['appUid'] = $sAppUid;
|
||||
$context['request'] = $nameFiles;
|
||||
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $context);
|
||||
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -4543,11 +4544,14 @@ class Cases
|
||||
$appDelay = new AppDelay();
|
||||
$appDelay->create($newData);
|
||||
|
||||
//update searchindex
|
||||
//Update searchindex
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($appUid);
|
||||
}
|
||||
|
||||
//Execute trigger
|
||||
$this->getExecuteTriggerProcess($appUid, 'REASSIGNED');
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$participated = new ListParticipatedLast();
|
||||
$participated->remove($newData['APP_UID'], $newUserUid, $delIndex);
|
||||
@@ -4567,9 +4571,7 @@ class Cases
|
||||
$criteriaSet = new Criteria("workflow");
|
||||
$criteriaSet->add(ListInboxPeer::DEL_INDEX, $newData['DEL_INDEX']);
|
||||
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->getExecuteTriggerProcess($appUid, 'REASSIGNED');
|
||||
|
||||
//Delete record of the table LIST_UNASSIGNED
|
||||
$unassigned = new ListUnassigned();
|
||||
@@ -7139,57 +7141,38 @@ class Cases
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the case is deleted will be removed the case from the report tables related
|
||||
*
|
||||
* @param string $applicationUid
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function reportTableDeleteRecord($applicationUid)
|
||||
{
|
||||
$criteria1 = new Criteria("workflow");
|
||||
|
||||
//SELECT
|
||||
$criteria1->addSelectColumn(ApplicationPeer::PRO_UID);
|
||||
|
||||
//FROM
|
||||
//WHERE
|
||||
$criteria1->add(ApplicationPeer::APP_UID, $applicationUid);
|
||||
|
||||
//QUERY
|
||||
$rsCriteria1 = ApplicationPeer::doSelectRS($criteria1);
|
||||
$rsCriteria1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsCriteria1->next();
|
||||
$row1 = $rsCriteria1->getRow();
|
||||
|
||||
$processUid = $row1["PRO_UID"];
|
||||
|
||||
$criteria2 = new Criteria("workflow");
|
||||
|
||||
//SELECT
|
||||
$criteria2->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
|
||||
//FROM
|
||||
//WHERE
|
||||
|
||||
$criteria2->add(AdditionalTablesPeer::PRO_UID, $processUid);
|
||||
|
||||
//QUERY
|
||||
$rsCriteria2 = AdditionalTablesPeer::doSelectRS($criteria2);
|
||||
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$pmTable = new PmTable();
|
||||
|
||||
while ($rsCriteria2->next()) {
|
||||
try {
|
||||
$row2 = $rsCriteria2->getRow();
|
||||
$tableName = $row2["ADD_TAB_NAME"];
|
||||
$pmTableName = $pmTable->toCamelCase($tableName);
|
||||
|
||||
//DELETE
|
||||
require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
|
||||
|
||||
$criteria3 = new Criteria("workflow");
|
||||
|
||||
eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);");
|
||||
eval($pmTableName . "Peer::doDelete(\$criteria3);");
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
$app = new Application();
|
||||
$applicationFields = $app->Load($applicationUid);
|
||||
if (!empty($applicationFields["PRO_UID"])) {
|
||||
$additionalTables = new AdditionalTables();
|
||||
$listTables = $additionalTables->getReportTables($applicationFields["PRO_UID"]);
|
||||
$pmTable = new PmTable();
|
||||
foreach ($listTables as $row) {
|
||||
try {
|
||||
$tableName = $row["ADD_TAB_NAME"];
|
||||
$pmTableName = $pmTable->toCamelCase($tableName);
|
||||
require_once(PATH_WORKSPACE . 'classes' . PATH_SEP . $pmTableName . '.php');
|
||||
$criteria = new Criteria("workflow");
|
||||
$pmTablePeer = $pmTableName . 'Peer';
|
||||
$criteria->add($pmTablePeer::APP_UID, $applicationUid);
|
||||
$pmTablePeer::doDelete($criteria);
|
||||
} catch (Exception $e) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['appUid'] = $applicationUid;
|
||||
$context['proUid'] = $applicationFields["PRO_UID"];
|
||||
$context['reportTable'] = $tableName;
|
||||
Bootstrap::registerMonolog('DeleteCases', 400, $e->getMessage(), $context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1768,25 +1768,33 @@ class Processes
|
||||
/**
|
||||
* Create "Process User" records
|
||||
*
|
||||
* @param array $arrayData Data to create
|
||||
* @param array $arrayData
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createProcessUser(array $arrayData)
|
||||
{
|
||||
try {
|
||||
$processUser = new ProcessUser();
|
||||
|
||||
foreach ($arrayData as $value) {
|
||||
$record = $value;
|
||||
|
||||
if ($processUser->Exists($record["PU_UID"])) {
|
||||
$result = $processUser->remove($record["PU_UID"]);
|
||||
}
|
||||
|
||||
$result = $processUser->create($record);
|
||||
$con = Propel::getConnection(ProcessUserPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($arrayData as $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(ProcessUserPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(ProcessUserPeer::PU_UID, $row['PU_UID']);
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(ProcessUserPeer::DATABASE_NAME);
|
||||
$criteria->add(ProcessUserPeer::PU_UID, $row['PU_UID']);
|
||||
$criteria->add(ProcessUserPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(ProcessUserPeer::USR_UID, $row['USR_UID']);
|
||||
$criteria->add(ProcessUserPeer::PU_TYPE, $row['PU_TYPE']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1832,23 +1840,41 @@ class Processes
|
||||
/**
|
||||
* Create "Process Variables" records
|
||||
*
|
||||
* @param array $arrayData Data to create
|
||||
* @param array $arrayData
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createProcessVariables(array $arrayData)
|
||||
{
|
||||
try {
|
||||
foreach ($arrayData as $value) {
|
||||
$processVariables = new ProcessVariables();
|
||||
$record = $value;
|
||||
|
||||
if ($processVariables->Exists($record["VAR_UID"])) {
|
||||
$result = $processVariables->remove($record["VAR_UID"]);
|
||||
}
|
||||
$result = $processVariables->create($record);
|
||||
$con = Propel::getConnection(ProcessVariablesPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($arrayData as $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(ProcessVariablesPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(ProcessVariablesPeer::VAR_UID, $row['VAR_UID']);
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(ProcessVariablesPeer::DATABASE_NAME);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_UID, $row['VAR_UID']);
|
||||
$criteria->add(ProcessVariablesPeer::PRJ_UID, $row['PRJ_UID']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_NAME, $row['VAR_NAME']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_FIELD_TYPE, $row['VAR_FIELD_TYPE']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_FIELD_SIZE, $row['VAR_FIELD_SIZE']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_LABEL, $row['VAR_LABEL']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_DBCONNECTION, $row['VAR_DBCONNECTION']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_SQL, $row['VAR_SQL']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_NULL, $row['VAR_NULL']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_DEFAULT, $row['VAR_DEFAULT']);
|
||||
$criteria->add(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, $row['VAR_ACCEPTED_VALUES']);
|
||||
$criteria->add(ProcessVariablesPeer::INP_DOC_UID, $row['INP_DOC_UID']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1895,47 +1921,86 @@ class Processes
|
||||
/**
|
||||
* Gets Input Documents Rows from aProcess.
|
||||
*
|
||||
* @param $sProUid string.
|
||||
* @return void
|
||||
* @param string $proUid
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getInputRows($sProUid)
|
||||
public function getInputRows($proUid)
|
||||
{
|
||||
try {
|
||||
$aInput = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(InputDocumentPeer::PRO_UID, $sProUid);
|
||||
$oDataset = InputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$oInput = new InputDocument();
|
||||
$aInput[] = $oInput->load($aRow['INP_DOC_UID']);
|
||||
$oDataset->next();
|
||||
$inputList = [];
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(InputDocumentPeer::PRO_UID, $proUid);
|
||||
$dataset = InputDocumentPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
$input = new InputDocument();
|
||||
$infoInput = $input->load($row['INP_DOC_UID']);
|
||||
unset($infoInput['INP_DOC_ID']);
|
||||
$inputList[] = $infoInput;
|
||||
$dataset->next();
|
||||
}
|
||||
return $aInput;
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
|
||||
return $inputList;
|
||||
} catch (Exception $error) {
|
||||
throw ($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Input Documents Rows from an array, removing those Objects
|
||||
* with the same UID, and recreaiting the records from the array data.
|
||||
* Create Input Documents
|
||||
*
|
||||
* @param array $input
|
||||
*
|
||||
* @param $aInput array.
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createInputRows($aInput)
|
||||
public function createInputRows($input)
|
||||
{
|
||||
foreach ($aInput as $key => $row) {
|
||||
$oInput = new InputDocument();
|
||||
//unset ($row['TAS_UID']);
|
||||
if ($oInput->InputExists($row['INP_DOC_UID'])) {
|
||||
$oInput->remove($row['INP_DOC_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(InputDocumentPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($input as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(InputDocumentPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_UID, $row['INP_DOC_UID']);
|
||||
//Get the INP_DOC_ID column
|
||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($dataSet->next()) {
|
||||
$inputInfo = $dataSet->getRow();
|
||||
$row['INP_DOC_ID'] = $inputInfo['INP_DOC_ID'];
|
||||
} else {
|
||||
$row['INP_DOC_ID'] = null;
|
||||
}
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(InputDocumentPeer::DATABASE_NAME);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_ID, $row['INP_DOC_ID']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_UID, $row['INP_DOC_UID']);
|
||||
$criteria->add(InputDocumentPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_TITLE, $row['INP_DOC_TITLE']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_DESCRIPTION, $row['INP_DOC_DESCRIPTION']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_FORM_NEEDED, $row['INP_DOC_FORM_NEEDED']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_ORIGINAL, $row['INP_DOC_ORIGINAL']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_PUBLISHED, $row['INP_DOC_PUBLISHED']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_VERSIONING, $row['INP_DOC_VERSIONING']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_DESTINATION_PATH, $row['INP_DOC_DESTINATION_PATH']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_TAGS, $row['INP_DOC_TAGS']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $row['INP_DOC_TYPE_FILE']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE, $row['INP_DOC_MAX_FILESIZE']);
|
||||
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, $row['INP_DOC_MAX_FILESIZE_UNIT']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$res = $oInput->create($row);
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2029,47 +2094,96 @@ class Processes
|
||||
/**
|
||||
* Gets the Output Documents Rows from a Process.
|
||||
*
|
||||
* @param $sProUid string.
|
||||
* @return $aOutput array
|
||||
* @param string $proUid
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getOutputRows($sProUid)
|
||||
public function getOutputRows($proUid)
|
||||
{
|
||||
try {
|
||||
$aOutput = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(OutputDocumentPeer::PRO_UID, $sProUid);
|
||||
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$oOutput = new OutputDocument();
|
||||
$aOutput[] = $oOutput->Load($aRow['OUT_DOC_UID']);
|
||||
$oDataset->next();
|
||||
$outputList = [];
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(OutputDocumentPeer::PRO_UID, $proUid);
|
||||
$dataset = OutputDocumentPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
$output = new OutputDocument();
|
||||
$infoOutput = $output->Load($row['OUT_DOC_UID']);
|
||||
unset($infoOutput['OUT_DOC_ID']);
|
||||
$outputList[] = $infoOutput;
|
||||
$dataset->next();
|
||||
}
|
||||
return $aOutput;
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
|
||||
return $outputList;
|
||||
} catch (Exception $error) {
|
||||
throw ($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Input Documents Rows from an array, removing those Objects
|
||||
* with the same UID, and recreaiting the records from the array data.
|
||||
* Create Input Documents
|
||||
*
|
||||
* @param array $output
|
||||
*
|
||||
* @param $aOutput array.
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createOutputRows($aOutput)
|
||||
public function createOutputRows($output)
|
||||
{
|
||||
foreach ($aOutput as $key => $row) {
|
||||
$oOutput = new OutputDocument();
|
||||
//unset ($row['TAS_UID']);
|
||||
if ($oOutput->OutputExists($row['OUT_DOC_UID'])) {
|
||||
$oOutput->remove($row['OUT_DOC_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($output as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(OutputDocumentPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_UID, $row['OUT_DOC_UID']);
|
||||
//Get the OUT_DOC_ID column
|
||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($dataSet->next()) {
|
||||
$outputInfo = $dataSet->getRow();
|
||||
$row['OUT_DOC_ID'] = $outputInfo['OUT_DOC_ID'];
|
||||
} else {
|
||||
$row['OUT_DOC_ID'] = null;
|
||||
}
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(OutputDocumentPeer::DATABASE_NAME);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_ID, $row['OUT_DOC_ID']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_UID, $row['OUT_DOC_UID']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_TITLE, $row['OUT_DOC_TITLE']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_DESCRIPTION, $row['OUT_DOC_DESCRIPTION']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_FILENAME, $row['OUT_DOC_FILENAME']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_TEMPLATE, $row['OUT_DOC_TEMPLATE']);
|
||||
$criteria->add(OutputDocumentPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR, $row['OUT_DOC_REPORT_GENERATOR']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_LANDSCAPE, $row['OUT_DOC_LANDSCAPE']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_MEDIA, $row['OUT_DOC_MEDIA']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, $row['OUT_DOC_LEFT_MARGIN']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, $row['OUT_DOC_RIGHT_MARGIN']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_TOP_MARGIN, $row['OUT_DOC_TOP_MARGIN']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, $row['OUT_DOC_BOTTOM_MARGIN']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_GENERATE, $row['OUT_DOC_GENERATE']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, $row['OUT_DOC_CURRENT_REVISION']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, $row['OUT_DOC_FIELD_MAPPING']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_VERSIONING, $row['OUT_DOC_VERSIONING']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, $row['OUT_DOC_DESTINATION_PATH']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_TAGS, $row['OUT_DOC_TAGS']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, $row['OUT_DOC_PDF_SECURITY_ENABLED']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, $row['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, $row['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, $row['OUT_DOC_PDF_SECURITY_PERMISSIONS']);
|
||||
$criteria->add(OutputDocumentPeer::OUT_DOC_OPEN_TYPE, $row['OUT_DOC_OPEN_TYPE']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$res = $oOutput->create($row);
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2665,37 +2779,75 @@ class Processes
|
||||
/**
|
||||
* Create Step Rows from a Process
|
||||
*
|
||||
* @param $aStep array.
|
||||
* @param array $step
|
||||
*
|
||||
* @return void.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createStepRows($aStep)
|
||||
public function createStepRows($step)
|
||||
{
|
||||
foreach ($aStep as $key => $row) {
|
||||
$oStep = new Step();
|
||||
if (isset($row['STEP_UID'])) {
|
||||
if ($oStep->StepExists($row['STEP_UID'])) {
|
||||
$oStep->remove($row['STEP_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(StepPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($step as $key => $row) {
|
||||
if (isset($row['STEP_UID'])) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(StepPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(StepPeer::STEP_UID, $row['STEP_UID']);
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(StepPeer::DATABASE_NAME);
|
||||
$criteria->add(StepPeer::STEP_UID, $row['STEP_UID']);
|
||||
$criteria->add(StepPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(StepPeer::TAS_UID, $row['TAS_UID']);
|
||||
$criteria->add(StepPeer::STEP_TYPE_OBJ, $row['STEP_TYPE_OBJ']);
|
||||
$criteria->add(StepPeer::STEP_UID_OBJ, $row['STEP_UID_OBJ']);
|
||||
$criteria->add(StepPeer::STEP_CONDITION, $row['STEP_CONDITION']);
|
||||
$criteria->add(StepPeer::STEP_POSITION, $row['STEP_POSITION']);
|
||||
$criteria->add(StepPeer::STEP_MODE, $row['STEP_MODE']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$res = $oStep->create($row);
|
||||
}
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Step Supervisor Rows for a Process from an array of data
|
||||
*
|
||||
* @param $aStepSupervisor array.
|
||||
* @param array $stepSupervisor
|
||||
*
|
||||
* @return void.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createStepSupervisorRows($aStepSupervisor)
|
||||
public function createStepSupervisorRows($stepSupervisor)
|
||||
{
|
||||
foreach ($aStepSupervisor as $key => $row) {
|
||||
$oStepSupervisor = new StepSupervisor();
|
||||
if ($oStepSupervisor->Exists($row['STEP_UID'])) {
|
||||
$oStepSupervisor->remove($row['STEP_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($stepSupervisor as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(StepSupervisorPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(StepSupervisorPeer::STEP_UID, $row['STEP_UID']);
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(StepSupervisorPeer::DATABASE_NAME);
|
||||
$criteria->add(StepSupervisorPeer::STEP_UID, $row['STEP_UID']);
|
||||
$criteria->add(StepSupervisorPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $row['STEP_TYPE_OBJ']);
|
||||
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $row['STEP_UID_OBJ']);
|
||||
$criteria->add(StepSupervisorPeer::STEP_POSITION, $row['STEP_POSITION']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$oStepSupervisor->create($row);
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2764,26 +2916,31 @@ class Processes
|
||||
/**
|
||||
* Get Dynaform Rows from a Process
|
||||
*
|
||||
* @param string $sProUid
|
||||
* @return $aDynaform array
|
||||
* @param string $proUid
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getDynaformRows($sProUid)
|
||||
public function getDynaformRows($proUid)
|
||||
{
|
||||
try {
|
||||
$aDynaform = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(DynaformPeer::PRO_UID, $sProUid);
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$oDynaform = new Dynaform();
|
||||
$aDynaform[] = $oDynaform->Load($aRow['DYN_UID']);
|
||||
$oDataset->next();
|
||||
$dynaformList = [];
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(DynaformPeer::PRO_UID, $proUid);
|
||||
$dataset = DynaformPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
$dynaform = new Dynaform();
|
||||
$infoDyn = $dynaform->Load($row['DYN_UID']);
|
||||
unset($infoDyn['DYN_ID']);
|
||||
$dynaformList[] = $infoDyn;
|
||||
$dataset->next();
|
||||
}
|
||||
return $aDynaform;
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
|
||||
return $dynaformList;
|
||||
} catch (Exception $error) {
|
||||
throw ($error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2906,22 +3063,53 @@ class Processes
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Dynaform Rows for a Process form an array
|
||||
* Create dynaforms for a process
|
||||
*
|
||||
* @param array $dynaforms
|
||||
*
|
||||
* @param array $aDynaform
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createDynaformRows($aDynaform)
|
||||
public function createDynaformRows($dynaforms)
|
||||
{
|
||||
foreach ($aDynaform as $key => $row) {
|
||||
$oDynaform = new Dynaform();
|
||||
//unset ($row['TAS_UID']);
|
||||
if ($oDynaform->exists($row['DYN_UID'])) {
|
||||
$oDynaform->remove($row['DYN_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(DynaformPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($dynaforms as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(DynaformPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(DynaformPeer::DYN_UID, $row['DYN_UID']);
|
||||
//Get the DYN_ID column
|
||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($dataSet->next()) {
|
||||
$dynInfo = $dataSet->getRow();
|
||||
$row['DYN_ID'] = $dynInfo['DYN_ID'];
|
||||
} else {
|
||||
$row['DYN_ID'] = null;
|
||||
}
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(DynaformPeer::DATABASE_NAME);
|
||||
$criteria->add(DynaformPeer::DYN_ID, $row['DYN_ID']);
|
||||
$criteria->add(DynaformPeer::DYN_UID, $row['DYN_UID']);
|
||||
$criteria->add(DynaformPeer::DYN_TITLE, $row['DYN_TITLE']);
|
||||
$criteria->add(DynaformPeer::DYN_DESCRIPTION, $row['DYN_DESCRIPTION']);
|
||||
$criteria->add(DynaformPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(DynaformPeer::DYN_TYPE, $row['DYN_TYPE']);
|
||||
$criteria->add(DynaformPeer::DYN_FILENAME, $row['DYN_FILENAME']);
|
||||
$criteria->add(DynaformPeer::DYN_CONTENT, $row['DYN_CONTENT']);
|
||||
$criteria->add(DynaformPeer::DYN_LABEL, $row['DYN_LABEL']);
|
||||
$criteria->add(DynaformPeer::DYN_VERSION, $row['DYN_VERSION']);
|
||||
$criteria->add(DynaformPeer::DYN_UPDATE_DATE, $row['DYN_UPDATE_DATE']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$res = $oDynaform->create($row);
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3035,20 +3223,38 @@ class Processes
|
||||
/**
|
||||
* Create Step Trigger Rows for a Process form an array
|
||||
*
|
||||
* @param array $aTrigger
|
||||
* @param array $trigger
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createTriggerRows($aTrigger)
|
||||
public function createTriggerRows($trigger)
|
||||
{
|
||||
foreach ($aTrigger as $key => $row) {
|
||||
$oTrigger = new Triggers();
|
||||
//unset ($row['TAS_UID']);
|
||||
if ($oTrigger->TriggerExists($row['TRI_UID'])) {
|
||||
$oTrigger->remove($row['TRI_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($trigger as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(TriggersPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(TriggersPeer::TRI_UID, $row['TRI_UID']);
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(TriggersPeer::DATABASE_NAME);
|
||||
$criteria->add(TriggersPeer::TRI_UID, $row['TRI_UID']);
|
||||
$criteria->add(TriggersPeer::TRI_TITLE, $row['TRI_TITLE']);
|
||||
$criteria->add(TriggersPeer::TRI_DESCRIPTION, $row['TRI_DESCRIPTION']);
|
||||
$criteria->add(TriggersPeer::PRO_UID, $row['PRO_UID']);
|
||||
$criteria->add(TriggersPeer::TRI_TYPE, $row['TRI_TYPE']);
|
||||
$criteria->add(TriggersPeer::TRI_WEBBOT, $row['TRI_WEBBOT']);
|
||||
$criteria->add(TriggersPeer::TRI_PARAM, $row['TRI_PARAM']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
$res = $oTrigger->create($row);
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3736,21 +3942,40 @@ class Processes
|
||||
/**
|
||||
* Get Task User Rows from an array of data
|
||||
*
|
||||
* @param array $aTaskUser
|
||||
* @return array $aStepTrigger
|
||||
* @param array $taskUser
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createTaskUserRows($aTaskUser)
|
||||
public function createTaskUserRows($taskUser)
|
||||
{
|
||||
if (is_array($aTaskUser)) {
|
||||
foreach ($aTaskUser as $key => $row) {
|
||||
$oTaskUser = new TaskUser();
|
||||
if ($oTaskUser->TaskUserExists($row['TAS_UID'], $row['USR_UID'], $row['TU_TYPE'], $row['TU_RELATION'])) {
|
||||
$oTaskUser->remove($row['TAS_UID'], $row['USR_UID'], $row['TU_TYPE'], $row['TU_RELATION']);
|
||||
try {
|
||||
if (is_array($taskUser)) {
|
||||
$con = Propel::getConnection(TaskUserPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($taskUser as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(TaskUserPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(TaskUserPeer::TAS_UID, $row['TAS_UID']);
|
||||
$criteria->add(TaskUserPeer::USR_UID, $row['USR_UID']);
|
||||
$criteria->add(TaskUserPeer::TU_TYPE, $row['TU_TYPE']);
|
||||
$criteria->add(TaskUserPeer::TU_RELATION, $row['TU_RELATION']);
|
||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||
if (!$dataSet->next()) {
|
||||
/** The validation added in method TaskUser->create is not required,
|
||||
* because in the current method only assigned GROUPS are present.
|
||||
* if (RBAC::isGuestUserUid($row['USR_UID']) && !$bmWebEntry->isTaskAWebEntry($row['TAS_UID'])) {...
|
||||
*/
|
||||
BasePeer::doInsert($criteria, $con, false);
|
||||
}
|
||||
}
|
||||
$res = $oTaskUser->create($row);
|
||||
$con->commit();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3794,21 +4019,42 @@ class Processes
|
||||
* @param array $group
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createGroupRow($group)
|
||||
{
|
||||
foreach ($group as $key => $row) {
|
||||
$groupInfo = [];
|
||||
$groupWf = new Groupwf();
|
||||
if ($groupWf->GroupwfExists($row['GRP_UID'])) {
|
||||
$groupInfo = $groupWf->Load($row['GRP_UID']);
|
||||
$groupWf->remove($row['GRP_UID']);
|
||||
try {
|
||||
$con = Propel::getConnection(GroupwfPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
foreach ($group as $key => $row) {
|
||||
//Prepare the delete
|
||||
$criteria = new Criteria(GroupwfPeer::DATABASE_NAME);
|
||||
$criteria->addSelectColumn('*');
|
||||
$criteria->add(GroupwfPeer::GRP_UID, $row['GRP_UID']);
|
||||
//Get the GRP_ID column
|
||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($dataSet->next()) {
|
||||
$groupInfo = $dataSet->getRow();
|
||||
$row['GRP_ID'] = $groupInfo['GRP_ID'];
|
||||
} else {
|
||||
$row['GRP_ID'] = null;
|
||||
}
|
||||
BasePeer::doDelete($criteria, $con);
|
||||
//Prepare the insert
|
||||
$criteria = new Criteria(GroupwfPeer::DATABASE_NAME);
|
||||
$criteria->add(GroupwfPeer::GRP_ID, $row['GRP_ID']);
|
||||
$criteria->add(GroupwfPeer::GRP_UID, $row['GRP_UID']);
|
||||
$criteria->add(GroupwfPeer::GRP_TITLE, $row['GRP_TITLE']);
|
||||
$criteria->add(GroupwfPeer::GRP_STATUS, $row['GRP_STATUS']);
|
||||
$criteria->add(GroupwfPeer::GRP_LDAP_DN, $row['GRP_LDAP_DN']);
|
||||
$criteria->add(GroupwfPeer::GRP_UX, $row['GRP_UX']);
|
||||
BasePeer::doInsert($criteria, $con);
|
||||
}
|
||||
//We will to keep the GRP_ID
|
||||
if (!empty($groupInfo['GRP_ID'])) {
|
||||
$row['GRP_ID'] = $groupInfo['GRP_ID'];
|
||||
}
|
||||
$res = $groupWf->create($row);
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4212,7 +4458,8 @@ class Processes
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createActionsByEmail($processUid, array $arrayData)
|
||||
{
|
||||
@@ -4784,45 +5031,35 @@ class Processes
|
||||
/**
|
||||
* function checkExistingGroups
|
||||
* checkExistingGroups check if any of the groups listed in the parameter
|
||||
* array exist and wich are those, that is the result $sFilteredGroups array.
|
||||
* array exist and which are those, that is the result $sFilteredGroups array.
|
||||
*
|
||||
* @author gustavo cruz gustavo-at-colosa.com
|
||||
* @param $sGroupList array of a group list
|
||||
* @return $existingGroupList array of existing groups or null
|
||||
* @param array $groupList, array of a group list
|
||||
* @return array|null, array of existing groups or null
|
||||
*/
|
||||
public function checkExistingGroups($sGroupList)
|
||||
public function checkExistingGroups($groupList)
|
||||
{
|
||||
$aGroupwf = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
|
||||
$oCriteria->addSelectColumn(GroupwfPeer::GRP_TITLE);
|
||||
$oDataset = GroupwfPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aGroupwf[] = $aRow;
|
||||
$oDataset->next();
|
||||
}
|
||||
//check if any group name exists in the dbase
|
||||
if (is_array($sGroupList)) {
|
||||
foreach ($aGroupwf as $groupBase) {
|
||||
foreach ($sGroupList as $group) {
|
||||
if ($groupBase['GRP_TITLE'] == $group['GRP_TITLE'] && $groupBase['GRP_UID'] != $group['GRP_UID']) {
|
||||
$oPro = GroupwfPeer::retrieveByPk( $group['GRP_UID'] );
|
||||
if(is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
|
||||
$group['GRP_UID'] = G::generateUniqueID();
|
||||
}
|
||||
$existingGroupList[] = $group;
|
||||
$existingGroupList = [];
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
|
||||
$criteria->addSelectColumn(GroupwfPeer::GRP_TITLE);
|
||||
$dataset = GroupwfPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
foreach ($groupList as $group) {
|
||||
//Check if any group name exists in the database
|
||||
if ($row['GRP_TITLE'] === $group['GRP_TITLE'] && $row['GRP_UID'] !== $group['GRP_UID']) {
|
||||
$groupWf = GroupwfPeer::retrieveByPk($group['GRP_UID']);
|
||||
if (is_object($groupWf) && get_class($groupWf) == 'Groupwf') {
|
||||
$group['GRP_UID'] = G::generateUniqueID();
|
||||
}
|
||||
$existingGroupList[] = $group;
|
||||
}
|
||||
}
|
||||
$dataset->next();
|
||||
}
|
||||
//return $sGroupList;
|
||||
if (isset($existingGroupList)) {
|
||||
return $existingGroupList;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return !empty($existingGroupList) ? $existingGroupList : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5499,54 +5736,21 @@ class Processes
|
||||
|
||||
$this->createProcessPropertiesFromData($oData);
|
||||
|
||||
// $this->createLaneRows( $oData->lanes );
|
||||
//
|
||||
//
|
||||
// if (isset( $oData->gateways )) {
|
||||
// $this->createGatewayRows( $oData->gateways );
|
||||
// }
|
||||
// $this->createDynaformRows( $oData->dynaforms );
|
||||
// $this->createInputRows( $oData->inputs );
|
||||
// $this->createOutputRows( $oData->outputs );
|
||||
// $this->createStepRows( $oData->steps );
|
||||
// $this->createStepSupervisorRows( isset( $oData->stepSupervisor ) ? $oData->stepSupervisor : array () );
|
||||
// $this->createTriggerRows( $oData->triggers );
|
||||
// $this->createStepTriggerRows( $oData->steptriggers );
|
||||
// $this->createTaskUserRows( $oData->taskusers );
|
||||
// $this->createGroupRow( $oData->groupwfs );
|
||||
// $this->createDBConnectionsRows( isset( $oData->dbconnections ) ? $oData->dbconnections : array () );
|
||||
// $this->createReportTables( isset( $oData->reportTables ) ? $oData->reportTables : array (), isset( $oData->reportTablesVars ) ? $oData->reportTablesVars : array () );
|
||||
// $this->createSubProcessRows( isset( $oData->subProcess ) ? $oData->subProcess : array () );
|
||||
// $this->createCaseTrackerRows( isset( $oData->caseTracker ) ? $oData->caseTracker : array () );
|
||||
// $this->createCaseTrackerObjectRows( isset( $oData->caseTrackerObject ) ? $oData->caseTrackerObject : array () );
|
||||
// $this->createObjectPermissionsRows( isset( $oData->objectPermissions ) ? $oData->objectPermissions : array () );
|
||||
// $this->createStageRows( isset( $oData->stage ) ? $oData->stage : array () );
|
||||
//
|
||||
// $this->createFieldCondition( isset( $oData->fieldCondition ) ? $oData->fieldCondition : array (), $oData->dynaforms );
|
||||
//
|
||||
// // Create before to createRouteRows for avoid duplicates
|
||||
// $this->createEventRows( isset( $oData->event ) ? $oData->event : array () );
|
||||
//
|
||||
// $this->createCaseSchedulerRows( isset( $oData->caseScheduler ) ? $oData->caseScheduler : array () );
|
||||
//
|
||||
// //Create data related to Configuration table
|
||||
// $this->createTaskExtraPropertiesRows( isset( $oData->taskExtraProperties ) ? $oData->taskExtraProperties : array () );
|
||||
|
||||
// and finally create the files, dynaforms (xml and html), emailTemplates and Public files
|
||||
$this->createFiles($oData, $pmFilename);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates a new Process, defined in the object $oData
|
||||
*
|
||||
* @param object $oData
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createProcessPropertiesFromData($oData)
|
||||
{
|
||||
$arrayProcessData = $oData->process;
|
||||
|
||||
// (*) Creating process dependencies
|
||||
// creating the process category
|
||||
$this->createProcessCategoryRow(isset($oData->processCategory) ? $oData->processCategory : null);
|
||||
|
||||
$this->createLaneRows($oData->lanes);
|
||||
|
||||
|
||||
if (isset($oData->gateways)) {
|
||||
$this->createGatewayRows($oData->gateways);
|
||||
}
|
||||
@@ -5557,8 +5761,8 @@ class Processes
|
||||
$this->createStepSupervisorRows(isset($oData->stepSupervisor) ? $oData->stepSupervisor : array());
|
||||
$this->createTriggerRows($oData->triggers);
|
||||
$this->createStepTriggerRows($oData->steptriggers);
|
||||
$this->createTaskUserRows($oData->taskusers);
|
||||
$this->createGroupRow($oData->groupwfs);
|
||||
$this->createTaskUserRows($oData->taskusers);
|
||||
$this->createDBConnectionsRows(isset($oData->dbconnections) ? $oData->dbconnections : array());
|
||||
$this->createReportTables(isset($oData->reportTables) ? $oData->reportTables : array(), isset($oData->reportTablesVars) ? $oData->reportTablesVars : array());
|
||||
$this->createSubProcessRows(isset($oData->subProcess) ? $oData->subProcess : array());
|
||||
@@ -5566,17 +5770,14 @@ class Processes
|
||||
$this->createCaseTrackerObjectRows(isset($oData->caseTrackerObject) ? $oData->caseTrackerObject : array());
|
||||
$this->createObjectPermissionsRows(isset($oData->objectPermissions) ? $oData->objectPermissions : array());
|
||||
$this->createStageRows(isset($oData->stage) ? $oData->stage : array());
|
||||
|
||||
$this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms);
|
||||
|
||||
// Create before to createRouteRows for avoid duplicates
|
||||
$this->createEventRows(isset($oData->event) ? $oData->event : array());
|
||||
|
||||
$this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array());
|
||||
|
||||
//Create data related to Configuration table
|
||||
$this->createTaskExtraPropertiesRows(isset($oData->taskExtraProperties) ? $oData->taskExtraProperties : array());
|
||||
|
||||
$this->createProcessUser((isset($oData->processUser)) ? $oData->processUser : array());
|
||||
$this->createProcessVariables((isset($oData->processVariables)) ? $oData->processVariables : array());
|
||||
$this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry)) ? $oData->webEntry : array());
|
||||
@@ -5715,10 +5916,12 @@ class Processes
|
||||
}
|
||||
|
||||
/**
|
||||
* this function creates a new Process, defined in the object $oData
|
||||
* This function creates a new Process, defined in the object $oData
|
||||
*
|
||||
* @param string $sProUid
|
||||
* @return boolean
|
||||
* @param object $oData
|
||||
* @param string $pmFilename
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateProcessFromData($oData, $pmFilename)
|
||||
{
|
||||
@@ -5736,8 +5939,8 @@ class Processes
|
||||
$this->createStepSupervisorRows($oData->stepSupervisor);
|
||||
$this->createTriggerRows($oData->triggers);
|
||||
$this->createStepTriggerRows($oData->steptriggers);
|
||||
$this->createTaskUserRows($oData->taskusers);
|
||||
$this->createGroupRow($oData->groupwfs);
|
||||
$this->createTaskUserRows($oData->taskusers);
|
||||
$this->createDBConnectionsRows($oData->dbconnections);
|
||||
$this->updateReportTables($oData->reportTables, $oData->reportTablesVars);
|
||||
$this->createFiles($oData, $pmFilename);
|
||||
|
||||
@@ -3215,7 +3215,7 @@ function PMFGetGroupName($grpUid, $lang = SYS_LANG) {
|
||||
* @param string | $text | Text
|
||||
* @param string | $category | Category
|
||||
* @param string | $proUid | ProcessUid
|
||||
* @param string | $lang | Languaje
|
||||
* @param string | $lang | Language
|
||||
* @return array
|
||||
*/
|
||||
function PMFGetUidFromText($text, $category, $proUid = null, $lang = SYS_LANG)
|
||||
@@ -3467,14 +3467,28 @@ function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null
|
||||
if ($arrayApplicationData === false) {
|
||||
return false;
|
||||
}
|
||||
$conf = new Configurations();
|
||||
$envSkin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', '');
|
||||
$workspace = (!empty($workspace)) ? $workspace : config("system.workspace");
|
||||
$language = (!empty($language)) ? $language : SYS_LANG;
|
||||
$skin = (!empty($skin)) ? $skin : SYS_SKIN;
|
||||
$skin = (!empty($skin)) ? $skin : $envSkin;
|
||||
|
||||
$uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid;
|
||||
|
||||
//Return
|
||||
return ((G::is_https()) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $uri;
|
||||
$envHost = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : SERVER_NAME;
|
||||
$envProtocol = defined("REQUEST_SCHEME") && REQUEST_SCHEME === "https";
|
||||
if (isset($_SERVER['SERVER_PORT'])) {
|
||||
$envPort = ($_SERVER['SERVER_PORT'] != "80") ? ":" . $_SERVER['SERVER_PORT'] : "";
|
||||
} else if (defined('SERVER_PORT')) {
|
||||
$envPort = (SERVER_PORT . "" != "80") ? ":" . SERVER_PORT : "";
|
||||
} else {
|
||||
$envPort = "";
|
||||
}
|
||||
if (!empty($envPort) && strpos($envHost, $envPort) === false) {
|
||||
$envHost = $envHost . $envPort;
|
||||
}
|
||||
$link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . $uri;
|
||||
return $link;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -56,8 +56,41 @@ function validateType($value, $type)
|
||||
|
||||
class AdditionalTables extends BaseAdditionalTables
|
||||
{
|
||||
public $fields = array();
|
||||
public $primaryKeys = array();
|
||||
const FLD_TYPE_VALUES = [
|
||||
'BIGINT',
|
||||
'BOOLEAN',
|
||||
'CHAR',
|
||||
'DATE',
|
||||
'DATETIME',
|
||||
'DECIMAL',
|
||||
'DOUBLE',
|
||||
'FLOAT',
|
||||
'INTEGER',
|
||||
'LONGVARCHAR',
|
||||
'REAL',
|
||||
'SMALLINT',
|
||||
'TIME',
|
||||
'TIMESTAMP',
|
||||
'TINYINT',
|
||||
'VARCHAR'
|
||||
];
|
||||
const FLD_TYPE_WITH_AUTOINCREMENT = [
|
||||
'BIGINT',
|
||||
'INTEGER',
|
||||
'SMALLINT',
|
||||
'TINYINT'
|
||||
];
|
||||
const FLD_TYPE_WITH_SIZE = [
|
||||
'BIGINT',
|
||||
'CHAR',
|
||||
'DECIMAL',
|
||||
'FLOAT',
|
||||
'INTEGER',
|
||||
'LONGVARCHAR',
|
||||
'VARCHAR'
|
||||
];
|
||||
public $fields = [];
|
||||
public $primaryKeys = [];
|
||||
|
||||
/**
|
||||
* Function load
|
||||
@@ -707,85 +740,84 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
*/
|
||||
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '', $addTabUid = '')
|
||||
{
|
||||
require_once "classes/model/Application.php";
|
||||
|
||||
$this->className = $this->getPHPName($tableName);
|
||||
$this->classPeerName = $this->className . 'Peer';
|
||||
|
||||
if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) {
|
||||
throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php'
|
||||
. " class file doesn't exit!");
|
||||
throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php' . " class file doesn't exit!");
|
||||
}
|
||||
|
||||
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||
|
||||
//get fields
|
||||
$fieldTypes = [];
|
||||
if ($addTabUid != '') {
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
|
||||
$dataset = FieldsPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
while ($dataset->next()) {
|
||||
$row = $dataset->getRow();
|
||||
switch ($row['FLD_TYPE']) {
|
||||
case 'FLOAT':
|
||||
case 'DOUBLE':
|
||||
case 'INTEGER':
|
||||
$fieldTypes[] = array($row['FLD_NAME'] => $row['FLD_TYPE']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//remove old applications references
|
||||
$connection = Propel::getConnection($sConnection);
|
||||
$statement = $connection->createStatement();
|
||||
$sql = "TRUNCATE " . $tableName;
|
||||
$statement->executeQuery($sql);
|
||||
|
||||
$case = new Cases();
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
|
||||
//select cases for this Process, ordered by APP_NUMBER
|
||||
$con = Propel::getConnection($sConnection);
|
||||
$stmt = $con->createStatement();
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(ApplicationPeer::PRO_UID, $processUid);
|
||||
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
$dataset = ApplicationPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$row = $dataset->getRow();
|
||||
//remove old applications references
|
||||
$deleteSql = "DELETE FROM $tableName WHERE APP_UID = '" . $row['APP_UID'] . "'";
|
||||
$rs = $stmt->executeQuery($deleteSql);
|
||||
// getting the case data
|
||||
$caseData = unserialize($row['APP_DATA']);
|
||||
|
||||
$fieldTypes = array();
|
||||
//getting the case data
|
||||
$appData = $case->unserializeData($row['APP_DATA']);
|
||||
|
||||
if ($addTabUid != '') {
|
||||
require_once 'classes/model/Fields.php';
|
||||
$criteriaField = new Criteria('workflow');
|
||||
$criteriaField->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
|
||||
$datasetField = FieldsPeer::doSelectRS($criteriaField);
|
||||
$datasetField->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
while ($datasetField->next()) {
|
||||
$rowfield = $datasetField->getRow();
|
||||
switch ($rowfield['FLD_TYPE']) {
|
||||
case 'FLOAT':
|
||||
case 'DOUBLE':
|
||||
case 'INTEGER':
|
||||
$fieldTypes[] = array($rowfield['FLD_NAME'] => $rowfield['FLD_TYPE']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//quick fix, map all empty values as NULL for Database
|
||||
foreach ($appData as $appDataKey => $appDataValue) {
|
||||
if (is_array($appDataValue) && count($appDataValue)) {
|
||||
$j = key($appDataValue);
|
||||
$appDataValue = is_array($appDataValue[$j]) ? $appDataValue : $appDataValue[$j];
|
||||
}
|
||||
}
|
||||
|
||||
// quick fix
|
||||
// map all empty values as NULL for Database
|
||||
foreach ($caseData as $dKey => $dValue) {
|
||||
if (is_array($dValue) && count($dValue)) {
|
||||
$j = key($dValue);
|
||||
$dValue = (is_array($dValue[$j])) ? $dValue : $dValue[$j];
|
||||
}
|
||||
if (is_string($dValue)) {
|
||||
if (is_string($appDataValue)) {
|
||||
foreach ($fieldTypes as $key => $fieldType) {
|
||||
foreach ($fieldType as $name => $theType) {
|
||||
if (strtoupper($dKey) == $name) {
|
||||
$caseData[$dKey] = validateType($dValue, $theType);
|
||||
unset($name);
|
||||
foreach ($fieldType as $fieldTypeKey => $fieldTypeValue) {
|
||||
if (strtoupper($appDataKey) == $fieldTypeKey) {
|
||||
$appData[$appDataKey] = validateType($appDataValue, $fieldTypeValue);
|
||||
unset($fieldTypeKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
// normal fields
|
||||
if (trim($dValue) === '') {
|
||||
$caseData[$dKey] = null;
|
||||
if (trim($appDataValue) === '') {
|
||||
$appData[$appDataKey] = null;
|
||||
}
|
||||
} else {
|
||||
// grids
|
||||
if (is_array($caseData[$dKey])) {
|
||||
foreach ($caseData[$dKey] as $dIndex => $dRow) {
|
||||
if (is_array($appData[$appDataKey])) {
|
||||
foreach ($appData[$appDataKey] as $dIndex => $dRow) {
|
||||
if (is_array($dRow)) {
|
||||
foreach ($dRow as $k => $v) {
|
||||
if (is_string($v) && trim($v) === '') {
|
||||
$caseData[$dKey][$dIndex][$k] = null;
|
||||
$appData[$appDataKey][$dIndex][$k] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -794,33 +826,48 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
}
|
||||
|
||||
//populate data
|
||||
$className = $this->className;
|
||||
if ($type === 'GRID') {
|
||||
list($gridName, $gridUid) = explode('-', $gridKey);
|
||||
$gridData = isset($caseData[$gridName]) ? $caseData[$gridName] : array();
|
||||
|
||||
$gridData = isset($appData[$gridName]) ? $appData[$gridName] : [];
|
||||
foreach ($gridData as $i => $gridRow) {
|
||||
eval('$obj = new ' . $this->className . '();');
|
||||
$obj->fromArray($caseData, BasePeer::TYPE_FIELDNAME);
|
||||
try {
|
||||
$obj = new $className();
|
||||
$obj->fromArray($appData, BasePeer::TYPE_FIELDNAME);
|
||||
$obj->setAppUid($row['APP_UID']);
|
||||
$obj->setAppNumber($row['APP_NUMBER']);
|
||||
if (method_exists($obj, 'setAppStatus')) {
|
||||
$obj->setAppStatus($row['APP_STATUS']);
|
||||
}
|
||||
$obj->fromArray(array_change_key_case($gridRow, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
||||
$obj->setRow($i);
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
$context["message"] = $e->getMessage();
|
||||
$context["tableName"] = $tableName;
|
||||
$context["appUid"] = $row['APP_UID'];
|
||||
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
|
||||
}
|
||||
unset($obj);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$obj = new $className();
|
||||
$obj->fromArray(array_change_key_case($appData, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
||||
$obj->setAppUid($row['APP_UID']);
|
||||
$obj->setAppNumber($row['APP_NUMBER']);
|
||||
if (method_exists($obj, 'setAppStatus')) {
|
||||
$obj->setAppStatus($row['APP_STATUS']);
|
||||
}
|
||||
$obj->fromArray(array_change_key_case($gridRow, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
||||
$obj->setRow($i);
|
||||
$obj->save();
|
||||
eval('$obj = new ' . $this->className . '();');
|
||||
} catch (Exception $e) {
|
||||
$context["message"] = $e->getMessage();
|
||||
$context["tableName"] = $tableName;
|
||||
$context["appUid"] = $row['APP_UID'];
|
||||
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
|
||||
}
|
||||
} else {
|
||||
eval('$obj = new ' . $this->className . '();');
|
||||
$obj->fromArray(array_change_key_case($caseData, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
||||
$obj->setAppUid($row['APP_UID']);
|
||||
$obj->setAppNumber($row['APP_NUMBER']);
|
||||
if (method_exists($obj, 'setAppStatus')) {
|
||||
$obj->setAppStatus($row['APP_STATUS']);
|
||||
}
|
||||
$obj->save();
|
||||
$obj = null;
|
||||
unset($obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1022,94 +1069,181 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
return $reportTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all data of AdditionalTables.
|
||||
*
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $filter
|
||||
* @param array $process
|
||||
* @return array
|
||||
*/
|
||||
public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||
|
||||
if (isset($process)) {
|
||||
foreach ($process as $key => $pro_uid) {
|
||||
if ($key == 'equal') {
|
||||
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL);
|
||||
$criteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL);
|
||||
} else {
|
||||
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL);
|
||||
$criteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter != '' && is_string($filter)) {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE)
|
||||
)
|
||||
);
|
||||
$subCriteria2 = $criteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%'
|
||||
. $filter
|
||||
. '%', Criteria::LIKE);
|
||||
$subCriteria1 = $criteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%'
|
||||
. $filter
|
||||
. '%', Criteria::LIKE)
|
||||
->addOr($subCriteria2);
|
||||
$criteria->add($subCriteria1);
|
||||
}
|
||||
|
||||
if (isset($_POST['sort'])) {
|
||||
if ($_POST['dir'] == 'ASC') {
|
||||
eval('$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');');
|
||||
} else {
|
||||
eval('$oCriteria->addDescendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');');
|
||||
$criteria->addAsColumn("PRO_TITLE", ProcessPeer::PRO_TITLE);
|
||||
$criteria->addAsColumn("PRO_DESCRIPTION", ProcessPeer::PRO_DESCRIPTION);
|
||||
$criteria->addJoin(AdditionalTablesPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
$stringBuild = '';
|
||||
$stringSql = "ADDITIONAL_TABLES.ADD_TAB_NAME IN ("
|
||||
. "SELECT TABLE_NAME "
|
||||
. "FROM information_schema.tables "
|
||||
. "WHERE table_schema = DATABASE()"
|
||||
. ")";
|
||||
$buildNumberRows = clone $criteria;
|
||||
$buildNumberRows->clear();
|
||||
$buildNumberRows->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$buildNumberRows->addAsColumn("EXISTS_TABLE", $stringSql);
|
||||
$dataset1 = AdditionalTablesPeer::doSelectRS($buildNumberRows);
|
||||
$dataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
while ($dataset1->next()) {
|
||||
$row = $dataset1->getRow();
|
||||
$stringCount = "'" . G::LoadTranslation('ID_TABLE_NOT_FOUND') . "'";
|
||||
if ($row["EXISTS_TABLE"] === "1") {
|
||||
$stringCount = "(SELECT COUNT(*) FROM " . $row["ADD_TAB_NAME"] . ")";
|
||||
}
|
||||
$stringBuild = $stringBuild
|
||||
. "WHEN '" . $row["ADD_TAB_NAME"]
|
||||
. "' THEN " . $stringCount
|
||||
. " \n";
|
||||
}
|
||||
$clauseRows = empty($stringBuild) ? "''" : "(CASE "
|
||||
. AdditionalTablesPeer::ADD_TAB_NAME
|
||||
. " "
|
||||
. $stringBuild
|
||||
. " END)";
|
||||
$criteria->addAsColumn("NUM_ROWS", $clauseRows);
|
||||
|
||||
if (empty($_POST['sort'])) {
|
||||
$criteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
} else {
|
||||
$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$column = $_POST["sort"];
|
||||
if (defined('AdditionalTablesPeer::' . $column)) {
|
||||
$column = constant('AdditionalTablesPeer::' . $column);
|
||||
}
|
||||
if ($column === "NUM_ROWS") {
|
||||
$column = "IF(" . $column . "='" . G::LoadTranslation('ID_TABLE_NOT_FOUND') . "',-1," . $column . ")";
|
||||
}
|
||||
if ($_POST['dir'] == 'ASC') {
|
||||
$criteria->addAscendingOrderByColumn($column);
|
||||
} else {
|
||||
$criteria->addDescendingOrderByColumn($column);
|
||||
}
|
||||
}
|
||||
|
||||
$criteriaCount = clone $oCriteria;
|
||||
$criteriaCount = clone $criteria;
|
||||
$count = AdditionalTablesPeer::doCount($criteriaCount);
|
||||
|
||||
$oCriteria->setLimit($limit);
|
||||
$oCriteria->setOffset($start);
|
||||
$criteria->setLimit($limit);
|
||||
$criteria->setOffset($start);
|
||||
|
||||
$oDataset = AdditionalTablesPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset = AdditionalTablesPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$addTables = array();
|
||||
$proUids = array();
|
||||
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$row['PRO_TITLE'] = $row['PRO_DESCRIPTION'] = '';
|
||||
$addTables = [];
|
||||
while ($dataset->next()) {
|
||||
$row = $dataset->getRow();
|
||||
$addTables[] = $row;
|
||||
if ($row['PRO_UID'] != '') {
|
||||
$proUids[] = $row['PRO_UID'];
|
||||
}
|
||||
}
|
||||
|
||||
//process details will have the info about the processes
|
||||
$procDetails = array();
|
||||
return [
|
||||
'rows' => $addTables,
|
||||
'count' => $count
|
||||
];
|
||||
}
|
||||
|
||||
if (count($proUids) > 0) {
|
||||
//now get the labels for all process, using an array of Uids,
|
||||
$c = new Criteria('workflow');
|
||||
$c->add(ProcessPeer::PRO_UID, $proUids, Criteria::IN);
|
||||
$dt = ProcessPeer::doSelectRS($c);
|
||||
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
/**
|
||||
* Get the table properties
|
||||
*
|
||||
* @param string $tabUid
|
||||
* @param array $tabData
|
||||
* @param boolean $isReportTable
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getTableProperties($tabUid, $tabData = [], $isReportTable = false)
|
||||
{
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(AdditionalTablesPeer::ADD_TAB_UID, $tabUid, Criteria::EQUAL);
|
||||
$dataset = AdditionalTablesPeer::doSelectOne($criteria);
|
||||
|
||||
while ($dt->next()) {
|
||||
$row = $dt->getRow();
|
||||
$procDetails[$row['PRO_UID']]['PRO_TITLE'] = $row['PRO_TITLE'];
|
||||
$procDetails[$row['PRO_UID']]['PRO_DESCRIPTION'] = $row['PRO_DESCRIPTION'];
|
||||
$dataValidate = [];
|
||||
if (!is_null($dataset)) {
|
||||
$dataValidate['rep_tab_uid'] = $tabUid;
|
||||
|
||||
$tableName = $dataset->getAddTabName();
|
||||
if (substr($tableName, 0, 4) === 'PMT_') {
|
||||
$tableNameWithoutPrefixPmt = substr($tableName, 4);
|
||||
} else {
|
||||
$tableNameWithoutPrefixPmt = $tableName;
|
||||
}
|
||||
|
||||
foreach ($addTables as $i => $addTable) {
|
||||
if (isset($procDetails[$addTable['PRO_UID']]['PRO_TITLE'])) {
|
||||
$addTables[$i]['PRO_TITLE'] = $procDetails[$addTable['PRO_UID']]['PRO_TITLE'];
|
||||
}
|
||||
$dataValidate['rep_tab_name'] = $tableNameWithoutPrefixPmt;
|
||||
$dataValidate['rep_tab_name_old_name'] = $tableName;
|
||||
$dataValidate['pro_uid'] = $dataset->getProUid();
|
||||
$dataValidate['rep_tab_dsc'] = $dataset->getAddTabDescription();
|
||||
$dataValidate['rep_tab_connection'] = $dataset->getDbsUid();
|
||||
$dataValidate['rep_tab_type'] = $dataset->getAddTabType();
|
||||
$dataValidate['rep_tab_grid'] = '';
|
||||
|
||||
if (isset($procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'])) {
|
||||
$addTables[$i]['PRO_DESCRIPTION'] = $procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'];
|
||||
if ($isReportTable) {
|
||||
if (!empty($tabData['pro_uid']) && $dataValidate['pro_uid'] !== $tabData['pro_uid']) {
|
||||
throw (new Exception("The property pro_uid: '". $tabData['pro_uid'] . "' is incorrect."));
|
||||
}
|
||||
if (!empty($tabData['rep_tab_name']) && $tableName !== $tabData['rep_tab_name']) {
|
||||
throw (new Exception("The property rep_tab_name: '". $tabData['rep_tab_name'] . "' is incorrect."));
|
||||
}
|
||||
if (!empty($dataValidate['rep_tab_dsc'])) {
|
||||
$dataValidate['rep_tab_dsc'] = $tabData['rep_tab_dsc'];
|
||||
}
|
||||
$tabGrid = $dataset->getAddTabGrid();
|
||||
if (strpos($tabGrid, '-')) {
|
||||
list($gridName, $gridId) = explode('-', $tabGrid);
|
||||
$dataValidate['rep_tab_grid'] = $gridId;
|
||||
}
|
||||
} else {
|
||||
if (!empty($tabData['rep_tab_name']) && $tableName !== $tabData['pmt_tab_name']) {
|
||||
throw (new Exception("The property pmt_tab_name: '". $tabData['pmt_tab_name'] . "' is incorrect."));
|
||||
}
|
||||
if (!empty($dataValidate['pmt_tab_dsc'])) {
|
||||
$dataValidate['rep_tab_dsc'] = $tabData['pmt_tab_dsc'];
|
||||
}
|
||||
}
|
||||
$dataValidate['fields'] = $tabData['fields'];
|
||||
}
|
||||
|
||||
return array('rows' => $addTables, 'count' => $count);
|
||||
return $dataValidate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user