Merge remote branch 'upstream/master'
@@ -2634,6 +2634,20 @@ class G
|
||||
$oldumask = umask( 0 );
|
||||
if (! is_dir( $path )) {
|
||||
G::verifyPath( $path, true );
|
||||
}
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$file = str_replace("\\\\","\\",$file,$count);
|
||||
if(!$count) {
|
||||
$winPath = explode("\\",$file);
|
||||
$file = "";
|
||||
foreach($winPath as $k => $v){
|
||||
if($v != "") {
|
||||
$file.= $v."\\";
|
||||
}
|
||||
}
|
||||
$file = substr($file,0,-1);
|
||||
}
|
||||
}
|
||||
|
||||
G::LoadSystem('inputfilter');
|
||||
|
||||
@@ -2868,4 +2868,30 @@ function PMFRemoveMask ($field, $separator = '.', $currency = '')
|
||||
$field = floatval(trim($field));
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
*@method
|
||||
*
|
||||
* Sends an array of case variables to a specified case.
|
||||
*
|
||||
* @name PMFSaveCurrentData
|
||||
* @label PMF Save Current Data
|
||||
*
|
||||
* @return int | $result | Result of send variables | Returns 1 if the variables were sent successfully to the case; otherwise, returns 0 if an error occurred.
|
||||
*
|
||||
*/
|
||||
|
||||
function PMFSaveCurrentData ()
|
||||
{
|
||||
global $oPMScript;
|
||||
$result = 0;
|
||||
|
||||
if (isset($_SESSION['APPLICATION']) && isset($oPMScript->aFields)) {
|
||||
G::LoadClass( 'wsBase' );
|
||||
$ws = new wsBase();
|
||||
$result = $ws->sendVariables( $_SESSION['APPLICATION'], $oPMScript->aFields );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1012,9 +1012,11 @@ class wsBase
|
||||
*
|
||||
* @param string $caseId
|
||||
* @param string $iDelIndex
|
||||
* @param bool $flagUseDelIndex
|
||||
*
|
||||
* @return $result will return an object
|
||||
*/
|
||||
public function getCaseInfo ($caseId, $iDelIndex)
|
||||
public function getCaseInfo($caseId, $iDelIndex, $flagUseDelIndex = false)
|
||||
{
|
||||
try {
|
||||
$oCase = new Cases();
|
||||
@@ -1060,7 +1062,12 @@ class wsBase
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
||||
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
||||
|
||||
if ($flagUseDelIndex) {
|
||||
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $iDelIndex, Criteria::EQUAL);
|
||||
} else {
|
||||
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||
}
|
||||
|
||||
$oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
||||
@@ -3308,3 +3315,4 @@ class wsBase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -431,40 +431,51 @@ class Cases
|
||||
throw (new \Exception($arrayData));
|
||||
}
|
||||
} else {
|
||||
\G::LoadClass("wsBase");
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX);
|
||||
$criteria->add(\AppCacheViewPeer::USR_UID, $userUid);
|
||||
$criteria->add(\AppCacheViewPeer::APP_UID, $applicationUid);
|
||||
$criteria->add(
|
||||
//ToDo - getToDo()
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "TO_DO", \CRITERIA::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
|
||||
)->addOr(
|
||||
//Draft - getDraft()
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "DRAFT", \CRITERIA::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
|
||||
);
|
||||
$criteria->addDescendingOrderByColumn(\AppCacheViewPeer::APP_NUMBER);
|
||||
$rsCriteria = \AppCacheViewPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$row["DEL_INDEX"] = '';
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
|
||||
$criteria->add(\AppDelegationPeer::APP_UID, $applicationUid);
|
||||
$criteria->add(\AppDelegationPeer::USR_UID, $userUid);
|
||||
|
||||
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
|
||||
}
|
||||
\G::LoadClass('wsBase');
|
||||
|
||||
//Get data
|
||||
$arrayStatusInfo = $this->getStatusInfo($applicationUid);
|
||||
|
||||
$applicationStatus = "";
|
||||
$delIndex = 0;
|
||||
$flagUseDelIndex = false;
|
||||
|
||||
if (count($arrayStatusInfo) > 0) {
|
||||
$applicationStatus = $arrayStatusInfo["APP_STATUS"];
|
||||
$delIndex = $arrayStatusInfo["DEL_INDEX"];
|
||||
|
||||
if (in_array($applicationStatus, array("DRAFT", "PAUSED", "CANCELLED"))) {
|
||||
$flagUseDelIndex = true;
|
||||
}
|
||||
}
|
||||
|
||||
$ws = new \wsBase();
|
||||
$fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]);
|
||||
|
||||
$fields = $ws->getCaseInfo($applicationUid, $delIndex, $flagUseDelIndex);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
|
||||
if ($array ["status_code"] != 0) {
|
||||
throw (new \Exception($array ["message"]));
|
||||
} else {
|
||||
$array['app_uid'] = $array['caseId'];
|
||||
$array['app_number'] = $array['caseNumber'];
|
||||
$array['app_name'] = $array['caseName'];
|
||||
$array['app_status'] = $array['caseStatus'];
|
||||
$array["app_status"] = ($applicationStatus != "")? $applicationStatus : $array["caseStatus"];
|
||||
$array['app_init_usr_uid'] = $array['caseCreatorUser'];
|
||||
$array['app_init_usr_username'] = trim($array['caseCreatorUserName']);
|
||||
$array['pro_uid'] = $array['processId'];
|
||||
@@ -472,6 +483,9 @@ class Cases
|
||||
$array['app_create_date'] = $array['createDate'];
|
||||
$array['app_update_date'] = $array['updateDate'];
|
||||
$array['current_task'] = $array['currentUsers'];
|
||||
|
||||
$aCurrent_task = array();
|
||||
|
||||
for ($i = 0; $i<=count($array['current_task'])-1; $i++) {
|
||||
$current_task = $array['current_task'][$i];
|
||||
$current_task['usr_uid'] = $current_task['userId'];
|
||||
@@ -2217,4 +2231,108 @@ class Cases
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status info Case
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
*
|
||||
* return array Return an array with status info Case, array empty otherwise
|
||||
*/
|
||||
public function getStatusInfo($applicationUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
//Get data
|
||||
//Status is PAUSED
|
||||
$delimiter = \DBAdapter::getStringDelimiter();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn($delimiter . "PAUSED" . $delimiter . " AS APP_STATUS");
|
||||
$criteria->addSelectColumn(\AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX");
|
||||
|
||||
$criteria->add(\AppDelayPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDelayPeer::APP_TYPE, "PAUSE", \Criteria::EQUAL);
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, null, \Criteria::ISNULL)->addOr(
|
||||
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, 0, \Criteria::EQUAL))
|
||||
);
|
||||
|
||||
$rsCriteria = \AppDelayPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
|
||||
}
|
||||
|
||||
//Status is TO_DO, DRAFT
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ApplicationPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppThreadPeer::APP_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "TO_DO", \Criteria::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
|
||||
$criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
|
||||
)->addOr(
|
||||
$criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "DRAFT", \Criteria::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
|
||||
);
|
||||
|
||||
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
|
||||
}
|
||||
|
||||
//Status is CANCELLED, COMPLETED
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ApplicationPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||
|
||||
$criteria->add(\ApplicationPeer::APP_STATUS, array("CANCELLED", "COMPLETED"), \Criteria::IN);
|
||||
$criteria->add(\AppDelegationPeer::DEL_LAST_INDEX, 1, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
|
||||
}
|
||||
|
||||
//Return
|
||||
return array();
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -599,12 +599,12 @@ class Cases extends Api
|
||||
public function doGetCaseInfo($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oData = $cases->getCaseInfo($app_uid, $userUid);
|
||||
return $oData;
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
return $case->getCaseInfo($app_uid, $this->getUserId());
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ class Server implements iAuthenticate
|
||||
$clientId = $_GET['client_id'];
|
||||
$requestedScope = isset($_GET['scope']) ? $_GET['scope'] : '*';
|
||||
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
|
||||
$client = $this->storage->getClientDetails($clientId);;
|
||||
$client = $this->storage->getClientDetails($clientId);
|
||||
|
||||
if (empty($client)) {
|
||||
// throw error, client does not exist.
|
||||
@@ -309,7 +309,17 @@ class Server implements iAuthenticate
|
||||
if ($returnResponse) {
|
||||
return $response;
|
||||
} else {
|
||||
$response->send();
|
||||
if ($response->getStatusCode() == 400) {
|
||||
$msg = $response->getParameter("error_description", "");
|
||||
$msg = ($msg != "")? $msg : $response->getParameter("error", "");
|
||||
|
||||
$rest = new \Maveriks\Extension\Restler();
|
||||
$rest->setMessage(new \Luracast\Restler\RestException(\ProcessMaker\Services\Api::STAT_APP_EXCEPTION, $msg));
|
||||
|
||||
exit(0);
|
||||
} else {
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 11 KiB |