validatePost(); ws_open (); $result = ws_newCase ( '{processUid}', '{taskUid}', convertFormToWSObjects($_POST['form']) ); if ($result->status_code == 0) { $caseId = $result->caseId; $caseNr = $result->caseNumber; {USR_VAR} if ($USR_UID == -1) { G::LoadClass("sessions"); global $sessionId; $sessions = new Sessions(); $session = $sessions->getSessionUser($sessionId); $USR_UID = $session["USR_UID"]; } //Save files if ( isset($_FILES['form']) ) { foreach ($_FILES['form']['name'] as $sFieldName => $vValue) { if ( $_FILES['form']['error'][$sFieldName] == 0 ){ file_put_contents(G::sys_get_temp_dir().PATH_SEP.$_FILES['form']['name'][$sFieldName], file_get_contents($_FILES['form']['tmp_name'][$sFieldName])); $fpath = G::sys_get_temp_dir().PATH_SEP.$_FILES['form']['name'][$sFieldName]; if( isset($_POST['INPUTS'][$sFieldName]) && $_POST['INPUTS'][$sFieldName] != '' ){ #input file type ws_sendFile($fpath, $USR_UID, $caseId, 1, $_POST['INPUTS'][$sFieldName]); } else { #attached file type ws_sendFile($fpath, $USR_UID, $caseId); } } } } $result = ws_routeCase ($caseId, 1); $assign = $result->message; $aMessage['MESSAGE'] = "
Case created in ProcessMaker
Case Number:$caseNr
Case Id:$caseId
Case derivated to: $assign"; } else { $aMessage['MESSAGE'] = 'An error occurred while the application was being processed.
Error code: '.$result->status_code.'
Error message: '.$result->message.'


please contact to your system administrator.'; } /** * by default show the case info, for the recently created case * you can change it or redirect to another page * i.e. G::header( 'Location: http://www.processmaker.com' ); */ $G_PUBLISH = new Publisher; $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', $aMessage ); G::RenderPage( 'publish', 'blank' ); } catch ( Exception $e ) { $G_PUBLISH = new Publisher; $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; $aMessage['MESSAGE'] = '
'.$e->getMessage().'
'.$suggest_message .'
'; $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); G::RenderPage( 'publish', 'blank' ); }