diff --git a/workflow/engine/methods/processes/processesList.php b/workflow/engine/methods/processes/processesList.php index 608f9e091..7ca688d77 100755 --- a/workflow/engine/methods/processes/processesList.php +++ b/workflow/engine/methods/processes/processesList.php @@ -1,74 +1,70 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -require_once 'classes/model/Process.php'; - -$start = isset($_POST['start'])? $_POST['start']: 0; -$limit = isset($_POST['limit'])? $_POST['limit']: ''; - -$oProcess = new Process(); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ - - $memcache = & PMmemcached::getSingleton(SYS_SYS); +require_once 'classes/model/Process.php'; - $memkey = 'no memcache'; - $memcacheUsed = 'not used'; - $totalCount = 0; - - if( isset($_POST['category']) && $_POST['category'] !== '' ) { - if( isset($_POST['processName']) ) - $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName']); - else - $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category']); - } - else { - if( isset($_POST['processName']) ) { - $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName']; - $memcacheUsed = 'yes'; - if ( ($proData = $memcache->get( $memkey )) === false ) { - $proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName']); - $memcache->set( $memkey , $proData, PMmemcached::ONE_HOUR ); - $memcacheUsed = 'no'; - } - } - else { - $memkey = 'processList-allProcesses-' . $start . '-' . $limit; - $memkeyTotal = $memkey . '-total'; - $memcacheUsed = 'yes'; - if ( ($proData = $memcache->get( $memkey )) === false || ($totalCount=$memcache->get( $memkeyTotal)) === false ) { - $proData = $oProcess->getAllProcesses($start, $limit); - $totalCount = $oProcess->getAllProcessesCount(); - $memcache->set( $memkey , $proData, PMmemcached::ONE_HOUR ); - $memcache->set( $memkeyTotal , $totalCount, PMmemcached::ONE_HOUR ); - $memcacheUsed = 'no'; - } +$start = isset( $_POST['start'] ) ? $_POST['start'] : 0; +$limit = isset( $_POST['limit'] ) ? $_POST['limit'] : ''; + +$oProcess = new Process(); + +$memcache = & PMmemcached::getSingleton( SYS_SYS ); + +$memkey = 'no memcache'; +$memcacheUsed = 'not used'; +$totalCount = 0; + +if (isset( $_POST['category'] ) && $_POST['category'] !== '') { + if (isset( $_POST['processName'] )) + $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'] ); + else + $proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'] ); +} else { + if (isset( $_POST['processName'] )) { + $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName']; + $memcacheUsed = 'yes'; + if (($proData = $memcache->get( $memkey )) === false) { + $proData = $oProcess->getAllProcesses( $start, $limit, null, $_POST['processName'] ); + $memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR ); + $memcacheUsed = 'no'; + } + } else { + $memkey = 'processList-allProcesses-' . $start . '-' . $limit; + $memkeyTotal = $memkey . '-total'; + $memcacheUsed = 'yes'; + if (($proData = $memcache->get( $memkey )) === false || ($totalCount = $memcache->get( $memkeyTotal )) === false) { + $proData = $oProcess->getAllProcesses( $start, $limit ); + $totalCount = $oProcess->getAllProcessesCount(); + $memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR ); + $memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR ); + $memcacheUsed = 'no'; + } } - } - $r->memkey = $memkey; - $r->memcache = $memcacheUsed; - $r->data = $proData; - $r->totalCount = $totalCount; - - echo G::json_encode($r); +} +$r->memkey = $memkey; +$r->memcache = $memcacheUsed; +$r->data = $proData; +$r->totalCount = $totalCount; + +echo G::json_encode( $r ); diff --git a/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php b/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php index 44943ad26..21dbad53a 100755 --- a/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php +++ b/workflow/engine/methods/processes/processes_SaveEditObjectPermission.php @@ -1,89 +1,78 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - -if(isset($_POST['form'])) - $sValue = $_POST['form']; //For old processmap -else - $sValue = $_POST; //For new processmap EXtjs - -list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']); -$sObjectUID = ''; -switch ($sValue['OP_OBJ_TYPE']) { - case 'ANY': - $sObjectUID = ''; - break; - case 'DYNAFORM': - $sObjectUID = $sValue['DYNAFORMS']; - break; - case 'INPUT': - $sObjectUID = $sValue['INPUTS']; - break; - case 'OUTPUT': - $sObjectUID = $sValue['OUTPUTS']; - break; -} -require_once 'classes/model/ObjectPermission.php'; -$oOP = new ObjectPermission(); -$aData = array('OP_UID' => $sValue['OP_UID'], - 'PRO_UID' => $sValue['PRO_UID'], - 'TAS_UID' => $sValue['TAS_UID']!='' ? $sValue['TAS_UID'] : '0' , - 'USR_UID' => (string)$sUserGroup, - 'OP_USER_RELATION' => $iRelation, - 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE']!='' ? $sValue['OP_TASK_SOURCE'] : '0', - 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE']!='' ? $sValue['OP_PARTICIPATE'] : 0, - 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE']!='' ? $sValue['OP_OBJ_TYPE'] : '0', - 'OP_OBJ_UID' => $sObjectUID!='' ? $sObjectUID : '0', - 'OP_ACTION' => $sValue['OP_ACTION']!='' ? $sValue['OP_ACTION'] : '0', - 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']!='' ? $sValue['OP_CASE_STATUS'] : '0' - ); - -$oObj = new ObjectPermission(); -$oObj->update($aData); - -G::LoadClass('processMap'); -$oProcessMap = new ProcessMap(); -$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +if (isset( $_POST['form'] )) + $sValue = $_POST['form']; //For old processmap +else + $sValue = $_POST; //For new processmap EXtjs + + +list ($iRelation, $sUserGroup) = explode( '|', $sValue['GROUP_USER'] ); +$sObjectUID = ''; +switch ($sValue['OP_OBJ_TYPE']) { + case 'ANY': + $sObjectUID = ''; + break; + case 'DYNAFORM': + $sObjectUID = $sValue['DYNAFORMS']; + break; + case 'INPUT': + $sObjectUID = $sValue['INPUTS']; + break; + case 'OUTPUT': + $sObjectUID = $sValue['OUTPUTS']; + break; +} +require_once 'classes/model/ObjectPermission.php'; +$oOP = new ObjectPermission(); +$aData = array ('OP_UID' => $sValue['OP_UID'],'PRO_UID' => $sValue['PRO_UID'],'TAS_UID' => $sValue['TAS_UID'] != '' ? $sValue['TAS_UID'] : '0','USR_UID' => (string) $sUserGroup,'OP_USER_RELATION' => $iRelation,'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'] != '' ? $sValue['OP_TASK_SOURCE'] : '0','OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'] != '' ? $sValue['OP_PARTICIPATE'] : 0,'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'] != '' ? $sValue['OP_OBJ_TYPE'] : '0','OP_OBJ_UID' => $sObjectUID != '' ? $sObjectUID : '0','OP_ACTION' => $sValue['OP_ACTION'] != '' ? $sValue['OP_ACTION'] : '0','OP_CASE_STATUS' => $sValue['OP_CASE_STATUS'] != '' ? $sValue['OP_CASE_STATUS'] : '0' +); + +$oObj = new ObjectPermission(); +$oObj->update( $aData ); + +G::LoadClass( 'processMap' ); +$oProcessMap = new ProcessMap(); +$oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] ); diff --git a/workflow/engine/methods/processes/processes_SaveObjectPermission.php b/workflow/engine/methods/processes/processes_SaveObjectPermission.php index 521e8e1da..a9caf9e2f 100755 --- a/workflow/engine/methods/processes/processes_SaveObjectPermission.php +++ b/workflow/engine/methods/processes/processes_SaveObjectPermission.php @@ -1,88 +1,78 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} -if(isset($_POST['form'])) - $sValue = $_POST['form']; //For old processmap -else - $sValue = $_POST; //For new processmap EXtjs - -list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']); -$sObjectUID = ''; -switch ($sValue['OP_OBJ_TYPE']) { - case 'ANY': - /*case 'ANY_DYNAFORM': - case 'ANY_INPUT': - case 'ANY_OUTPUT':*/ - $sObjectUID = ''; - break; - case 'DYNAFORM': - $sObjectUID = $sValue['DYNAFORMS']; - break; - case 'INPUT': - $sObjectUID = $sValue['INPUTS']; - break; - case 'OUTPUT': - $sObjectUID = $sValue['OUTPUTS']; - break; -} -require_once 'classes/model/ObjectPermission.php'; -$oOP = new ObjectPermission(); -$aData = array('OP_UID' => G::generateUniqueID(), - 'PRO_UID' =>$sValue['PRO_UID'], - 'TAS_UID' => $sValue['TAS_UID'], - 'USR_UID' => (string)$sUserGroup, - 'OP_USER_RELATION' => $iRelation, - 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'], - 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'], - 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'], - 'OP_OBJ_UID' => $sObjectUID, - 'OP_ACTION' => $sValue['OP_ACTION'], - 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']); -$oOP->fromArray($aData,BasePeer::TYPE_FIELDNAME); -$oOP->save(); -G::LoadClass('processMap'); -$oProcessMap = new ProcessMap(); -$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} +if (isset( $_POST['form'] )) + $sValue = $_POST['form']; //For old processmap +else + $sValue = $_POST; //For new processmap EXtjs + + +list ($iRelation, $sUserGroup) = explode( '|', $sValue['GROUP_USER'] ); +$sObjectUID = ''; +switch ($sValue['OP_OBJ_TYPE']) { + case 'ANY': + /*case 'ANY_DYNAFORM': + case 'ANY_INPUT': + case 'ANY_OUTPUT':*/ + $sObjectUID = ''; + break; + case 'DYNAFORM': + $sObjectUID = $sValue['DYNAFORMS']; + break; + case 'INPUT': + $sObjectUID = $sValue['INPUTS']; + break; + case 'OUTPUT': + $sObjectUID = $sValue['OUTPUTS']; + break; +} +require_once 'classes/model/ObjectPermission.php'; +$oOP = new ObjectPermission(); +$aData = array ('OP_UID' => G::generateUniqueID(),'PRO_UID' => $sValue['PRO_UID'],'TAS_UID' => $sValue['TAS_UID'],'USR_UID' => (string) $sUserGroup,'OP_USER_RELATION' => $iRelation,'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'],'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'],'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'],'OP_OBJ_UID' => $sObjectUID,'OP_ACTION' => $sValue['OP_ACTION'],'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS'] +); +$oOP->fromArray( $aData, BasePeer::TYPE_FIELDNAME ); +$oOP->save(); +G::LoadClass( 'processMap' ); +$oProcessMap = new ProcessMap(); +$oProcessMap->getObjectsPermissionsCriteria( $sValue['PRO_UID'] ); diff --git a/workflow/engine/methods/processes/processes_UploadFiles.php b/workflow/engine/methods/processes/processes_UploadFiles.php index d4d6c064f..4d6cca241 100755 --- a/workflow/engine/methods/processes/processes_UploadFiles.php +++ b/workflow/engine/methods/processes/processes_UploadFiles.php @@ -1,19 +1,19 @@ -parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');'); +parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');' ); diff --git a/workflow/engine/methods/processes/processes_UploadFilesForm.php b/workflow/engine/methods/processes/processes_UploadFilesForm.php index 5871cb5c5..2606fc0a2 100755 --- a/workflow/engine/methods/processes/processes_UploadFilesForm.php +++ b/workflow/engine/methods/processes/processes_UploadFilesForm.php @@ -12,37 +12,33 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - if($_GET['NAVIGATOR']=='ie'){ - $oForm = new Form('processes/processes_UploadFilesForm', '', SYS_LANG); +if ($_GET['NAVIGATOR'] == 'ie') { + $oForm = new Form( 'processes/processes_UploadFilesForm', '', SYS_LANG ); $oForm->action = 'processes_UploadFiles'; - $oForm->values = array('PRO_UID' => $_GET['PRO_UID'], - 'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'], - 'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY']); - echo '' . - $oForm->render(PATH_CORE . 'templates/xmlform.html', $scriptCode = ''); + $oForm->values = array ('PRO_UID' => $_GET['PRO_UID'],'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'],'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY'] + ); + echo '' . $oForm->render( PATH_CORE . 'templates/xmlform.html', $scriptCode = '' ); + +} else { + $params = Array ('PRO_UID' => $_GET['PRO_UID'],'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'],'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY'] + ); - } else { - $params = Array('PRO_UID' => $_GET['PRO_UID'], - 'MAIN_DIRECTORY' => $_GET['MAIN_DIRECTORY'], - 'CURRENT_DIRECTORY' => $_GET['CURRENT_DIRECTORY']); - $_SESSION['processes_upload'] = $params; $G_PUBLISH = new Publisher(); - $oHeadPublisher =& headPublisher::getSingleton(); - $G_PUBLISH->AddContent('view', 'processes/processes_Upload'); - G::RenderPage( "publish" , "raw" ); - } + $oHeadPublisher = & headPublisher::getSingleton(); + $G_PUBLISH->AddContent( 'view', 'processes/processes_Upload' ); + G::RenderPage( "publish", "raw" ); +} diff --git a/workflow/engine/methods/processes/processes_User.php b/workflow/engine/methods/processes/processes_User.php index 26aa26b96..76b57954d 100755 --- a/workflow/engine/methods/processes/processes_User.php +++ b/workflow/engine/methods/processes/processes_User.php @@ -1,10 +1,10 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - /** - * @Description This is a callback for the View of all groups from a determinated user - * @author Everth S. Berrios Morales - * @Date 16/05/2008 - * @LastModification none - */ -G::LoadThirdParty('pear/json','class.json'); +/** + * ription This is a callback for the View of all groups from a determinated user + * + * @author Everth S. Berrios Morales + * @Date 16/05/2008 + * @LastModification none + */ +G::LoadThirdParty( 'pear/json', 'class.json' ); try { - $oJSON = new Services_JSON(); - $stdObj = $oJSON->decode(stripslashes($_POST['data'])); - if ( isset ($stdObj->pro_uid ) ) - $sProUid = $stdObj->pro_uid; - else - throw ( new Exception ( 'the process uid is not defined!.' ) ); + $oJSON = new Services_JSON(); + $stdObj = $oJSON->decode( stripslashes( $_POST['data'] ) ); + if (isset( $stdObj->pro_uid )) + $sProUid = $stdObj->pro_uid; + else + throw (new Exception( 'the process uid is not defined!.' )); - G::LoadClass('processMap'); - $oProcessMap = new ProcessMap(); - $c = $oProcessMap->listProcessesUser($sProUid); + G::LoadClass( 'processMap' ); + $oProcessMap = new ProcessMap(); + $c = $oProcessMap->listProcessesUser( $sProUid ); - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile('/jscore/processmap/core/processUser.js'); - - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'processes/processes_User', $c, array('PRO_UID' => $sProUid)); - G::RenderPage( 'publish', 'raw' ); + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile( '/jscore/processmap/core/processUser.js' ); -} -catch ( Exception $e ){ - $G_PUBLISH = new Publisher; - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); - G::RenderPage('publish', 'raw' ); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'processes/processes_User', $c, array ('PRO_UID' => $sProUid + ) ); + G::RenderPage( 'publish', 'raw' ); + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'raw' ); } ?> \ No newline at end of file diff --git a/workflow/engine/methods/processes/processes_subProcessSave.php b/workflow/engine/methods/processes/processes_subProcessSave.php index 19f0fb9b1..603f19d9d 100755 --- a/workflow/engine/methods/processes/processes_subProcessSave.php +++ b/workflow/engine/methods/processes/processes_subProcessSave.php @@ -1,102 +1,90 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -global $RBAC; -$access = $RBAC->userCanAccess('PM_FACTORY'); -if( $access != 1 ){ - switch ($access) - { - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - default: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } -} - -//print_r($_POST); die; - -$out = array(); -for($i=1; $i<=count($_POST['form']['grid1']); $i++) -{ - $out[$_POST['form']['grid1'][$i]['VAR_OUT1']]= $_POST['form']['grid1'][$i]['VAR_OUT2']; -} - -$in = array(); -for($j=1; $j<=count($_POST['form']['grid2']); $j++) -{ - $in[$_POST['form']['grid2'][$j]['VAR_IN1']] = $_POST['form']['grid2'][$j]['VAR_IN2']; -} - -require_once 'classes/model/Task.php'; -$oTask= new Task(); -//$aTask=$oTask->load($_POST['form']['TASKS']); -//$aTask=$oTask->load($_POST['form']['PRO_UID']); -$aTask=($_POST['form']['TASKS']!=0)?$oTask->load($_POST['form']['TASKS']):0; -//$aTask['PRO_UID']=0; - -if ( isset ( $_POST['form']['SP_SYNCHRONOUS']) && $_POST['form']['SP_SYNCHRONOUS'] == '' ) { - $_POST['form']['SP_SYNCHRONOUS'] = '0'; -} - -if ( !isset ( $_POST['form']['SP_SYNCHRONOUS']) ) { - $_POST['form']['SP_SYNCHRONOUS'] = '0'; -} - -require_once 'classes/model/SubProcess.php'; -$oOP = new SubProcess(); -$aData = array('SP_UID' => $_POST['form']['SP_UID'],//G::generateUniqueID(), - 'PRO_UID' => (isset($aTask['PRO_UID']))?$aTask['PRO_UID']:'', - 'TAS_UID' => $_POST['form']['TASKS'], - 'PRO_PARENT' => $_POST['form']['PRO_PARENT'], - 'TAS_PARENT' => $_POST['form']['TAS_PARENT'], - 'SP_TYPE' => 'SIMPLE', - 'SP_SYNCHRONOUS' => $_POST['form']['SP_SYNCHRONOUS'], - 'SP_SYNCHRONOUS_TYPE' => 'ALL', - 'SP_SYNCHRONOUS_WAIT' => 0, - 'SP_VARIABLES_OUT' => serialize($out), - 'SP_VARIABLES_IN' => serialize($in), - 'SP_GRID_IN' => ''); - - -$oOP->update($aData); - -require_once 'classes/model/Content.php'; -$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; -//$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); -$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['TAS_PARENT'], $lang, $_POST['form']['SPROCESS_NAME'] ); -//$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); -//G::header('location: processes_Map?PRO_UID='. $_POST['form']['PRO_UID']); -die; +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +$access = $RBAC->userCanAccess( 'PM_FACTORY' ); +if ($access != 1) { + switch ($access) { + case - 1: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + case - 2: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + default: + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + break; + } +} + +//print_r($_POST); die; + + +$out = array (); +for ($i = 1; $i <= count( $_POST['form']['grid1'] ); $i ++) { + $out[$_POST['form']['grid1'][$i]['VAR_OUT1']] = $_POST['form']['grid1'][$i]['VAR_OUT2']; +} + +$in = array (); +for ($j = 1; $j <= count( $_POST['form']['grid2'] ); $j ++) { + $in[$_POST['form']['grid2'][$j]['VAR_IN1']] = $_POST['form']['grid2'][$j]['VAR_IN2']; +} + +require_once 'classes/model/Task.php'; +$oTask = new Task(); +//$aTask=$oTask->load($_POST['form']['TASKS']); +//$aTask=$oTask->load($_POST['form']['PRO_UID']); +$aTask = ($_POST['form']['TASKS'] != 0) ? $oTask->load( $_POST['form']['TASKS'] ) : 0; +//$aTask['PRO_UID']=0; + + +if (isset( $_POST['form']['SP_SYNCHRONOUS'] ) && $_POST['form']['SP_SYNCHRONOUS'] == '') { + $_POST['form']['SP_SYNCHRONOUS'] = '0'; +} + +if (! isset( $_POST['form']['SP_SYNCHRONOUS'] )) { + $_POST['form']['SP_SYNCHRONOUS'] = '0'; +} + +require_once 'classes/model/SubProcess.php'; +$oOP = new SubProcess(); +$aData = array ('SP_UID' => $_POST['form']['SP_UID'],//G::generateUniqueID(), +'PRO_UID' => (isset( $aTask['PRO_UID'] )) ? $aTask['PRO_UID'] : '','TAS_UID' => $_POST['form']['TASKS'],'PRO_PARENT' => $_POST['form']['PRO_PARENT'],'TAS_PARENT' => $_POST['form']['TAS_PARENT'],'SP_TYPE' => 'SIMPLE','SP_SYNCHRONOUS' => $_POST['form']['SP_SYNCHRONOUS'],'SP_SYNCHRONOUS_TYPE' => 'ALL','SP_SYNCHRONOUS_WAIT' => 0,'SP_VARIABLES_OUT' => serialize( $out ),'SP_VARIABLES_IN' => serialize( $in ),'SP_GRID_IN' => '' +); + +$oOP->update( $aData ); + +require_once 'classes/model/Content.php'; +$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; +//$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); +$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['TAS_PARENT'], $lang, $_POST['form']['SPROCESS_NAME'] ); +//$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); +//G::header('location: processes_Map?PRO_UID='. $_POST['form']['PRO_UID']); +die(); diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index a67f8caba..983aae414 100755 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -1,171 +1,170 @@ -PRO_UID; -$sTASKS = $oData->TASKS; -$sDYNAFORM = $oData->DYNAFORM; -$sWE_TYPE = $oData->WE_TYPE; -$sWS_USER = $oData->WS_USER; -$sWS_PASS = $oData->WS_PASS; -$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; -$sWE_USR = $oData->WE_USR; - -$withWS = $sWE_TYPE == 'WS'; - -G::LoadClass("system"); - -try { - $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; - G::mk_dir ( $pathProcess, 0777 ); - - $oTask = new Task ( ); - $TaskFields = $oTask->load ( $sTASKS ); - $WE_EVN_UID = $oTask->getStartingEvent($sTASKS); - if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') { - throw (new Exception ( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'." )); - } - - G::LoadClass ( 'tasks' ); - $oTask = new Tasks ( ); - $user = $oTask->assignUsertoTask ( $sTASKS ); - - if ($user == 0) { - throw (new Exception ( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have users." )); - } - - if (G::is_https ()) - $http = 'https://'; - else - $http = 'http://'; - - $sContent = ''; - - if ($withWS) { - //creating sys.info; - $SITE_PUBLIC_PATH = ''; - if (file_exists ( $SITE_PUBLIC_PATH . '' )) {} - - //creating the first file - require_once 'classes/model/Dynaform.php'; - $oDynaform = new Dynaform ( ); - $aDynaform = $oDynaform->load ( $sDYNAFORM ); - $dynTitle = str_replace ( ' ', '_', str_replace ( '/', '_', $aDynaform['DYN_TITLE'] ) ); - $sContent = "AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; - $sContent .= "G::RenderPage('publish', 'blank');"; - file_put_contents ( $pathProcess . $dynTitle . '.php', $sContent ); - //creating the second file, the post file who receive the post form. - $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - $template->assign ( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign ( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); - $template->assign ( 'processUid', $sPRO_UID ); - $template->assign ( 'dynaformUid', $sDYNAFORM ); - $template->assign ( 'taskUid', $sTASKS ); - $template->assign ( 'wsUser', $sWS_USER ); - $template->assign ( 'wsPass', 'md5:' . md5 ( $sWS_PASS ) ); - $template->assign ( 'wsRoundRobin', $sWS_ROUNDROBIN ); - - if($sWE_USR == "2"){ - $template->assign ( 'USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;" ); - } else { - $template->assign ( 'USR_VAR', '$USR_UID = -1;' ); - } - - - $template->assign ( 'dynaform', $dynTitle ); - $template->assign ( 'timestamp', date ( 'l jS \of F Y h:i:s A' ) ); - $template->assign ( 'ws', SYS_SYS ); - $template->assign ( 'version', System::getVersion() ); - - $fileName = $pathProcess . $dynTitle . 'Post.php'; - file_put_contents ( $fileName, $template->getOutputContent () ); - //creating the third file, only if this wsClient.php file doesn't exist. - $fileName = $pathProcess . 'wsClient.php'; - $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; - - if ( file_exists ($fileName) ) { - if( filesize($fileName) != filesize($pluginTpl) ){ - @copy($fileName, $pathProcess . 'wsClient.php.bck'); - @unlink($fileName); - - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - file_put_contents ( $fileName, $template->getOutputContent () ); - } - } else { - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - file_put_contents ( $fileName, $template->getOutputContent () ); - } - - require_once 'classes/model/Event.php'; - $oEvent = new Event ( ); - $aDataEvent = array(); - - $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; - $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; - $aDataEvent['EVN_ACTION'] = $sDYNAFORM; - $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; - $output = $oEvent->update($aDataEvent); - //Show link - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; - print $link; - //print "\n $link "; - - - } else { - $G_FORM = new Form ( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); - $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; - - $scriptCode = ''; - $scriptCode = $G_FORM->render ( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); - $scriptCode = str_replace ( '/controls/', $http . $_SERVER['HTTP_HOST'] . '/controls/', $scriptCode ); - $scriptCode = str_replace ( '/js/maborak/core/images/', $http . $_SERVER['HTTP_HOST'] . '/js/maborak/core/images/', $scriptCode ); - - //render the template - $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; - $template = new TemplatePower ( $pluginTpl ); - $template->prepare (); - require_once 'classes/model/Step.php'; - $oStep = new Step(); - $sUidGrids = $oStep->lookingforUidGrids($sPRO_UID,$sDYNAFORM); - - - $template->assign ( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); - $template->assign ( 'sysSys', SYS_SYS ); - $template->assign ( 'sysLang', SYS_LANG ); - $template->assign ( 'sysSkin', SYS_SKIN ); - $template->assign ( 'processUid', $sPRO_UID ); - $template->assign ( 'dynaformUid', $sDYNAFORM ); - $template->assign ( 'taskUid', $sTASKS ); - $template->assign ( 'dynFileName', $sPRO_UID . '/' . $sDYNAFORM ); - $template->assign ( 'formId', $G_FORM->id ); - $template->assign ( 'scriptCode', $scriptCode ); - - if(sizeof($sUidGrids)>0){ - foreach($sUidGrids as $k => $v){ - $template->newBlock( 'grid_uids' ); - $template->assign ( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); - $template->assign ( 'gridFileName', $sPRO_UID . '/' . $v ); - } - } - - print_r ( '' ); - } - -} catch ( Exception $e ) { - $G_PUBLISH = new Publisher ( ); - $aMessage['MESSAGE'] = $e->getMessage (); - $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage ( 'publish', 'raw' ); -} - - +PRO_UID; +$sTASKS = $oData->TASKS; +$sDYNAFORM = $oData->DYNAFORM; +$sWE_TYPE = $oData->WE_TYPE; +$sWS_USER = $oData->WS_USER; +$sWS_PASS = $oData->WS_PASS; +$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; +$sWE_USR = $oData->WE_USR; + +$withWS = $sWE_TYPE == 'WS'; + +G::LoadClass( "system" ); + +try { + $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; + G::mk_dir( $pathProcess, 0777 ); + + $oTask = new Task(); + $TaskFields = $oTask->load( $sTASKS ); + $WE_EVN_UID = $oTask->getStartingEvent( $sTASKS ); + if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') { + throw (new Exception( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'." )); + } + + G::LoadClass( 'tasks' ); + $oTask = new Tasks(); + $user = $oTask->assignUsertoTask( $sTASKS ); + + if ($user == 0) { + throw (new Exception( "The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have users." )); + } + + if (G::is_https()) + $http = 'https://'; + else + $http = 'http://'; + + $sContent = ''; + + if ($withWS) { + //creating sys.info; + $SITE_PUBLIC_PATH = ''; + if (file_exists( $SITE_PUBLIC_PATH . '' )) { + } + + //creating the first file + require_once 'classes/model/Dynaform.php'; + $oDynaform = new Dynaform(); + $aDynaform = $oDynaform->load( $sDYNAFORM ); + $dynTitle = str_replace( ' ', '_', str_replace( '/', '_', $aDynaform['DYN_TITLE'] ) ); + $sContent = "AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; + $sContent .= "G::RenderPage('publish', 'blank');"; + file_put_contents( $pathProcess . $dynTitle . '.php', $sContent ); + //creating the second file, the post file who receive the post form. + $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); + $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'processUid', $sPRO_UID ); + $template->assign( 'dynaformUid', $sDYNAFORM ); + $template->assign( 'taskUid', $sTASKS ); + $template->assign( 'wsUser', $sWS_USER ); + $template->assign( 'wsPass', 'md5:' . md5( $sWS_PASS ) ); + $template->assign( 'wsRoundRobin', $sWS_ROUNDROBIN ); + + if ($sWE_USR == "2") { + $template->assign( 'USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;" ); + } else { + $template->assign( 'USR_VAR', '$USR_UID = -1;' ); + } + + $template->assign( 'dynaform', $dynTitle ); + $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) ); + $template->assign( 'ws', SYS_SYS ); + $template->assign( 'version', System::getVersion() ); + + $fileName = $pathProcess . $dynTitle . 'Post.php'; + file_put_contents( $fileName, $template->getOutputContent() ); + //creating the third file, only if this wsClient.php file doesn't exist. + $fileName = $pathProcess . 'wsClient.php'; + $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; + + if (file_exists( $fileName )) { + if (filesize( $fileName ) != filesize( $pluginTpl )) { + @copy( $fileName, $pathProcess . 'wsClient.php.bck' ); + @unlink( $fileName ); + + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + file_put_contents( $fileName, $template->getOutputContent() ); + } + } else { + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + file_put_contents( $fileName, $template->getOutputContent() ); + } + + require_once 'classes/model/Event.php'; + $oEvent = new Event(); + $aDataEvent = array (); + + $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; + $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; + $aDataEvent['EVN_ACTION'] = $sDYNAFORM; + $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; + $output = $oEvent->update( $aDataEvent ); + //Show link + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + print $link; + //print "\n $link "; + + + } else { + $G_FORM = new Form( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); + $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; + + $scriptCode = ''; + $scriptCode = $G_FORM->render( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); + $scriptCode = str_replace( '/controls/', $http . $_SERVER['HTTP_HOST'] . '/controls/', $scriptCode ); + $scriptCode = str_replace( '/js/maborak/core/images/', $http . $_SERVER['HTTP_HOST'] . '/js/maborak/core/images/', $scriptCode ); + + //render the template + $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; + $template = new TemplatePower( $pluginTpl ); + $template->prepare(); + require_once 'classes/model/Step.php'; + $oStep = new Step(); + $sUidGrids = $oStep->lookingforUidGrids( $sPRO_UID, $sDYNAFORM ); + + $template->assign( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); + $template->assign( 'sysSys', SYS_SYS ); + $template->assign( 'sysLang', SYS_LANG ); + $template->assign( 'sysSkin', SYS_SKIN ); + $template->assign( 'processUid', $sPRO_UID ); + $template->assign( 'dynaformUid', $sDYNAFORM ); + $template->assign( 'taskUid', $sTASKS ); + $template->assign( 'dynFileName', $sPRO_UID . '/' . $sDYNAFORM ); + $template->assign( 'formId', $G_FORM->id ); + $template->assign( 'scriptCode', $scriptCode ); + + if (sizeof( $sUidGrids ) > 0) { + foreach ($sUidGrids as $k => $v) { + $template->newBlock( 'grid_uids' ); + $template->assign( 'siteUrl', $http . $_SERVER['HTTP_HOST'] ); + $template->assign( 'gridFileName', $sPRO_UID . '/' . $v ); + } + } + + print_r( '' ); + } + +} catch (Exception $e) { + $G_PUBLISH = new Publisher(); + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); + G::RenderPage( 'publish', 'raw' ); +} + + diff --git a/workflow/engine/methods/processes/processes_webEntryValidate.php b/workflow/engine/methods/processes/processes_webEntryValidate.php index 46ffd6059..03f78520a 100755 --- a/workflow/engine/methods/processes/processes_webEntryValidate.php +++ b/workflow/engine/methods/processes/processes_webEntryValidate.php @@ -11,8 +11,8 @@ $sTASKS_SEL = $oData->TASKS_NAME; //echo $sTASKS."
"; $sDYNAFORM = $oData->DYNAFORM; $sWE_TYPE = $oData->WE_TYPE; -$sWS_USER = trim($oData->WS_USER); -$sWS_PASS = trim($oData->WS_PASS); +$sWS_USER = trim( $oData->WS_USER ); +$sWS_PASS = trim( $oData->WS_PASS ); $sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN; $sWE_USR = $oData->WE_USR; @@ -20,37 +20,41 @@ $sWE_USR = $oData->WE_USR; //echo ($sTASKS."
"); //echo ($sDYNAFORM."
"); -if (G::is_https ()) + +if (G::is_https()) $http = 'https://'; - else +else $http = 'http://'; $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; -@$client = new SoapClient ( $endpoint ); +@$client = new SoapClient( $endpoint ); $user = $sWS_USER; $pass = $sWS_PASS; -$params = array ('userid' => $user, 'password' => $pass ); -$result = $client->__SoapCall ( 'login', array ($params ) ); +$params = array ('userid' => $user,'password' => $pass +); +$result = $client->__SoapCall( 'login', array ($params +) ); //$_SESSION ['WS_SESSION_ID'] = ''; + //if ($result->status_code == 0) { // $_SESSION ['WS_SESSION_ID'] = $result->message; //} -$fields ['status_code'] = $result->status_code; -$fields ['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; -$fields ['version'] = $result->version; -$fields ['time_stamp'] = $result->timestamp; + +$fields['status_code'] = $result->status_code; +$fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; +$fields['version'] = $result->version; +$fields['time_stamp'] = $result->timestamp; $messageCode = 1; - -G::LoadClass ( 'Task' ); -G::LoadClass ( 'User' ); -G::LoadClass ( 'TaskUser' ); -G::LoadClass ( 'Groupwf' ); +G::LoadClass( 'Task' ); +G::LoadClass( 'User' ); +G::LoadClass( 'TaskUser' ); +G::LoadClass( 'Groupwf' ); /** * note added by gustavo cruz gustavo-at-colosa-dot-com * This is a little check to see if the GroupUser class has been declared or not. @@ -58,39 +62,39 @@ G::LoadClass ( 'Groupwf' ); * It's seems that could be replicated in a Linux server easily. * I recomend that in some way check already if a imported class is declared * somewhere else or maybe delegate the task to the G Class LoadClass method. - **/ -if(!class_exists('GroupUser')) { - G::LoadClass ( 'GroupUser' ); + */ +if (! class_exists( 'GroupUser' )) { + G::LoadClass( 'GroupUser' ); } - // if the user has been authenticated, then check if has the rights or - // permissions to create the webentry - if ($result->status_code == 0) { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(UsersPeer::USR_UID); - $oCriteria->addSelectColumn(TaskUserPeer::USR_UID); - $oCriteria->addSelectColumn(TaskUserPeer::TAS_UID); - $oCriteria->addJoin(TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - $oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); - $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); - //$oCriteria->add(TaskUserPeer::TU_RELATION,1); - $userIsAssigned = TaskUserPeer::doCount($oCriteria); - // if the user is not assigned directly, maybe a have the task a group with the user - if($userIsAssigned<1) { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(UsersPeer::USR_UID); - $oCriteria->addJoin(UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN); - $oCriteria->addJoin(GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN); - $oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); - $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); - $userIsAssigned = GroupUserPeer::doCount($oCriteria); - if (!($userIsAssigned>=1)) { - $messageCode = "The User \"".$sWS_USER."\" doesn't have the task \"".$sTASKS_SEL."\" assigned"; - } - } - - } else { - $messageCode = $result->message; +// if the user has been authenticated, then check if has the rights or +// permissions to create the webentry +if ($result->status_code == 0) { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( UsersPeer::USR_UID ); + $oCriteria->addSelectColumn( TaskUserPeer::USR_UID ); + $oCriteria->addSelectColumn( TaskUserPeer::TAS_UID ); + $oCriteria->addJoin( TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN ); + $oCriteria->add( TaskUserPeer::TAS_UID, $sTASKS ); + $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER ); + //$oCriteria->add(TaskUserPeer::TU_RELATION,1); + $userIsAssigned = TaskUserPeer::doCount( $oCriteria ); + // if the user is not assigned directly, maybe a have the task a group with the user + if ($userIsAssigned < 1) { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( UsersPeer::USR_UID ); + $oCriteria->addJoin( UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN ); + $oCriteria->addJoin( GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN ); + $oCriteria->add( TaskUserPeer::TAS_UID, $sTASKS ); + $oCriteria->add( UsersPeer::USR_USERNAME, $sWS_USER ); + $userIsAssigned = GroupUserPeer::doCount( $oCriteria ); + if (! ($userIsAssigned >= 1)) { + $messageCode = "The User \"" . $sWS_USER . "\" doesn't have the task \"" . $sTASKS_SEL . "\" assigned"; } + } + +} else { + $messageCode = $result->message; +} echo ($messageCode); ?> diff --git a/workflow/engine/methods/processes/webEntry_Val_Assig.php b/workflow/engine/methods/processes/webEntry_Val_Assig.php index e7f1fcfc0..5c2cc7028 100755 --- a/workflow/engine/methods/processes/webEntry_Val_Assig.php +++ b/workflow/engine/methods/processes/webEntry_Val_Assig.php @@ -1,32 +1,32 @@ -PRO_UID; -$sTASKS = $oData->TASKS; -$sDYNAFORM = $oData->DYNAFORM; - - -if (G::is_https ()) - $http = 'https://'; - else - $http = 'http://'; - -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; -@$client = new SoapClient ( $endpoint ); - - -G::LoadClass ( 'Task' ); -G::LoadClass ( 'User' ); -G::LoadClass ( 'TaskUser' ); - -$oTask = new Task ( ); - $TaskFields = $oTask->kgetassigType ( $sPRO_UID, $sTASKS ); - -if ($TaskFields['TAS_ASSIGN_TYPE'] == 'BALANCED')echo 1; -else echo 0; - -?> +PRO_UID; +$sTASKS = $oData->TASKS; +$sDYNAFORM = $oData->DYNAFORM; + +if (G::is_https()) + $http = 'https://'; +else + $http = 'http://'; + +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +@$client = new SoapClient( $endpoint ); + +G::LoadClass( 'Task' ); +G::LoadClass( 'User' ); +G::LoadClass( 'TaskUser' ); + +$oTask = new Task(); +$TaskFields = $oTask->kgetassigType( $sPRO_UID, $sTASKS ); + +if ($TaskFields['TAS_ASSIGN_TYPE'] == 'BALANCED') + echo 1; +else + echo 0; + +?>