diff --git a/config/app.php b/config/app.php index 18c615493..548de0a20 100644 --- a/config/app.php +++ b/config/app.php @@ -12,19 +12,20 @@ return [ 'log' => env('APP_LOG', 'single'), 'log_level' => env('APP_LOG_LEVEL', 'debug'), 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), - + 'key' => env('APP_KEY', 'base64:rU28h/tElUn/eiLY0qC24jJq1rakvAFRoRl1DWxj/kM='), + 'cipher' => 'AES-256-CBC', 'providers' => [ - FilesystemServiceProvider::class, CacheServiceProvider::class, - ViewServiceProvider::class, + FilesystemServiceProvider::class, Illuminate\Database\DatabaseServiceProvider::class, Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, Illuminate\Queue\QueueServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class, - + Illuminate\Encryption\EncryptionServiceProvider::class, + ViewServiceProvider::class ], - 'aliases' => [ + 'Crypt' => Illuminate\Support\Facades\Crypt::class ], ]; diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index 87eac721e..166485a06 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -1,308 +1,985 @@ defineWorkspace(); + $this->defineServicePath(); } /** - * @param $data - * @param $dataAbe + * 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; + + } + + /** + * Get the email to + * + * @return string + */ + public function getEmailTo() + { + return $this->emailTo; + } + + /** + * 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; + $currentUser = $RBAC->aUserInfo['USER_INFO']; + $from = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); + } + } + //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); + 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 the action by email + * + * @param object $data + * @param array $dataAbe + * + * @return void * @throws Exception */ - 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'] ); - 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(); - - 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; - $currentUser = $RBAC->aUserInfo['USER_INFO']; - $emailFrom = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); - } - } 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 + $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) + { + $bodyToCrypt = [ + 'workspace' => $this->getWorkspace(), + 'appUid' => $this->getAppUid(), + 'delIndex' => $this->getIndex(), + 'fieldValue' => $fieldValue, + ]; + $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 + ); + + return $result; + } catch (Exception $error) { + throw $error; + } + } } diff --git a/workflow/engine/classes/SpoolRun.php b/workflow/engine/classes/SpoolRun.php index 255aeda04..56bccc4ec 100644 --- a/workflow/engine/classes/SpoolRun.php +++ b/workflow/engine/classes/SpoolRun.php @@ -50,6 +50,26 @@ class SpoolRun $this->mailEreg = "/^([\w\-_\+\.']+@[\w\-_\.]+\.\w{2,5}+)$/"; } + /** + * Set the $spool_id + * + * @param string + */ + public function setSpoolId($v) + { + $this->spool_id = $v; + } + + /** + * Get the $spool_id + * + * @return string + */ + public function getSpoolId() + { + return $this->spool_id; + } + /** * get all files into spool in a list * diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index 489fdd533..67165343d 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -5,6 +5,7 @@ use ProcessMaker\BusinessModel\EmailServer; use ProcessMaker\ChangeLog\ChangeLog; /*----------------------------------********---------------------------------*/ use ProcessMaker\Core\System; +use ProcessMaker\Util\WsMessageResponse; class WsBase { @@ -947,7 +948,8 @@ class WsBase $spool->sendMail(); if ($spool->status == 'sent') { - $result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to); + $result = new WsMessageResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to); + $result->setAppMessUid($spool->getSpoolId()); } else { $result = new WsResponse(29, $spool->status . ' ' . $spool->error . print_r($setup, 1)); } diff --git a/workflow/engine/classes/model/AbeConfiguration.php b/workflow/engine/classes/model/AbeConfiguration.php index 6b740d85a..6722958cf 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) @@ -136,6 +138,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 90f1fc9a4..663ade86c 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/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/config/schema.xml b/workflow/engine/config/schema.xml index 2419ba032..75517b680 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -5094,6 +5094,16 @@ + + + + + + + + + + @@ -5141,6 +5151,7 @@ + @@ -5769,7 +5780,7 @@
- + diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 57caa88d5..7027ef788 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -1699,6 +1699,12 @@ 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_FORM_ALREADY_FILLED #: LABEL/ID_ABE_FORM_ALREADY_FILLED @@ -4235,6 +4241,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 diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index a7cd4f3e4..8277694f0 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -57081,6 +57081,7 @@ 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') , @@ -57513,6 +57514,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') , diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index f78a95cd0..30f4f911f 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2865,6 +2865,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 +2874,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/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; + } +} +