Merge branch 'release/3.2.1' of bitbucket.org:colosa/processmaker into bugfix/HOR-2307
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ abstract class Importer
|
||||
protected $filename = "";
|
||||
protected $saveDir = "";
|
||||
protected $metadata = array();
|
||||
protected $prjCreateUser = '';
|
||||
/**
|
||||
* Title of the process before being updated/deleted.
|
||||
* @var string
|
||||
@@ -494,6 +495,7 @@ abstract class Importer
|
||||
$project["diagrams"] = array($diagram);
|
||||
$project["prj_author"] = isset($this->data["usr_uid"])? $this->data["usr_uid"]: "00000000000000000000000000000001";
|
||||
$project["process"] = $tables["process"][0];
|
||||
$project["prjCreateUser"] = $this->prjCreateUser;
|
||||
|
||||
return Adapter\BpmnWorkflow::createFromStruct($project, $generateUid);
|
||||
}
|
||||
@@ -761,7 +763,7 @@ abstract class Importer
|
||||
}
|
||||
}
|
||||
|
||||
public function saveAs($prj_uid, $prj_name, $prj_description, $prj_category)
|
||||
public function saveAs($prj_uid, $prj_name, $prj_description, $prj_category, $prj_user = '')
|
||||
{
|
||||
try {
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
|
||||
@@ -779,6 +781,7 @@ abstract class Importer
|
||||
|
||||
$this->setSourceFile($outputFilename);
|
||||
$this->prepare();
|
||||
$this->prjCreateUser = $prj_user;
|
||||
$this->importData["tables"]["bpmn"]["project"][0]["prj_name"] = $prj_name;
|
||||
$this->importData["tables"]["bpmn"]["project"][0]["prj_description"] = $prj_description;
|
||||
$this->importData["tables"]["bpmn"]["diagram"][0]["dia_name"] = $prj_name;
|
||||
|
||||
@@ -94,6 +94,10 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$wpData["PRO_STATUS"] = $data["PRO_STATUS"];
|
||||
}
|
||||
|
||||
if (array_key_exists("PRO_CREATE_USER", $data)) {
|
||||
$wpData["PRO_CREATE_USER"] = $data["PRO_CREATE_USER"];
|
||||
}
|
||||
|
||||
$this->wp = new Project\Workflow();
|
||||
$this->wp->create($wpData);
|
||||
|
||||
@@ -1318,6 +1322,10 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$data["PRO_STATUS"] = $projectData['pro_status'];
|
||||
}
|
||||
|
||||
if (isset($projectData['prjCreateUser'])){
|
||||
$data["PRO_CREATE_USER"] = $projectData['prjCreateUser'];
|
||||
}
|
||||
|
||||
$bwp->create($data);
|
||||
|
||||
$diagramData = $processData = array();
|
||||
|
||||
@@ -221,7 +221,7 @@ class Project extends Api
|
||||
public function doSaveAs($prj_uid, $prj_name, $prj_description = null, $prj_category = null)
|
||||
{
|
||||
$importer = new \ProcessMaker\Importer\XmlImporter();
|
||||
return $importer->saveAs($prj_uid, $prj_name, $prj_description, $prj_category);
|
||||
return $importer->saveAs($prj_uid, $prj_name, $prj_description, $prj_category, $this->getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,10 +78,10 @@ class OutputDocuments extends Api
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $outputDocumentUid {@min 32} {@max 32}
|
||||
* @param OutputDocumentStructure $request_data
|
||||
* @param array $request_data
|
||||
*
|
||||
*/
|
||||
public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, OutputDocumentStructure $request_data)
|
||||
public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, $request_data)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
|
||||
Reference in New Issue
Block a user