From 18412391e1c770313348a10245d844e65680c285 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Fri, 18 Nov 2016 15:47:39 -0500 Subject: [PATCH] HOR-1605-A "In PMFNewCase Add..." --- workflow/engine/classes/class.pmFunctions.php | 5 +++-- workflow/engine/classes/class.wsBase.php | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index c3c666835..e76f3ce0c 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2130,15 +2130,16 @@ function PMFNewCaseImpersonate ($processId, $userId, $variables, $taskId = '') * @param string(32) | $userId | User ID | The unique ID of the user. * @param string(32) | $taskId | Task ID | The unique ID of the task. * @param array | $variables | Array of variables | An associative array of the variables which will be sent to the case. + * @param string(32) | $status=null | Status | Status of the case DRAFT or TO_DO. * @return string | $idNewCase | Case ID | If an error occured, it returns the integer zero. Otherwise, it returns a string with the case UID of the new case. * */ -function PMFNewCase ($processId, $userId, $taskId, $variables) +function PMFNewCase ($processId, $userId, $taskId, $variables, $status = null) { G::LoadClass( 'wsBase' ); $ws = new wsBase(); - $result = $ws->newCase( $processId, $userId, $taskId, $variables ); + $result = $ws->newCase($processId, $userId, $taskId, $variables, 0, $status); if ($result->status_code == 0) { return $result->caseId; diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 041217edb..67f044d90 100644 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -1931,9 +1931,10 @@ class wsBase * @param string $taskId * @param string $variables * @param int $executeTriggers : Optional parameter. The execution all triggers of the task, according to your steps, 1 yes 0 no. + * @param string $status * @return $result will return an object */ - public function newCase($processId, $userId, $taskId, $variables, $executeTriggers = 0) + public function newCase($processId, $userId, $taskId, $variables, $executeTriggers = 0, $status = 'DRAFT') { //$executeTriggers, this parameter is not important, it may be the last parameter in the method @@ -2028,6 +2029,11 @@ class wsBase $oldFields['DEL_INDEX'] = $case['INDEX']; $oldFields['TAS_UID'] = $taskId; + + if (!is_null($status) && $status != 'DRAFT') { + $oldFields['APP_STATUS'] = $status; + } + $up_case = $oCase->updateCase( $caseId, $oldFields ); //Execute all triggers of the task, according to your steps