diff --git a/workflow/engine/Features/ActionsByEmail/ActionsByEmailService.php b/workflow/engine/Features/ActionsByEmail/ActionsByEmailService.php index b590aa164..3e3aa346f 100644 --- a/workflow/engine/Features/ActionsByEmail/ActionsByEmailService.php +++ b/workflow/engine/Features/ActionsByEmail/ActionsByEmailService.php @@ -35,7 +35,7 @@ class ActionsByEmailService if ($params['type'] != 'activity' || !\PMLicensedFeatures ::getSingleton() - ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) + ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { return false; } diff --git a/workflow/engine/Features/ActionsByEmail/Services/dataField.php b/workflow/engine/Features/ActionsByEmail/Services/dataField.php deleted file mode 100644 index 84133552f..000000000 --- a/workflow/engine/Features/ActionsByEmail/Services/dataField.php +++ /dev/null @@ -1,109 +0,0 @@ -loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); - - if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) { - $dataField = array(); - $dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE']; - $caseFieldsABE ['APP_DATA'] = array_merge ( $caseFieldsABE ['APP_DATA'], $dataField ); - - $dataResponses = array(); - $dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER']; - $dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR']; - $dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']); - $dataResponses['ABE_RES_STATUS'] = 'PENDING'; - $dataResponses['ABE_RES_MESSAGE'] = ''; - - try { - set_include_path(PATH_PLUGINS . 'actionsByEmail' . PATH_SEPARATOR . get_include_path()); - require_once 'classes/model/AbeResponses.php'; - $abeAbeResponsesInstance = new AbeResponses(); - $dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses); - } catch (Exception $error) { - throw $error; - } - - $cases->updateCase($_REQUEST['APP_UID'], $caseFieldsABE); - - G::LoadClass('wsBase'); - - $ws = new wsBase(); - - $result = $ws->derivateCase($caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true); - $code = (is_array($result) ? $result['status_code'] : $result->status_code); - - if ($code != 0 ) { - throw new Exception('An error occurred while the application was being processed.

- Error code: '.$result->status_code.'
- Error message: '.$result->message.'

'); - } - - // Update - $dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR'); - $dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message); - - try { - $abeAbeResponsesInstance = new AbeResponses(); - $abeAbeResponsesInstance->createOrUpdate($dataResponses); - } catch (Exception $error) { - throw $error; - } - - $message = 'The answer has been submited. Thank you'; - - //Save Cases Notes - include_once 'utils.php'; - - $dataAbeRequests = loadAbeRequest($_REQUEST['ABER']); - $dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']); - - if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) { - $response = new stdclass(); - $response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED']; - $response->appUid = $_REQUEST['APP_UID']; - $response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO']; - - postNote($response); - } - - $dataAbeRequests['ABE_REQ_ANSWERED'] = 1; - $code == 0 ? uploadAbeRequest($dataAbeRequests) : ''; - } else { - $message = 'The response has already been sent.'; - } - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message)); -} catch (Exception $error) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage() . 'Please contact to your system administrator.')); -} - -G::RenderPage('publish', 'blank'); - diff --git a/workflow/engine/Features/ActionsByEmail/Services/dataForm.php b/workflow/engine/Features/ActionsByEmail/Services/dataForm.php deleted file mode 100644 index 8f016ba4d..000000000 --- a/workflow/engine/Features/ActionsByEmail/Services/dataForm.php +++ /dev/null @@ -1,39 +0,0 @@ -loadCase(G::decrypt($_REQUEST['APP_UID'], URL_KEY),G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY)); - - if (is_null($caseFields['DEL_FINISH_DATE'])) { - $action = 'dataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER']; - $G_PUBLISH->AddContent('dynaform', 'xmlform', $caseFields['PRO_UID'] . PATH_SEP . G::decrypt($_REQUEST['DYN_UID'], URL_KEY), '', $caseFields['APP_DATA'], $action, '../../gulliver/defaultAjaxDynaform'); - } else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => 'The form has already been filled and sent.')); - } -} catch (Exception $error) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $error->getMessage())); -} - -G::RenderPage('publish', 'blank'); - diff --git a/workflow/engine/Features/ActionsByEmail/Services/dataFormPost.php b/workflow/engine/Features/ActionsByEmail/Services/dataFormPost.php deleted file mode 100644 index 6a650784b..000000000 --- a/workflow/engine/Features/ActionsByEmail/Services/dataFormPost.php +++ /dev/null @@ -1,202 +0,0 @@ -loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); - - $casesFields['APP_DATA'] = array_merge($casesFields['APP_DATA'], $_REQUEST['form']); - - //Get user info - $current_user_uid = null; - $currentUsrName = null; - - $criteria = new Criteria("workflow"); - - $criteria->addSelectColumn(AppDelegationPeer::USR_UID); - $criteria->add(AppDelegationPeer::APP_UID, $_REQUEST["APP_UID"]); - $criteria->add(AppDelegationPeer::DEL_INDEX, $_REQUEST["DEL_INDEX"]); - - $rsSQL = AppDelegationPeer::doSelectRS($criteria); - $rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - while ($rsSQL->next()) { - $row = $rsSQL->getRow(); - - $current_user_uid = $row["USR_UID"]; - } - - if ($current_user_uid != null) { - $criteria = new Criteria("workflow"); - - $criteria->addSelectColumn(UsersPeer::USR_USERNAME); - $criteria->add(UsersPeer::USR_UID, $current_user_uid); - - $rsSQL = UsersPeer::doSelectRS($criteria); - $rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $rsSQL->next(); - - $row = $rsSQL->getRow(); - $currentUsrName = $row["USR_USERNAME"]; - - $casesFields["APP_DATA"]["USER_LOGGED"] = $current_user_uid; - $casesFields["APP_DATA"]["USR_USERNAME"] = $currentUsrName; - } - - foreach ($casesFields["APP_DATA"] as $index => $value) { - $_SESSION[$index] = $value; - } - - //Update case info - $case->updateCase($_REQUEST['APP_UID'], $casesFields); - - G::LoadClass('wsBase'); - - $wsBaseInstance = new wsBase(); - $result = $wsBaseInstance->derivateCase($casesFields['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST ['DEL_INDEX'], true); - $code = (is_array($result) ? $result['status_code'] : $result->status_code); - - $dataResponses = array(); - $dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER']; - $dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR']; - $dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['form']); - $dataResponses['ABE_RES_STATUS'] = 'PENDING'; - $dataResponses['ABE_RES_MESSAGE'] = ''; - - try { - set_include_path(PATH_PLUGINS . 'actionsByEmail' . PATH_SEPARATOR . get_include_path()); - require_once 'classes/model/AbeResponses.php'; - - $abeAbeResponsesInstance = new AbeResponses(); - $dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses); - } catch (Exception $error) { - throw $error; - } - - if ($code == 0) { - //Save Cases Notes - include_once 'utils.php'; - - $dataAbeRequests = loadAbeRequest($_REQUEST['ABER']); - $dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']); - - if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) { - $response = new stdclass(); - $response->usrUid = $casesFields['APP_DATA']['USER_LOGGED']; - $response->appUid = $_REQUEST['APP_UID']; - $response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO']; - - postNote($response); - } - - $dataAbeRequests['ABE_REQ_ANSWERED'] = 1; - $code == 0 ? uploadAbeRequest($dataAbeRequests) : ''; - - if (isset ( $_FILES ['form'] )) { - foreach ($_FILES ['form'] ['name'] as $fieldName => $value) { - if ($_FILES ['form'] ['error'] [$fieldName] == 0) { - $appDocument = new AppDocument ( ); - - if ( isset ( $_REQUEST['INPUTS'] [$fieldName] ) && $_REQUEST['INPUTS'] [$fieldName] != '' ) { - require_once 'classes/model/AppFolder.php'; - require_once 'classes/model/InputDocument.php'; - - $inputDocument = new InputDocument(); - $id = $inputDocument->load($_REQUEST['INPUTS'] [$fieldName]); - - //Get the Custom Folder ID (create if necessary) - $oFolder=new AppFolder(); - $folderId=$oFolder->createFromPath($id['INP_DOC_DESTINATION_PATH']); - - //Tags - $fileTags=$oFolder->parseTags($id['INP_DOC_TAGS']); - - $fields = array ( - 'APP_UID' => $_REQUEST['APP_UID'], - 'DEL_INDEX' => $_REQUEST ['DEL_INDEX'], - 'USR_UID' => $casesFields['APP_DATA']['USER_LOGGED'], - 'DOC_UID' => $_REQUEST['INPUTS'] [$fieldName], - 'APP_DOC_TYPE' => 'INPUT', - 'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ), - 'APP_DOC_COMMENT' => '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => $_FILES ['form'] ['name'] [$fieldName], - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags - ); - } else { - $fields = array ( - 'APP_UID' => $_REQUEST['APP_UID'], - 'DEL_INDEX' => $_REQUEST ['DEL_INDEX'], - 'USR_UID' => $casesFields['APP_DATA']['USER_LOGGED'], - 'DOC_UID' => - 1, - 'APP_DOC_TYPE' => 'ATTACHED', - 'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ), - 'APP_DOC_COMMENT' => '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => $_FILES ['form'] ['name'] [$fieldName] - ); - } - - $appDocument->create($fields); - $docVersion = $appDocument->getDocVersion(); - $appDocUid = $appDocument->getAppDocUid (); - $info = pathinfo ( $appDocument->getAppDocFilename () ); - $extension = (isset ( $info ['extension'] ) ? $info ['extension'] : ''); - $pathName = PATH_DOCUMENT . $_REQUEST['APP_UID'] . PATH_SEP; - $fileName = $appDocUid . '_'.$docVersion.'.' . $extension; - - G::uploadFile ( $_FILES ['form'] ['tmp_name'] [$fieldName], $pathName, $fileName ); - } - } - } - - $assign = $result['message']; - $aMessage['MESSAGE'] = 'The information was submitted. Thank you.'; - } else { - throw new Exception('An error occurred while the application was being processed.

- Error code: '.$result->status_code.'
- Error message: '.$result->message.'

'); - } - - // Update - $dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR'); - $dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message); - - try { - $abeAbeResponsesInstance = new AbeResponses(); - $abeAbeResponsesInstance->createOrUpdate($dataResponses); - } catch (Exception $error) { - throw $error; - } - - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', $aMessage); -} catch (Exception $error) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage().'Please contact to your system administrator.')); -} - -G::RenderPage('publish', 'blank'); - diff --git a/workflow/engine/Features/ActionsByEmail/actionsByEmail.xml b/workflow/engine/Features/ActionsByEmail/actionsByEmail.xml deleted file mode 100644 index abe67e37a..000000000 --- a/workflow/engine/Features/ActionsByEmail/actionsByEmail.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - <en>Action By Email Plugin</en> - <pt-BR><![CDATA[Ação por Email Plugin]]></pt-BR> - - - There is no further configuration needed. - - - diff --git a/workflow/engine/Features/ActionsByEmail/actionsByEmailAjax.php b/workflow/engine/Features/ActionsByEmail/actionsByEmailAjax.php deleted file mode 100644 index b7a2f51de..000000000 --- a/workflow/engine/Features/ActionsByEmail/actionsByEmailAjax.php +++ /dev/null @@ -1,514 +0,0 @@ -load($Category,'', $Id, $Lang); - - return $value; -} - -// General Validations -if (!isset($_REQUEST['action'])) { - $_REQUEST['action'] = ''; -} - -if (!isset($_REQUEST['limit'])) { - $_REQUEST['limit'] = ''; -} - -if (!isset($_REQUEST['start'])) { - $_REQUEST['start'] = ''; -} - -// Initialize response object -$response = new stdclass(); -$response->status = 'OK'; - -// Main switch -try { - switch ($_REQUEST['action']) { - case 'editTemplate': - // Action Validations - if (!isset($_REQUEST['TEMPLATE'])) { - $_REQUEST['TEMPLATE'] = ''; - } - - if ($_REQUEST['TEMPLATE'] == '') { - throw new Exception('The TEMPLATE parameter is empty.'); - } - - $data = array( - 'CONTENT' => file_get_contents(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE']), - 'TEMPLATE' => $_REQUEST['TEMPLATE'], - ); - - global $G_PUBLISH; - - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/actionsByEmail_FileEdit', '', $data); - - G::RenderPage('publish', 'raw'); - die(); - break; - case 'updateTemplate': - // Action Validations - if (!isset($_REQUEST['TEMPLATE'])) { - $_REQUEST['TEMPLATE'] = ''; - } - - if (!isset($_REQUEST['CONTENT'])) { - $_REQUEST['CONTENT'] = ''; - } - - if ($_REQUEST['TEMPLATE'] == '') { - throw new Exception('The TEMPLATE parameter is empty.'); - } - - $templateFile = fopen(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE'], 'w'); - $content = stripslashes($_REQUEST['CONTENT']); - $content = str_replace('@amp@', '&', $content); - $content = base64_decode($content); - - fwrite($templateFile, $content); - fclose($templateFile); - break; - // comment - case 'loadFields': - if (!isset($_REQUEST['DYN_UID'])) { - $_REQUEST['DYN_UID'] = ''; - } - - if (!isset($_REQUEST['PRO_UID'])) { - $_REQUEST['PRO_UID'] = ''; - } - - $response->emailFields = array(); - $response->actionFields = array(); - - if ($_REQUEST['PRO_UID'] != '' && $_REQUEST['DYN_UID']) { - $dynaform = new Form($_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'], PATH_DYNAFORM, SYS_LANG, false); - - foreach ($dynaform->fields as $fieldName => $data) { - switch($data->type) { - case 'text': - case 'suggest': - case 'hidden': - case 'textarea': - $response->emailFields[] = array('value' => $data->name, 'label' => $data->label . ' (@@' . $data->name . ')'); - break; - case 'dropdown': - case 'radiogroup': - case 'yesno': - case 'checkbox': - $response->actionFields[] = array('value' => $data->name, 'label' => $data->label . ' (@@' . $data->name . ')'); - break; - } - } - } - break; - case 'saveConfiguration': - // Action Validations - if (!isset($_REQUEST['ABE_UID'])) { - $_REQUEST['ABE_UID'] = ''; - } - - if (!isset($_REQUEST['PRO_UID'])) { - $_REQUEST['PRO_UID'] = ''; - } - - if (!isset($_REQUEST['TAS_UID'])) { - $_REQUEST['TAS_UID'] = ''; - } - - if (!isset($_REQUEST['ABE_TYPE'])) { - $_REQUEST['ABE_TYPE'] = ''; - } - - if (!isset($_REQUEST['ABE_TEMPLATE'])) { - $_REQUEST['ABE_TEMPLATE'] = ''; - } - - if (!isset($_REQUEST['DYN_UID'])) { - $_REQUEST['DYN_UID'] = ''; - } - - if (!isset($_REQUEST['ABE_EMAIL_FIELD'])) { - $_REQUEST['ABE_EMAIL_FIELD'] = ''; - } - - if (!isset($_REQUEST['ABE_ACTION_FIELD'])) { - $_REQUEST['ABE_ACTION_FIELD'] = ''; - } - - if (!isset($_REQUEST['ABE_CASE_NOTE_IN_RESPONSE'])) { - $_REQUEST['ABE_CASE_NOTE_IN_RESPONSE'] = 0; - } - - if ($_REQUEST['PRO_UID'] == '') { - throw new Exception('The PRO_UID parameter is empty.'); - } - - if ($_REQUEST['TAS_UID'] == '') { - throw new Exception('The TAS_UID parameter is empty.'); - } - - require_once 'classes/model/AbeConfiguration.php'; - - $abeConfigurationInstance = new AbeConfiguration(); - - if ($_REQUEST['ABE_TYPE'] != '') { - if ($_REQUEST['DYN_UID'] == '') { - throw new Exception('The DYN_UID parameter is empty.'); - } - - try { - $response->ABE_UID = $abeConfigurationInstance->createOrUpdate($_REQUEST); - } catch (Exception $error) { - throw $error; - } - } else { - try { - $abeConfigurationInstance->deleteByTasUid($_REQUEST['TAS_UID']); - $response->ABE_UID = ''; - } catch (Exception $error) { - throw $error; - } - } - break; - case 'loadActionByEmail': - $criteria = new Criteria(); - $criteria->addSelectColumn( 'COUNT(*)'); - - $criteria->addJoin(AbeConfigurationPeer::ABE_UID,AbeRequestsPeer::ABE_UID); - $criteria->addJoin(AppDelegationPeer::APP_UID,AbeRequestsPeer::APP_UID); - $criteria->addJoin(AppDelegationPeer::DEL_INDEX,AbeRequestsPeer::DEL_INDEX); - $result = AbeConfigurationPeer::doSelectRS($criteria); - $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $result->next(); - $totalCount = $result->getRow(); - $totalCount = $totalCount['COUNT(*)']; - - $criteria = new Criteria(); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); - $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); - - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); - $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); - $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE); - - $criteria->addSelectColumn(ApplicationPeer::APP_NUMBER); - - $criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS); - - $criteria->addJoin(AbeConfigurationPeer::ABE_UID,AbeRequestsPeer::ABE_UID); - $criteria->addJoin(ApplicationPeer::APP_UID,AbeRequestsPeer::APP_UID); - - $criteria->addJoin(AppDelegationPeer::APP_UID,AbeRequestsPeer::APP_UID); - $criteria->addJoin(AppDelegationPeer::DEL_INDEX,AbeRequestsPeer::DEL_INDEX); - $criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE); - $criteria->setLimit( $_REQUEST['limit'] ); - $criteria->setOffset( $_REQUEST['start'] ); - $result = AbeConfigurationPeer::doSelectRS($criteria); - $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $data = Array(); - $arrayPro = Array(); - $arrayTAS = Array(); - $index = 0; - - while ($result->next()) { - $data[] = $result->getRow(); - $criteriaRes = new Criteria(); - - $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_UID); - $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_CLIENT_IP); - $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA); - $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_STATUS); - $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_MESSAGE); - - $criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']); - - $resultRes = AbeResponsesPeer::doSelectRS($criteriaRes); - $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $resultRes->next(); - $dataRes = Array(); - - if ($dataRes = $resultRes->getRow()) { - $data[$index]['ABE_RES_UID'] = $dataRes['ABE_RES_UID']; - $data[$index]['ABE_RES_CLIENT_IP'] = $dataRes['ABE_RES_CLIENT_IP']; - $data[$index]['ABE_RES_DATA'] = $dataRes['ABE_RES_DATA']; - $data[$index]['ABE_RES_STATUS'] = $dataRes['ABE_RES_STATUS']; - $data[$index]['ABE_RES_MESSAGE'] = $dataRes['ABE_RES_MESSAGE']; - } else { - $data[$index]['ABE_RES_UID'] = ''; - $data[$index]['ABE_RES_CLIENT_IP'] = ''; - $data[$index]['ABE_RES_DATA'] = ''; - $data[$index]['ABE_RES_STATUS'] = ''; - $data[$index]['ABE_RES_MESSAGE'] = ''; - } - - $criteriaRes = new Criteria(); - - $criteriaRes->addSelectColumn(AppDelegationPeer::USR_UID); - $criteriaRes->addSelectColumn(UsersPeer::USR_FIRSTNAME); - $criteriaRes->addSelectColumn(UsersPeer::USR_LASTNAME); - - $criteria->addJoin(AppDelegationPeer::APP_UID,$data[$index]['APP_UID']); - $criteria->addJoin(AppDelegationPeer::DEL_INDEX,$data[$index]['DEL_PREVIOUS']); - $criteria->addJoin(AppDelegationPeer::USR_UID,UsersPeer::USR_UID); - $resultRes = AppDelegationPeer::doSelectRS($criteriaRes); - $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $resultRes->next(); - - if ($dataRes = $resultRes->getRow()) { - $data[$index]['USER'] = $dataRes['USR_FIRSTNAME']. ' '.$dataRes['USR_LASTNAME']; - } else { - $data[$index]['USER'] = ''; - } - - $data[$index]['ABE_REQ_ANSWERED'] = ($data[$index]['ABE_REQ_ANSWERED'] == 1)? 'YES' : 'NO'; - /* - $swPRO = false; - foreach($arrayPro as $k => $field){ - if($arrayPro[$k]['PRO_UID'] == $data[$index]['PRO_UID'] && $arrayPro[$k]['LANG'] == SYS_LANG){ - $data[$index]['PRO_TITLE'] = $arrayPro[$k]['PRO_TITLE']; - $swPRO = true; - } - } - if(!$swPRO){ - $data[$index]['PRO_TITLE'] = addTitlle('PRO_TITLE', $data[$index]['PRO_UID'], SYS_LANG); - $arrayPRO[] = Array('PRO_UID'=>$data[$index]['PRO_UID'] , 'PRO_TITLE'=>$data[$index]['PRO_TITLE'],'LANG' => SYS_LANG); - } - $swTAS = false; - foreach($arrayTAS as $k => $field){ - if($arrayTAS[$k]['TAS_UID'] == $data[$index]['TAS_UID'] && $arrayTAS[$k]['LANG'] == SYS_LANG){ - $data[$index]['TAS_TITLE'] = $arrayTAS[$k]['TAS_TITLE']; - $swTAS = true; - } - } - if(!$swTAS){ - $data[$index]['TAS_TITLE'] = addTitlle('TAS_TITLE', $data[$index]['TAS_UID'], SYS_LANG); - $arrayTAS[] = Array('TAS_UID'=>$data[$index]['TAS_UID'] , 'TAS_TITLE'=>$data[$index]['TAS_TITLE'],'LANG' => SYS_LANG); - }*/ - $index++; - } - - $response = array(); - $response['totalCount'] = $totalCount; - $response['data'] = $data; - break; - case 'forwardMail': - if (!isset($_REQUEST['REQ_UID'])) { - $_REQUEST['REQ_UID'] = ''; - } - - $criteria = new Criteria(); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); - - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); - $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); - $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED); - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS); - - $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); - - $criteria->add(AbeRequestsPeer::ABE_REQ_UID,$_REQUEST['REQ_UID']); - $criteria->addJoin(AbeRequestsPeer::ABE_UID,AbeConfigurationPeer::ABE_UID); - $criteria->addJoin(AppDelegationPeer::APP_UID,AbeRequestsPeer::APP_UID); - $criteria->addJoin(AppDelegationPeer::DEL_INDEX,AbeRequestsPeer::DEL_INDEX); - $resultRes = AbeRequestsPeer::doSelectRS($criteria); - $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $resultRes->next(); - $dataRes = Array(); - - if ($dataRes = $resultRes->getRow()) { - if (is_null($dataRes['DEL_FINISH_DATE'])) { - require_once 'classes/model/Configuration.php'; - G::LoadClass('spool'); - - $configuration = new Configuration(); - $sDelimiter = DBAdapter::getStringDelimiter(); - $criteria = new Criteria('workflow'); - $criteria->add(ConfigurationPeer::CFG_UID, 'Emails'); - $criteria->add(ConfigurationPeer::OBJ_UID, ''); - $criteria->add(ConfigurationPeer::PRO_UID, ''); - $criteria->add(ConfigurationPeer::USR_UID, ''); - $criteria->add(ConfigurationPeer::APP_UID, ''); - - if (ConfigurationPeer::doCount($criteria) == 0) { - $configuration->create(array('CFG_UID'=>'Emails', 'OBJ_UID'=>'', 'CFG_VALUE'=>'', 'PRO_UID'=>'', 'USR_UID'=>'', 'APP_UID'=>'')); - $newConfiguration = array(); - } else { - $newConfiguration = $configuration->load('Emails', '', '', '', ''); - - if ($newConfiguration['CFG_VALUE'] != '') { - $newConfiguration = unserialize($newConfiguration['CFG_VALUE']); - } else { - $newConfiguration = array(); - } - } - - $spool = new spoolRun(); - $spool->setConfig(array( - 'MESS_ENGINE' => $newConfiguration['MESS_ENGINE'], - 'MESS_SERVER' => $newConfiguration['MESS_SERVER'], - 'MESS_PORT' => $newConfiguration['MESS_PORT'], - 'MESS_ACCOUNT' => $newConfiguration['MESS_ACCOUNT'], - 'MESS_PASSWORD' => $newConfiguration['MESS_PASSWORD'], - 'SMTPAuth' => $newConfiguration['MESS_RAUTH'] - )); - - $spool->create(array( - 'msg_uid' => '', - 'app_uid' => $dataRes['APP_UID'], - 'del_index' => $dataRes['DEL_INDEX'], - 'app_msg_type' => 'TEST', - 'app_msg_subject' => $dataRes['ABE_REQ_SUBJECT'], - 'app_msg_from' => $newConfiguration['MESS_ACCOUNT'], - 'app_msg_to' => $dataRes['ABE_REQ_SENT_TO'], - 'app_msg_body' => $dataRes['ABE_REQ_BODY'], - 'app_msg_cc' => '', - 'app_msg_bcc' => '', - 'app_msg_attach' => '', - 'app_msg_template'=> '', - 'app_msg_status' => 'pending' - )); - - if ($spool->sendMail()) { - $dataRes['ABE_REQ_STATUS'] = 'SENT'; - - $message = 'The email was resend to: '. $dataRes['ABE_REQ_SENT_TO']; - } else { - $dataRes['ABE_REQ_STATUS'] = 'ERROR'; - $message = 'There was a problem sending the email to: '. $dataRes['ABE_REQ_SENT_TO'] .', please try later.'; - } - - try { - $abeRequestsInstance = new AbeRequests(); - $abeRequestsInstance->createOrUpdate($dataRes); - } catch (Exception $error) { - throw $error; - } - } else { - $message = 'Unable to send email, the task is closed.'; - } - } else { - $message = 'An unexpected error occurred please try again later.'; - } - - print_r($message); - die; - break; - case 'viewForm': - //coment - if (!isset($_REQUEST['REQ_UID'])) { - $_REQUEST['REQ_UID'] = ''; - } - - $criteria = new Criteria(); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); - $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); - - $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); - $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); - $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); - - $criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_UID); - $criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA); - - - $criteria->add(AbeRequestsPeer::ABE_REQ_UID,$_REQUEST['REQ_UID']); - $criteria->addJoin(AbeRequestsPeer::ABE_UID,AbeConfigurationPeer::ABE_UID); - $criteria->addJoin(AbeResponsesPeer::ABE_REQ_UID,AbeRequestsPeer::ABE_REQ_UID); - $resultRes = AbeRequestsPeer::doSelectRS($criteria); - $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $resultRes->next(); - $dataRes = Array(); - $message = 'The user has not responded to this request.'; - - if ($dataRes = $resultRes->getRow()) { - $_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']); - $dynaform = new Form($dataRes['PRO_UID'] . PATH_SEP . trim($dataRes['DYN_UID']), PATH_DYNAFORM, SYS_LANG, false); - $dynaform->mode = 'view'; - - if ($dataRes['ABE_RES_DATA'] != '') { - $value = unserialize( $dataRes['ABE_RES_DATA'] ); - - if (is_array($value)) { - $dynaform->values = $value; - - foreach ($dynaform->fields as $fieldName => $field) { - if ($field->type == 'submit') { - unset($dynaform->fields[$fieldName]); - } - } - - $message = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode); - } else { - $response = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode); - $field = $dynaform->fields[$dataRes['ABE_ACTION_FIELD']]; - $message = 'Type: '.$field->type . '
'; - - switch ($field->type) { - case 'dropdown': - case 'radiogroup': - $message .=$field->label .' - '; - $message .= $field->options[$value]; - break; - case 'yesno': - $message .= ''.$field->label. ' - '; - $message .= ($value == 1)? 'Yes' : 'No'; - break; - case 'checkbox': - $message .= ''. $field->label. ' - '; - $message .= ($value == 'On')? 'Check' : 'Uncheck'; - break; - } - } - } - } - - print_r($message); - die; - break; - } -} catch (Exception $error) { - $response = new stdclass(); - $response->status = 'ERROR'; - $response->message = $error->getMessage(); -} - -header('Content-Type: application/json;'); - -die(G::json_encode($response)); - diff --git a/workflow/engine/Features/ActionsByEmail/actionsByEmail_FileEdit.html b/workflow/engine/Features/ActionsByEmail/actionsByEmail_FileEdit.html deleted file mode 100644 index 11281afa4..000000000 --- a/workflow/engine/Features/ActionsByEmail/actionsByEmail_FileEdit.html +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
- - - - -
- - - - - - - - - - - - - - - -
{$form.TEMPLATE}
{$form.THETITLE}
{$form.CONTENT}
{$form.ACCEPT}   {$form.CANCEL}
-
-
-
-
-
- \ No newline at end of file diff --git a/workflow/engine/Features/ActionsByEmail/actionsByEmail_FileEdit.xml b/workflow/engine/Features/ActionsByEmail/actionsByEmail_FileEdit.xml deleted file mode 100644 index 3aab89fb6..000000000 --- a/workflow/engine/Features/ActionsByEmail/actionsByEmail_FileEdit.xml +++ /dev/null @@ -1,40 +0,0 @@ - - -