diff --git a/composer.json b/composer.json index 989da13b4..3734ad1ca 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "smarty/smarty": "2.6.30", "pdepend/pdepend": "@stable", "chumper/zipper": "^1.0", + "php-imap/php-imap": "^3.0", "nikic/php-parser": "3.1.5", "laravel/tinker": "^1.0" }, diff --git a/composer.lock b/composer.lock index aa753f4cb..3e87b567a 100644 --- a/composer.lock +++ b/composer.lock @@ -2274,6 +2274,58 @@ ], "time": "2016-01-26T13:27:02+00:00" }, + { + "name": "php-imap/php-imap", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/barbushin/php-imap.git", + "reference": "d4f8ef4504dfb555857241aa7d1e414a1c229079" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barbushin/php-imap/zipball/d4f8ef4504dfb555857241aa7d1e414a1c229079", + "reference": "d4f8ef4504dfb555857241aa7d1e414a1c229079", + "shasum": "" + }, + "require": { + "ext-imap": "*", + "php": ">=5.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpImap\\": "src/PhpImap" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sergey Barbushin", + "email": "barbushin@gmail.com", + "homepage": "http://linkedin.com/in/barbushin" + } + ], + "description": "Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)", + "homepage": "https://github.com/barbushin/php-imap", + "keywords": [ + "imap", + "mail", + "mailbox", + "php", + "pop3", + "receive emails" + ], + "time": "2017-12-22T12:53:34+00:00" + }, { "name": "phpmailer/phpmailer", "version": "v5.2.27", diff --git a/config/app.php b/config/app.php index 35dfc27a3..a6de0c625 100644 --- a/config/app.php +++ b/config/app.php @@ -10,6 +10,8 @@ return [ 'env' => env('APP_ENV', 'production'), 'debug' => env('APP_DEBUG', false), 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), + 'key' => env('APP_KEY', 'base64:rU28h/tElUn/eiLY0qC24jJq1rakvAFRoRl1DWxj/kM='), + 'cipher' => 'AES-256-CBC', 'timezone' => 'UTC', 'providers' => [ FilesystemServiceProvider::class, @@ -19,12 +21,14 @@ return [ Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, Illuminate\Queue\QueueServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class, + Illuminate\Encryption\EncryptionServiceProvider::class, Laravel\Tinker\TinkerServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, ], 'aliases' => [ + 'Crypt' => Illuminate\Support\Facades\Crypt::class ], ]; diff --git a/workflow/engine/bin/actionsByEmailEmailResponse.php b/workflow/engine/bin/actionsByEmailEmailResponse.php new file mode 100644 index 000000000..e22f1ad68 --- /dev/null +++ b/workflow/engine/bin/actionsByEmailEmailResponse.php @@ -0,0 +1,2 @@ +actionsByEmailEmailResponse(); + break; + /*----------------------------------********---------------------------------*/ } } catch (Exception $e) { $token = strtotime("now"); diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index f013b02f9..e69d6cd22 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -1,324 +1,999 @@ defineWorkspace(); + $this->defineServicePath(); } - public function setup() + /** + * Set the action by email request + * + * @param array $v + */ + public function setAbeRequest($v) { + $this->abeRequest = $v; + } + + /** + * Get the action by email request + * + * @return array + */ + public function getAbeRequest() + { + return $this->abeRequest; + } + + /** + * Set the specific task property + * + * @param array $item + * + * @return void + */ + public function addItemAbeRequest(array $item) + { + $this->abeRequest = array_merge($this->abeRequest, $item); + } + + /** + * Get the specific task property + * + * @param string $key + * + * @return string + */ + public function getItemAbeRequest($key) + { + if (array_key_exists($key, $this->getAbeRequest())) { + return $this->abeRequest[$key]; + } else { + return []; + } + } + + /** + * Set the application uid + * + * @param string $v + */ + public function setAppUid($v) + { + $this->appUid = $v; + } + + /** + * Get the application uid + * + * @return string + */ + public function getAppUid() + { + return $this->appUid; + } + + /** + * Set the case number + * + * @param integer $v + */ + public function setAppNumber($v) + { + $this->appNumber = $v; + } + + /** + * Get the case number + * + * @return integer + */ + public function getAppNumber() + { + return $this->appNumber; + } + + /** + * Set the case properties + * + * @param array $v + */ + public function setCaseProperties(array $v) + { + $this->caseProperties = $v; + } + + /** + * Get the case properties + * + * @return array + */ + public function getCaseProperties() + { + return $this->caseProperties; + } + + /** + * Get the specific case property + * + * @param string $key + * + * @return array + */ + public function getCasePropertiesKey($key) + { + if (array_key_exists($key, $this->getCaseProperties())) { + return $this->caseProperties[$key]; + } else { + return []; + } + } + + /** + * Set the email from + * + * @param string $v + */ + public function setEmailFrom($v) + { + $this->emailFrom = $v; + } + + /** + * Get the email from + * + * @return string + */ + public function getEmailFrom() + { + return $this->emailFrom; + } + + /** + * Set the email to + * + * @param string $v + */ + public function setEmailTo($v) + { + $this->emailTo = $v; } - public function getFieldsForPageSetup() + /** + * Get the email to + * + * @return string + */ + public function getEmailTo() { - return array(); + return $this->emailTo; } - public function updateFieldsForPageSetup() + /** + * Set the index + * + * @param integer $v + */ + public function setIndex($v) { + $this->index = $v; + } + + /** + * Get the index + * + * @return integer + */ + public function getIndex() + { + return $this->index; + } + + /** + * Set prefix + * + * @param array $v + */ + public function setPrefix(array $v) + { + $this->prefix = $v; + } + + /** + * Get prefix + * + * @return array + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the previous user + * + * @param string $v + */ + public function setPreviousUser($v) + { + $this->previousUser = $v; + } + + /** + * Get the previous user + * + * @return string + */ + public function getPreviousUser() + { + return $this->previousUser; + } + + /** + * Set the reply to + * + * @param string $v + */ + public function setReplyTo($v) + { + $this->replyTo = $v; + } + + /** + * Get the reply to + * + * @return string + */ + public function getReplyTo() + { + return $this->replyTo; + } + + /** + * Set the task + * + * @param string $v + */ + public function setTask($v) + { + $this->task = $v; + } + + /** + * Get the task + * + * @return string + */ + public function getTask() + { + return $this->task; + } + + /** + * Set in the task the action by email properties + * + * @param array $v + */ + public function setTaskAbeProperties(array $v) + { + $this->taskAbeProperties = $v; + } + + /** + * Get the task the action by email properties + * + * @return array + */ + public function getTaskAbeProperties() + { + return $this->taskAbeProperties; + } + + /** + * Add a item in the action by email properties + * + * @param array $item + * + * @return void + */ + public function addItemAbeProperties(array $item) + { + $this->taskAbeProperties = array_merge($this->taskAbeProperties, $item); + } + + /** + * Get the specific task property + * + * @param string $key + * + * @return array + */ + public function getItemAbeProperties($key) + { + if (array_key_exists($key, $this->getTaskAbeProperties())) { + return $this->taskAbeProperties[$key]; + } else { + return []; + } + } + + /** + * Set the link + */ + public function defineServicePath() + { + $this->servicePath = System::getServerMainPath() . '/services/ActionsByEmail'; + } + + /** + * Get the link + * + * @return string + */ + public function getServicePath() + { + return $this->servicePath; + } + + /** + * Set the user uid + * + * @param string $v + */ + public function setUser($v) + { + $this->user = $v; + } + + /** + * Get the user uid + * + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * Set the subject + * + * @param string $v + */ + public function setSubject($v) + { + $this->subject = $v; + } + + /** + * Get the subject + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set the workspace name + */ + public function defineWorkspace() + { + $this->workspace = config("system.workspace"); + } + + /** + * Get the workspace name + * + * @return string + */ + public function getWorkspace() + { + return $this->workspace; + } + + /** + * Get the email server definition + * + * @param string $emailServerKey + * + * @return object + */ + private function getEmailServer($emailServerKey) + { + $emailServer = new EmailServer(); + $emailSetup = (!is_null(EmailServerPeer::retrieveByPK($emailServerKey))) ? + $emailServer->getEmailServer($emailServerKey, true) : + $emailServer->getEmailServerDefault(); + + return $emailSetup; + } + + /** + * Define the properties in the task related the action by email configuration + * + * @return void + */ + private function defineTaskAbeProperties() + { + $actionEmailTable = new AbeConfiguration(); + $properties = $actionEmailTable->getTaskConfiguration($this->getCasePropertiesKey('PRO_UID'), $this->getTask()); + $this->setTaskAbeProperties($properties); + } + + /** + * Define the email from + * + * @param array $emailServerSetup + * + * @return void + */ + private function defineEmailFrom(array $emailServerSetup) + { + $from = ''; + if (!$this->getItemAbeProperties('ABE_MAILSERVER_OR_MAILCURRENT') && !empty($this->getItemAbeProperties('ABE_TYPE'))) { + if (!empty($this->getPreviousUser())) { + $user = new Users(); + $userDetails = $user->loadDetails($this->getPreviousUser()); + $from = ($userDetails["USR_FULLNAME"] . ' <' . $userDetails["USR_EMAIL"] . '>'); + } else { + global $RBAC; + + if ($RBAC != null && is_array($RBAC->aUserInfo['USER_INFO'])) { + $currentUser = $RBAC->aUserInfo['USER_INFO']; + $from = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); + } else { + $usersPeer = UsersPeer::retrieveByPK($this->getUser()); + if (!empty($usersPeer)) { + $from = ($usersPeer->getUsrFirstname() . ' ' . $usersPeer->getUsrLastname() . ' <' . $usersPeer->getUsrEmail() . '>'); + } + } + } + } + //Define the email from + $emailFrom = G::buildFrom($emailServerSetup, $from); + $this->setEmailFrom($emailFrom); + } + + /** + * Define the email to + * + * @param string $emailField + * @param array $caseData + * + * @return void + */ + private function defineEmailTo($emailField, array $caseData) + { + $emailField = str_replace($this->getPrefix(), '', $emailField); + if ($emailField != '' && isset($caseData[$emailField])) { + $emailTo = trim($caseData[$emailField]); + } else { + $userInstance = new Users(); + $emailTo = $userInstance->getAllInformation($this->getUser())['mail']; + } + + $this->setEmailTo($emailTo); + } + + /** + * Define the reply to + * + * @param string $receiverUid + * + * @return void + */ + private function defineReplyTo($receiverUid) + { + $emailServer = $this->getEmailServer($receiverUid); + $replyTo = $emailServer["MESS_ACCOUNT"]; + + $this->setReplyTo($replyTo); + } + + /** + * Define the subject + * + * @param string $subjectField + * @param array $caseData + * + * @return void + */ + private function defineSubject($subjectField, array $caseData) + { + $subject = G::replaceDataField($subjectField, $caseData, 'mysql', false); + if (empty($subject)) { + $subject = $this->getCasePropertiesKey('APP_TITLE'); + } + + $this->setSubject($subject); + } + + /** + * Validate and set the fields that we need for the action by email + * + * @param object $data + */ + private function validateAndSetValues($data) + { + try { + if (!is_object($data)) { + throw new Exception('The parameter $data is null.'); + } + // Validate the tas_uid + if (empty($data->TAS_UID)) { + throw new Exception('The parameter $data->TAS_UID is null or empty.'); + } else { + $this->setTask($data->TAS_UID); + } + // Validate the app_uid + if (empty($data->APP_UID)) { + throw new Exception('The parameter $data->APP_UID is null or empty.'); + } else { + $this->setAppUid($data->APP_UID); + } + // Validate the del_index + if (empty($data->DEL_INDEX)) { + throw new Exception('The parameter $data->DEL_INDEX is null or empty.'); + } elseif ($data->DEL_INDEX === 1) { + // Processmaker log + $context = Bootstrap::getDefaultContextLog(); + $context['delIndex'] = $data->DEL_INDEX; + Bootstrap::registerMonolog('ActionByEmail', 250, 'Actions by email does not work in the initial task', $context); + + return; + } else { + $this->setIndex($data->DEL_INDEX); + } + // Validate the usr_uid + if (empty($data->USR_UID)) { + throw new Exception('The parameter $data->USR_UID is null or empty.'); + } else { + $this->setUser($data->USR_UID); + } + // Define the previous user + if (!empty($data->PREVIOUS_USR_UID)) { + $this->setPreviousUser($data->PREVIOUS_USR_UID); + } + } catch (Exception $e) { + $token = strtotime("now"); + PMException::registerErrorLog($e, $token); + G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", [$token])); + die; + } } /** * Send Actions By Email. - * + * * @global object $RBAC * @param object $data * @param array $dataAbe * @return type * @throws Exception - * + * * @see AppDelegation->createAppDelegation() * @link https://wiki.processmaker.com/3.3/Actions_by_Email */ - public function sendActionsByEmail($data, $dataAbe) + public function sendActionsByEmail($data, array $dataAbe) { try { // Validations - try { - if (!is_object($data)) { - throw new Exception('The parameter $data is null.'); - } - if (!isset($data->TAS_UID)) { - throw new Exception('The parameter $data->TAS_UID is null.'); - } + self::validateAndSetValues($data); - if (!isset($data->APP_UID)) { - throw new Exception('The parameter $data->APP_UID is null.'); - } - - if (!isset($data->DEL_INDEX)) { - throw new Exception('The parameter $data->DEL_INDEX is null.'); - } - - if (!isset($data->USR_UID)) { - throw new Exception('The parameter $data->USR_UID is null.'); - } - - if ($data->TAS_UID === '') { - throw new Exception('The parameter $data->TAS_UID is empty.'); - } - - if ($data->APP_UID === '') { - throw new Exception('The parameter $data->APP_UID is empty.'); - } - - if ($data->DEL_INDEX === '') { - throw new Exception('The parameter $data->DEL_INDEX is empty.'); - } - - if ($data->DEL_INDEX === 1) { - error_log('The parameter $data->DEL_INDEX is 1, you can not use ActionsByEmail in the initial task', 0); - return; - } - - if ($data->USR_UID === '') { - error_log('The parameter $data->USR_UID is empty, the routed task may be a self-service type, actions by email does not work with self-service task types.', 0); - } - } catch(Exception $e) { - $token = strtotime("now"); - PMException::registerErrorLog($e, $token); - G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); - die; - } - - $emailServer = new \ProcessMaker\BusinessModel\EmailServer(); - - $emailSetup = (!is_null(\EmailServerPeer::retrieveByPK($dataAbe['ABE_EMAIL_SERVER_UID']))) ? - $emailServer->getEmailServer($dataAbe['ABE_EMAIL_SERVER_UID'], true) : - $emailServer->getEmailServerDefault(); - - if (!empty($emailSetup)) { + $emailServerSetup = $this->getEmailServer($dataAbe['ABE_EMAIL_SERVER_UID']); + if (!empty($emailServerSetup)) { $cases = new Cases(); - $caseFields = $cases->loadCase($data->APP_UID, $data->DEL_INDEX); - $actionEmailTable = new AbeConfiguration(); - $configuration = $actionEmailTable->getTaskConfiguration($caseFields['PRO_UID'], $data->TAS_UID); - $caseFields['APP_DATA']['PRO_ID'] = $configuration['PRO_ID']; - $caseFields['APP_DATA']['TAS_ID'] = $configuration['TAS_ID']; + $caseFields = $cases->loadCase($this->getAppUid(), $this->getIndex()); + $this->setCaseProperties($caseFields); + $this->defineTaskAbeProperties(); + $caseFields['APP_DATA']['PRO_ID'] = $this->getItemAbeProperties('PRO_ID'); + $caseFields['APP_DATA']['TAS_ID'] = $this->getItemAbeProperties('TAS_ID'); + if (!empty($this->getTaskAbeProperties())) { + $this->defineEmailTo($this->getItemAbeProperties('ABE_EMAIL_FIELD'), $caseFields['APP_DATA']); - if (!empty($configuration)) { - $configuration['ABE_EMAIL_FIELD'] = str_replace('@@', '', $configuration['ABE_EMAIL_FIELD']); - if ($configuration['ABE_EMAIL_FIELD'] != '' && isset($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']])) { - $email = trim($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']]); - } else { - $userInstance = new Users(); - $userInfo = $userInstance->getAllInformation($data->USR_UID); - $email = $userInfo['mail']; - } + if (!empty($this->getEmailTo())) { + $this->defineSubject($this->getItemAbeProperties('ABE_SUBJECT_FIELD'), $caseFields['APP_DATA']); - if ($email != '') { - $subject = G::replaceDataField( $configuration['ABE_SUBJECT_FIELD'], $caseFields['APP_DATA'], 'mysql', false ); - if($subject == ''){ - $subject = $caseFields['APP_TITLE']; - } + $request = [ + 'ABE_REQ_UID' => '', + 'ABE_UID' => $this->getItemAbeProperties('ABE_UID'), + 'APP_UID' => $this->getAppUid(), + 'DEL_INDEX' => $this->getIndex(), + 'ABE_REQ_SENT_TO' => $this->getEmailTo(), + 'ABE_REQ_SUBJECT' => $this->getSubject(), + 'ABE_REQ_BODY' => '', + 'ABE_REQ_ANSWERED' => 0, + 'ABE_REQ_STATUS' => 'PENDING' + ]; + $this->setAbeRequest($request); + $this->registerRequest(); - $abeRequest = array(); - $abeRequest['ABE_REQ_UID'] = ''; - $abeRequest['ABE_UID'] = $configuration['ABE_UID']; - $abeRequest['APP_UID'] = $data->APP_UID; - $abeRequest['DEL_INDEX'] = $data->DEL_INDEX; - $abeRequest['ABE_REQ_SENT_TO'] = $email; - $abeRequest['ABE_REQ_SUBJECT'] = $subject; - $abeRequest['ABE_REQ_BODY'] = ''; - $abeRequest['ABE_REQ_ANSWERED'] = 0; - $abeRequest['ABE_REQ_STATUS'] = 'PENDING'; - - try { - $abeRequestsInstance = new AbeRequests(); - $abeRequest['ABE_REQ_UID'] = $abeRequestsInstance->createOrUpdate($abeRequest); - } catch (Exception $error) { - throw $error; - } - - if ($configuration['ABE_TYPE'] != '') { + if (!empty($this->getItemAbeProperties('ABE_TYPE'))) { // Email - $_SESSION['CURRENT_DYN_UID'] = $configuration['DYN_UID']; - + $_SESSION['CURRENT_DYN_UID'] = $this->getItemAbeProperties('DYN_UID'); $__ABE__ = ''; - - $link = System::getServerMainPath() . '/services/ActionsByEmail'; - switch ($configuration['ABE_TYPE']) { + switch ($this->getItemAbeProperties('ABE_TYPE')) { case 'CUSTOM': - $customGrid = unserialize($configuration['ABE_CUSTOM_GRID']); - $variableService = new \ProcessMaker\Services\Api\Project\Variable(); - $variables = $variableService->doGetVariables($caseFields['PRO_UID']); - $field = new stdClass(); - $field->label = ''; - $actionField = str_replace(array('@@', '@#', '@=', '@%', '@?', '@$'), '', $configuration['ABE_ACTION_FIELD']); - - $obj = new PmDynaform($configuration['DYN_UID']); - $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID']; - $file = $obj->printPmDynaformAbe($configuration); - $__ABE__ .= $file; - $__ABE__ .= '
' . $field->label . ''; - $index = 1; - $__ABE__ .= '
'; - foreach ($customGrid as $key => $value) { - $__ABE__ .= '' . (($index % 5 == 0) ? '' : ' '); - $index++; - } - $__ABE__ .= '
' . $value['abe_custom_label']; - $__ABE__ .= '
'; + $__ABE__ .= $this->getCustomTemplate(); + break; + case 'RESPONSE': + $this->defineReplyTo($dataAbe['ABE_EMAIL_SERVER_RECEIVER_UID']); + $__ABE__ .= $this->getResponseTemplate(); break; case 'LINK': - $__ABE__ .= 'Please complete this form'; + $__ABE__ .= $this->getServicePathTemplate(); break; - // coment case 'FIELD': - $variableService = new \ProcessMaker\Services\Api\Project\Variable(); - $variables = $variableService->doGetVariables($caseFields['PRO_UID']); - $field = new stdClass(); - $field->label = 'Test'; - $field->type = 'dropdown'; - $field->options = array(); - $field->value = ''; - $actionField = str_replace(array('@@','@#','@=','@%','@?','@$'), '', $configuration['ABE_ACTION_FIELD']); - $dynaform = $configuration['DYN_UID']; - $variables = G::json_decode($configuration['DYN_CONTENT'], true); - if(isset($variables['items'][0]['items'])){ - $fields = $variables['items'][0]['items']; - foreach ($fields as $key => $value) { - foreach($value as $var){ - if(isset($var['variable'])){ - if ($var['variable'] == $actionField) { - $field->label = $var['label']; - $field->type = $var['type']; - $values = $var['options']; - foreach ($values as $val){ - $field->options[$val['value']] = $val['value']; - } - } - } - } - } - } - - $obj = new PmDynaform($configuration['DYN_UID']); - $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID']; - $file = $obj->printPmDynaformAbe($configuration); - $__ABE__ .= $file; - $__ABE__ .= '' . $field->label . '
'; - switch ($field->type) { - case 'dropdown': - case 'radio': - case 'radiogroup': - $index = 1; - $__ABE__.='
'; - break; - case 'yesno': - $__ABE__ .= ''; - $__ABE__ .= ''; - break; - case 'checkbox': - $__ABE__ .= ''; - $__ABE__ .= ''; - break; - } - $__ABE__ .= '
'; - foreach ($field->options as $optValue => $optName) { - $__ABE__ .= '' . (($index % 5 == 0) ? '' : ' '); - $index++; - } - - $__ABE__.='
' . $optName; - $__ABE__ .= '
' . G::LoadTranslation('ID_YES_VALUE') . '' . G::LoadTranslation('ID_NO_VALUE') . 'CheckUncheck
'; + $__ABE__ .= $this->getFieldTemplate(); break; } - - $__ABE__ = preg_replace('/\/', '' , $__ABE__); - $__ABE__ = preg_replace('/\]*\/>/', '' , $__ABE__); + $__ABE__ = preg_replace('/\/', '', $__ABE__); + $__ABE__ = preg_replace('/\]*\/>/', '', $__ABE__); $__ABE__ = preg_replace('/]*>(.*?)<\/select>/is', "", $__ABE__); - $__ABE__ = preg_replace('/align=\"center\"/', '' , $__ABE__); - $__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ', $__ABE__); + $__ABE__ = preg_replace('/align=\"center\"/', '', $__ABE__); + $__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ', + $__ABE__); $caseFields['APP_DATA']['__ABE__'] = $__ABE__; - $user = new Users(); - - $emailFrom = ''; - if (!$configuration['ABE_MAILSERVER_OR_MAILCURRENT'] && $configuration['ABE_TYPE'] !== '') { - if ($data->PREVIOUS_USR_UID !== '') { - $userDetails = $user->loadDetails($data->PREVIOUS_USR_UID); - $emailFrom = ($userDetails["USR_FULLNAME"] . ' <' . $userDetails["USR_EMAIL"] . '>'); - } else { - global $RBAC; - if ($RBAC != null && is_array($RBAC->aUserInfo['USER_INFO'])) { - $currentUser = $RBAC->aUserInfo['USER_INFO']; - $emailFrom = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); - } else { - $usersPeer = UsersPeer::retrieveByPK($data->USR_UID); - if (!empty($usersPeer)) { - $emailFrom = ($usersPeer->getUsrFirstname() . ' ' . $usersPeer->getUsrLastname() . ' <' . $usersPeer->getUsrEmail() . '>'); - } - } - } - } else { - if (isset($emailSetup["MESS_FROM_NAME"]) && isset($emailSetup["MESS_FROM_MAIL"])) { - $emailFrom = ($emailSetup["MESS_FROM_NAME"] . ' <' . $emailSetup["MESS_FROM_MAIL"] . '>'); - } else { - $emailFrom = ((isset($emailSetup["MESS_FROM_NAME"])) ? $emailSetup["MESS_FROM_NAME"] : $emailSetup["MESS_FROM_MAIL"]); - } - } - - $wsBaseInstance = new WsBase(); - $result = $wsBaseInstance->sendMessage( - $data->APP_UID, - $emailFrom, - $email, - '', - '', - $subject, - $configuration['ABE_TEMPLATE'], + $this->defineEmailFrom($emailServerSetup); + $result = $this->abeSendMessage( + $this->getItemAbeProperties('ABE_TEMPLATE'), $caseFields['APP_DATA'], - null, - true, - $data->DEL_INDEX, - $emailSetup, - 0, - WsBase::MESSAGE_TYPE_ACTIONS_BY_EMAIL + $emailServerSetup ); - $abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR'); + $request = []; + $request['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR'); - $body = ''; - $messageSent = executeQuery('SELECT `APP_MSG_BODY` FROM `APP_MESSAGE` ORDER BY `APP_MSG_SEND_DATE` DESC LIMIT 1'); - - if (!empty($messageSent) && is_array($messageSent)) { - $body = $messageSent[1]['APP_MSG_BODY']; - } - - $abeRequest['ABE_REQ_BODY'] = $body; - - // Update - try { - $abeRequestsInstance = new AbeRequests(); - $abeRequestsInstance->createOrUpdate($abeRequest); - } catch (Exception $error) { - throw $error; - } + $request['ABE_REQ_BODY'] = empty($result->getAppMessUid()) ? '' : AppMessage::getAppMsgBodyByKey($result->getAppMessUid()); + $this->addItemAbeRequest($request); + $this->registerRequest(); } } + } else { + throw new Exception('Task does not have an action by email configuration.'); } } } catch (Exception $error) { throw $error; } } + + /** + * Get the html template for email response + * + * @return string + */ + private function getResponseTemplate() + { + $noReply = $this->getReplyTo(); + $customGrid = unserialize($this->getItemAbeProperties('ABE_CUSTOM_GRID')); + $field = new stdClass(); + $field->label = ''; + $html = '
' . $field->label . ''; + $html .= '
'; + $index = 1; + foreach ($customGrid as $key => $value) { + // Get the subject + $emailSubject = $this->getSubjectByResponse($value['abe_custom_label']); + $emailBody = $this->getBodyByResponse($value['abe_custom_value']); + // Define the html for the actions + $html .= '' . (($index % 5 == 0) ? '' : ' '); + $index++; + } + $html .= '
'; + $html .= $value['abe_custom_label']; + $html .= '
'; + + return $html; + } + + /** + * Get the subject for response the action by email + * + * @param string $fieldLabel + * + * @return string + */ + private function getSubjectByResponse($fieldLabel) + { + $subject = G::LoadTranslation('ID_CASE') . ' ' . $this->getCasePropertiesKey('APP_TITLE'); + $subject .= $this->delimiter . ' ' . $fieldLabel; + + return urlencode($subject); + } + + /** + * Get the body for response the action by email + * + * @param string $fieldValue + * + * @return string + */ + private function getBodyByResponse($fieldValue) + { + $abeRequest = $this->getAbeRequest(); + $bodyToCrypt = [ + 'workspace' => $this->getWorkspace(), + 'appUid' => $this->getAppUid(), + 'delIndex' => $this->getIndex(), + 'fieldValue' => $fieldValue, + 'ABE_REQ_UID' => $abeRequest['ABE_REQ_UID'] + ]; + $bodyToCrypt = G::json_encode($bodyToCrypt); + + $body = str_repeat(self::BODY_REPLY_LF, 4); + $body .= '/' . str_repeat("=", 24) . self::BODY_REPLY_LF; + $body .= G::LoadTranslation('ID_ABE_EMAIL_RESPONSE_BODY_NOTE') . self::BODY_REPLY_LF; + $body .= '{' . Crypt::encryptString($bodyToCrypt) . '}' . self::BODY_REPLY_LF; + $body .= str_repeat("=", 24) . '/'; + return $body; + } + + /** + * Get the html template for custom actions + * @todo we need to revise this function + * + * @return string + */ + private function getCustomTemplate() + { + $abeRequest = $this->getAbeRequest(); + $customGrid = unserialize($this->getItemAbeProperties('ABE_CUSTOM_GRID')); + $variableService = new Variable(); + $variables = $variableService->doGetVariables($this->getCasePropertiesKey('PRO_UID')); + $field = new stdClass(); + $field->label = ''; + $actionField = str_replace( + $this->getPrefix(), + '', + $this->getItemAbeProperties('ABE_ACTION_FIELD') + ); + + $itemDynUid = $this->getItemAbeProperties('DYN_UID'); + $obj = new PmDynaform($itemDynUid); + $this->addItemAbeProperties(['CURRENT_DYNAFORM' => $itemDynUid]); + $file = $obj->printPmDynaformAbe($this->getTaskAbeProperties()); + $html = $file; + $html .= '
' . $field->label . ''; + $index = 1; + $html .= '
'; + foreach ($customGrid as $key => $value) { + $html .= '' . (($index % 5 == 0) ? '' : ' '); + $index++; + } + $html .= '
getServicePath())) . '?ACTION=' . G::encrypt('processABE', + URL_KEY, true) . '&APP_UID='; + $html .= G::encrypt($this->getAppUid(), URL_KEY, + true) . '&DEL_INDEX=' . G::encrypt($this->getindex(), URL_KEY); + $html .= '&FIELD=' . G::encrypt($actionField, URL_KEY, + true) . '&VALUE=' . G::encrypt($value['abe_custom_value'], URL_KEY, + true); + $html .= '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY, + true) . '" target="_blank" >' . $value['abe_custom_label']; + $html .= '
'; + + return $html; + } + + /** + * Get the html template for link to fill a form + * @todo we need to revise this function + * + * @return string + */ + private function getServicePathTemplate() + { + $abeRequest = $this->getAbeRequest(); + $html = 'Please complete this form'; + + return $html; + } + + /** + * Get the html template for use a field to generate actions links + * @todo we need to revise this function + * + * @return string + */ + private function getFieldTemplate() + { + $abeRequest = $this->getAbeRequest(); + $variableService = new Variable(); + $variables = $variableService->doGetVariables($this->getCasePropertiesKey('PRO_UID')); + $field = new stdClass(); + $field->label = 'Test'; + $field->type = 'dropdown'; + $field->options = []; + $field->value = ''; + $actionField = str_replace( + $this->getPrefix(), + '', + $this->getItemAbeProperties('ABE_ACTION_FIELD') + ); + $dynUid = $this->getItemAbeProperties('DYN_UID'); + $variables = G::json_decode($this->getItemAbeProperties('DYN_CONTENT'), true); + if (isset($variables['items'][0]['items'])) { + $fields = $variables['items'][0]['items']; + foreach ($fields as $key => $value) { + foreach ($value as $var) { + if (isset($var['variable'])) { + if ($var['variable'] == $actionField) { + $field->label = $var['label']; + $field->type = $var['type']; + $values = $var['options']; + foreach ($values as $val) { + $field->options[$val['value']] = $val['value']; + } + } + } + } + } + } + + $obj = new PmDynaform($dynUid); + $this->addItemAbeProperties(['CURRENT_DYNAFORM' => $dynUid]); + $file = $obj->printPmDynaformAbe($this->getTaskAbeProperties()); + $html = $file; + $html .= '' . $field->label . '
'; + switch ($field->type) { + case 'dropdown': + case 'radio': + case 'radiogroup': + $index = 1; + $html .= '
'; + break; + case 'yesno': + $html .= ''; + $html .= ''; + break; + case 'checkbox': + $html .= ''; + $html .= ''; + break; + } + $html .= '
'; + foreach ($field->options as $optValue => $optName) { + $html .= '' . (($index % 5 == 0) ? '' : ' '); + $index++; + } + + $html .= '
' . $optName; + $html .= '
' . G::LoadTranslation('ID_YES_VALUE') . '' . G::LoadTranslation('ID_NO_VALUE') . 'CheckUncheck
'; + + return $html; + } + + /** + * Register the request in the table ABE_REQUEST + * + * @return void + * @throws Exception + */ + private function registerRequest() + { + try { + $requestInstance = new AbeRequests(); + $abeRequest['ABE_REQ_UID'] = $requestInstance->createOrUpdate($this->getAbeRequest()); + $this->setAbeRequest($abeRequest); + } catch (Exception $error) { + throw $error; + } + } + + /** + * Send the message + * + * @param string $template + * @param array $caseData + * @param array $configEmail + * + * @return object + * @throws Exception + */ + private function abeSendMessage($template, array $caseData, array $configEmail) + { + try { + $wsBaseInstance = new WsBase(); + $result = $wsBaseInstance->sendMessage( + $this->getAppUid(), + $this->getEmailFrom(), + $this->getEmailTo(), + '', + '', + $this->getSubject(), + $template, + $caseData, + null, + true, + $this->getIndex(), + $configEmail, + 0, + WsBase::MESSAGE_TYPE_ACTIONS_BY_EMAIL + ); + + return $result; + } catch (Exception $error) { + throw $error; + } + } } diff --git a/workflow/engine/classes/SpoolRun.php b/workflow/engine/classes/SpoolRun.php index 1b5ac211c..f5b1054fa 100644 --- a/workflow/engine/classes/SpoolRun.php +++ b/workflow/engine/classes/SpoolRun.php @@ -91,6 +91,26 @@ class SpoolRun $this->appMsgUid = $v; } + /** + * Set the $spoolId + * + * @param string + */ + public function setSpoolId($v) + { + $this->spoolId = $v; + } + + /** + * Get the $spoolId + * + * @return string + */ + public function getSpoolId() + { + return $this->spoolId; + } + /** * Get the fileData property * @@ -489,11 +509,13 @@ class SpoolRun switch ($this->config['MESS_ENGINE']) { case 'MAIL': case 'PHPMAILER': + case 'IMAP': switch ($this->config['MESS_ENGINE']) { case 'MAIL': $phpMailer = new PHPMailer(); $phpMailer->Mailer = 'mail'; break; + case 'IMAP': case 'PHPMAILER': $phpMailer = new PHPMailer(true); $phpMailer->Mailer = 'smtp'; @@ -505,6 +527,7 @@ class SpoolRun switch ($this->config['MESS_ENGINE']) { case 'MAIL': break; + case 'IMAP': case 'PHPMAILER': //Posible Options for SMTPSecure are: "", "ssl" or "tls" if (isset($this->config['SMTPSecure']) && preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) { diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index bcf19474a..ba547808c 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -6,6 +6,7 @@ use ProcessMaker\ChangeLog\ChangeLog; /*----------------------------------********---------------------------------*/ use ProcessMaker\Core\JobsManager; use ProcessMaker\Core\System; +use ProcessMaker\Util\WsMessageResponse; class WsBase { @@ -1011,14 +1012,20 @@ class WsBase $spool->sendMail(); return $spool; }; - $result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to); + $result = new WsMessageResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to); switch ($appMsgType) { case WsBase::MESSAGE_TYPE_EMAIL_EVENT: case WsBase::MESSAGE_TYPE_PM_FUNCTION: JobsManager::getSingleton()->dispatch('EmailEvent', $closure); break; default : - JobsManager::getSingleton()->dispatch('Email', $closure); + $spool = $closure(); + if ($spool->status == 'sent') { + $result = new WsMessageResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to); + $result->setAppMessUid($spool->getSpoolId()); + } else { + $result = new WsResponse(29, $spool->status . ' ' . $spool->error . PHP_EOL . print_r($setup, 1)); + } break; } } diff --git a/workflow/engine/classes/model/AbeConfiguration.php b/workflow/engine/classes/model/AbeConfiguration.php index 66b6cf0d0..90679a92e 100644 --- a/workflow/engine/classes/model/AbeConfiguration.php +++ b/workflow/engine/classes/model/AbeConfiguration.php @@ -26,6 +26,7 @@ class AbeConfiguration extends BaseAbeConfiguration 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', + 'ABE_ACTION_BODY_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_FORCE_LOGIN', 'ABE_CREATE_DATE', @@ -33,7 +34,8 @@ class AbeConfiguration extends BaseAbeConfiguration 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', - 'ABE_EMAIL_SERVER_UID' + 'ABE_EMAIL_SERVER_UID', + 'ABE_EMAIL_SERVER_RECEIVER_UID' ]; public function load($abeUid) @@ -152,6 +154,7 @@ class AbeConfiguration extends BaseAbeConfiguration $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_BODY_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_SUBJECT_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_CUSTOM_GRID); diff --git a/workflow/engine/classes/model/AppMessage.php b/workflow/engine/classes/model/AppMessage.php index 8758937b3..4b2659c56 100644 --- a/workflow/engine/classes/model/AppMessage.php +++ b/workflow/engine/classes/model/AppMessage.php @@ -300,5 +300,24 @@ class AppMessage extends BaseAppMessage return $messages; } + + /** + * Get the APP_MSG_BODY related to the key + * + * @param string $key + * + * @return string + * @throws Exception + */ + public static function getAppMsgBodyByKey($key) + { + try { + $appMessage = AppMessagePeer::retrieveByPk($key); + + return $appMessage->getAppMsgBody(); + } catch (Exception $error) { + throw $error; + } + } } diff --git a/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php b/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php index 8652ef90a..c74d98fa0 100644 --- a/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php +++ b/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php @@ -83,6 +83,8 @@ class AbeConfigurationMapBuilder $tMap->addColumn('ABE_ACTION_FIELD', 'AbeActionField', 'string', CreoleTypes::VARCHAR, false, 255); + $tMap->addColumn('ABE_ACTION_BODY_FIELD', 'AbeActionBodyField', 'string', CreoleTypes::VARCHAR, false, 255); + $tMap->addColumn('ABE_CASE_NOTE_IN_RESPONSE', 'AbeCaseNoteInResponse', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('ABE_FORCE_LOGIN', 'AbeForceLogin', 'int', CreoleTypes::INTEGER, false, null); @@ -99,6 +101,8 @@ class AbeConfigurationMapBuilder $tMap->addColumn('ABE_EMAIL_SERVER_UID', 'AbeEmailServerUid', 'string', CreoleTypes::VARCHAR, false, 32); + $tMap->addColumn('ABE_EMAIL_SERVER_RECEIVER_UID', 'AbeEmailServerReceiverUid', 'string', CreoleTypes::VARCHAR, false, 32); + } // doBuild() } // AbeConfigurationMapBuilder diff --git a/workflow/engine/classes/model/map/EmailServerMapBuilder.php b/workflow/engine/classes/model/map/EmailServerMapBuilder.php index ab8fd959a..b9e5729a0 100644 --- a/workflow/engine/classes/model/map/EmailServerMapBuilder.php +++ b/workflow/engine/classes/model/map/EmailServerMapBuilder.php @@ -73,6 +73,10 @@ class EmailServerMapBuilder $tMap->addColumn('MESS_PORT', 'MessPort', 'int', CreoleTypes::INTEGER, true, null); + $tMap->addColumn('MESS_INCOMING_SERVER', 'MessIncomingServer', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_INCOMING_PORT', 'MessIncomingPort', 'int', CreoleTypes::INTEGER, true, null); + $tMap->addColumn('MESS_RAUTH', 'MessRauth', 'int', CreoleTypes::INTEGER, true, null); $tMap->addColumn('MESS_ACCOUNT', 'MessAccount', 'string', CreoleTypes::VARCHAR, true, 256); diff --git a/workflow/engine/classes/model/om/BaseAbeConfiguration.php b/workflow/engine/classes/model/om/BaseAbeConfiguration.php index 7de6b6b1a..a83b0448d 100644 --- a/workflow/engine/classes/model/om/BaseAbeConfiguration.php +++ b/workflow/engine/classes/model/om/BaseAbeConfiguration.php @@ -81,6 +81,12 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent */ protected $abe_action_field = ''; + /** + * The value for the abe_action_body_field field. + * @var string + */ + protected $abe_action_body_field = ''; + /** * The value for the abe_case_note_in_response field. * @var int @@ -129,6 +135,12 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent */ protected $abe_email_server_uid = ''; + /** + * The value for the abe_email_server_receiver_uid field. + * @var string + */ + protected $abe_email_server_receiver_uid = ''; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -242,6 +254,17 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent return $this->abe_action_field; } + /** + * Get the [abe_action_body_field] column value. + * + * @return string + */ + public function getAbeActionBodyField() + { + + return $this->abe_action_body_field; + } + /** * Get the [abe_case_note_in_response] column value. * @@ -372,6 +395,17 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent return $this->abe_email_server_uid; } + /** + * Get the [abe_email_server_receiver_uid] column value. + * + * @return string + */ + public function getAbeEmailServerReceiverUid() + { + + return $this->abe_email_server_receiver_uid; + } + /** * Set the value of [abe_uid] column. * @@ -570,6 +604,28 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent } // setAbeActionField() + /** + * Set the value of [abe_action_body_field] column. + * + * @param string $v new value + * @return void + */ + public function setAbeActionBodyField($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->abe_action_body_field !== $v || $v === '') { + $this->abe_action_body_field = $v; + $this->modifiedColumns[] = AbeConfigurationPeer::ABE_ACTION_BODY_FIELD; + } + + } // setAbeActionBodyField() + /** * Set the value of [abe_case_note_in_response] column. * @@ -760,6 +816,28 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent } // setAbeEmailServerUid() + /** + * Set the value of [abe_email_server_receiver_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAbeEmailServerReceiverUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->abe_email_server_receiver_uid !== $v || $v === '') { + $this->abe_email_server_receiver_uid = $v; + $this->modifiedColumns[] = AbeConfigurationPeer::ABE_EMAIL_SERVER_RECEIVER_UID; + } + + } // setAbeEmailServerReceiverUid() + /** * Hydrates (populates) the object variables with values from the database resultset. * @@ -795,28 +873,32 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $this->abe_action_field = $rs->getString($startcol + 8); - $this->abe_case_note_in_response = $rs->getInt($startcol + 9); + $this->abe_action_body_field = $rs->getString($startcol + 9); - $this->abe_force_login = $rs->getInt($startcol + 10); + $this->abe_case_note_in_response = $rs->getInt($startcol + 10); - $this->abe_create_date = $rs->getTimestamp($startcol + 11, null); + $this->abe_force_login = $rs->getInt($startcol + 11); - $this->abe_update_date = $rs->getTimestamp($startcol + 12, null); + $this->abe_create_date = $rs->getTimestamp($startcol + 12, null); - $this->abe_subject_field = $rs->getString($startcol + 13); + $this->abe_update_date = $rs->getTimestamp($startcol + 13, null); - $this->abe_mailserver_or_mailcurrent = $rs->getInt($startcol + 14); + $this->abe_subject_field = $rs->getString($startcol + 14); - $this->abe_custom_grid = $rs->getString($startcol + 15); + $this->abe_mailserver_or_mailcurrent = $rs->getInt($startcol + 15); - $this->abe_email_server_uid = $rs->getString($startcol + 16); + $this->abe_custom_grid = $rs->getString($startcol + 16); + + $this->abe_email_server_uid = $rs->getString($startcol + 17); + + $this->abe_email_server_receiver_uid = $rs->getString($startcol + 18); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 17; // 17 = AbeConfigurationPeer::NUM_COLUMNS - AbeConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 19; // 19 = AbeConfigurationPeer::NUM_COLUMNS - AbeConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating AbeConfiguration object", $e); @@ -1048,29 +1130,35 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent return $this->getAbeActionField(); break; case 9: - return $this->getAbeCaseNoteInResponse(); + return $this->getAbeActionBodyField(); break; case 10: - return $this->getAbeForceLogin(); + return $this->getAbeCaseNoteInResponse(); break; case 11: - return $this->getAbeCreateDate(); + return $this->getAbeForceLogin(); break; case 12: - return $this->getAbeUpdateDate(); + return $this->getAbeCreateDate(); break; case 13: - return $this->getAbeSubjectField(); + return $this->getAbeUpdateDate(); break; case 14: - return $this->getAbeMailserverOrMailcurrent(); + return $this->getAbeSubjectField(); break; case 15: - return $this->getAbeCustomGrid(); + return $this->getAbeMailserverOrMailcurrent(); break; case 16: + return $this->getAbeCustomGrid(); + break; + case 17: return $this->getAbeEmailServerUid(); break; + case 18: + return $this->getAbeEmailServerReceiverUid(); + break; default: return null; break; @@ -1100,14 +1188,16 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $keys[6] => $this->getDynUid(), $keys[7] => $this->getAbeEmailField(), $keys[8] => $this->getAbeActionField(), - $keys[9] => $this->getAbeCaseNoteInResponse(), - $keys[10] => $this->getAbeForceLogin(), - $keys[11] => $this->getAbeCreateDate(), - $keys[12] => $this->getAbeUpdateDate(), - $keys[13] => $this->getAbeSubjectField(), - $keys[14] => $this->getAbeMailserverOrMailcurrent(), - $keys[15] => $this->getAbeCustomGrid(), - $keys[16] => $this->getAbeEmailServerUid(), + $keys[9] => $this->getAbeActionBodyField(), + $keys[10] => $this->getAbeCaseNoteInResponse(), + $keys[11] => $this->getAbeForceLogin(), + $keys[12] => $this->getAbeCreateDate(), + $keys[13] => $this->getAbeUpdateDate(), + $keys[14] => $this->getAbeSubjectField(), + $keys[15] => $this->getAbeMailserverOrMailcurrent(), + $keys[16] => $this->getAbeCustomGrid(), + $keys[17] => $this->getAbeEmailServerUid(), + $keys[18] => $this->getAbeEmailServerReceiverUid(), ); return $result; } @@ -1167,29 +1257,35 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $this->setAbeActionField($value); break; case 9: - $this->setAbeCaseNoteInResponse($value); + $this->setAbeActionBodyField($value); break; case 10: - $this->setAbeForceLogin($value); + $this->setAbeCaseNoteInResponse($value); break; case 11: - $this->setAbeCreateDate($value); + $this->setAbeForceLogin($value); break; case 12: - $this->setAbeUpdateDate($value); + $this->setAbeCreateDate($value); break; case 13: - $this->setAbeSubjectField($value); + $this->setAbeUpdateDate($value); break; case 14: - $this->setAbeMailserverOrMailcurrent($value); + $this->setAbeSubjectField($value); break; case 15: - $this->setAbeCustomGrid($value); + $this->setAbeMailserverOrMailcurrent($value); break; case 16: + $this->setAbeCustomGrid($value); + break; + case 17: $this->setAbeEmailServerUid($value); break; + case 18: + $this->setAbeEmailServerReceiverUid($value); + break; } // switch() } @@ -1250,35 +1346,43 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent } if (array_key_exists($keys[9], $arr)) { - $this->setAbeCaseNoteInResponse($arr[$keys[9]]); + $this->setAbeActionBodyField($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { - $this->setAbeForceLogin($arr[$keys[10]]); + $this->setAbeCaseNoteInResponse($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { - $this->setAbeCreateDate($arr[$keys[11]]); + $this->setAbeForceLogin($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { - $this->setAbeUpdateDate($arr[$keys[12]]); + $this->setAbeCreateDate($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { - $this->setAbeSubjectField($arr[$keys[13]]); + $this->setAbeUpdateDate($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { - $this->setAbeMailserverOrMailcurrent($arr[$keys[14]]); + $this->setAbeSubjectField($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { - $this->setAbeCustomGrid($arr[$keys[15]]); + $this->setAbeMailserverOrMailcurrent($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { - $this->setAbeEmailServerUid($arr[$keys[16]]); + $this->setAbeCustomGrid($arr[$keys[16]]); + } + + if (array_key_exists($keys[17], $arr)) { + $this->setAbeEmailServerUid($arr[$keys[17]]); + } + + if (array_key_exists($keys[18], $arr)) { + $this->setAbeEmailServerReceiverUid($arr[$keys[18]]); } } @@ -1328,6 +1432,10 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $criteria->add(AbeConfigurationPeer::ABE_ACTION_FIELD, $this->abe_action_field); } + if ($this->isColumnModified(AbeConfigurationPeer::ABE_ACTION_BODY_FIELD)) { + $criteria->add(AbeConfigurationPeer::ABE_ACTION_BODY_FIELD, $this->abe_action_body_field); + } + if ($this->isColumnModified(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE)) { $criteria->add(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, $this->abe_case_note_in_response); } @@ -1360,6 +1468,10 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $criteria->add(AbeConfigurationPeer::ABE_EMAIL_SERVER_UID, $this->abe_email_server_uid); } + if ($this->isColumnModified(AbeConfigurationPeer::ABE_EMAIL_SERVER_RECEIVER_UID)) { + $criteria->add(AbeConfigurationPeer::ABE_EMAIL_SERVER_RECEIVER_UID, $this->abe_email_server_receiver_uid); + } + return $criteria; } @@ -1430,6 +1542,8 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $copyObj->setAbeActionField($this->abe_action_field); + $copyObj->setAbeActionBodyField($this->abe_action_body_field); + $copyObj->setAbeCaseNoteInResponse($this->abe_case_note_in_response); $copyObj->setAbeForceLogin($this->abe_force_login); @@ -1446,6 +1560,8 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $copyObj->setAbeEmailServerUid($this->abe_email_server_uid); + $copyObj->setAbeEmailServerReceiverUid($this->abe_email_server_receiver_uid); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php b/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php index 213759db2..07f5b2bf0 100644 --- a/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php +++ b/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php @@ -25,7 +25,7 @@ abstract class BaseAbeConfigurationPeer const CLASS_DEFAULT = 'classes.model.AbeConfiguration'; /** The total number of columns. */ - const NUM_COLUMNS = 17; + const NUM_COLUMNS = 19; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -58,6 +58,9 @@ abstract class BaseAbeConfigurationPeer /** the column name for the ABE_ACTION_FIELD field */ const ABE_ACTION_FIELD = 'ABE_CONFIGURATION.ABE_ACTION_FIELD'; + /** the column name for the ABE_ACTION_BODY_FIELD field */ + const ABE_ACTION_BODY_FIELD = 'ABE_CONFIGURATION.ABE_ACTION_BODY_FIELD'; + /** the column name for the ABE_CASE_NOTE_IN_RESPONSE field */ const ABE_CASE_NOTE_IN_RESPONSE = 'ABE_CONFIGURATION.ABE_CASE_NOTE_IN_RESPONSE'; @@ -82,6 +85,9 @@ abstract class BaseAbeConfigurationPeer /** the column name for the ABE_EMAIL_SERVER_UID field */ const ABE_EMAIL_SERVER_UID = 'ABE_CONFIGURATION.ABE_EMAIL_SERVER_UID'; + /** the column name for the ABE_EMAIL_SERVER_RECEIVER_UID field */ + const ABE_EMAIL_SERVER_RECEIVER_UID = 'ABE_CONFIGURATION.ABE_EMAIL_SERVER_RECEIVER_UID'; + /** The PHP to DB Name Mapping */ private static $phpNameMap = null; @@ -93,10 +99,10 @@ abstract class BaseAbeConfigurationPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('AbeUid', 'ProUid', 'TasUid', 'AbeType', 'AbeTemplate', 'AbeDynType', 'DynUid', 'AbeEmailField', 'AbeActionField', 'AbeCaseNoteInResponse', 'AbeForceLogin', 'AbeCreateDate', 'AbeUpdateDate', 'AbeSubjectField', 'AbeMailserverOrMailcurrent', 'AbeCustomGrid', 'AbeEmailServerUid', ), - BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID, AbeConfigurationPeer::PRO_UID, AbeConfigurationPeer::TAS_UID, AbeConfigurationPeer::ABE_TYPE, AbeConfigurationPeer::ABE_TEMPLATE, AbeConfigurationPeer::ABE_DYN_TYPE, AbeConfigurationPeer::DYN_UID, AbeConfigurationPeer::ABE_EMAIL_FIELD, AbeConfigurationPeer::ABE_ACTION_FIELD, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, AbeConfigurationPeer::ABE_FORCE_LOGIN, AbeConfigurationPeer::ABE_CREATE_DATE, AbeConfigurationPeer::ABE_UPDATE_DATE, AbeConfigurationPeer::ABE_SUBJECT_FIELD, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT, AbeConfigurationPeer::ABE_CUSTOM_GRID, AbeConfigurationPeer::ABE_EMAIL_SERVER_UID, ), - BasePeer::TYPE_FIELDNAME => array ('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_FORCE_LOGIN', 'ABE_CREATE_DATE', 'ABE_UPDATE_DATE', 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', 'ABE_EMAIL_SERVER_UID', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) + BasePeer::TYPE_PHPNAME => array ('AbeUid', 'ProUid', 'TasUid', 'AbeType', 'AbeTemplate', 'AbeDynType', 'DynUid', 'AbeEmailField', 'AbeActionField', 'AbeActionBodyField', 'AbeCaseNoteInResponse', 'AbeForceLogin', 'AbeCreateDate', 'AbeUpdateDate', 'AbeSubjectField', 'AbeMailserverOrMailcurrent', 'AbeCustomGrid', 'AbeEmailServerUid', 'AbeEmailServerReceiverUid', ), + BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID, AbeConfigurationPeer::PRO_UID, AbeConfigurationPeer::TAS_UID, AbeConfigurationPeer::ABE_TYPE, AbeConfigurationPeer::ABE_TEMPLATE, AbeConfigurationPeer::ABE_DYN_TYPE, AbeConfigurationPeer::DYN_UID, AbeConfigurationPeer::ABE_EMAIL_FIELD, AbeConfigurationPeer::ABE_ACTION_FIELD, AbeConfigurationPeer::ABE_ACTION_BODY_FIELD, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, AbeConfigurationPeer::ABE_FORCE_LOGIN, AbeConfigurationPeer::ABE_CREATE_DATE, AbeConfigurationPeer::ABE_UPDATE_DATE, AbeConfigurationPeer::ABE_SUBJECT_FIELD, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT, AbeConfigurationPeer::ABE_CUSTOM_GRID, AbeConfigurationPeer::ABE_EMAIL_SERVER_UID, AbeConfigurationPeer::ABE_EMAIL_SERVER_RECEIVER_UID, ), + BasePeer::TYPE_FIELDNAME => array ('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', 'ABE_ACTION_BODY_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_FORCE_LOGIN', 'ABE_CREATE_DATE', 'ABE_UPDATE_DATE', 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', 'ABE_EMAIL_SERVER_UID', 'ABE_EMAIL_SERVER_RECEIVER_UID', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -106,10 +112,10 @@ abstract class BaseAbeConfigurationPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('AbeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'AbeType' => 3, 'AbeTemplate' => 4, 'AbeDynType' => 5, 'DynUid' => 6, 'AbeEmailField' => 7, 'AbeActionField' => 8, 'AbeCaseNoteInResponse' => 9, 'AbeForceLogin' => 10, 'AbeCreateDate' => 11, 'AbeUpdateDate' => 12, 'AbeSubjectField' => 13, 'AbeMailserverOrMailcurrent' => 14, 'AbeCustomGrid' => 15, 'AbeEmailServerUid' => 16, ), - BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID => 0, AbeConfigurationPeer::PRO_UID => 1, AbeConfigurationPeer::TAS_UID => 2, AbeConfigurationPeer::ABE_TYPE => 3, AbeConfigurationPeer::ABE_TEMPLATE => 4, AbeConfigurationPeer::ABE_DYN_TYPE => 5, AbeConfigurationPeer::DYN_UID => 6, AbeConfigurationPeer::ABE_EMAIL_FIELD => 7, AbeConfigurationPeer::ABE_ACTION_FIELD => 8, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE => 9, AbeConfigurationPeer::ABE_FORCE_LOGIN => 10, AbeConfigurationPeer::ABE_CREATE_DATE => 11, AbeConfigurationPeer::ABE_UPDATE_DATE => 12, AbeConfigurationPeer::ABE_SUBJECT_FIELD => 13, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT => 14, AbeConfigurationPeer::ABE_CUSTOM_GRID => 15, AbeConfigurationPeer::ABE_EMAIL_SERVER_UID => 16, ), - BasePeer::TYPE_FIELDNAME => array ('ABE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'ABE_TYPE' => 3, 'ABE_TEMPLATE' => 4, 'ABE_DYN_TYPE' => 5, 'DYN_UID' => 6, 'ABE_EMAIL_FIELD' => 7, 'ABE_ACTION_FIELD' => 8, 'ABE_CASE_NOTE_IN_RESPONSE' => 9, 'ABE_FORCE_LOGIN' => 10, 'ABE_CREATE_DATE' => 11, 'ABE_UPDATE_DATE' => 12, 'ABE_SUBJECT_FIELD' => 13, 'ABE_MAILSERVER_OR_MAILCURRENT' => 14, 'ABE_CUSTOM_GRID' => 15, 'ABE_EMAIL_SERVER_UID' => 16, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) + BasePeer::TYPE_PHPNAME => array ('AbeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'AbeType' => 3, 'AbeTemplate' => 4, 'AbeDynType' => 5, 'DynUid' => 6, 'AbeEmailField' => 7, 'AbeActionField' => 8, 'AbeActionBodyField' => 9, 'AbeCaseNoteInResponse' => 10, 'AbeForceLogin' => 11, 'AbeCreateDate' => 12, 'AbeUpdateDate' => 13, 'AbeSubjectField' => 14, 'AbeMailserverOrMailcurrent' => 15, 'AbeCustomGrid' => 16, 'AbeEmailServerUid' => 17, 'AbeEmailServerReceiverUid' => 18, ), + BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID => 0, AbeConfigurationPeer::PRO_UID => 1, AbeConfigurationPeer::TAS_UID => 2, AbeConfigurationPeer::ABE_TYPE => 3, AbeConfigurationPeer::ABE_TEMPLATE => 4, AbeConfigurationPeer::ABE_DYN_TYPE => 5, AbeConfigurationPeer::DYN_UID => 6, AbeConfigurationPeer::ABE_EMAIL_FIELD => 7, AbeConfigurationPeer::ABE_ACTION_FIELD => 8, AbeConfigurationPeer::ABE_ACTION_BODY_FIELD => 9, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE => 10, AbeConfigurationPeer::ABE_FORCE_LOGIN => 11, AbeConfigurationPeer::ABE_CREATE_DATE => 12, AbeConfigurationPeer::ABE_UPDATE_DATE => 13, AbeConfigurationPeer::ABE_SUBJECT_FIELD => 14, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT => 15, AbeConfigurationPeer::ABE_CUSTOM_GRID => 16, AbeConfigurationPeer::ABE_EMAIL_SERVER_UID => 17, AbeConfigurationPeer::ABE_EMAIL_SERVER_RECEIVER_UID => 18, ), + BasePeer::TYPE_FIELDNAME => array ('ABE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'ABE_TYPE' => 3, 'ABE_TEMPLATE' => 4, 'ABE_DYN_TYPE' => 5, 'DYN_UID' => 6, 'ABE_EMAIL_FIELD' => 7, 'ABE_ACTION_FIELD' => 8, 'ABE_ACTION_BODY_FIELD' => 9, 'ABE_CASE_NOTE_IN_RESPONSE' => 10, 'ABE_FORCE_LOGIN' => 11, 'ABE_CREATE_DATE' => 12, 'ABE_UPDATE_DATE' => 13, 'ABE_SUBJECT_FIELD' => 14, 'ABE_MAILSERVER_OR_MAILCURRENT' => 15, 'ABE_CUSTOM_GRID' => 16, 'ABE_EMAIL_SERVER_UID' => 17, 'ABE_EMAIL_SERVER_RECEIVER_UID' => 18, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -228,6 +234,8 @@ abstract class BaseAbeConfigurationPeer $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_BODY_FIELD); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_FORCE_LOGIN); @@ -244,6 +252,8 @@ abstract class BaseAbeConfigurationPeer $criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_SERVER_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_SERVER_RECEIVER_UID); + } const COUNT = 'COUNT(ABE_CONFIGURATION.ABE_UID)'; diff --git a/workflow/engine/classes/model/om/BaseEmailServer.php b/workflow/engine/classes/model/om/BaseEmailServer.php index 111488080..82716bab4 100644 --- a/workflow/engine/classes/model/om/BaseEmailServer.php +++ b/workflow/engine/classes/model/om/BaseEmailServer.php @@ -51,6 +51,18 @@ abstract class BaseEmailServer extends BaseObject implements Persistent */ protected $mess_port = 0; + /** + * The value for the mess_incoming_server field. + * @var string + */ + protected $mess_incoming_server = ''; + + /** + * The value for the mess_incoming_port field. + * @var int + */ + protected $mess_incoming_port = 0; + /** * The value for the mess_rauth field. * @var int @@ -163,6 +175,28 @@ abstract class BaseEmailServer extends BaseObject implements Persistent return $this->mess_port; } + /** + * Get the [mess_incoming_server] column value. + * + * @return string + */ + public function getMessIncomingServer() + { + + return $this->mess_incoming_server; + } + + /** + * Get the [mess_incoming_port] column value. + * + * @return int + */ + public function getMessIncomingPort() + { + + return $this->mess_incoming_port; + } + /** * Get the [mess_rauth] column value. * @@ -350,6 +384,50 @@ abstract class BaseEmailServer extends BaseObject implements Persistent } // setMessPort() + /** + * Set the value of [mess_incoming_server] column. + * + * @param string $v new value + * @return void + */ + public function setMessIncomingServer($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->mess_incoming_server !== $v || $v === '') { + $this->mess_incoming_server = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_INCOMING_SERVER; + } + + } // setMessIncomingServer() + + /** + * Set the value of [mess_incoming_port] column. + * + * @param int $v new value + * @return void + */ + public function setMessIncomingPort($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->mess_incoming_port !== $v || $v === 0) { + $this->mess_incoming_port = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_INCOMING_PORT; + } + + } // setMessIncomingPort() + /** * Set the value of [mess_rauth] column. * @@ -573,30 +651,34 @@ abstract class BaseEmailServer extends BaseObject implements Persistent $this->mess_port = $rs->getInt($startcol + 3); - $this->mess_rauth = $rs->getInt($startcol + 4); + $this->mess_incoming_server = $rs->getString($startcol + 4); - $this->mess_account = $rs->getString($startcol + 5); + $this->mess_incoming_port = $rs->getInt($startcol + 5); - $this->mess_password = $rs->getString($startcol + 6); + $this->mess_rauth = $rs->getInt($startcol + 6); - $this->mess_from_mail = $rs->getString($startcol + 7); + $this->mess_account = $rs->getString($startcol + 7); - $this->mess_from_name = $rs->getString($startcol + 8); + $this->mess_password = $rs->getString($startcol + 8); - $this->smtpsecure = $rs->getString($startcol + 9); + $this->mess_from_mail = $rs->getString($startcol + 9); - $this->mess_try_send_inmediatly = $rs->getInt($startcol + 10); + $this->mess_from_name = $rs->getString($startcol + 10); - $this->mail_to = $rs->getString($startcol + 11); + $this->smtpsecure = $rs->getString($startcol + 11); - $this->mess_default = $rs->getInt($startcol + 12); + $this->mess_try_send_inmediatly = $rs->getInt($startcol + 12); + + $this->mail_to = $rs->getString($startcol + 13); + + $this->mess_default = $rs->getInt($startcol + 14); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 13; // 13 = EmailServerPeer::NUM_COLUMNS - EmailServerPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 15; // 15 = EmailServerPeer::NUM_COLUMNS - EmailServerPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating EmailServer object", $e); @@ -813,30 +895,36 @@ abstract class BaseEmailServer extends BaseObject implements Persistent return $this->getMessPort(); break; case 4: - return $this->getMessRauth(); + return $this->getMessIncomingServer(); break; case 5: - return $this->getMessAccount(); + return $this->getMessIncomingPort(); break; case 6: - return $this->getMessPassword(); + return $this->getMessRauth(); break; case 7: - return $this->getMessFromMail(); + return $this->getMessAccount(); break; case 8: - return $this->getMessFromName(); + return $this->getMessPassword(); break; case 9: - return $this->getSmtpsecure(); + return $this->getMessFromMail(); break; case 10: - return $this->getMessTrySendInmediatly(); + return $this->getMessFromName(); break; case 11: - return $this->getMailTo(); + return $this->getSmtpsecure(); break; case 12: + return $this->getMessTrySendInmediatly(); + break; + case 13: + return $this->getMailTo(); + break; + case 14: return $this->getMessDefault(); break; default: @@ -863,15 +951,17 @@ abstract class BaseEmailServer extends BaseObject implements Persistent $keys[1] => $this->getMessEngine(), $keys[2] => $this->getMessServer(), $keys[3] => $this->getMessPort(), - $keys[4] => $this->getMessRauth(), - $keys[5] => $this->getMessAccount(), - $keys[6] => $this->getMessPassword(), - $keys[7] => $this->getMessFromMail(), - $keys[8] => $this->getMessFromName(), - $keys[9] => $this->getSmtpsecure(), - $keys[10] => $this->getMessTrySendInmediatly(), - $keys[11] => $this->getMailTo(), - $keys[12] => $this->getMessDefault(), + $keys[4] => $this->getMessIncomingServer(), + $keys[5] => $this->getMessIncomingPort(), + $keys[6] => $this->getMessRauth(), + $keys[7] => $this->getMessAccount(), + $keys[8] => $this->getMessPassword(), + $keys[9] => $this->getMessFromMail(), + $keys[10] => $this->getMessFromName(), + $keys[11] => $this->getSmtpsecure(), + $keys[12] => $this->getMessTrySendInmediatly(), + $keys[13] => $this->getMailTo(), + $keys[14] => $this->getMessDefault(), ); return $result; } @@ -916,30 +1006,36 @@ abstract class BaseEmailServer extends BaseObject implements Persistent $this->setMessPort($value); break; case 4: - $this->setMessRauth($value); + $this->setMessIncomingServer($value); break; case 5: - $this->setMessAccount($value); + $this->setMessIncomingPort($value); break; case 6: - $this->setMessPassword($value); + $this->setMessRauth($value); break; case 7: - $this->setMessFromMail($value); + $this->setMessAccount($value); break; case 8: - $this->setMessFromName($value); + $this->setMessPassword($value); break; case 9: - $this->setSmtpsecure($value); + $this->setMessFromMail($value); break; case 10: - $this->setMessTrySendInmediatly($value); + $this->setMessFromName($value); break; case 11: - $this->setMailTo($value); + $this->setSmtpsecure($value); break; case 12: + $this->setMessTrySendInmediatly($value); + break; + case 13: + $this->setMailTo($value); + break; + case 14: $this->setMessDefault($value); break; } // switch() @@ -982,39 +1078,47 @@ abstract class BaseEmailServer extends BaseObject implements Persistent } if (array_key_exists($keys[4], $arr)) { - $this->setMessRauth($arr[$keys[4]]); + $this->setMessIncomingServer($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { - $this->setMessAccount($arr[$keys[5]]); + $this->setMessIncomingPort($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { - $this->setMessPassword($arr[$keys[6]]); + $this->setMessRauth($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { - $this->setMessFromMail($arr[$keys[7]]); + $this->setMessAccount($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { - $this->setMessFromName($arr[$keys[8]]); + $this->setMessPassword($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { - $this->setSmtpsecure($arr[$keys[9]]); + $this->setMessFromMail($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { - $this->setMessTrySendInmediatly($arr[$keys[10]]); + $this->setMessFromName($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { - $this->setMailTo($arr[$keys[11]]); + $this->setSmtpsecure($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { - $this->setMessDefault($arr[$keys[12]]); + $this->setMessTrySendInmediatly($arr[$keys[12]]); + } + + if (array_key_exists($keys[13], $arr)) { + $this->setMailTo($arr[$keys[13]]); + } + + if (array_key_exists($keys[14], $arr)) { + $this->setMessDefault($arr[$keys[14]]); } } @@ -1044,6 +1148,14 @@ abstract class BaseEmailServer extends BaseObject implements Persistent $criteria->add(EmailServerPeer::MESS_PORT, $this->mess_port); } + if ($this->isColumnModified(EmailServerPeer::MESS_INCOMING_SERVER)) { + $criteria->add(EmailServerPeer::MESS_INCOMING_SERVER, $this->mess_incoming_server); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_INCOMING_PORT)) { + $criteria->add(EmailServerPeer::MESS_INCOMING_PORT, $this->mess_incoming_port); + } + if ($this->isColumnModified(EmailServerPeer::MESS_RAUTH)) { $criteria->add(EmailServerPeer::MESS_RAUTH, $this->mess_rauth); } @@ -1140,6 +1252,10 @@ abstract class BaseEmailServer extends BaseObject implements Persistent $copyObj->setMessPort($this->mess_port); + $copyObj->setMessIncomingServer($this->mess_incoming_server); + + $copyObj->setMessIncomingPort($this->mess_incoming_port); + $copyObj->setMessRauth($this->mess_rauth); $copyObj->setMessAccount($this->mess_account); diff --git a/workflow/engine/classes/model/om/BaseEmailServerPeer.php b/workflow/engine/classes/model/om/BaseEmailServerPeer.php index c78d96808..a020a0763 100644 --- a/workflow/engine/classes/model/om/BaseEmailServerPeer.php +++ b/workflow/engine/classes/model/om/BaseEmailServerPeer.php @@ -25,7 +25,7 @@ abstract class BaseEmailServerPeer const CLASS_DEFAULT = 'classes.model.EmailServer'; /** The total number of columns. */ - const NUM_COLUMNS = 13; + const NUM_COLUMNS = 15; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -43,6 +43,12 @@ abstract class BaseEmailServerPeer /** the column name for the MESS_PORT field */ const MESS_PORT = 'EMAIL_SERVER.MESS_PORT'; + /** the column name for the MESS_INCOMING_SERVER field */ + const MESS_INCOMING_SERVER = 'EMAIL_SERVER.MESS_INCOMING_SERVER'; + + /** the column name for the MESS_INCOMING_PORT field */ + const MESS_INCOMING_PORT = 'EMAIL_SERVER.MESS_INCOMING_PORT'; + /** the column name for the MESS_RAUTH field */ const MESS_RAUTH = 'EMAIL_SERVER.MESS_RAUTH'; @@ -81,10 +87,10 @@ abstract class BaseEmailServerPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('MessUid', 'MessEngine', 'MessServer', 'MessPort', 'MessRauth', 'MessAccount', 'MessPassword', 'MessFromMail', 'MessFromName', 'Smtpsecure', 'MessTrySendInmediatly', 'MailTo', 'MessDefault', ), - BasePeer::TYPE_COLNAME => array (EmailServerPeer::MESS_UID, EmailServerPeer::MESS_ENGINE, EmailServerPeer::MESS_SERVER, EmailServerPeer::MESS_PORT, EmailServerPeer::MESS_RAUTH, EmailServerPeer::MESS_ACCOUNT, EmailServerPeer::MESS_PASSWORD, EmailServerPeer::MESS_FROM_MAIL, EmailServerPeer::MESS_FROM_NAME, EmailServerPeer::SMTPSECURE, EmailServerPeer::MESS_TRY_SEND_INMEDIATLY, EmailServerPeer::MAIL_TO, EmailServerPeer::MESS_DEFAULT, ), - BasePeer::TYPE_FIELDNAME => array ('MESS_UID', 'MESS_ENGINE', 'MESS_SERVER', 'MESS_PORT', 'MESS_RAUTH', 'MESS_ACCOUNT', 'MESS_PASSWORD', 'MESS_FROM_MAIL', 'MESS_FROM_NAME', 'SMTPSECURE', 'MESS_TRY_SEND_INMEDIATLY', 'MAIL_TO', 'MESS_DEFAULT', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) + BasePeer::TYPE_PHPNAME => array ('MessUid', 'MessEngine', 'MessServer', 'MessPort', 'MessIncomingServer', 'MessIncomingPort', 'MessRauth', 'MessAccount', 'MessPassword', 'MessFromMail', 'MessFromName', 'Smtpsecure', 'MessTrySendInmediatly', 'MailTo', 'MessDefault', ), + BasePeer::TYPE_COLNAME => array (EmailServerPeer::MESS_UID, EmailServerPeer::MESS_ENGINE, EmailServerPeer::MESS_SERVER, EmailServerPeer::MESS_PORT, EmailServerPeer::MESS_INCOMING_SERVER, EmailServerPeer::MESS_INCOMING_PORT, EmailServerPeer::MESS_RAUTH, EmailServerPeer::MESS_ACCOUNT, EmailServerPeer::MESS_PASSWORD, EmailServerPeer::MESS_FROM_MAIL, EmailServerPeer::MESS_FROM_NAME, EmailServerPeer::SMTPSECURE, EmailServerPeer::MESS_TRY_SEND_INMEDIATLY, EmailServerPeer::MAIL_TO, EmailServerPeer::MESS_DEFAULT, ), + BasePeer::TYPE_FIELDNAME => array ('MESS_UID', 'MESS_ENGINE', 'MESS_SERVER', 'MESS_PORT', 'MESS_INCOMING_SERVER', 'MESS_INCOMING_PORT', 'MESS_RAUTH', 'MESS_ACCOUNT', 'MESS_PASSWORD', 'MESS_FROM_MAIL', 'MESS_FROM_NAME', 'SMTPSECURE', 'MESS_TRY_SEND_INMEDIATLY', 'MAIL_TO', 'MESS_DEFAULT', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -94,10 +100,10 @@ abstract class BaseEmailServerPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('MessUid' => 0, 'MessEngine' => 1, 'MessServer' => 2, 'MessPort' => 3, 'MessRauth' => 4, 'MessAccount' => 5, 'MessPassword' => 6, 'MessFromMail' => 7, 'MessFromName' => 8, 'Smtpsecure' => 9, 'MessTrySendInmediatly' => 10, 'MailTo' => 11, 'MessDefault' => 12, ), - BasePeer::TYPE_COLNAME => array (EmailServerPeer::MESS_UID => 0, EmailServerPeer::MESS_ENGINE => 1, EmailServerPeer::MESS_SERVER => 2, EmailServerPeer::MESS_PORT => 3, EmailServerPeer::MESS_RAUTH => 4, EmailServerPeer::MESS_ACCOUNT => 5, EmailServerPeer::MESS_PASSWORD => 6, EmailServerPeer::MESS_FROM_MAIL => 7, EmailServerPeer::MESS_FROM_NAME => 8, EmailServerPeer::SMTPSECURE => 9, EmailServerPeer::MESS_TRY_SEND_INMEDIATLY => 10, EmailServerPeer::MAIL_TO => 11, EmailServerPeer::MESS_DEFAULT => 12, ), - BasePeer::TYPE_FIELDNAME => array ('MESS_UID' => 0, 'MESS_ENGINE' => 1, 'MESS_SERVER' => 2, 'MESS_PORT' => 3, 'MESS_RAUTH' => 4, 'MESS_ACCOUNT' => 5, 'MESS_PASSWORD' => 6, 'MESS_FROM_MAIL' => 7, 'MESS_FROM_NAME' => 8, 'SMTPSECURE' => 9, 'MESS_TRY_SEND_INMEDIATLY' => 10, 'MAIL_TO' => 11, 'MESS_DEFAULT' => 12, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) + BasePeer::TYPE_PHPNAME => array ('MessUid' => 0, 'MessEngine' => 1, 'MessServer' => 2, 'MessPort' => 3, 'MessIncomingServer' => 4, 'MessIncomingPort' => 5, 'MessRauth' => 6, 'MessAccount' => 7, 'MessPassword' => 8, 'MessFromMail' => 9, 'MessFromName' => 10, 'Smtpsecure' => 11, 'MessTrySendInmediatly' => 12, 'MailTo' => 13, 'MessDefault' => 14, ), + BasePeer::TYPE_COLNAME => array (EmailServerPeer::MESS_UID => 0, EmailServerPeer::MESS_ENGINE => 1, EmailServerPeer::MESS_SERVER => 2, EmailServerPeer::MESS_PORT => 3, EmailServerPeer::MESS_INCOMING_SERVER => 4, EmailServerPeer::MESS_INCOMING_PORT => 5, EmailServerPeer::MESS_RAUTH => 6, EmailServerPeer::MESS_ACCOUNT => 7, EmailServerPeer::MESS_PASSWORD => 8, EmailServerPeer::MESS_FROM_MAIL => 9, EmailServerPeer::MESS_FROM_NAME => 10, EmailServerPeer::SMTPSECURE => 11, EmailServerPeer::MESS_TRY_SEND_INMEDIATLY => 12, EmailServerPeer::MAIL_TO => 13, EmailServerPeer::MESS_DEFAULT => 14, ), + BasePeer::TYPE_FIELDNAME => array ('MESS_UID' => 0, 'MESS_ENGINE' => 1, 'MESS_SERVER' => 2, 'MESS_PORT' => 3, 'MESS_INCOMING_SERVER' => 4, 'MESS_INCOMING_PORT' => 5, 'MESS_RAUTH' => 6, 'MESS_ACCOUNT' => 7, 'MESS_PASSWORD' => 8, 'MESS_FROM_MAIL' => 9, 'MESS_FROM_NAME' => 10, 'SMTPSECURE' => 11, 'MESS_TRY_SEND_INMEDIATLY' => 12, 'MAIL_TO' => 13, 'MESS_DEFAULT' => 14, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -206,6 +212,10 @@ abstract class BaseEmailServerPeer $criteria->addSelectColumn(EmailServerPeer::MESS_PORT); + $criteria->addSelectColumn(EmailServerPeer::MESS_INCOMING_SERVER); + + $criteria->addSelectColumn(EmailServerPeer::MESS_INCOMING_PORT); + $criteria->addSelectColumn(EmailServerPeer::MESS_RAUTH); $criteria->addSelectColumn(EmailServerPeer::MESS_ACCOUNT); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index eac919313..040682cad 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4866,6 +4866,8 @@ + + @@ -5094,6 +5096,16 @@ + + + + + + + + + + @@ -5141,6 +5153,7 @@ + @@ -5769,7 +5782,7 @@
- + diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index edc9b4484..dae323258 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -1699,6 +1699,30 @@ msgstr "3 days at least" msgid "The answer has been submitted. Thank you." msgstr "The answer has been submitted. Thank you." +# TRANSLATION +# LABEL/ID_ABE_EMAIL_RESPONSE_BODY_NOTE +#: LABEL/ID_ABE_EMAIL_RESPONSE_BODY_NOTE +msgid "Please add your comments above this section. Don't modify or delete this section." +msgstr "Please add your comments above this section. Don't modify or delete this section." + +# TRANSLATION +# LABEL/ID_ABE_CASE_NOTE_ANSWER +#: LABEL/ID_ABE_CASE_NOTE_ANSWER +msgid "Answer: {optionLabel}" +msgstr "Answer: {optionLabel}" + +# TRANSLATION +# LABEL/ID_ABE_CASE_NOTE_COMMENT +#: LABEL/ID_ABE_CASE_NOTE_COMMENT +msgid "Comment: {emailBody}" +msgstr "Comment: {emailBody}" + +# TRANSLATION +# LABEL/ID_ABE_CASE_NOTE_HEADER +#: LABEL/ID_ABE_CASE_NOTE_HEADER +msgid "{emailAccount} has completed a task from Actions by Email." +msgstr "{emailAccount} has completed a task from Actions by Email." + # TRANSLATION # LABEL/ID_ABE_FORM_ALREADY_FILLED #: LABEL/ID_ABE_FORM_ALREADY_FILLED @@ -1711,6 +1735,54 @@ msgstr "The form has already been filled and sent." msgid "The information was submitted. Thank you." msgstr "The information was submitted. Thank you." +# TRANSLATION +# LABEL/ID_ABE_LOG_ALREADY_ROUTED +#: LABEL/ID_ABE_LOG_ALREADY_ROUTED +msgid "The case was identified correctly but it was already routed." +msgstr "The case was identified correctly but it was already routed." + +# TRANSLATION +# LABEL/ID_ABE_LOG_CANNOT_BE_IDENTIFIED +#: LABEL/ID_ABE_LOG_CANNOT_BE_IDENTIFIED +msgid "The case cannot be identified." +msgstr "The case cannot be identified." + +# TRANSLATION +# LABEL/ID_ABE_LOG_CANNOT_READ +#: LABEL/ID_ABE_LOG_CANNOT_READ +msgid "The application cannot read the email receiver account." +msgstr "The application cannot read the email receiver account." + +# TRANSLATION +# LABEL/ID_ABE_LOG_PROCESSED_OK +#: LABEL/ID_ABE_LOG_PROCESSED_OK +msgid "The answer was processed correctly." +msgstr "The answer was processed correctly." + +# TRANSLATION +# LABEL/ID_ABE_LOG_ROUTING_FAILED +#: LABEL/ID_ABE_LOG_ROUTING_FAILED +msgid "The case was identified correctly but the routing process has failed." +msgstr "The case was identified correctly but the routing process has failed." + +# TRANSLATION +# LABEL/ID_ABE_RESPONSE_ALREADY_ROUTED +#: LABEL/ID_ABE_RESPONSE_ALREADY_ROUTED +msgid "Your answer cannot be processed because the case was already routed or is no longer assigned to you." +msgstr "Your answer cannot be processed because the case was already routed or is no longer assigned to you." + +# TRANSLATION +# LABEL/ID_ABE_RESPONSE_CANNOT_BE_IDENTIFIED +#: LABEL/ID_ABE_RESPONSE_CANNOT_BE_IDENTIFIED +msgid "Your answer cannot be processed, please try again and make sure to keep the subject code untouched." +msgstr "Your answer cannot be processed, please try again and make sure to keep the subject code untouched." + +# TRANSLATION +# LABEL/ID_ABE_RESPONSE_ROUTING_FAILED +#: LABEL/ID_ABE_RESPONSE_ROUTING_FAILED +msgid "Your answer cannot be processed because there is an error in the flow definition, please notify to this issue to the system administrator." +msgstr "Your answer cannot be processed because there is an error in the flow definition, please notify to this issue to the system administrator." + # TRANSLATION # LABEL/ID_ABE_RESPONSE_SENT #: LABEL/ID_ABE_RESPONSE_SENT @@ -4247,6 +4319,12 @@ msgstr "Close Editor" msgid "[LABEL/ID_CODE] Code" msgstr "Code" +# TRANSLATION +# LABEL/ID_CODE_CRYPT +#: LABEL/ID_CODE_CRYPT +msgid "Code:" +msgstr "Code:" + # TRANSLATION # LABEL/ID_COLLAPSE_ALL #: LABEL/ID_COLLAPSE_ALL @@ -13625,6 +13703,12 @@ msgstr "Execute a trigger when a case is deleted" msgid "Please press the \"Generate Link\" button." msgstr "Please press the \"Generate Link\" button." +# TRANSLATION +# LABEL/ID_MAFE_660cfca112471f69246e9942f5e8afd1 +#: LABEL/ID_MAFE_660cfca112471f69246e9942f5e8afd1 +msgid "Store email body in" +msgstr "Store email body in" + # TRANSLATION # LABEL/ID_MAFE_66285b36f894a5439af5a98e3e1a36d2 #: LABEL/ID_MAFE_66285b36f894a5439af5a98e3e1a36d2 @@ -14555,6 +14639,12 @@ msgstr "January" msgid "[LABEL/ID_MAFE_86fd9a7abc9f357e7fa206b2d42ec5ba] Destination Path" msgstr "Destination Path" +# TRANSLATION +# LABEL/ID_MAFE_8738321e65db027ee6476c0ab12d8cd5 +#: LABEL/ID_MAFE_8738321e65db027ee6476c0ab12d8cd5 +msgid "Store option in" +msgstr "Store option in" + # TRANSLATION # LABEL/ID_MAFE_87557f11575c0ad78e4e28abedc13b6e #: LABEL/ID_MAFE_87557f11575c0ad78e4e28abedc13b6e @@ -15371,6 +15461,12 @@ msgstr "Properties" msgid "[LABEL/ID_MAFE_9fced129522f128b2445a41fb0b6ef9f] checkbox" msgstr "checkbox" +# TRANSLATION +# LABEL/ID_MAFE_a036226d97d1d0d725d494a1431f322c +#: LABEL/ID_MAFE_a036226d97d1d0d725d494a1431f322c +msgid "Receiver account" +msgstr "Receiver account" + # TRANSLATION # LABEL/ID_MAFE_a05ac4341235111bd2cba5c3c105ba81 #: LABEL/ID_MAFE_a05ac4341235111bd2cba5c3c105ba81 @@ -17945,6 +18041,12 @@ msgstr "Users" msgid "validate" msgstr "validate" +# TRANSLATION +# LABEL/ID_MAFE_fa2b5b7c9bccd35e42cb74042690a091 +#: LABEL/ID_MAFE_fa2b5b7c9bccd35e42cb74042690a091 +msgid "Email response" +msgstr "Email response" + # TRANSLATION # LABEL/ID_MAFE_fa3c608c8fc755543f0d37afd6a42651 #: LABEL/ID_MAFE_fa3c608c8fc755543f0d37afd6a42651 @@ -23549,6 +23651,18 @@ msgstr "Sent By" msgid "[LABEL/ID_SERVER] Server" msgstr "Server" +# TRANSLATION +# LABEL/ID_OUTGOING_SERVER +#: LABEL/ID_OUTGOING_SERVER +msgid "Outgoing Server" +msgstr "Outgoing Server" + +# TRANSLATION +# LABEL/ID_INCOMING_SERVER +#: LABEL/ID_INCOMING_SERVER +msgid "Incoming Server" +msgstr "Incoming Server" + # TRANSLATION # LABEL/ID_SERVER_ADDRESS #: LABEL/ID_SERVER_ADDRESS @@ -26033,18 +26147,6 @@ msgstr "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgid "The file has not been attached because the extension is not allowed or because the content doesn't correspond." msgstr "The file has not been attached because the extension is not allowed or because the content doesn't correspond." -# TRANSLATION -# LABEL/ID_UPLOAD_INVALID_DOC_MAX_FILESIZE -#: LABEL/ID_UPLOAD_INVALID_DOC_MAX_FILESIZE -msgid "File size exceeds the allowable limit of {0}" -msgstr "File size exceeds the allowable limit of {0}" - -# TRANSLATION -# LABEL/ID_UPLOAD_INVALID_DOC_TYPE_FILE -#: LABEL/ID_UPLOAD_INVALID_DOC_TYPE_FILE -msgid "Invalid file format, please upload a file with one of the following formats {0}" -msgstr "Invalid file format, please upload a file with one of the following formats {0}" - # TRANSLATION # LABEL/ID_UPLOAD_ERR_NO_FILE #: LABEL/ID_UPLOAD_ERR_NO_FILE @@ -26093,6 +26195,18 @@ msgstr "Upload from file" msgid "Upload image" msgstr "Upload image" +# TRANSLATION +# LABEL/ID_UPLOAD_INVALID_DOC_MAX_FILESIZE +#: LABEL/ID_UPLOAD_INVALID_DOC_MAX_FILESIZE +msgid "File size exceeds the allowable limit of {0}" +msgstr "File size exceeds the allowable limit of {0}" + +# TRANSLATION +# LABEL/ID_UPLOAD_INVALID_DOC_TYPE_FILE +#: LABEL/ID_UPLOAD_INVALID_DOC_TYPE_FILE +msgid "Invalid file format, please upload a file with one of the following formats {0}" +msgstr "Invalid file format, please upload a file with one of the following formats {0}" + # TRANSLATION # LABEL/ID_UPLOAD_LANGUAGE #: LABEL/ID_UPLOAD_LANGUAGE @@ -28013,6 +28127,18 @@ msgstr "Photo gallery" msgid "Port (default 25)" msgstr "Port (default 25)" +# TRANSLATION +# LABEL/INCOMING_PORT_DEFAULT +#: LABEL/INCOMING_PORT_DEFAULT +msgid "Incoming Port (default 143)" +msgstr "Incoming Port (default 143)" + +# TRANSLATION +# LABEL/OUTGOING_PORT_DEFAULT +#: LABEL/OUTGOING_PORT_DEFAULT +msgid "Outgoing Port (default 25)" +msgstr "Outgoing Port (default 25)" + # TRANSLATION # LABEL/REQUIRE_AUTHENTICATION #: LABEL/REQUIRE_AUTHENTICATION diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index b4c490c62..f81c61cb4 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -57081,9 +57081,21 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','HTML_FILES','en','You can open only files with the .html extension','2014-01-15') , ( 'LABEL','ID_3DAYSMINIMUM','en','3 days at least','2014-01-15') , ( 'LABEL','ID_ABE_ANSWER_SUBMITTED','en','The answer has been submitted. Thank you.','2017-06-19') , +( 'LABEL','ID_ABE_EMAIL_RESPONSE_BODY_NOTE','en','Please add your comments above this section. Don''t modify or delete this section.','2018-11-16') , ( 'LABEL','ID_ABE_FORM_ALREADY_FILLED','en','The form has already been filled and sent.','2017-06-09') , ( 'LABEL','ID_ABE_INFORMATION_SUBMITTED','en','The information was submitted. Thank you.','2017-06-19') , ( 'LABEL','ID_ABE_RESPONSE_SENT','en','The response has already been sent.','2017-06-19') , +( 'LABEL','ID_ABE_RESPONSE_CANNOT_BE_IDENTIFIED','en','Your answer cannot be processed, please try again and make sure to keep the subject code untouched.','2018-11-20') , +( 'LABEL','ID_ABE_RESPONSE_ALREADY_ROUTED','en','Your answer cannot be processed because the case was already routed or is no longer assigned to you.','2018-11-20') , +( 'LABEL','ID_ABE_RESPONSE_ROUTING_FAILED','en','Your answer cannot be processed because there is an error in the flow definition, please notify to this issue to the system administrator.','2018-11-20') , +( 'LABEL','ID_ABE_CASE_NOTE_ANSWER','en','Answer: {optionLabel}','2018-11-20') , +( 'LABEL','ID_ABE_CASE_NOTE_COMMENT','en','Comment: {emailBody}','2018-11-20') , +( 'LABEL','ID_ABE_CASE_NOTE_HEADER','en','{emailAccount} has completed a task from Actions by Email.','2018-11-20') , +( 'LABEL','ID_ABE_LOG_CANNOT_READ','en','The application cannot read the email receiver account.','2018-11-20') , +( 'LABEL','ID_ABE_LOG_PROCESSED_OK','en','The answer was processed correctly.','2018-11-20') , +( 'LABEL','ID_ABE_LOG_CANNOT_BE_IDENTIFIED','en','The case cannot be identified.','2018-11-20') , +( 'LABEL','ID_ABE_LOG_ALREADY_ROUTED','en','The case was identified correctly but it was already routed.','2018-11-20') , +( 'LABEL','ID_ABE_LOG_ROUTING_FAILED','en','The case was identified correctly but the routing process has failed.','2018-11-20') , ( 'LABEL','ID_ACCEPT','en','Accept','2014-01-15') , ( 'LABEL','ID_ACCESS_DENIED','en','Access Denied!','2015-12-03') , ( 'LABEL','ID_ACCOUNT','en','Account','2014-01-15') , @@ -57515,6 +57527,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CLOSE','en','Close','2014-01-15') , ( 'LABEL','ID_CLOSE_EDITOR','en','Close Editor','2014-01-15') , ( 'LABEL','ID_CODE','en','Code','2014-01-15') , +( 'LABEL','ID_CODE_CRYPT','en','Code:','2018-11-16') , ( 'LABEL','ID_COLLAPSE_ALL','en','Collapse All','2014-01-15') , ( 'LABEL','ID_COLOSA_AND_CERTIFIED_PARTNERS','en','Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by Colosa and its Certified Partners.','2014-10-21') , ( 'LABEL','ID_COLUMNS','en','columns','2014-01-15') , @@ -58425,6 +58438,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INACTIVE','en','Inactive','2014-01-15') , ( 'LABEL','ID_INBOX','en','Inbox','2014-01-15') , ( 'LABEL','ID_INBOX_EMPTY','en','Your Inbox is empty...','2015-05-06') , +( 'LABEL','ID_INCOMING_SERVER','en','Incoming Server','2018-11-23') , ( 'LABEL','ID_INCORRECT_EMAIL','en','Your E-mail address is not valid.','2014-01-15') , ( 'LABEL','ID_INCORRECT_USERNAME_PASSWORD','en','Incorrect username or password','2014-01-15') , ( 'LABEL','ID_INCORRECT_VALUE_ACTION','en','The value for $action is incorrect.','2014-05-29') , @@ -60206,6 +60220,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_ORIGIN_TASK','en','Origin Task','2014-01-15') , ( 'LABEL','ID_OTHER','en','Other','2014-01-15') , ( 'LABEL','ID_OUTBOX','en','Outbox','2014-01-15') , +( 'LABEL','ID_OUTGOING_SERVER','en','Outgoing Server','2018-11-23') , ( 'LABEL','ID_OUTPUT_DB','en','Output','2014-10-08') , ( 'LABEL','ID_OUTPUT_DOCUMENT','en','Output Document','2014-01-15') , ( 'LABEL','ID_OUTPUT_DOCUMENTS','en','Output Documents','2014-01-15') , @@ -61476,6 +61491,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','IMPORT_PROCESS_DISABLE','en','Disable the current process and create a new version of the process','2014-01-15') , ( 'LABEL','IMPORT_PROCESS_NEW','en','Create a completely new process without changing the current process','2014-01-15') , ( 'LABEL','IMPORT_PROCESS_OVERWRITING','en','Update the current process, overwriting all tasks and steps','2014-01-15') , +( 'LABEL','INCOMING_PORT_DEFAULT','en','Incoming Port (default 143)','2018-11-23') , ( 'LABEL','INVALID_FILE','en','Invalid file!','2014-01-15') , ( 'LABEL','IS_USER_NAME_DISPLAY_FORMAT','en','User Name Display Format','2014-01-15') , ( 'LABEL','LOGIN','en','Login','2014-01-15') , @@ -61543,6 +61559,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','NEW_SITE_SUCCESS_CONFIRM','en','Do you want open the new site?','2014-01-15') , ( 'LABEL','NEW_SITE_SUCCESS_CONFIRMNOTE','en','Note.- If you open the new site your current session will be closed.','2014-01-15') , ( 'LABEL','OPEN_NEW_WS','en','Open new site','2014-01-15') , +( 'LABEL','OUTGOING_PORT_DEFAULT','en','Outgoing Port (default 25)','2018-11-26') , ( 'LABEL','OUTPUT_CREATE','en','Output document has been created successfully','2014-01-15') , ( 'LABEL','PASSWORD_HISTORY','en','Password history','2014-01-15') , ( 'LABEL','PAUSED','en','Pause','2014-01-15') , diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index f8ad65084..56c3fcda1 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2744,6 +2744,8 @@ CREATE TABLE `EMAIL_SERVER` `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, `MESS_SERVER` VARCHAR(256) default '' NOT NULL, `MESS_PORT` INTEGER default 0 NOT NULL, + `MESS_INCOMING_SERVER` VARCHAR(256) default '' NOT NULL, + `MESS_INCOMING_PORT` INTEGER default 0 NOT NULL, `MESS_RAUTH` INTEGER default 0 NOT NULL, `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, @@ -2865,6 +2867,7 @@ CREATE TABLE `ABE_CONFIGURATION` `DYN_UID` VARCHAR(32) default '' NOT NULL, `ABE_EMAIL_FIELD` VARCHAR(255) default '' NOT NULL, `ABE_ACTION_FIELD` VARCHAR(255) default '', + `ABE_ACTION_BODY_FIELD` VARCHAR(255) default '', `ABE_CASE_NOTE_IN_RESPONSE` INTEGER default 0, `ABE_FORCE_LOGIN` INTEGER default 0, `ABE_CREATE_DATE` DATETIME NOT NULL, @@ -2873,6 +2876,7 @@ CREATE TABLE `ABE_CONFIGURATION` `ABE_MAILSERVER_OR_MAILCURRENT` INTEGER default 0, `ABE_CUSTOM_GRID` MEDIUMTEXT, `ABE_EMAIL_SERVER_UID` VARCHAR(32) default '', + `ABE_EMAIL_SERVER_RECEIVER_UID` VARCHAR(32) default '', PRIMARY KEY (`ABE_UID`), KEY `indexAbeProcess`(`PRO_UID`), KEY `indexAbeProcessTask`(`PRO_UID`, `TAS_UID`) diff --git a/workflow/engine/methods/emailServer/emailServerAjax.php b/workflow/engine/methods/emailServer/emailServerAjax.php index 6f3c246e3..59a454f52 100644 --- a/workflow/engine/methods/emailServer/emailServerAjax.php +++ b/workflow/engine/methods/emailServer/emailServerAjax.php @@ -9,6 +9,8 @@ switch ($option) { $server = ""; $port = ""; + $incomingServer = ""; + $incomingPort = ""; $reqAuthentication = 0; $password = ""; $smtpSecure = ""; @@ -27,6 +29,14 @@ switch ($option) { $reqAuthentication = (int)($_POST["reqAuthentication"]); $password = ($reqAuthentication == 1)? $_POST["password"] : ""; $smtpSecure = $_POST["smtpSecure"]; + } elseif ($cboEmailEngine == "IMAP") { + $server = $_POST["server"]; + $port = (int)($_POST["port"]); + $incomingServer = $_POST["incomingServer"]; + $incomingPort = (int)($_POST["incomingPort"]); + $reqAuthentication = (int)($_POST["reqAuthentication"]); + $password = ($reqAuthentication == 1)? $_POST["password"] : ""; + $smtpSecure = $_POST["smtpSecure"]; } try { @@ -34,6 +44,8 @@ switch ($option) { "MESS_ENGINE" => $cboEmailEngine, "MESS_SERVER" => $server, "MESS_PORT" => $port, + "MESS_INCOMING_SERVER" => $incomingServer, + "MESS_INCOMING_PORT" => $incomingPort, "MESS_RAUTH" => $reqAuthentication, "MESS_ACCOUNT" => $accountFrom, "MESS_PASSWORD" => $password, @@ -63,6 +75,8 @@ switch ($option) { $server = ""; $port = ""; + $incomingServer = ""; + $incomingPort = ""; $reqAuthentication = 0; $password = ""; $smtpSecure = ""; @@ -81,6 +95,14 @@ switch ($option) { $reqAuthentication = (int)($_POST["reqAuthentication"]); $password = ($reqAuthentication == 1)? $_POST["password"] : ""; $smtpSecure = $_POST["smtpSecure"]; + } elseif ($cboEmailEngine == "IMAP") { + $server = $_POST["server"]; + $port = (int)($_POST["port"]); + $incomingServer = $_POST["incomingServer"]; + $incomingPort = (int)($_POST["incomingPort"]); + $reqAuthentication = (int)($_POST["reqAuthentication"]); + $password = ($reqAuthentication == 1)? $_POST["password"] : ""; + $smtpSecure = $_POST["smtpSecure"]; } try { @@ -88,6 +110,8 @@ switch ($option) { "MESS_ENGINE" => $cboEmailEngine, "MESS_SERVER" => $server, "MESS_PORT" => $port, + "MESS_INCOMING_SERVER" => $incomingServer, + "MESS_INCOMING_PORT" => $incomingPort, "MESS_RAUTH" => $reqAuthentication, "MESS_ACCOUNT" => $accountFrom, "MESS_PASSWORD" => $password, @@ -153,6 +177,8 @@ switch ($option) { $server = ""; $port = ""; + $incomingServer = ""; + $incomingPort = ""; $reqAuthentication = 0; $password = ""; $smtpSecure = ""; @@ -165,7 +191,7 @@ switch ($option) { $mailTo = ($sendTestMail == 1)? $_POST["mailTo"] : ""; $emailServerDefault = (int)($_POST["emailServerDefault"]); - if ($cboEmailEngine == "PHPMAILER") { + if ($cboEmailEngine == "PHPMAILER" || $cboEmailEngine == "IMAP") { $server = $_POST["server"]; $port = (int)($_POST["port"]); $reqAuthentication = (int)($_POST["reqAuthentication"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail/ResponseReader.php b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail/ResponseReader.php new file mode 100644 index 000000000..c0fe78ccb --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail/ResponseReader.php @@ -0,0 +1,355 @@ +messageResponseError; + } + + /** + * @param string $messageResponseError + */ + public function setMessageResponseError($messageResponseError) + { + $this->messageResponseError = $messageResponseError; + } + + /** + * Read the Action by Email listener inbox looking for new messages + */ + public function actionsByEmailEmailResponse() + { + try { + if (!extension_loaded('imap')) { + G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", ['php_imap']) . "\n"); + exit; + } + if (PMLicensedFeatures + ::getSingleton() + ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { + $criteriaAbe = new Criteria(); + $criteriaAbe->add(AbeConfigurationPeer::ABE_TYPE, "RESPONSE"); + $resultAbe = AbeConfigurationPeer::doSelectRS($criteriaAbe); + $resultAbe->setFetchmode(ResultSet::FETCHMODE_ASSOC); + while ($resultAbe->next()) { + $dataAbe = $resultAbe->getRow(); + $this->getAllEmails($dataAbe); + } + } + } catch (Exception $e) { + Bootstrap::registerMonolog( + $this->channel, + $e->getCode() != 0 ? $e->getCode() : 300, + $e->getMessage(), + $this->case, + config("system.workspace"), + 'processmaker.log' + ); + } + } + + /** + * Decrypt password of Email Server + * @param array $emailSetup + * @return mixed|string + */ + private function decryptPassword(array $emailSetup) + { + $pass = isset($emailSetup['MESS_PASSWORD']) ? $emailSetup['MESS_PASSWORD'] : ''; + $passDec = G::decrypt($pass, 'EMAILENCRYPT'); + $auxPass = explode('hash:', $passDec); + if (count($auxPass) > 1) { + if (count($auxPass) == 2) { + $pass = $auxPass[1]; + } else { + array_shift($auxPass); + $pass = implode('', $auxPass); + } + } + return $pass; + } + + /** + * Get all Email of server listener + * @param array $dataAbe + */ + public function getAllEmails(array $dataAbe) + { + try { + $emailServer = new EmailServer(); + $emailSetup = (!is_null(EmailServerPeer::retrieveByPK($dataAbe['ABE_EMAIL_SERVER_RECEIVER_UID']))) ? + $emailServer->getEmailServer($dataAbe['ABE_EMAIL_SERVER_RECEIVER_UID'], true) : + $emailServer->getEmailServerDefault(); + if (empty($emailSetup) || (empty($emailSetup['MESS_INCOMING_SERVER']) && $emailSetup['MESS_INCOMING_PORT'] == 0)) { + throw (new Exception(G::LoadTranslation('ID_ABE_LOG_CANNOT_READ'), 500)); + } + $mailbox = new Mailbox( + '{'. $emailSetup['MESS_INCOMING_SERVER'] . ':' . $emailSetup['MESS_INCOMING_PORT'] . '/imap/ssl/novalidate-cert}INBOX', + $emailSetup['MESS_ACCOUNT'], + $this->decryptPassword($emailSetup) + ); + + // Read all messages into an array + $mailsIds = $mailbox->searchMailbox('UNSEEN'); + if ($mailsIds) { + // Get the first message and save its attachment(s) to disk: + foreach ($mailsIds as $key => $mailId) { + /** @var IncomingMail $mail */ + $mail = $mailbox->getMail($mailId, false); + if (!empty($mail->textPlain)) { + preg_match("/{(.*)}/", $mail->textPlain, $matches); + if ($matches) { + $dataEmail = G::json_decode(Crypt::decryptString($matches[1]), true); + $dataAbeReq = loadAbeRequest($dataEmail['ABE_REQ_UID']); + if (config("system.workspace") === $dataEmail['workspace'] + && (array_key_exists('ABE_UID', $dataAbeReq) && $dataAbeReq['ABE_UID'] == $dataAbe['ABE_UID'])) { + $this->case = $dataEmail; + try { + $appDelegate = new AppDelegation(); + $alreadyRouted = $appDelegate->alreadyRouted($this->case["appUid"], $this->case["delIndex"]); + //Verify if the current case is already routed. + if ($alreadyRouted) { + $this->setMessageResponseError(G::LoadTranslation('ID_ABE_RESPONSE_ALREADY_ROUTED')); + throw (new Exception(G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED'), 400)); + } + $this->processABE($this->case, $mail, $dataAbe); + $mailbox->markMailAsRead($mailId); + Bootstrap::registerMonolog( + $this->channel, + 100, // DEBUG + G::LoadTranslation('ID_ABE_LOG_PROCESSED_OK'), + $this->case, + config("system.workspace"), + 'processmaker.log' + ); + } catch (Exception $e) { + $this->sendMessageError( + $this->getMessageResponseError() ? $this->getMessageResponseError() : $e->getMessage(), + $this->case, + $mail, + $emailSetup + ); + Bootstrap::registerMonolog( + $this->channel, + $e->getCode() != 0 ? $e->getCode() : 400, + $e->getMessage(), + $this->case, + config("system.workspace"), + 'processmaker.log' + ); + } + } + } + } + } + } + } catch (Exception $e) { + Bootstrap::registerMonolog( + $this->channel, + $e->getCode() != 0 ? $e->getCode() : 500, + $e->getMessage(), + $this->case, + config("system.workspace"), + 'processmaker.log' + ); + } + } + + /** + * Derivation of the case with the mail information + * @param array $caseInfo + * @param IncomingMail $mail + * @param array $dataAbe + * @throws Exception + */ + public function processABE(array $caseInfo, IncomingMail $mail, array $dataAbe = []) + { + try { + $actionsByEmail = new ActionsByEmail(); + $actionsByEmail->verifyLogin($caseInfo['appUid'], $caseInfo['delIndex']); + + $case = new Cases(); + $caseFieldsABE = $case->loadCase($caseInfo['appUid'], $caseInfo['delIndex']); + + $actionsByEmailCore = new ActionsByEmailCoreClass(); + $actionField = str_replace( + $actionsByEmailCore->getPrefix(), + '', + $dataAbe['ABE_ACTION_FIELD'] + ); + $dataField = []; + $dataField[$actionField] = $caseInfo['fieldValue']; + $actionBodyField = str_replace( + $actionsByEmailCore->getPrefix(), + '', + $dataAbe['ABE_ACTION_BODY_FIELD'] + ); + $textPlain = $mail->textPlain; + $textPlain = substr($textPlain, 0, strpos($textPlain, "/=")); + $dataField[$actionBodyField] = $textPlain; + $caseFieldsABE['APP_DATA'] = array_merge($caseFieldsABE['APP_DATA'], $dataField); + + $dataResponses = []; + $dataResponses['ABE_REQ_UID'] = $caseInfo['ABE_REQ_UID']; + $dataResponses['ABE_RES_CLIENT_IP'] = 'localhost'; + $dataResponses['ABE_RES_DATA'] = serialize($dataField); + $dataResponses['ABE_RES_STATUS'] = 'PENDING'; + $dataResponses['ABE_RES_MESSAGE'] = ''; + + try { + $abeAbeResponsesInstance = new AbeResponses(); + $dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses); + } catch (Exception $e) { + Bootstrap::registerMonolog( + $this->channel, + 300, + $e->getMessage(), + $this->case, + config("system.workspace"), + 'processmaker.log' + ); + } + + ChangeLog::getChangeLog() + ->getUsrIdByUsrUid($caseFieldsABE['CURRENT_USER_UID'], true) + ->setSourceId(ChangeLog::FromABE); + + $caseFieldsABE['CURRENT_DYNAFORM'] = ''; + $caseFieldsABE['USER_UID'] = $caseFieldsABE['CURRENT_USER_UID']; + $caseFieldsABE['OBJECT_TYPE'] = ''; + + $case->updateCase($caseInfo['appUid'], $caseFieldsABE); + + try { + $ws = new WsBase(); + $result = $ws->derivateCase( + $caseFieldsABE['CURRENT_USER_UID'], + $caseInfo['appUid'], + $caseInfo['delIndex'], + 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\n" . + "Error code: " . $result->status_code . "\nError message: " . $result->message + ); + } + } catch (Exception $e) { + $this->setMessageResponseError(G::LoadTranslation('ID_ABE_RESPONSE_ROUTING_FAILED')); + throw (new Exception(G::LoadTranslation('ID_ABE_LOG_ROUTING_FAILED'), 400)); + } + + //Update AbeResponses + $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 $e) { + Bootstrap::registerMonolog( + $this->channel, + 300, + $e->getMessage(), + $this->case, + config("system.workspace"), + 'processmaker.log' + ); + } + $dataAbeRequests = loadAbeRequest($caseInfo['ABE_REQ_UID']); + //Save Cases Notes + if ($dataAbe['ABE_CASE_NOTE_IN_RESPONSE'] == 1) { + $customGrid = unserialize($dataAbe['ABE_CUSTOM_GRID']); + $fieldLabel = null; + foreach ($customGrid as $key => $value) { + if ($value['abe_custom_value'] == $caseInfo['fieldValue']) { + $fieldLabel = $value['abe_custom_label']; + break; + } + } + $appNotes = new AppNotes(); + $noteText = G::LoadTranslation('ID_ABE_CASE_NOTE_HEADER', ['emailAccount' => $mail->toString]) . "\n\n"; + $noteText .= G::LoadTranslation('ID_ABE_CASE_NOTE_ANSWER', ['optionLabel' => $fieldLabel ? $fieldLabel : $caseInfo['fieldValue']]) . "\n\n"; + $noteText .= G::LoadTranslation('ID_ABE_CASE_NOTE_COMMENT', ['emailBody' => $textPlain]); + $noteContent = addslashes($noteText); + $appNotes->postNewNote($caseInfo['appUid'], $caseFieldsABE['APP_DATA']['USER_LOGGED'], $noteContent, false); + } + $dataAbeRequests['ABE_REQ_ANSWERED'] = 1; + $code == 0 ? uploadAbeRequest($dataAbeRequests) : ''; + } catch (Exception $e) { + if ($e->getCode() == 400) { + throw (new Exception($e->getMessage(), $e->getCode())); + } else { + $this->setMessageResponseError(G::LoadTranslation('ID_ABE_RESPONSE_CANNOT_BE_IDENTIFIED')); + throw (new Exception(G::LoadTranslation('ID_ABE_LOG_CANNOT_BE_IDENTIFIED'), 300)); + } + } + } + + /** + * Send an error message to the sender + * @param string $msgError + * @param array $caseInf + * @param IncomingMail $mail + * @param array $emailSetup + * @return \ProcessMaker\Util\Response|string|\WsResponse + */ + public function sendMessageError($msgError, array $caseInf, IncomingMail $mail, array $emailSetup) + { + $wsBase = new WsBase(); + $result = $wsBase->sendMessage( + $caseInf['appUid'], + $mail->toString, + $mail->fromAddress, + '', + '', + $mail->subject, + 'actionsByEmailErrorReply.html', + ['ACTIONS_BY_EMAIL_ERROR_MESSAGE' => $msgError], + null, + true, + $caseInf['delIndex'], + $emailSetup, + 0 + ); + return $result; + } + /*----------------------------------********---------------------------------*/ +} diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php index 0f6dfaf45..b278810f8 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -14,9 +14,11 @@ class EmailServer { private $arrayFieldDefinition = array( "MESS_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "emailServerUid"), - "MESS_ENGINE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("PHPMAILER", "MAIL"), "fieldNameAux" => "emailServerEngine"), + "MESS_ENGINE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("PHPMAILER", "MAIL", "IMAP"), "fieldNameAux" => "emailServerEngine"), "MESS_SERVER" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerServer"), "MESS_PORT" => array("type" => "int", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPort"), + "MESS_INCOMING_SERVER" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerIncomingServer"), + "MESS_INCOMING_PORT" => array("type" => "int", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerIncomingPort"), "MESS_RAUTH" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerRauth"), "MESS_ACCOUNT" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerUserName"), "MESS_PASSWORD" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPassword"), @@ -52,10 +54,10 @@ class EmailServer throw $e; } } - + /** * Get the default information from the context. - * + * * @global type $RBAC * @return void */ @@ -527,6 +529,7 @@ class EmailServer } break; case "PHPMAILER": + case "IMAP": $numSteps = ($arrayData['MAIL_TO'] != '') ? count($arrayPhpMailerTestName) : count($arrayPhpMailerTestName) - 1; for ($step = 1; $step <= $numSteps; $step++) { @@ -831,6 +834,8 @@ class EmailServer 'engine'=> $arrayData["MESS_ENGINE"], 'server' => $arrayData["MESS_SERVER"], 'port' => $arrayData["MESS_PORT"], + 'incomingServer' => $arrayData["MESS_INCOMING_SERVER"], + 'incomingPort' => $arrayData["MESS_INCOMING_PORT"], 'requireAuthentication' => $arrayData["MESS_RAUTH"], 'account' => $arrayData["MESS_ACCOUNT"], 'senderEmail' => $arrayData["MESS_FROM_MAIL"], @@ -1002,6 +1007,8 @@ class EmailServer 'engine' => $arrayData["MESS_ENGINE"], 'server' => $arrayData["MESS_SERVER"], 'port' => $arrayData["MESS_PORT"], + 'incomingServer' => $arrayData["MESS_INCOMING_SERVER"], + 'incomingPort' => $arrayData["MESS_INCOMING_PORT"], 'requireAuthentication' => $arrayData["MESS_RAUTH"], 'account' => $arrayData["MESS_ACCOUNT"], 'senderEmail' => $arrayData["MESS_FROM_MAIL"], @@ -1088,6 +1095,8 @@ class EmailServer $criteria->addSelectColumn(\EmailServerPeer::MESS_ENGINE); $criteria->addSelectColumn(\EmailServerPeer::MESS_SERVER); $criteria->addSelectColumn(\EmailServerPeer::MESS_PORT); + $criteria->addSelectColumn(\EmailServerPeer::MESS_INCOMING_SERVER); + $criteria->addSelectColumn(\EmailServerPeer::MESS_INCOMING_PORT); $criteria->addSelectColumn(\EmailServerPeer::MESS_RAUTH); $criteria->addSelectColumn(\EmailServerPeer::MESS_ACCOUNT); $criteria->addSelectColumn(\EmailServerPeer::MESS_PASSWORD); @@ -1120,6 +1129,8 @@ class EmailServer $this->getFieldNameByFormatFieldName("MESS_ENGINE") => $record["MESS_ENGINE"], $this->getFieldNameByFormatFieldName("MESS_SERVER") => $record["MESS_SERVER"], $this->getFieldNameByFormatFieldName("MESS_PORT") => $record["MESS_PORT"], + $this->getFieldNameByFormatFieldName("MESS_INCOMING_SERVER") => $record["MESS_INCOMING_SERVER"], + $this->getFieldNameByFormatFieldName("MESS_INCOMING_PORT") => $record["MESS_INCOMING_PORT"], $this->getFieldNameByFormatFieldName("MESS_RAUTH") => $record["MESS_RAUTH"], $this->getFieldNameByFormatFieldName("MESS_ACCOUNT") => $record["MESS_ACCOUNT"], $this->getFieldNameByFormatFieldName("MESS_PASSWORD") => $record["MESS_PASSWORD"], @@ -1165,6 +1176,8 @@ class EmailServer $arrayData["MESS_ENGINE"] = $row["MESS_ENGINE"]; $arrayData["MESS_SERVER"] = $row["MESS_SERVER"]; $arrayData["MESS_PORT"] = (int)($row["MESS_PORT"]); + $arrayData["MESS_INCOMING_SERVER"] = $row["MESS_INCOMING_SERVER"]; + $arrayData["MESS_INCOMING_PORT"] = (int)($row["MESS_INCOMING_PORT"]); $arrayData["MESS_RAUTH"] = (int)($row["MESS_RAUTH"]); $arrayData["MESS_ACCOUNT"] = $row["MESS_ACCOUNT"]; $arrayData["MESS_PASSWORD"] = $row["MESS_PASSWORD"]; @@ -1221,6 +1234,7 @@ class EmailServer $criteria->add( $criteria->getNewCriterion(\EmailServerPeer::MESS_ENGINE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)->addOr( $criteria->getNewCriterion(\EmailServerPeer::MESS_SERVER, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( + $criteria->getNewCriterion(\EmailServerPeer::MESS_INCOMING_SERVER,"%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( $criteria->getNewCriterion(\EmailServerPeer::MESS_ACCOUNT, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( $criteria->getNewCriterion(\EmailServerPeer::MESS_FROM_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( $criteria->getNewCriterion(\EmailServerPeer::SMTPSECURE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)) @@ -1245,7 +1259,7 @@ class EmailServer if (!is_null($sortField) && trim($sortField) != "") { $sortField = strtoupper($sortField); - if (in_array($sortField, array("MESS_ENGINE", "MESS_SERVER", "MESS_ACCOUNT", "MESS_FROM_NAME", "SMTPSECURE"))) { + if (in_array($sortField, array("MESS_ENGINE", "MESS_SERVER", "MESS_INCOMING_SERVER", "MESS_ACCOUNT", "MESS_FROM_NAME", "SMTPSECURE"))) { $sortField = \EmailServerPeer::TABLE_NAME . "." . $sortField; } else { $sortField = \EmailServerPeer::MESS_ENGINE; @@ -1318,6 +1332,7 @@ class EmailServer $row = $rsCriteria->getRow(); $row["MESS_PORT"] = (int)($row["MESS_PORT"]); + $row["MESS_INCOMING_PORT"] = (int)($row["MESS_INCOMING_PORT"]); $row["MESS_RAUTH"] = (int)($row["MESS_RAUTH"]); $row["MESS_TRY_SEND_INMEDIATLY"] = (int)($row["MESS_TRY_SEND_INMEDIATLY"]); $row["MESS_DEFAULT"] = (int)($row["MESS_DEFAULT"]); diff --git a/workflow/engine/src/ProcessMaker/Services/Api/ActionsByEmail.php b/workflow/engine/src/ProcessMaker/Services/Api/ActionsByEmail.php index 339b5bb27..63045f2ec 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/ActionsByEmail.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/ActionsByEmail.php @@ -154,6 +154,13 @@ class ActionsByEmail extends Api $arrayData = $filesManager->addProcessFilesManager($proId, $userUid, $data); @copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmail.html', $path . 'actionsByEmail.html'); } + /*----------------------------------********---------------------------------*/ + if (!file_exists($path . 'actionsByEmailErrorReply.html')) { + $data = array('prf_content' => '', 'prf_filename' => 'actionsByEmailErrorReply.html', 'prf_path' => 'templates'); + $arrayData = $filesManager->addProcessFilesManager($proId, $userUid, $data); + @copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmailErrorReply.html', $path . 'actionsByEmailErrorReply.html'); + } + /*----------------------------------********---------------------------------*/ } $directory = dir($path); diff --git a/workflow/engine/src/ProcessMaker/Util/WsMessageResponse.php b/workflow/engine/src/ProcessMaker/Util/WsMessageResponse.php new file mode 100644 index 000000000..ec6a1f92c --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Util/WsMessageResponse.php @@ -0,0 +1,32 @@ +appMessUid; + } + + /** + * Set the appMessUid + * + * @param string $v + * @return void + */ + public function setAppMessUid($v) + { + $this->appMessUid = $v; + } +} + diff --git a/workflow/engine/templates/actionsByEmail/actionsByEmailErrorReply.html b/workflow/engine/templates/actionsByEmail/actionsByEmailErrorReply.html new file mode 100644 index 000000000..c8584c420 --- /dev/null +++ b/workflow/engine/templates/actionsByEmail/actionsByEmailErrorReply.html @@ -0,0 +1,20 @@ +
+ + + + + + +
ACTIONS BY EMAIL
+
+
+ @#ACTIONS_BY_EMAIL_ERROR_MESSAGE +
+
+
+ This is an automated email, please do not replay to it. +
+ www.processmaker.com +
+
\ No newline at end of file diff --git a/workflow/engine/templates/emailServer/emailServer.js b/workflow/engine/templates/emailServer/emailServer.js index 91bed9ee9..dc72cd436 100644 --- a/workflow/engine/templates/emailServer/emailServer.js +++ b/workflow/engine/templates/emailServer/emailServer.js @@ -48,83 +48,69 @@ emailServer.application = { } /*----------------------------------********---------------------------------*/ + var typeEmailEngine = Ext.getCmp("cboEmailEngine").getValue(); + + if (typeEmailEngine === "PHPMAILER") { + var rdoGrpOption = Ext.getCmp("rdoGrpSmtpSecure").getValue(); + var smtpSecure = rdoGrpOption.getGroupValue(); + + p = { + option: option, + + cboEmailEngine: typeEmailEngine, + server: Ext.getCmp("txtServer").getValue(), + port: Ext.getCmp("txtPort").getValue(), + reqAuthentication: (Ext.getCmp("chkReqAuthentication").checked) ? 1 : 0, + accountFrom: Ext.getCmp("txtAccountFrom").getValue(), + password: Ext.getCmp("txtPassword").getValue(), + fromMail: Ext.getCmp("txtFromMail").getValue(), + fromName: Ext.getCmp("txtFromName").getValue(), + smtpSecure: smtpSecure, + sendTestMail: (Ext.getCmp("chkSendTestMail").checked) ? 1 : 0, + mailTo: Ext.getCmp("txtMailTo").getValue(), + emailServerDefault: emailDefault + }; + } else if (typeEmailEngine === "IMAP") { + /*----------------------------------********---------------------------------*/ + var rdoGrpOption = Ext.getCmp("rdoGrpSmtpSecure").getValue(); + var smtpSecure = rdoGrpOption.getGroupValue(); + + p = { + option: option, + + cboEmailEngine: typeEmailEngine, + server: Ext.getCmp("txtServer").getValue(), + port: Ext.getCmp("txtPort").getValue(), + incomingServer: Ext.getCmp("txtIncomingServer").getValue(), + incomingPort: Ext.getCmp("txtIncomingPort").getValue(), + reqAuthentication: (Ext.getCmp("chkReqAuthentication").checked) ? 1 : 0, + accountFrom: Ext.getCmp("txtAccountFrom").getValue(), + password: Ext.getCmp("txtPassword").getValue(), + fromMail: Ext.getCmp("txtFromMail").getValue(), + fromName: Ext.getCmp("txtFromName").getValue(), + smtpSecure: smtpSecure, + sendTestMail: (Ext.getCmp("chkSendTestMail").checked) ? 1 : 0, + mailTo: Ext.getCmp("txtMailTo").getValue(), + emailServerDefault: emailDefault + }; + /*----------------------------------********---------------------------------*/ + } else { + //MAIL + p = { + option: option, + + cboEmailEngine: typeEmailEngine, + fromMail: Ext.getCmp("txtFromMail").getValue(), + fromName: Ext.getCmp("txtFromName").getValue(), + sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, + mailTo: Ext.getCmp("txtMailTo").getValue(), + emailServerDefault: emailDefault + }; + } + switch (option) { - case "INS": - var typeEmailEngine = Ext.getCmp("cboEmailEngine").getValue(); - - - if (typeEmailEngine == "PHPMAILER") { - var rdoGrpOption = Ext.getCmp("rdoGrpSmtpSecure").getValue(); - var smtpSecure = rdoGrpOption.getGroupValue(); - - p = { - option: option, - - cboEmailEngine: typeEmailEngine, - server: Ext.getCmp("txtServer").getValue(), - port: Ext.getCmp("txtPort").getValue(), - reqAuthentication: (Ext.getCmp("chkReqAuthentication").checked)? 1 : 0, - accountFrom: Ext.getCmp("txtAccountFrom").getValue(), - password: Ext.getCmp("txtPassword").getValue(), - fromMail: Ext.getCmp("txtFromMail").getValue(), - fromName: Ext.getCmp("txtFromName").getValue(), - smtpSecure: smtpSecure, - sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, - mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: emailDefault - }; - } else { - //MAIL - p = { - option: option, - - cboEmailEngine: typeEmailEngine, - fromMail: Ext.getCmp("txtFromMail").getValue(), - fromName: Ext.getCmp("txtFromName").getValue(), - sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, - mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: emailDefault - }; - } - break; case "UPD": - var typeEmailEngine = Ext.getCmp("cboEmailEngine").getValue(); - - if (typeEmailEngine == "PHPMAILER") { - var rdoGrpOption = Ext.getCmp("rdoGrpSmtpSecure").getValue(); - var smtpSecure = rdoGrpOption.getGroupValue(); - - p = { - option: option, - emailServerUid: emailServerUid, - - cboEmailEngine: typeEmailEngine, - server: Ext.getCmp("txtServer").getValue(), - port: Ext.getCmp("txtPort").getValue(), - reqAuthentication: (Ext.getCmp("chkReqAuthentication").checked)? 1 : 0, - accountFrom: Ext.getCmp("txtAccountFrom").getValue(), - password: Ext.getCmp("txtPassword").getValue(), - fromMail: Ext.getCmp("txtFromMail").getValue(), - fromName: Ext.getCmp("txtFromName").getValue(), - smtpSecure: smtpSecure, - sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, - mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: emailDefault - }; - } else { - //MAIL - p = { - option: option, - emailServerUid: emailServerUid, - - cboEmailEngine: typeEmailEngine, - fromMail: Ext.getCmp("txtFromMail").getValue(), - fromName: Ext.getCmp("txtFromName").getValue(), - sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, - mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: emailDefault - }; - } + p.emailServerUid = emailServerUid; break; case "DEL": p = { @@ -132,45 +118,6 @@ emailServer.application = { emailServerUid: emailServerUid }; break; - //case "LST": - // break; - case "TEST": - var typeEmailEngine = Ext.getCmp("cboEmailEngine").getValue(); - - if (typeEmailEngine == "PHPMAILER") { - var rdoGrpOption = Ext.getCmp("rdoGrpSmtpSecure").getValue(); - var smtpSecure = rdoGrpOption.getGroupValue(); - - p = { - option: option, - - cboEmailEngine: typeEmailEngine, - server: Ext.getCmp("txtServer").getValue(), - port: Ext.getCmp("txtPort").getValue(), - reqAuthentication: (Ext.getCmp("chkReqAuthentication").checked)? 1 : 0, - accountFrom: Ext.getCmp("txtAccountFrom").getValue(), - password: Ext.getCmp("txtPassword").getValue(), - fromMail: Ext.getCmp("txtFromMail").getValue(), - fromName: Ext.getCmp("txtFromName").getValue(), - smtpSecure: smtpSecure, - sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, - mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: emailDefault - }; - } else { - //MAIL - p = { - option: option, - - cboEmailEngine: typeEmailEngine, - fromMail: Ext.getCmp("txtFromMail").getValue(), - fromName: Ext.getCmp("txtFromName").getValue(), - sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, - mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: emailDefault - }; - } - break; } Ext.Ajax.request({ @@ -240,11 +187,16 @@ emailServer.application = { Ext.getCmp("txtServer").allowBlank = true; Ext.getCmp("txtPort").allowBlank = true; + Ext.getCmp("txtIncomingServer").allowBlank = true; + Ext.getCmp("txtIncomingPort").allowBlank = true; Ext.getCmp("txtAccountFrom").allowBlank = true; Ext.getCmp("txtServer").setValue(""); Ext.getCmp("txtPort").setValue(""); + Ext.getCmp("txtIncomingServer").setValue(""); + Ext.getCmp("txtIncomingPort").setValue(""); + Ext.getCmp("chkReqAuthentication").setValue(false); emailServerSetPassword(Ext.getCmp("chkReqAuthentication").checked); @@ -286,6 +238,9 @@ emailServer.application = { Ext.getCmp("txtServer").setValue(record.get("MESS_SERVER")); Ext.getCmp("txtPort").setValue((record.get("MESS_PORT") != 0)? record.get("MESS_PORT") : ""); + Ext.getCmp("txtIncomingServer").setValue(record.get("MESS_INCOMING_SERVER")); + Ext.getCmp("txtIncomingPort").setValue((record.get("MESS_INCOMING_PORT") !== 0)? record.get("MESS_INCOMING_PORT") : ""); + Ext.getCmp("chkReqAuthentication").setValue((parseInt(record.get("MESS_RAUTH")) == 1)? true : false); emailServerSetPassword(Ext.getCmp("chkReqAuthentication").checked); @@ -323,10 +278,21 @@ emailServer.application = { { Ext.getCmp("frmEmailServer").getForm().clearInvalid(); - if (cboEmailEngine == "PHPMAILER") { + if (cboEmailEngine === "PHPMAILER") { Ext.getCmp("txtServer").setVisible(true); Ext.getCmp("txtPort").setVisible(true); + try { + Ext.getCmp("txtServer").label.update(_("ID_SERVER")); + Ext.getCmp("txtPort").label.update(_("PORT_DEFAULT")); + } catch (err) { + Ext.getCmp("txtServer").fieldLabel = _("ID_SERVER"); + Ext.getCmp("txtPort").fieldLabel = _("PORT_DEFAULT"); + } + + Ext.getCmp("txtIncomingServer").setVisible(false); + Ext.getCmp("txtIncomingPort").setVisible(false); + Ext.getCmp("chkReqAuthentication").setVisible(true); emailServerSetPassword(Ext.getCmp("chkReqAuthentication").checked); @@ -336,12 +302,46 @@ emailServer.application = { Ext.getCmp("txtServer").allowBlank = false; Ext.getCmp("txtPort").allowBlank = false; + Ext.getCmp("txtIncomingServer").allowBlank = true; + Ext.getCmp("txtIncomingPort").allowBlank = true; Ext.getCmp("txtAccountFrom").allowBlank = false; + } else if (cboEmailEngine === "IMAP") { + /*----------------------------------********---------------------------------*/ + Ext.getCmp("txtServer").setVisible(true); + Ext.getCmp("txtPort").setVisible(true); + + try { + Ext.getCmp("txtServer").label.update(_("ID_OUTGOING_SERVER")); + Ext.getCmp("txtPort").label.update(_("OUTGOING_PORT_DEFAULT")); + } catch (err) { + Ext.getCmp("txtServer").fieldLabel = _("ID_OUTGOING_SERVER"); + Ext.getCmp("txtPort").fieldLabel = _("OUTGOING_PORT_DEFAULT"); + } + + Ext.getCmp("txtIncomingServer").setVisible(true); + Ext.getCmp("txtIncomingPort").setVisible(true); + + Ext.getCmp("chkReqAuthentication").setVisible(true); + + emailServerSetPassword(Ext.getCmp("chkReqAuthentication").checked); + + Ext.getCmp("txtAccountFrom").setVisible(true); + Ext.getCmp("rdoGrpSmtpSecure").setVisible(true); + + Ext.getCmp("txtServer").allowBlank = false; + Ext.getCmp("txtPort").allowBlank = false; + Ext.getCmp("txtIncomingServer").allowBlank = false; + Ext.getCmp("txtIncomingPort").allowBlank = false; + Ext.getCmp("txtAccountFrom").allowBlank = false; + /*----------------------------------********---------------------------------*/ } else { //MAIL Ext.getCmp("txtServer").setVisible(false); Ext.getCmp("txtPort").setVisible(false); + Ext.getCmp("txtIncomingServer").setVisible(false); + Ext.getCmp("txtIncomingPort").setVisible(false); + Ext.getCmp("chkReqAuthentication").setVisible(false); emailServerSetPassword(false); @@ -351,6 +351,8 @@ emailServer.application = { Ext.getCmp("txtServer").allowBlank = true; Ext.getCmp("txtPort").allowBlank = true; + Ext.getCmp("txtIncomingServer").allowBlank = true; + Ext.getCmp("txtIncomingPort").allowBlank = true; Ext.getCmp("txtAccountFrom").allowBlank = true; Ext.getCmp("txtPassword").allowBlank = true; } @@ -384,7 +386,7 @@ emailServer.application = { FLAGTEST = 1; - if (option == "PHPMAILER") { + if (option === "PHPMAILER" || option === "IMAP") { if (typeof(testData.resolving_name) != "undefined") { if (testData.resolving_name.result) { msg = msg + "" + testData.resolving_name.title + "
"; @@ -492,6 +494,8 @@ emailServer.application = { {name: "MESS_ENGINE", type: "string"}, {name: "MESS_SERVER", type: "string"}, {name: "MESS_PORT", type: "int"}, + {name: "MESS_INCOMING_SERVER", type: "string"}, + {name: "MESS_INCOMING_PORT", type: "int"}, {name: "MESS_RAUTH", type: "int"}, {name: "MESS_ACCOUNT", type: "string"}, {name: "MESS_PASSWORD", type: "string"}, @@ -548,6 +552,9 @@ emailServer.application = { data: [ ["PHPMAILER", "SMTP (PHPMailer)"], + /*----------------------------------********---------------------------------*/ + ["IMAP", "SMTP - IMAP (PHPMailer)"], + /*----------------------------------********---------------------------------*/ ["MAIL", "Mail (PHP)"] ] }); @@ -597,6 +604,24 @@ emailServer.application = { emptyText: null }); + var txtIncomingServer = new Ext.form.TextField({ + id: "txtIncomingServer", + name: "txtIncomingServer", + + fieldLabel: _("ID_INCOMING_SERVER") //Server + }); + + var txtIncomingPort = new Ext.form.NumberField({ + id: "txtIncomingPort", + name: "txtIncomingPort", + + fieldLabel: _("INCOMING_PORT_DEFAULT"), //Port (default 993) + + anchor: "36%", + maxLength: 3, + emptyText: null + }); + var chkReqAuthentication = new Ext.form.Checkbox({ id: "chkReqAuthentication", name: "chkReqAuthentication", @@ -745,7 +770,7 @@ emailServer.application = { var winData = new Ext.Window({ layout: "fit", width: 550, - height: 388, + height: 450, //title: "", modal: true, resizable: false, @@ -772,6 +797,8 @@ emailServer.application = { cboEmailEngine, txtServer, txtPort, + txtIncomingServer, + txtIncomingPort, chkReqAuthentication, txtAccountFrom, txtPassword, @@ -997,6 +1024,16 @@ emailServer.application = { return (value != 0)? value : "-"; }; + var rendererMessIncomingServer = function (value) + { + return (value !== "")? value : "-"; + }; + + var rendererMessIncomingPort = function (value) + { + return (value !== 0)? value : "-"; + }; + var rendererMessSmtpSecure = function (value) { return (value != "")? value : "-"; @@ -1017,6 +1054,8 @@ emailServer.application = { {id: "MESS_ENGINE", dataIndex: "MESS_ENGINE", hidden: false, header: _("EMAIL_ENGINE"), width: 80, hideable: true, align: "left"}, {id: "MESS_SERVER", dataIndex: "MESS_SERVER", hidden: false, header: _("ID_SERVER"), width: 150, hideable: true, align: "center", renderer: rendererMessServer}, {id: "MESS_PORT", dataIndex: "MESS_PORT", hidden: false, header: _("ID_EMAIL_SERVER_PORT"), width: 50, hideable: true, align: "center", renderer: rendererMessPort}, + {id: "MESS_INCOMING_SERVER", dataIndex: "MESS_INCOMING_SERVER", hidden: true, header: _("ID_INCOMING_SERVER"), width: 150, hideable: true, align: "center", renderer: rendererMessIncomingServer}, + {id: "MESS_INCOMING_PORT", dataIndex: "MESS_INCOMING_PORT", hidden: true, header: _("ID_EMAIL_SERVER_PORT"), width: 50, hideable: true, align: "center", renderer: rendererMessIncomingPort}, {id: "MESS_RAUTH", dataIndex: "MESS_RAUTH", hidden: true, header: _("REQUIRE_AUTHENTICATION"), width: 50, hideable: false, align: "left"}, {id: "MESS_ACCOUNT", dataIndex: "MESS_ACCOUNT", hidden: false, header: _("ID_EMAIL_SERVER_ACCOUNT_FROM"), width: 130, hideable: true, align: "left"}, {id: "MESS_PASSWORD", dataIndex: "MESS_PASSWORD", hidden: true, header: _("ID_PASSWORD"), width: 130, hideable: false, align: "left"},