Merged in release/3.2 (pull request #5472)

Release/3.2

Approved-by: Paula Quispe
This commit is contained in:
Paula Quispe
2017-02-24 19:00:11 +00:00
15 changed files with 346 additions and 269 deletions

View File

@@ -1698,19 +1698,29 @@ class Cases
if (isset($field['type'])) {
if ($field['type'] != 'form') {
if (isset($field['name']) && isset($appData[$field['name']])) {
if (isset($field['dataType']) && $field['dataType'] != 'grid') {
$caseVariable[$field['name']] = $appData[$field['name']];
if (isset($appData[$field['name'] . '_label'])) {
$caseVariable[$field['name'] . '_label'] = $appData[$field['name'] . '_label'];
} else {
$caseVariable[$field['name'] . '_label'] = '';
}
} else {
$caseVariable[$field['name']] = $appData[$field['name']];
foreach ($field as &$val) {
if (is_string($val) && in_array(substr($val, 0, 2), \pmDynaform::$prefixs)) {
$val = substr($val, 2);
}
}
foreach ($appData as $key => $valueKey) {
if (in_array($key, $field, true) != false) {
$keyname = array_search($key, $field);
if (isset($field['dataType']) && $field['dataType'] != 'grid') {
$caseVariable[$field[$keyname]] = $appData[$field[$keyname]];
if (isset($appData[$field[$keyname] . '_label'])) {
$caseVariable[$field[$keyname] . '_label'] = $appData[$field[$keyname] . '_label'];
} else {
$caseVariable[$field[$keyname] . '_label'] = '';
}
} else {
$caseVariable[$field[$keyname]] = $appData[$field[$keyname]];
}
break;
}
}
} else {
$caseVariableAux = $this->__getFieldsAndValuesByDynaFormAndAppData($field, $appData, $caseVariable);
$caseVariable = array_merge($caseVariable, $caseVariableAux);

View File

@@ -84,12 +84,13 @@ class FilesManager
}
}
foreach ($aFiles as $aFile) {
$arrayFileUid = $this->getFileManagerUid($sDirectory.$aFile['FILE']);
$arrayFileUid = $this->getFileManagerUid($sDirectory.$aFile['FILE'], $aFile['FILE']);
$fcontent = "";
if ($getContent === true) {
$fcontent = file_get_contents($sDirectory . $aFile['FILE']);
}
$fileUid = $arrayFileUid["PRF_UID"];
$fileUid = isset($arrayFileUid["PRF_UID"]) ? $arrayFileUid["PRF_UID"] : '';
$derivationScreen = isset($arrayFileUid["DERIVATION_SCREEN_TPL"]) ? true : false;
if ($fileUid != null) {
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($fileUid);
$editable = $oProcessFiles->getPrfEditable();
@@ -107,7 +108,8 @@ class FilesManager
'prf_editable' => $editable,
'prf_create_date' => $oProcessFiles->getPrfCreateDate(),
'prf_update_date' => $oProcessFiles->getPrfUpdateDate(),
'prf_content' => $fcontent);
'prf_content' => $fcontent,
'prf_derivation_screen' => $derivationScreen);
} else {
$extention = end(explode(".", $aFile['FILE']));
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp'
@@ -125,7 +127,8 @@ class FilesManager
'prf_editable' => $editable,
'prf_create_date' => '',
'prf_update_date' => '',
'prf_content' => $fcontent);
'prf_content' => $fcontent,
'prf_derivation_screen' => false);
}
}
return $aTheFiles;
@@ -389,13 +392,14 @@ class FilesManager
}
/**
* Get data of unique ids of a file
* Get data of unique ids of a file and if the template is used in a derivation screen
*
* @param string $path
* @param string $fileName the name of template
*
* return array
*/
public function getFileManagerUid($path)
public function getFileManagerUid($path, $fileName = '')
{
try {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
@@ -406,11 +410,25 @@ class FilesManager
$baseName2 = $path[count($path)-2]."/".$path[count($path)-1];
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
$criteria->addSelectColumn(\ProcessPeer::PRO_DERIVATION_SCREEN_TPL);
$criteria->addSelectColumn(\TaskPeer::TAS_DERIVATION_SCREEN_TPL);
$criteria->addJoin(\ProcessFilesPeer::PRO_UID, \ProcessPeer::PRO_UID);
$criteria->addJoin(\ProcessPeer::PRO_UID, \TaskPeer::PRO_UID);
$criteria->add( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName . '%', \Criteria::LIKE )->addOr( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName2 . '%', \Criteria::LIKE )));
$rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
return $rsCriteria->getRow();
$row = array();
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if (!empty($row['PRO_DERIVATION_SCREEN_TPL']) && $row['PRO_DERIVATION_SCREEN_TPL'] == $fileName) {
$row['DERIVATION_SCREEN_TPL'] = true;
return $row;
} elseif (!empty($row['TAS_DERIVATION_SCREEN_TPL']) && $row['TAS_DERIVATION_SCREEN_TPL'] == $fileName) {
$row['DERIVATION_SCREEN_TPL'] = true;
return $row;
}
}
return $row;
} catch (\Exception $e) {
throw $e;
}

View File

@@ -68,19 +68,12 @@ class Light
$task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
$arrayWebEntryEvent = array();
$allWebEntryEvents = $webEntryEvent->getAllWebEntryEvents();
foreach ($allWebEntryEvents as $webEntryEvents) {
$arrayWebEntryEvent[] = $webEntryEvents["ACT_UID"];
}
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
$response = array();
foreach ($processList as $key => $processInfo) {
$tempTreeChildren = array ();
foreach ($processList[$key] as $keyChild => $processInfoChild) {
if (!in_array($processInfoChild['uid'], $arrayWebEntryEvent) && in_array($processInfoChild['pro_uid'], $bpmnProjects)) {
if (in_array($processInfoChild['pro_uid'], $bpmnProjects)) {
$tempTreeChild['text'] = $keyChild; //ellipsis ( $keyChild, 50 );
$tempTreeChild['processId'] = $processInfoChild['pro_uid'];
$tempTreeChild['taskId'] = $processInfoChild['uid'];