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

This commit is contained in:
Paula Quispe
2017-05-05 13:36:31 -04:00
39 changed files with 383 additions and 335 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

@@ -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;
}
}
}

View File

@@ -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;

View File

@@ -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();

View File

@@ -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());
}
/**

View File

@@ -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);