Merged in luisfernandosl/processmaker/HOR-1605-A-32 (pull request #5166)

HOR-1605-A
This commit is contained in:
Paula Quispe
2016-11-21 19:35:10 +00:00
2 changed files with 10 additions and 3 deletions

View File

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

View File

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