Merge branch 'release/3.2.1' of bitbucket.org:colosa/processmaker into bugfix/HOR-2307

This commit is contained in:
Paula Quispe
2017-05-05 16:34:16 -04:00
47 changed files with 475 additions and 399 deletions

View File

@@ -233,7 +233,6 @@ class Cases
}
G::LoadClass("applications");
$solrEnabled = false;
$userUid = $dataList["userId"];
$callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001";
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
@@ -327,70 +326,30 @@ class Cases
}
}
if ((
$action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" ||
$action == "selfservice" || $action == "unassigned" || $action == "search"
) &&
(($solrConf = \System::solrEnv()) !== false)
) {
G::LoadClass("AppSolr");
G::LoadClass("applications");
$apps = new \Applications();
$result = $apps->getAll(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
(strpos($sort, ".") !== false) ? $sort : "APP_CACHE_VIEW." . $sort,
$category,
true,
$paged,
$newerThan,
$oldestThan
);
$ApplicationSolrIndex = new \AppSolr(
$solrConf["solr_enabled"],
$solrConf["solr_host"],
$solrConf["solr_instance"]
);
if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
//Check if there are missing records to reindex and reindex them
$ApplicationSolrIndex->synchronizePendingApplications();
$solrEnabled = true;
}
}
if ($solrEnabled) {
$result = $ApplicationSolrIndex->getAppGridData(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
$sort,
$category
);
} else {
G::LoadClass("applications");
$apps = new \Applications();
$result = $apps->getAll(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
(strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort,
$category,
true,
$paged,
$newerThan,
$oldestThan
);
}
if (!empty($result['data'])) {
foreach ($result['data'] as &$value) {
$value = array_change_key_case($value, CASE_LOWER);

View File

@@ -78,6 +78,9 @@ class Light
$tempTreeChild['processId'] = $processInfoChild['pro_uid'];
$tempTreeChild['taskId'] = $processInfoChild['uid'];
list($tempTreeChild['offlineEnabled'], $tempTreeChild['autoRoot']) = $task->getColumnValues($processInfoChild['pro_uid'], $processInfoChild['uid'], array('TAS_OFFLINE', 'TAS_AUTO_ROOT'));
//Add process category
$tempTreeChild['categoryName'] = $processInfoChild['catname'];
$tempTreeChild['categoryId'] = $processInfoChild['cat'];
$forms = $task->getSteps($processInfoChild['uid']);
$newForm = array();
$c = 0;

View File

@@ -398,10 +398,10 @@ class WebEntry
$weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]);
$fileName = $weTitle;
$fileContent = "<?php\n";
$fileContent = "<?php\n\n";
$fileContent .= "global \$_DBArray;\n";
$fileContent .= "if (!isset(\$_DBArray)) {\n";
$fileContent .= " \$_DBArray = array();\n";
$fileContent .= " \$_DBArray = array();\n";
$fileContent .= "}\n";
$fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n";
$fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n";
@@ -409,15 +409,18 @@ class WebEntry
$fileContent .= "G::LoadClass(\"pmDynaform\");\n";
$fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n";
$fileContent .= "if (\$a->isResponsive()) {";
$fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");";
$fileContent .= "} else {";
$fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n";
$fileContent .= " G::RenderPage(\"publish\", \"blank\");";
$fileContent .= "}";
$fileContent .= "if (\$a->isResponsive()) {\n";
$fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");\n";
$fileContent .= "} else {\n";
$fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n";
$fileContent .= " G::RenderPage(\"publish\", \"blank\");\n";
$fileContent .= "}\n";
file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent);
//Create file to display information and prevent resubmission data (Post/Redirect/Get).
self::createFileInfo($pathDataPublicProcess . PATH_SEP . $weTitle . "Info.php");
//Creating the second file, the post file who receive the post form.
$pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl";
@@ -432,6 +435,7 @@ class WebEntry
$template->assign("wsUser", $usrUsername);
$template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword);
$template->assign("wsRoundRobin", $wsRoundRobin);
$template->assign("weTitle", $weTitle);
if ($webEntryInputDocumentAccess == 0) {
//Restricted to process permissions
@@ -1033,5 +1037,30 @@ class WebEntry
return $result;
}
/**
* Create file to display information and prevent resubmission data (Post/Redirect/Get).
* @param string $pathFileName
*/
public static function createFileInfo($pathFileName)
{
$code = ""
. "<?php\n"
. "\n"
. "\$G_PUBLISH = new Publisher();\n"
. "\$show = \"login/showMessage\";\n"
. "\$message = \"\";\n"
. "if (isset(\$_SESSION[\"__webEntrySuccess__\"])) {\n"
. " \$show = \"login/showInfo\";\n"
. " \$message = \$_SESSION[\"__webEntrySuccess__\"];\n"
. "} else {\n"
. " \$show = \"login/showMessage\";\n"
. " \$message = \$_SESSION[\"__webEntryError__\"];\n"
. "}\n"
. "\$G_PUBLISH->AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n"
. "G::RenderPage(\"publish\", \"blank\");\n"
. "\n";
file_put_contents($pathFileName, $code);
}
}

View File

@@ -996,4 +996,24 @@ class WebEntryEvent
throw $e;
}
}
/**
* This function verify if a user $userUid was configure in a Web Entry and return the total of records
*
* @param string $userUid uid of a user
*
* return integer $total
*/
public function getWebEntryRelatedToUser($userUid)
{
try {
//Get data
$criteria = $this->getWebEntryEventCriteria();
$criteria->add(\WebEntryEventPeer::USR_UID, $userUid, \Criteria::EQUAL);
$total = \WebEntryEventPeer::doCount($criteria);
return $total;
} catch (\Exception $e) {
throw $e;
}
}
}