BUG 9377 "APP_FINISH_DATE is set to 1902-01-01 00:00:00 when..." SOLVED

- APP_FINISH_DATE is set to 1902-01-01 00:00:00 when create new case
  using webservices
- DEL_INIT_DATE is set to NULL when routing case using webservices
- Solved the problem in the fields APPLICATION.APP_FINISH_DATE and
  APP_CACHE_VIEW.APP_FINISH_DATE, when you create a new case now set to NULL
- Solved the problem in the fields APP_DELEGATION.DEL_INIT_DATE and
  APP_CACHE_VIEW.DEL_INIT_DATE when the case is routed set to the date corresponding
This commit is contained in:
Victor Saisa Lopez
2012-07-09 13:21:20 -04:00
parent 54af0aca9b
commit df8cfae446
5 changed files with 195 additions and 190 deletions

View File

@@ -73,13 +73,13 @@
class wsBase class wsBase
{ {
public $stored_system_variables; //boolean public $stored_system_variables; //boolean
public $wsSessionId; // web service session id, if the wsbase function is used from a WS request public $wsSessionId; // web service session id, if the wsbase function is used from a WS request
function __construct($params=NULL) { function __construct($params=NULL) {
$this->stored_system_variables = FALSE; $this->stored_system_variables = FALSE;
if( $params != NULL ){ if( $params != NULL ){
$this->stored_system_variables = isset($params->stored_system_variables)? $params->stored_system_variables: FALSE; $this->stored_system_variables = isset($params->stored_system_variables)? $params->stored_system_variables: FALSE;
$this->wsSessionId = isset($params->wsSessionId)? $params->wsSessionId: ''; $this->wsSessionId = isset($params->wsSessionId)? $params->wsSessionId: '';
@@ -151,7 +151,7 @@ class wsBase
} }
/* /*
* get all groups * get all groups
* @param none * @param none
* @return $result will return an object * @return $result will return an object
*/ */
@@ -179,11 +179,11 @@ class wsBase
return $result; return $result;
} }
} }
/* /*
* get all roles, to see all roles * get all roles, to see all roles
* @param none * @param none
* @return $result will return an object * @return $result will return an object
*/ */
public function roleList( ) { public function roleList( ) {
try { try {
@@ -263,7 +263,7 @@ class wsBase
//get the users from this department //get the users from this department
$c = new Criteria(); $c = new Criteria();
$c->clearSelectColumns(); $c->clearSelectColumns();
$c->addSelectColumn('COUNT(*)'); $c->addSelectColumn('COUNT(*)');
$c->add(UsersPeer::DEP_UID, $aRow['DEP_UID'] ); $c->add(UsersPeer::DEP_UID, $aRow['DEP_UID'] );
$rs = UsersPeer::doSelectRS($c); $rs = UsersPeer::doSelectRS($c);
$rs->next(); $rs->next();
@@ -334,10 +334,10 @@ class wsBase
* @return $result will return an object * @return $result will return an object
*/ */
public function unassignedCaseList( $userId ) { public function unassignedCaseList( $userId ) {
try { try {
$result = array(); $result = array();
$oAppCache = new AppCacheView(); $oAppCache = new AppCacheView();
$Criteria = $oAppCache->getUnassignedListCriteria($userId); $Criteria = $oAppCache->getUnassignedListCriteria($userId);
$oDataset = AppCacheViewPeer::doSelectRS($Criteria); $oDataset = AppCacheViewPeer::doSelectRS($Criteria);
$oDataset -> setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset -> setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();
@@ -345,7 +345,7 @@ class wsBase
$result[] = array ( 'guid' => $aRow['APP_UID'], 'name' => $aRow['APP_NUMBER'], 'delIndex' => $aRow['DEL_INDEX'] ); $result[] = array ( 'guid' => $aRow['APP_UID'], 'name' => $aRow['APP_NUMBER'], 'delIndex' => $aRow['DEL_INDEX'] );
$oDataset-> next(); $oDataset-> next();
} }
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
$result[] = array ( 'guid' => $e->getMessage(), 'name' => $e->getMessage(), 'status' => $e->getMessage() , 'status' => $e->getMessage() ); $result[] = array ( 'guid' => $e->getMessage(), 'name' => $e->getMessage(), 'status' => $e->getMessage() , 'status' => $e->getMessage() );
@@ -356,7 +356,7 @@ class wsBase
/* /*
* get all groups * get all groups
* @param none * @param none
* @return $result will return an object * @return $result will return an object
*/ */
public function userList( ) { public function userList( ) {
try { try {
@@ -382,11 +382,11 @@ class wsBase
} }
/* /*
* get list of all the available triggers in a workspace * get list of all the available triggers in a workspace
* @param none * @param none
* @return $result will return an object * @return $result will return an object
*/ */
public function triggerList( ) { public function triggerList( ) {
try { try {
@@ -441,15 +441,15 @@ class wsBase
foreach ( $_DBArray['inputDocuments'] as $key => $row ) { foreach ( $_DBArray['inputDocuments'] as $key => $row ) {
if ( isset($row['DOC_VERSION']) ) { if ( isset($row['DOC_VERSION']) ) {
$docrow = array(); $docrow = array();
$docrow['guid'] = $row['APP_DOC_UID']; $docrow['guid'] = $row['APP_DOC_UID'];
$docrow['filename'] = $row['APP_DOC_FILENAME']; $docrow['filename'] = $row['APP_DOC_FILENAME'];
$docrow['docId'] = $row['DOC_UID']; $docrow['docId'] = $row['DOC_UID'];
$docrow['version'] = $row['DOC_VERSION']; $docrow['version'] = $row['DOC_VERSION'];
$docrow['createDate'] = $row['CREATE_DATE']; $docrow['createDate'] = $row['CREATE_DATE'];
$docrow['createBy'] = $row['CREATED_BY']; $docrow['createBy'] = $row['CREATED_BY'];
$docrow['type'] = $row['TYPE']; $docrow['type'] = $row['TYPE'];
$docrow['index'] = $row['APP_DOC_INDEX']; $docrow['index'] = $row['APP_DOC_INDEX'];
$docrow['link'] = 'cases/' . $row['DOWNLOAD_LINK']; $docrow['link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$result[] = $docrow; $result[] = $docrow;
} }
} }
@@ -463,38 +463,38 @@ class wsBase
/* /*
* input document process list * input document process list
* @param string $sProcessUID * @param string $sProcessUID
* @return $result will return an object * @return $result will return an object
*/ */
public function inputDocumentProcessList( $sProcessUID ) { public function inputDocumentProcessList( $sProcessUID ) {
try { try {
global $_DBArray; global $_DBArray;
$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : ''); $_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
$oMap = new processMap(); $oMap = new processMap();
$oCriteria = $oMap->getInputDocumentsCriteria($sProcessUID); $oCriteria = $oMap->getInputDocumentsCriteria($sProcessUID);
$oDataset = InputDocumentPeer::doSelectRS ( $oCriteria ); $oDataset = InputDocumentPeer::doSelectRS ( $oCriteria );
$oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$oDataset->next (); $oDataset->next ();
$result = array(); $result = array();
//$result[] = array('guid'=>'char','name'=>'name','description'=>'description'); //not necesary for SOAP message //$result[] = array('guid'=>'char','name'=>'name','description'=>'description'); //not necesary for SOAP message
while ( $aRow = $oDataset->getRow() ) { while ( $aRow = $oDataset->getRow() ) {
if ( $aRow['INP_DOC_TITLE'] == NULL){// There is no transaltion for this Document name, try to get/regenerate the label if ( $aRow['INP_DOC_TITLE'] == NULL){// There is no transaltion for this Document name, try to get/regenerate the label
$inputDocument = new InputDocument(); $inputDocument = new InputDocument();
$inputDocumentObj = $inputDocument->load($aRow['INP_DOC_UID']); $inputDocumentObj = $inputDocument->load($aRow['INP_DOC_UID']);
$aRow['INP_DOC_TITLE'] = $inputDocumentObj['INP_DOC_TITLE']; $aRow['INP_DOC_TITLE'] = $inputDocumentObj['INP_DOC_TITLE'];
$aRow['INP_DOC_DESCRIPTION'] = $inputDocumentObj['INP_DOC_DESCRIPTION']; $aRow['INP_DOC_DESCRIPTION'] = $inputDocumentObj['INP_DOC_DESCRIPTION'];
} }
$docrow = array(); $docrow = array();
$docrow['guid'] = $aRow['INP_DOC_UID']; $docrow['guid'] = $aRow['INP_DOC_UID'];
$docrow['name'] = $aRow['INP_DOC_TITLE']; $docrow['name'] = $aRow['INP_DOC_TITLE'];
$docrow['description'] = $aRow['INP_DOC_DESCRIPTION']; $docrow['description'] = $aRow['INP_DOC_DESCRIPTION'];
$result[] = $docrow; $result[] = $docrow;
$oDataset->next (); $oDataset->next ();
} }
//$_DBArray['inputDocArray'] = $inputDocArray; //$_DBArray['inputDocArray'] = $inputDocArray;
return $result; return $result;
} }
@@ -507,7 +507,7 @@ class wsBase
/* /*
* output document list * output document list
* @param string $sApplicationUID * @param string $sApplicationUID
* @param string $sUserUID * @param string $sUserUID
* @return $result will return an object * @return $result will return an object
*/ */
@@ -524,16 +524,16 @@ class wsBase
foreach ( $_DBArray['outputDocuments'] as $key => $row ) { foreach ( $_DBArray['outputDocuments'] as $key => $row ) {
if ( isset($row['DOC_VERSION']) ) { if ( isset($row['DOC_VERSION']) ) {
$docrow = array(); $docrow = array();
$docrow['guid'] = $row['APP_DOC_UID']; $docrow['guid'] = $row['APP_DOC_UID'];
$docrow['filename'] = $row['DOWNLOAD_FILE']; $docrow['filename'] = $row['DOWNLOAD_FILE'];
$docrow['docId'] = $row['DOC_UID']; $docrow['docId'] = $row['DOC_UID'];
$docrow['version'] = $row['DOC_VERSION']; $docrow['version'] = $row['DOC_VERSION'];
$docrow['createDate'] = $row['CREATE_DATE']; $docrow['createDate'] = $row['CREATE_DATE'];
$docrow['createBy'] = $row['CREATED_BY']; $docrow['createBy'] = $row['CREATED_BY'];
$docrow['type'] = $row['TYPE']; $docrow['type'] = $row['TYPE'];
$docrow['index'] = $row['APP_DOC_INDEX']; $docrow['index'] = $row['APP_DOC_INDEX'];
$docrow['link'] = 'cases/' . $row['DOWNLOAD_LINK']; $docrow['link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$result[] = $docrow; $result[] = $docrow;
} }
} }
@@ -611,14 +611,14 @@ class wsBase
/* /*
* send message * send message
* @param string $caseId * @param string $caseId
* @param string $sFrom * @param string $sFrom
* @param string $sTo * @param string $sTo
* @param string $sCc * @param string $sCc
* @param string $sBcc * @param string $sBcc
* @param string $sSubject * @param string $sSubject
* @param string $sTemplate * @param string $sTemplate
* @param $appFields = null * @param $appFields = null
* @return $result will return an object * @return $result will return an object
*/ */
public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null ) { public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null ) {
@@ -630,9 +630,9 @@ class wsBase
$passwd =$aSetup['MESS_PASSWORD']; $passwd =$aSetup['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT'); $passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) { if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec); list($hash, $pass) = explode(":", $passwdDec);
$arrayFrom['MESS_PASSWORD'] = $pass; $arrayFrom['MESS_PASSWORD'] = $pass;
} }
$oSpool = new spoolRun(); $oSpool = new spoolRun();
$oSpool->setConfig(array( $oSpool->setConfig(array(
'MESS_ENGINE' => $aSetup['MESS_ENGINE'], 'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
@@ -654,17 +654,17 @@ class wsBase
if (!file_exists($fileTemplate)) { if (!file_exists($fileTemplate)) {
$data['FILE_TEMPLATE'] = $fileTemplate; $data['FILE_TEMPLATE'] = $fileTemplate;
$result = new wsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data)); $result = new wsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
return $result; return $result;
} }
if ($appFields == null) { if ($appFields == null) {
$Fields = $oldFields['APP_DATA']; $Fields = $oldFields['APP_DATA'];
} }
else { else {
$Fields = array_merge($oldFields['APP_DATA'], $appFields); $Fields = array_merge($oldFields['APP_DATA'], $appFields);
} }
$templateContents = file_get_contents($fileTemplate); $templateContents = file_get_contents($fileTemplate);
//$sContent = G::unhtmlentities($sContent); //$sContent = G::unhtmlentities($sContent);
@@ -712,7 +712,7 @@ class wsBase
); );
$oSpool->create( $messageArray ); $oSpool->create( $messageArray );
$oSpool->sendMail(); $oSpool->sendMail();
if ( $oSpool->status == 'sent' ) if ( $oSpool->status == 'sent' )
$result = new wsResponse (0, G::loadTranslation ('ID_MESSAGE_SENT') . ": ". $sTo ); $result = new wsResponse (0, G::loadTranslation ('ID_MESSAGE_SENT') . ": ". $sTo );
@@ -720,14 +720,14 @@ class wsBase
$result = new wsResponse (29, $oSpool->status . ' ' . $oSpool->error . print_r ($aSetup ,1 ) ); $result = new wsResponse (29, $oSpool->status . ' ' . $oSpool->error . print_r ($aSetup ,1 ) );
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
return new wsResponse (100, $e->getMessage()); return new wsResponse (100, $e->getMessage());
} }
} }
/* /*
* get case information * get case information
* @param string $caseId * @param string $caseId
* @param string $iDelIndex * @param string $iDelIndex
* @return $result will return an object * @return $result will return an object
@@ -810,7 +810,7 @@ class wsBase
$currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS']; $currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS'];
$aCurrentUsers[] = $currentUser; $aCurrentUsers[] = $currentUser;
} }
$result->currentUsers = $aCurrentUsers; $result->currentUsers = $aCurrentUsers;
return $result; return $result;
@@ -822,14 +822,14 @@ class wsBase
} }
/* /*
* creates a new user * creates a new user
* @param string sessionId : The session ID * @param string sessionId : The session ID
* @param string userId : The username for the new user. * @param string userId : The username for the new user.
* @param string firstname : The user's first name. * @param string firstname : The user's first name.
* @param string lastname : The user's last name. * @param string lastname : The user's last name.
* @param string email : The user's email address. * @param string email : The user's email address.
* @param string role : The user's role, such as 'PROCESSMAKER_ADMIN' or 'PROCESSMAKER_OPERATOR'. * @param string role : The user's role, such as 'PROCESSMAKER_ADMIN' or 'PROCESSMAKER_OPERATOR'.
* @param string password : The user's password such as 'Be@gle2'(It will be automatically encrypted with an MD5 hash). * @param string password : The user's password such as 'Be@gle2'(It will be automatically encrypted with an MD5 hash).
* @return $result will return an object * @return $result will return an object
*/ */
public function createUser( $userId, $firstname, $lastname, $email, $role, $password) { public function createUser( $userId, $firstname, $lastname, $email, $role, $password) {
@@ -899,7 +899,7 @@ class wsBase
$aData['USR_STATUS'] = 'ACTIVE'; $aData['USR_STATUS'] = 'ACTIVE';
$aData['USR_COUNTRY'] = ''; $aData['USR_COUNTRY'] = '';
$aData['USR_CITY'] = ''; $aData['USR_CITY'] = '';
$aData['USR_LOCATION'] = ''; $aData['USR_LOCATION'] = '';
$aData['USR_ADDRESS'] = ''; $aData['USR_ADDRESS'] = '';
$aData['USR_PHONE'] = ''; $aData['USR_PHONE'] = '';
$aData['USR_ZIP_CODE'] = ''; $aData['USR_ZIP_CODE'] = '';
@@ -919,7 +919,7 @@ class wsBase
'message' => $res->message, 'message' => $res->message,
'userUID' => $sUserUID, 'userUID' => $sUserUID,
'timestamp' => $res->timestamp ); 'timestamp' => $res->timestamp );
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
@@ -927,27 +927,27 @@ class wsBase
return $result; return $result;
} }
} }
/* /*
* create Group * create Group
* @param string $groupName * @param string $groupName
* @return $result will return an object * @return $result will return an object
*/ */
public function createGroup( $groupName) { public function createGroup( $groupName) {
try { try {
if( trim($groupName) == '' ) { if( trim($groupName) == '' ) {
$result = new wsCreateGroupResponse (25, G::loadTranslation ('ID_GROUP_NAME_REQUIRED'), ''); $result = new wsCreateGroupResponse (25, G::loadTranslation ('ID_GROUP_NAME_REQUIRED'), '');
return $result; return $result;
} }
$group = new Groupwf(); $group = new Groupwf();
$grpRow['GRP_TITLE'] = $groupName; $grpRow['GRP_TITLE'] = $groupName;
$groupId = $group->create( $grpRow ); $groupId = $group->create( $grpRow );
$data['GROUP_NAME'] = $groupName; $data['GROUP_NAME'] = $groupName;
$result = new wsCreateGroupResponse (0, G::loadTranslation ('ID_GROUP_CREATED_SUCCESSFULLY', SYS_LANG, $data), $groupId); $result = new wsCreateGroupResponse (0, G::loadTranslation ('ID_GROUP_CREATED_SUCCESSFULLY', SYS_LANG, $data), $groupId);
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
@@ -957,14 +957,14 @@ class wsBase
} }
/* /*
* Create New Department link on the top section of the left pane allows you to create a root-level department. * Create New Department link on the top section of the left pane allows you to create a root-level department.
* @param string $departmentName * @param string $departmentName
* @param string $parentUID * @param string $parentUID
* @return $result will return an object * @return $result will return an object
*/ */
public function createDepartment( $departmentName, $parentUID ) { public function createDepartment( $departmentName, $parentUID ) {
try { try {
if( trim($departmentName) == '' ) { if( trim($departmentName) == '' ) {
$result = new wsCreateDepartmentResponse (25, G::loadTranslation ('ID_DEPARTMENT_NAME_REQUIRED'), ''); $result = new wsCreateDepartmentResponse (25, G::loadTranslation ('ID_DEPARTMENT_NAME_REQUIRED'), '');
return $result; return $result;
} }
@@ -1041,11 +1041,11 @@ class wsBase
} }
/* /*
* assigns a user to a group * assigns a user to a group
* @param string $userId * @param string $userId
* @param string $groupId * @param string $groupId
* @return $result will return an object * @return $result will return an object
*/ */
public function assignUserToGroup( $userId, $groupId) { public function assignUserToGroup( $userId, $groupId) {
try { try {
global $RBAC; global $RBAC;
@@ -1080,9 +1080,9 @@ class wsBase
/* /*
* assigns user to department * assigns user to department
* @param string $userId * @param string $userId
* @param string $depId * @param string $depId
* @param string $manager * @param string $manager
* @return $result will return an object * @return $result will return an object
*/ */
@@ -1106,7 +1106,7 @@ class wsBase
if ( ! $deps->existsUserInDepartment( $depId, $userId ) ) { if ( ! $deps->existsUserInDepartment( $depId, $userId ) ) {
$deps->addUserToDepartment( $depId, $userId, $manager, true ); $deps->addUserToDepartment( $depId, $userId, $manager, true );
} }
$result = new wsResponse (0, G::loadTranslation ('ID_COMMAND_EXECUTED_SUCCESSFULY')); $result = new wsResponse (0, G::loadTranslation ('ID_COMMAND_EXECUTED_SUCCESSFULY'));
return $result; return $result;
} }
@@ -1117,8 +1117,8 @@ class wsBase
} }
/* /*
* sends variables to a case * sends variables to a case
* @param string $caseId * @param string $caseId
* @param string $variables * @param string $variables
* @return $result will return an object * @return $result will return an object
*/ */
@@ -1155,11 +1155,11 @@ class wsBase
ob_start(); ob_start();
print_r($variables); print_r($variables);
$cdata = ob_get_contents(); $cdata = ob_get_contents();
ob_end_clean(); ob_end_clean();
$up_case = $oCase->updateCase($caseId, $oldFields); $up_case = $oCase->updateCase($caseId, $oldFields);
$result = new wsResponse (0, $cant . " " . G::loadTranslation ('ID_VARIABLES_RECEIVED') . ": \n" . trim(str_replace('Array', '', $cdata)) ); $result = new wsResponse (0, $cant . " " . G::loadTranslation ('ID_VARIABLES_RECEIVED') . ": \n" . trim(str_replace('Array', '', $cdata)) );
return $result; return $result;
} }
else { else {
$result = new wsResponse (23, G::loadTranslation ('ID_VARIABLES_PARAM_ZERO')); $result = new wsResponse (23, G::loadTranslation ('ID_VARIABLES_PARAM_ZERO'));
return $result; return $result;
@@ -1177,7 +1177,7 @@ class wsBase
/* /*
* get variables The variables can be system variables and/or case variables * get variables The variables can be system variables and/or case variables
* @param string $caseId * @param string $caseId
* @param string $variables * @param string $variables
* @return $result will return an object * @return $result will return an object
*/ */
@@ -1207,13 +1207,13 @@ class wsBase
$node->name = $val->name."][".$gridKey."][".$col; $node->name = $val->name."][".$gridKey."][".$col;
$node->value =$colValue; $node->value =$colValue;
$resFields[] = $node; $resFields[] = $node;
} }
}else{//Checkgroups, Radiogroups }else{//Checkgroups, Radiogroups
$node = new stdClass(); $node = new stdClass();
$node->name = $key; $node->name = $key;
$node->value =implode("|",$val); $node->value =implode("|",$val);
$resFields[] = $node; $resFields[] = $node;
} }
} }
} }
} }
@@ -1240,9 +1240,9 @@ class wsBase
/* /*
* new Case begins a new case under the name of the logged-in user. * new Case begins a new case under the name of the logged-in user.
* @param string $processId * @param string $processId
* @param string $userId * @param string $userId
* @param string $taskId * @param string $taskId
* @param string $variables * @param string $variables
* @return $result will return an object * @return $result will return an object
*/ */
@@ -1257,14 +1257,14 @@ class wsBase
if (isset($_SESSION['USER_LOGGED'])) unset($_SESSION['USER_LOGGED']); if (isset($_SESSION['USER_LOGGED'])) unset($_SESSION['USER_LOGGED']);
//if (isset($_SESSION['USR_USERNAME'])) unset($_SESSION['USR_USERNAME']); //if (isset($_SESSION['USR_USERNAME'])) unset($_SESSION['USR_USERNAME']);
//if (isset($_SESSION['STEP_POSITION'])) unset($_SESSION['STEP_POSITION']); //if (isset($_SESSION['STEP_POSITION'])) unset($_SESSION['STEP_POSITION']);
$Fields = array(); $Fields = array();
if ( is_array($variables) && count($variables)>0 ) { if ( is_array($variables) && count($variables)>0 ) {
$Fields = $variables; $Fields = $variables;
} }
$oProcesses = new Processes(); $oProcesses = new Processes();
$pro = $oProcesses->processExists($processId); $pro = $oProcesses->processExists($processId);
if( !$pro ) { if( !$pro ) {
$result = new wsResponse (11, G::loadTranslation ('ID_INVALID_PROCESS') . " " . $processId); $result = new wsResponse (11, G::loadTranslation ('ID_INVALID_PROCESS') . " " . $processId);
return $result; return $result;
} }
@@ -1296,9 +1296,9 @@ class wsBase
$result = new wsResponse (14, G::loadTranslation ('ID_TASK_INVALID_USER_NOT_ASSIGNED_TASK')); $result = new wsResponse (14, G::loadTranslation ('ID_TASK_INVALID_USER_NOT_ASSIGNED_TASK'));
return $result; return $result;
} }
$case = $oCase->startCase($taskId, $userId); $case = $oCase->startCase($taskId, $userId);
$_SESSION['APPLICATION'] = $case['APPLICATION']; $_SESSION['APPLICATION'] = $case['APPLICATION'];
$_SESSION['PROCESS'] = $case['PROCESS']; $_SESSION['PROCESS'] = $case['PROCESS'];
$_SESSION['TASK'] = $taskId; $_SESSION['TASK'] = $taskId;
@@ -1306,7 +1306,7 @@ class wsBase
$_SESSION['USER_LOGGED'] = $userId; $_SESSION['USER_LOGGED'] = $userId;
//$_SESSION['USR_USERNAME'] = $case['USR_USERNAME']; //$_SESSION['USR_USERNAME'] = $case['USR_USERNAME'];
//$_SESSION['STEP_POSITION'] = 0; //$_SESSION['STEP_POSITION'] = 0;
$caseId = $case['APPLICATION']; $caseId = $case['APPLICATION'];
$caseNr = $case['CASE_NUMBER']; $caseNr = $case['CASE_NUMBER'];
@@ -1315,12 +1315,12 @@ class wsBase
$oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields); $oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields);
$up_case = $oCase->updateCase($caseId, $oldFields); $up_case = $oCase->updateCase($caseId, $oldFields);
$result = new wsResponse (0, G::loadTranslation ('ID_STARTED_SUCCESSFULLY')); $result = new wsResponse (0, G::loadTranslation ('ID_STARTED_SUCCESSFULLY'));
$result->caseId = $caseId; $result->caseId = $caseId;
$result->caseNumber = $caseNr; $result->caseNumber = $caseNr;
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
@@ -1398,10 +1398,10 @@ class wsBase
$up_case = $oCase->updateCase($caseId, $oldFields); $up_case = $oCase->updateCase($caseId, $oldFields);
$result = new wsResponse (0, G::loadTranslation ('ID_COMMAND_EXECUTED_SUCCESSFULLY')); $result = new wsResponse (0, G::loadTranslation ('ID_COMMAND_EXECUTED_SUCCESSFULLY'));
$result->caseId = $caseId; $result->caseId = $caseId;
$result->caseNumber = $caseNumber; $result->caseNumber = $caseNumber;
return $result; return $result;
} }
else { else {
@@ -1423,13 +1423,13 @@ class wsBase
/* /*
* derivate Case moves the case to the next task in the process according to the routing rules * derivate Case moves the case to the next task in the process according to the routing rules
* @param string $userId * @param string $userId
@param string $caseId @param string $caseId
@param string $delIndex @param string $delIndex
* @return $result will return an object * @return $result will return an object
*/ */
public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false) { public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false) {
try { try {
$sStatus = 'TO_DO'; $sStatus = 'TO_DO';
$varResponse = ''; $varResponse = '';
@@ -1479,7 +1479,7 @@ class wsBase
if(is_array($aRow)) if(is_array($aRow))
{ {
if ( isset($aRow['APP_DISABLE_ACTION_USER']) && $aRow['APP_DISABLE_ACTION_USER']!=0 && if ( isset($aRow['APP_DISABLE_ACTION_USER']) && $aRow['APP_DISABLE_ACTION_USER']!=0 &&
isset($aRow['APP_DISABLE_ACTION_DATE']) && $aRow['APP_DISABLE_ACTION_DATE']!='' ) { isset($aRow['APP_DISABLE_ACTION_DATE']) && $aRow['APP_DISABLE_ACTION_DATE']!='' ) {
$result = new wsResponse (19, G::loadTranslation ('ID_CASE_IN_STATUS') . " " . $aRow['APP_TYPE']); $result = new wsResponse (19, G::loadTranslation ('ID_CASE_IN_STATUS') . " " . $aRow['APP_TYPE']);
return $result; return $result;
@@ -1489,10 +1489,16 @@ class wsBase
$aData['APP_UID'] = $caseId; $aData['APP_UID'] = $caseId;
$aData['DEL_INDEX'] = $delIndex; $aData['DEL_INDEX'] = $delIndex;
$aData['USER_UID'] = $userId; $aData['USER_UID'] = $userId;
//load data //Load data
$oCase = new Cases (); $oCase = new Cases();
$appFields = $oCase->loadCase( $caseId ); $appFields = $oCase->loadCase($caseId, $delIndex);
if (is_null($appFields["DEL_INIT_DATE"])) {
$oCase->setDelInitDate($caseId, $delIndex);
$appFields = $oCase->loadCase($caseId, $delIndex);
}
$appFields['APP_DATA']['APPLICATION'] = $caseId; $appFields['APP_DATA']['APPLICATION'] = $caseId;
if ($bExecuteTriggersBeforeAssignment) { if ($bExecuteTriggersBeforeAssignment) {
@@ -1503,7 +1509,7 @@ class wsBase
foreach ($aTriggers as $aTrigger) { foreach ($aTriggers as $aTrigger) {
//$appFields = $oCase->loadCase( $caseId ); //$appFields = $oCase->loadCase( $caseId );
//$appFields['APP_DATA']['APPLICATION'] = $caseId; //$appFields['APP_DATA']['APPLICATION'] = $caseId;
//@Neyek ############################################################################################# //@Neyek #############################################################################################
if (!$this->stored_system_variables) { if (!$this->stored_system_variables) {
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants()); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants());
@@ -1513,23 +1519,23 @@ class wsBase
$oParams->option = "STORED SESSION"; $oParams->option = "STORED SESSION";
$oParams->SID = $this->wsSessionId; $oParams->SID = $this->wsSessionId;
$oParams->appData = $appFields["APP_DATA"]; $oParams->appData = $appFields["APP_DATA"];
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants($oParams)); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants($oParams));
} }
//#################################################################################################### //####################################################################################################
$oPMScript->setFields( $appFields['APP_DATA'] ); $oPMScript->setFields( $appFields['APP_DATA'] );
$bExecute = true; $bExecute = true;
if ($aTrigger['ST_CONDITION'] !== '') { if ($aTrigger['ST_CONDITION'] !== '') {
$oPMScript->setScript($aTrigger['ST_CONDITION']); $oPMScript->setScript($aTrigger['ST_CONDITION']);
$bExecute = $oPMScript->evaluate(); $bExecute = $oPMScript->evaluate();
} }
if ($bExecute) { if ($bExecute) {
$oPMScript->setScript($aTrigger['TRI_WEBBOT']); $oPMScript->setScript($aTrigger['TRI_WEBBOT']);
$oPMScript->execute(); $oPMScript->execute();
$varTriggers .= "<br/><b>-= Before Assignment =-</b><br/>" . nl2br(htmlentities($aTrigger['TRI_WEBBOT'], ENT_QUOTES)) . "<br/>"; $varTriggers .= "<br/><b>-= Before Assignment =-</b><br/>" . nl2br(htmlentities($aTrigger['TRI_WEBBOT'], ENT_QUOTES)) . "<br/>";
//$appFields = $oCase->loadCase( $caseId ); //$appFields = $oCase->loadCase( $caseId );
$appFields['APP_DATA'] = $oPMScript->aFields; $appFields['APP_DATA'] = $oPMScript->aFields;
$oCase->updateCase ( $caseId, $appFields ); $oCase->updateCase ( $caseId, $appFields );
@@ -1546,7 +1552,7 @@ class wsBase
foreach ($aTriggers as $aTrigger) { foreach ($aTriggers as $aTrigger) {
//$appFields = $oCase->loadCase( $caseId ); //$appFields = $oCase->loadCase( $caseId );
//$appFields['APP_DATA']['APPLICATION'] = $caseId; //$appFields['APP_DATA']['APPLICATION'] = $caseId;
//@Neyek ############################################################################################# //@Neyek #############################################################################################
if (!$this->stored_system_variables) { if (!$this->stored_system_variables) {
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants()); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants());
@@ -1556,18 +1562,18 @@ class wsBase
$oParams->option = "STORED SESSION"; $oParams->option = "STORED SESSION";
$oParams->SID = $this->wsSessionId; $oParams->SID = $this->wsSessionId;
$oParams->appData = $appFields["APP_DATA"]; $oParams->appData = $appFields["APP_DATA"];
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants($oParams)); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants($oParams));
} }
//#################################################################################################### //####################################################################################################
$oPMScript->setFields( $appFields['APP_DATA'] ); $oPMScript->setFields( $appFields['APP_DATA'] );
$bExecute = true; $bExecute = true;
if ($aTrigger['ST_CONDITION'] !== '') { if ($aTrigger['ST_CONDITION'] !== '') {
$oPMScript->setScript($aTrigger['ST_CONDITION']); $oPMScript->setScript($aTrigger['ST_CONDITION']);
$bExecute = $oPMScript->evaluate(); $bExecute = $oPMScript->evaluate();
} }
if ($bExecute) { if ($bExecute) {
$oPMScript->setScript($aTrigger['TRI_WEBBOT']); $oPMScript->setScript($aTrigger['TRI_WEBBOT']);
$oPMScript->execute(); $oPMScript->execute();
@@ -1599,24 +1605,24 @@ class wsBase
$result = new wsResponse (15, G::loadTranslation ('ID_TASK_DEFINED_MANUAL_ASSIGNMENT')); $result = new wsResponse (15, G::loadTranslation ('ID_TASK_DEFINED_MANUAL_ASSIGNMENT'));
return $result; return $result;
} }
//Routed to the next task, if end process then not exist user //Routed to the next task, if end process then not exist user
$nodeNext = array(); $nodeNext = array();
$usrasgdUid = null; $usrasgdUid = null;
$usrasgdUserName = null; $usrasgdUserName = null;
if (isset($val['NEXT_TASK']['USER_ASSIGNED'])) { if (isset($val['NEXT_TASK']['USER_ASSIGNED'])) {
$usrasgdUid = $val['NEXT_TASK']['USER_ASSIGNED']['USR_UID']; $usrasgdUid = $val['NEXT_TASK']['USER_ASSIGNED']['USR_UID'];
$usrasgdUserName = '(' . $val['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME'] . ')'; $usrasgdUserName = '(' . $val['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME'] . ')';
} }
$nodeNext['TAS_UID'] = $val['NEXT_TASK']['TAS_UID']; $nodeNext['TAS_UID'] = $val['NEXT_TASK']['TAS_UID'];
$nodeNext['USR_UID'] = $usrasgdUid; $nodeNext['USR_UID'] = $usrasgdUid;
$nodeNext['TAS_ASSIGN_TYPE'] = $val['NEXT_TASK']['TAS_ASSIGN_TYPE']; $nodeNext['TAS_ASSIGN_TYPE'] = $val['NEXT_TASK']['TAS_ASSIGN_TYPE'];
$nodeNext['TAS_DEF_PROC_CODE'] = $val['NEXT_TASK']['TAS_DEF_PROC_CODE']; $nodeNext['TAS_DEF_PROC_CODE'] = $val['NEXT_TASK']['TAS_DEF_PROC_CODE'];
$nodeNext['DEL_PRIORITY'] = $appdel['DEL_PRIORITY']; $nodeNext['DEL_PRIORITY'] = $appdel['DEL_PRIORITY'];
$nodeNext['TAS_PARENT'] = $val['NEXT_TASK']['TAS_PARENT']; $nodeNext['TAS_PARENT'] = $val['NEXT_TASK']['TAS_PARENT'];
$nextDelegations[] = $nodeNext; $nextDelegations[] = $nodeNext;
$varResponse = $varResponse . (($varResponse != '')? ',' : '') . $val['NEXT_TASK']['TAS_TITLE'] . $usrasgdUserName; $varResponse = $varResponse . (($varResponse != '')? ',' : '') . $val['NEXT_TASK']['TAS_TITLE'] . $usrasgdUserName;
} }
@@ -1660,7 +1666,7 @@ class wsBase
if (count($aTriggers) > 0) { if (count($aTriggers) > 0) {
$oPMScript = new PMScript(); $oPMScript = new PMScript();
//$appFields['APP_DATA']['APPLICATION'] = $caseId; //$appFields['APP_DATA']['APPLICATION'] = $caseId;
//@Neyek ############################################################################################# //@Neyek #############################################################################################
if (!$this->stored_system_variables) { if (!$this->stored_system_variables) {
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants()); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants());
@@ -1670,11 +1676,11 @@ class wsBase
$oParams->option = "STORED SESSION"; $oParams->option = "STORED SESSION";
$oParams->SID = $this->wsSessionId; $oParams->SID = $this->wsSessionId;
$oParams->appData = $appFields["APP_DATA"]; $oParams->appData = $appFields["APP_DATA"];
$appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants($oParams)); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], G::getSystemConstants($oParams));
} }
//#################################################################################################### //####################################################################################################
$oPMScript->setFields( $appFields['APP_DATA'] ); $oPMScript->setFields( $appFields['APP_DATA'] );
$varTriggers .= "<b>-= After Derivation =-</b><br/>"; $varTriggers .= "<b>-= After Derivation =-</b><br/>";
foreach ($aTriggers as $aTrigger) { foreach ($aTriggers as $aTrigger) {
@@ -1699,11 +1705,11 @@ class wsBase
$oUser = new Users(); $oUser = new Users();
$aUser = $oUser->load($userId); $aUser = $oUser->load($userId);
if (trim($aUser['USR_EMAIL'])=='') { if (trim($aUser['USR_EMAIL'])=='') {
$aUser['USR_EMAIL'] = 'info@'.$_SERVER['HTTP_HOST']; $aUser['USR_EMAIL'] = 'info@'.$_SERVER['HTTP_HOST'];
} }
$sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <'.$aUser['USR_EMAIL'].'>'; $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <'.$aUser['USR_EMAIL'].'>';
$oCase->sendNotifications($appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName); $oCase->sendNotifications($appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName);
@@ -1711,8 +1717,8 @@ class wsBase
//$appFields = $oCase->loadCase( $caseId ); //$appFields = $oCase->loadCase( $caseId );
//$oCase->updateCase ( $caseId, $appFields ); //$oCase->updateCase ( $caseId, $appFields );
//Save data - End //Save data - End
$oProcess = new Process(); $oProcess = new Process();
$oProcessFieds = $oProcess->Load($appFields['PRO_UID']); $oProcessFieds = $oProcess->Load($appFields['PRO_UID']);
//here dubug mode in web entry //here dubug mode in web entry
@@ -1722,7 +1728,7 @@ class wsBase
else{ else{
$result = new wsResponse (0, $varResponse." --- ".$oProcessFieds['PRO_DEBUG']); $result = new wsResponse (0, $varResponse." --- ".$oProcessFieds['PRO_DEBUG']);
} }
$res = $result->getPayloadArray (); $res = $result->getPayloadArray ();
//now fill the array of AppDelegationPeer //now fill the array of AppDelegationPeer
@@ -1772,7 +1778,7 @@ class wsBase
$currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS']; $currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS'];
$aCurrentUsers[] = $currentUser; $aCurrentUsers[] = $currentUser;
} }
$res['routing'] = $aCurrentUsers; $res['routing'] = $aCurrentUsers;
return $res; return $res;
} }
@@ -1781,12 +1787,12 @@ class wsBase
return $result; return $result;
} }
} }
/* /*
* execute Trigger, executes a ProcessMaker trigger. Note that triggers which are tied to case derivation will executing automatically. * execute Trigger, executes a ProcessMaker trigger. Note that triggers which are tied to case derivation will executing automatically.
* @param string $userId * @param string $userId
* @param string $caseId * @param string $caseId
* @param string $delIndex * @param string $delIndex
* @return $result will return an object * @return $result will return an object
*/ */
public function executeTrigger($userId, $caseId, $triggerIndex, $delIndex) { public function executeTrigger($userId, $caseId, $triggerIndex, $delIndex) {
@@ -1872,7 +1878,7 @@ class wsBase
/* /*
* task Case * task Case
* @param string sessionId : The session ID which is obtained when logging in * @param string sessionId : The session ID which is obtained when logging in
* @param string caseId : The case ID. The caseList() function can be used to find the ID number for cases * @param string caseId : The case ID. The caseList() function can be used to find the ID number for cases
* @return $result returns the current task for a given case. Note that the logged-in user must have privileges to access the task * @return $result returns the current task for a given case. Note that the logged-in user must have privileges to access the task
*/ */
public function taskCase( $caseId ) { public function taskCase( $caseId ) {
@@ -1941,9 +1947,9 @@ class wsBase
* @param string caseId : The case ID (which can be obtained with the caseList() function) * @param string caseId : The case ID (which can be obtained with the caseList() function)
* @param string delIndex : The delegation index number of the case (which can be obtained with the caseList() function). * @param string delIndex : The delegation index number of the case (which can be obtained with the caseList() function).
* @param string userIdSource : The user who is currently assigned the case. * @param string userIdSource : The user who is currently assigned the case.
* @param string userIdTarget : The target user who will be newly assigned to the case. * @param string userIdTarget : The target user who will be newly assigned to the case.
* @return $result will return an object * @return $result will return an object
*/ */
public function reassignCase( $sessionId, $caseId, $delIndex, $userIdSource, $userIdTarget ){ public function reassignCase( $sessionId, $caseId, $delIndex, $userIdSource, $userIdTarget ){
try { try {
if ( $userIdTarget == $userIdSource ) { if ( $userIdTarget == $userIdSource ) {
@@ -2039,9 +2045,9 @@ class wsBase
/* /*
* get system information * get system information
* @param string sessionId : The session ID (which was obtained at login) * @param string sessionId : The session ID (which was obtained at login)
* @return $eturns information about the WAMP/LAMP stack, the workspace database, the IP number and version of ProcessMaker, and the IP number and version of web browser of the user * @return $eturns information about the WAMP/LAMP stack, the workspace database, the IP number and version of ProcessMaker, and the IP number and version of web browser of the user
*/ */
public function systemInformation() { public function systemInformation() {
try { try {
define ( 'SKIP_RENDER_SYSTEM_INFORMATION', true ); define ( 'SKIP_RENDER_SYSTEM_INFORMATION', true );
@@ -2062,7 +2068,7 @@ class wsBase
$result->availableDatabases = $Fields['AVAILABLE_DB']; $result->availableDatabases = $Fields['AVAILABLE_DB'];
$result->userBrowser = $Fields['HTTP_USER_AGENT']; $result->userBrowser = $Fields['HTTP_USER_AGENT'];
$result->userIp = $Fields['IP']; $result->userIp = $Fields['IP'];
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
@@ -2078,9 +2084,9 @@ class wsBase
* @param string version : * @param string version :
* @param string importOption : * @param string importOption :
* @param string usernameLibrary : The username to obtain access to the ProcessMaker library. * @param string usernameLibrary : The username to obtain access to the ProcessMaker library.
* @param string passwordLibrary : The password to obtain access to the ProcessMaker library. * @param string passwordLibrary : The password to obtain access to the ProcessMaker library.
* @return $eturns will return an object * @return $eturns will return an object
*/ */
public function importProcessFromLibrary ( $processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '' ) { public function importProcessFromLibrary ( $processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '' ) {
try { try {
G::LoadClass('processes'); G::LoadClass('processes');
@@ -2097,13 +2103,13 @@ class wsBase
$privacy = $oProcess->privacy; $privacy = $oProcess->privacy;
$strSession = ''; $strSession = '';
if ( $privacy != 'FREE' ) { if ( $privacy != 'FREE' ) {
global $sessionId; global $sessionId;
$antSession = $sessionId; $antSession = $sessionId;
$oProcesses->ws_open ($usernameLibrary, $passwordLibrary ); $oProcesses->ws_open ($usernameLibrary, $passwordLibrary );
$strSession = "&s=" . $sessionId; $strSession = "&s=" . $sessionId;
$sessionId = $antSession; $sessionId = $antSession;
} }
//downloading the file //downloading the file
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP ; $localPath = PATH_DOCUMENT . 'input' . PATH_SEP ;
@@ -2129,7 +2135,7 @@ class wsBase
//if the process exists, we need to check the $importOption to and re-import if the user wants, //if the process exists, we need to check the $importOption to and re-import if the user wants,
if ( $oProcess->processExists ( $sProUid ) ) { if ( $oProcess->processExists ( $sProUid ) ) {
//Update the current Process, overwriting all tasks and steps //Update the current Process, overwriting all tasks and steps
if ( $importOption == 1 ) { if ( $importOption == 1 ) {
$oProcess->updateProcessFromData ($oData, $localPath . $newfilename ); $oProcess->updateProcessFromData ($oData, $localPath . $newfilename );
@@ -2145,7 +2151,7 @@ class wsBase
} }
$sNewProUid = $sProUid; $sNewProUid = $sProUid;
} }
//Disable current Process and create a new version of the Process //Disable current Process and create a new version of the Process
if ( $importOption == 2 ) { if ( $importOption == 2 ) {
$oProcess ->disablePreviousProcesses( $sProUid ); $oProcess ->disablePreviousProcesses( $sProUid );
@@ -2156,7 +2162,7 @@ class wsBase
$oProcess ->renewAll ( $oData ); $oProcess ->renewAll ( $oData );
$oProcess ->createProcessFromData ($oData, $localPath . $newfilename ); $oProcess ->createProcessFromData ($oData, $localPath . $newfilename );
} }
//Create a completely new Process without change the current Process //Create a completely new Process without change the current Process
if ( $importOption == 3 ) { if ( $importOption == 3 ) {
//krumo ($oData); die; //krumo ($oData); die;
@@ -2176,7 +2182,7 @@ class wsBase
if ( ! $oProcess->processExists ( $processId ) ) { if ( ! $oProcess->processExists ( $processId ) ) {
$oProcess->createProcessFromData ($oData, $localPath . $newfilename ); $oProcess->createProcessFromData ($oData, $localPath . $newfilename );
} }
//show the info after the imported process //show the info after the imported process
$oProcess = new Processes(); $oProcess = new Processes();
$oProcess ->ws_open_public (); $oProcess ->ws_open_public ();
@@ -2189,7 +2195,7 @@ class wsBase
$result ->processTitle = $processData->title; $result ->processTitle = $processData->title;
$result ->category = (isset($processData->category) ? $processData->category : ''); $result ->category = (isset($processData->category) ? $processData->category : '');
$result ->version = $processData->version; $result ->version = $processData->version;
return $result; return $result;
} }
catch ( Exception $e ) { catch ( Exception $e ) {
@@ -2197,7 +2203,7 @@ class wsBase
return $result; return $result;
} }
} }
public function getCaseNotes ($applicationID, $userUid = '') { public function getCaseNotes ($applicationID, $userUid = '') {
try { try {
G::LoadClass('case'); G::LoadClass('case');

View File

@@ -104,20 +104,20 @@ class Application extends BaseApplication {
public function isEmptyInContent ( $content, $field, $lang ) { public function isEmptyInContent ( $content, $field, $lang ) {
if ( isset ( $content[$field][ $lang ] ) ) { if ( isset ( $content[$field][ $lang ] ) ) {
if ( trim( $content[$field][ $lang ] ) != '' ) if ( trim( $content[$field][ $lang ] ) != '' )
return false; return false;
}; };
return true; return true;
} }
public function updateInsertContent ( $content, $field, $value ) { public function updateInsertContent ( $content, $field, $value ) {
if ( isset ( $content[$field][ 'en' ] ) ) { if ( isset ( $content[$field][ 'en' ] ) ) {
//update //update
$con = ContentPeer::retrieveByPK ( $field, '', $this->getAppUid(), 'en' ); $con = ContentPeer::retrieveByPK ( $field, '', $this->getAppUid(), 'en' );
$con->setConValue ( $value ); $con->setConValue ( $value );
if ($con->validate ()) { if ($con->validate ()) {
$res = $con->save (); $res = $con->save ();
} }
} }
else {//insert else {//insert
$con = new Content ( ); $con = new Content ( );
@@ -127,10 +127,10 @@ class Application extends BaseApplication {
$con->setConLang ( 'en' ); $con->setConLang ( 'en' );
$con->setConValue ( $value ); $con->setConValue ( $value );
if ($con->validate ()) { if ($con->validate ()) {
$res = $con->save (); $res = $con->save ();
} }
} }
} }
public function normalizeContent( $content, $field , $lang ) { public function normalizeContent( $content, $field , $lang ) {
$value = ''; $value = '';
@@ -140,7 +140,7 @@ class Application extends BaseApplication {
$value = $content [ $field ][ $lang ]; $value = $content [ $field ][ $lang ];
if ( $lang != 'en' ) { if ( $lang != 'en' ) {
$this->updateInsertContent ( $content, $field , $value ); $this->updateInsertContent ( $content, $field , $value );
} }
} }
else { else {
//if the lang row is empty, and 'en' row is not empty return 'en' value //if the lang row is empty, and 'en' row is not empty return 'en' value
@@ -152,13 +152,13 @@ class Application extends BaseApplication {
if ( $this->isEmptyInContent ( $content, $field , 'en' ) ) { if ( $this->isEmptyInContent ( $content, $field , 'en' ) ) {
if ( isset($content[$field]) && is_array ($content[$field] ) ) { if ( isset($content[$field]) && is_array ($content[$field] ) ) {
foreach ( $content [ $field ] as $lan => $val ) { foreach ( $content [ $field ] as $lan => $val ) {
if ( trim ( $val ) != '' ) { if ( trim ( $val ) != '' ) {
$value = $val; $value = $val;
if ( $lan != 'en' ) { if ( $lan != 'en' ) {
$this->updateInsertContent ( $content, $field , $value ); $this->updateInsertContent ( $content, $field , $value );
continue; continue;
} }
} }
} }
} }
else { else {
@@ -167,7 +167,7 @@ class Application extends BaseApplication {
} }
} }
return $value; return $value;
} }
/** /**
* Get the [app_description] , [app_title] column values. * Get the [app_description] , [app_title] column values.
@@ -181,8 +181,8 @@ class Application extends BaseApplication {
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$c = new Criteria(); $c = new Criteria();
$c->clearSelectColumns(); $c->clearSelectColumns();
$c->addSelectColumn( ContentPeer::CON_CATEGORY ); $c->addSelectColumn( ContentPeer::CON_CATEGORY );
$c->addSelectColumn( ContentPeer::CON_LANG ); $c->addSelectColumn( ContentPeer::CON_LANG );
$c->addSelectColumn( ContentPeer::CON_VALUE ); $c->addSelectColumn( ContentPeer::CON_VALUE );
$c->add( ContentPeer::CON_ID, $this->getAppUid() ); $c->add( ContentPeer::CON_ID, $this->getAppUid() );
//$c->add( ContentPeer::CON_LANG, $lang ); //$c->add( ContentPeer::CON_LANG, $lang );
@@ -201,7 +201,7 @@ class Application extends BaseApplication {
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
} }
$appTitle = $this->normalizeContent( $content, 'APP_TITLE', $lang ); $appTitle = $this->normalizeContent( $content, 'APP_TITLE', $lang );
$appDescription = $this->normalizeContent( $content, 'APP_DESCRIPTION', $lang ); $appDescription = $this->normalizeContent( $content, 'APP_DESCRIPTION', $lang );
@@ -288,7 +288,7 @@ class Application extends BaseApplication {
if (is_object($oApplication) && get_class ($oApplication) == 'Application' ) { if (is_object($oApplication) && get_class ($oApplication) == 'Application' ) {
$aFields = $oApplication->toArray(BasePeer::TYPE_FIELDNAME); $aFields = $oApplication->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray ($aFields, BasePeer::TYPE_FIELDNAME ); $this->fromArray ($aFields, BasePeer::TYPE_FIELDNAME );
//this is the new function to optimize content queries //this is the new function to optimize content queries
$aContentFields = $oApplication->getContentFields(); $aContentFields = $oApplication->getContentFields();
@@ -335,13 +335,12 @@ class Application extends BaseApplication {
$this->setAppCurUser ( $sUsrUid ); $this->setAppCurUser ( $sUsrUid );
$this->setAppCreateDate( 'now' ); $this->setAppCreateDate( 'now' );
$this->setAppInitDate ( 'now' ); $this->setAppInitDate ( 'now' );
$this->setAppFinishDate( '19020101' ); //to do: what is the empty date for propel???/
$this->setAppUpdateDate( 'now' ); $this->setAppUpdateDate( 'now' );
$pin = G::generateCode( 4, 'ALPHANUMERIC'); $pin = G::generateCode( 4, 'ALPHANUMERIC');
$this->setAppData ( serialize ( array('PIN'=>$pin) ) ); $this->setAppData ( serialize ( array('PIN'=>$pin) ) );
$this->setAppPin ( md5($pin) ); $this->setAppPin ( md5($pin) );
$c = new Criteria(); $c = new Criteria();
$c->clearSelectColumns(); $c->clearSelectColumns();
$c->addSelectColumn( 'MAX(' . ApplicationPeer::APP_NUMBER . ')' ); //the appnumber is based in all processes active, not only in the specified process guid $c->addSelectColumn( 'MAX(' . ApplicationPeer::APP_NUMBER . ')' ); //the appnumber is based in all processes active, not only in the specified process guid
@@ -367,7 +366,7 @@ class Application extends BaseApplication {
$con->commit(); $con->commit();
return $this->getAppUid(); return $this->getAppUid();
} }
else { else {
$msg = ''; $msg = '';
foreach($this->getValidationFailures() as $objValidationFailure) foreach($this->getValidationFailures() as $objValidationFailure)
$msg .= $objValidationFailure->getMessage() . "<br/>"; $msg .= $objValidationFailure->getMessage() . "<br/>";
@@ -479,7 +478,6 @@ class Application extends BaseApplication {
$this->setAppCurUser ( $aData['USR_UID'] ); $this->setAppCurUser ( $aData['USR_UID'] );
$this->setAppCreateDate(isset($aData['APP_CREATE_DATE'])? $aData['APP_CREATE_DATE'] : 'now' ); $this->setAppCreateDate(isset($aData['APP_CREATE_DATE'])? $aData['APP_CREATE_DATE'] : 'now' );
$this->setAppInitDate (isset($aData['APP_INIT_DATE']) ? $aData['APP_INIT_DATE'] : 'now' ); $this->setAppInitDate (isset($aData['APP_INIT_DATE']) ? $aData['APP_INIT_DATE'] : 'now' );
//$this->setAppFinishDate(isset($aData['APP_FINISH_DATE'])? $aData['APP_FINISH_DATE'] : '' );
$this->setAppUpdateDate(isset($aData['APP_UPDATE_DATE'])? $aData['APP_UPDATE_DATE'] : 'now' ); $this->setAppUpdateDate(isset($aData['APP_UPDATE_DATE'])? $aData['APP_UPDATE_DATE'] : 'now' );
//$this->setAppData ( serialize ( array() ) ); //$this->setAppData ( serialize ( array() ) );

View File

@@ -33,7 +33,7 @@
<column name="APP_CUR_USER" type="VARCHAR" size="32" required="true" default=""/> <column name="APP_CUR_USER" type="VARCHAR" size="32" required="true" default=""/>
<column name="APP_CREATE_DATE" type="TIMESTAMP" required="true"/> <column name="APP_CREATE_DATE" type="TIMESTAMP" required="true"/>
<column name="APP_INIT_DATE" type="TIMESTAMP" required="true"/> <column name="APP_INIT_DATE" type="TIMESTAMP" required="true"/>
<column name="APP_FINISH_DATE" type="TIMESTAMP" required="true"/> <column name="APP_FINISH_DATE" type="TIMESTAMP" required="false"/>
<column name="APP_UPDATE_DATE" type="TIMESTAMP" required="true"/> <column name="APP_UPDATE_DATE" type="TIMESTAMP" required="true"/>
<column name="APP_DATA" type="LONGVARCHAR" required="true"/> <column name="APP_DATA" type="LONGVARCHAR" required="true"/>
<column name="APP_PIN" type="VARCHAR" size="32" required="true" default=""/> <column name="APP_PIN" type="VARCHAR" size="32" required="true" default=""/>
@@ -1172,7 +1172,7 @@
<column name="TAS_EVN_UID" type="VARCHAR" size="32" required="true" default=""/> <column name="TAS_EVN_UID" type="VARCHAR" size="32" required="true" default=""/>
<column name="TAS_BOUNDARY" type="VARCHAR" size="32" required="true" default=""/> <column name="TAS_BOUNDARY" type="VARCHAR" size="32" required="true" default=""/>
<column name="TAS_DERIVATION_SCREEN_TPL" type="VARCHAR" size="128" default="" required="false"/> <column name="TAS_DERIVATION_SCREEN_TPL" type="VARCHAR" size="128" default="" required="false"/>
<validator column="TAS_TYPE"> <validator column="TAS_TYPE">
<rule name="validValues" value="NORMAL|ADHOC|SUBPROCESS|HIDDEN" message="Please select a valid value for TAS_TYPE."/> <rule name="validValues" value="NORMAL|ADHOC|SUBPROCESS|HIDDEN" message="Please select a valid value for TAS_TYPE."/>
</validator> </validator>

View File

@@ -13,7 +13,7 @@ SELECT
APP_DELEGATION.TAS_UID, APP_DELEGATION.TAS_UID,
APP_DELEGATION.PRO_UID, APP_DELEGATION.PRO_UID,
substring(APP_DELEGATION.DEL_DELEGATE_DATE,1,19), substring(APP_DELEGATION.DEL_DELEGATE_DATE,1,19),
substring(APP_DELEGATION.DEL_INIT_DATE,1,19), substring(APP_DELEGATION.DEL_INIT_DATE,1,19),
substring(APP_DELEGATION.DEL_TASK_DUE_DATE,1,19), substring(APP_DELEGATION.DEL_TASK_DUE_DATE,1,19),
substring(APP_DELEGATION.DEL_FINISH_DATE,1,19), substring(APP_DELEGATION.DEL_FINISH_DATE,1,19),
APP_DELEGATION.DEL_THREAD_STATUS, APP_DELEGATION.DEL_THREAD_STATUS,
@@ -31,13 +31,13 @@ SELECT
if( APP_DELEGATION.DEL_FINISH_DATE IS NULL , 0 , 1 ), if( APP_DELEGATION.DEL_FINISH_DATE IS NULL , 0 , 1 ),
APP_DELEGATION.DEL_DELAYED, APP_DELEGATION.DEL_DELAYED,
APPLICATION.APP_CREATE_DATE, APPLICATION.APP_CREATE_DATE,
NULL, IF (APPLICATION.APP_STATUS = 'COMPLETED', APPLICATION.APP_FINISH_DATE, NULL),
APPLICATION.APP_UPDATE_DATE, APPLICATION.APP_UPDATE_DATE,
APP_DELEGATION.APP_OVERDUE_PERCENTAGE APP_DELEGATION.APP_OVERDUE_PERCENTAGE
FROM FROM
APPLICATION APPLICATION
LEFT JOIN APP_DELEGATION ON (APPLICATION.APP_UID=APP_DELEGATION.APP_UID) LEFT JOIN APP_DELEGATION ON (APPLICATION.APP_UID=APP_DELEGATION.APP_UID)
LEFT JOIN TASK ON (APP_DELEGATION.TAS_UID=TASK.TAS_UID) LEFT JOIN TASK ON (APP_DELEGATION.TAS_UID=TASK.TAS_UID)
LEFT JOIN USERS ON (APP_DELEGATION.USR_UID=USERS.USR_UID) LEFT JOIN USERS ON (APP_DELEGATION.USR_UID=USERS.USR_UID)
LEFT JOIN APP_THREAD ON (APPLICATION.APP_UID=APP_THREAD.APP_UID AND APP_DELEGATION.DEL_THREAD=APP_THREAD.APP_THREAD_INDEX) LEFT JOIN APP_THREAD ON (APPLICATION.APP_UID=APP_THREAD.APP_UID AND APP_DELEGATION.DEL_THREAD=APP_THREAD.APP_THREAD_INDEX)
LEFT JOIN CONTENT APP_TITLE ON (APPLICATION.APP_UID=APP_TITLE.CON_ID AND APP_TITLE.CON_CATEGORY='APP_TITLE' AND APP_TITLE.CON_LANG = @DEFAULT_LANG) LEFT JOIN CONTENT APP_TITLE ON (APPLICATION.APP_UID=APP_TITLE.CON_ID AND APP_TITLE.CON_CATEGORY='APP_TITLE' AND APP_TITLE.CON_LANG = @DEFAULT_LANG)

View File

@@ -4,19 +4,20 @@ FOR EACH ROW
BEGIN BEGIN
DECLARE APP_STATUS VARCHAR(32); DECLARE APP_STATUS VARCHAR(32);
SELECT APPLICATION.APP_STATUS into @APP_STATUS FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1; DECLARE APP_FINISH_DATE DATETIME;
SELECT APPLICATION.APP_STATUS into @APP_STATUS FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
IF(OLD.APP_STATUS<>NEW.APP_STATUS) THEN IF(OLD.APP_STATUS<>NEW.APP_STATUS) THEN
SET @APP_STATUS = NEW.APP_STATUS; SET @APP_STATUS = NEW.APP_STATUS;
UPDATE APP_CACHE_VIEW SET APP_STATUS = @APP_STATUS WHERE APP_UID = NEW.APP_UID; UPDATE APP_CACHE_VIEW SET APP_STATUS = @APP_STATUS WHERE APP_UID = NEW.APP_UID;
END IF; END IF;
IF(OLD.APP_DATA<>NEW.APP_DATA) THEN IF(OLD.APP_DATA<>NEW.APP_DATA) THEN
UPDATE APP_CACHE_VIEW SET APP_UPDATE_DATE = NOW() WHERE APP_UID = NEW.APP_UID;
UPDATE APP_CACHE_VIEW SET APP_UPDATE_DATE = NOW() WHERE APP_UID = NEW.APP_UID;
END IF; END IF;
IF (NEW.APP_STATUS = 'COMPLETED') THEN
UPDATE APP_CACHE_VIEW SET APP_FINISH_DATE = NEW.APP_FINISH_DATE WHERE APP_UID = NEW.APP_UID;
END IF;
END END