diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index d9cb9a8e0..38515fd73 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -7,6 +7,7 @@ use ProcessMaker\Services\Api\Project\Variable; class ActionsByEmailCoreClass extends PMPlugin { + //The %0d and %0a are URL-encoded forms of CR and LF const BODY_REPLY_LF = '%0D%0A'; private $abeRequest = []; private $appNumber = null; @@ -716,38 +717,60 @@ class ActionsByEmailCoreClass extends PMPlugin $customGrid = unserialize($this->getItemAbeProperties('ABE_CUSTOM_GRID')); $field = new stdClass(); $field->label = ''; - $html = '
' . $field->label . ''; - $html .= '\n" + . "\n" + . "
'; + + $html = '' + . "
\n" + . "{$field->label}\n" + . "
\n" + . "\n" + . "\n" + . "
\n" + . "\n" + . "\n"; + $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) ? '' : ' '); + + $emailSubject = rawurlencode($emailSubject); + $emailBody = rawurlencode($emailBody); + + $href = "mailto:{$noReply}?subject={$emailSubject}&body={$emailBody}"; + + $html = $html + . "\n"; + //this is left for compatibility with template customizations + if ($index % 5 === 0) { + $html = $html + . "\n" + . "\n"; + } $index++; } - $html .= '
'; - $html .= $value['abe_custom_label']; - $html .= '
\n" + . "{$value['abe_custom_label']}\n" + . "
'; + $html = $html + . "
\n" + . "
\n" + . "\n"; return $html; } /** - * Get the subject for response the action by email - * + * Get the subject for response the action by email. + * * @param string $fieldLabel - * * @return string */ - private function getSubjectByResponse($fieldLabel) + private function getSubjectByResponse(string $fieldLabel): string { $subject = G::LoadTranslation('ID_CASE') . ' ' . $this->getCasePropertiesKey('APP_TITLE'); $subject .= $this->delimiter . ' ' . $fieldLabel; - - return urlencode($subject); + return $subject; } /** @@ -769,10 +792,11 @@ class ActionsByEmailCoreClass extends PMPlugin ]; $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; + $CR_LF = "\r\n"; + $body = str_repeat($CR_LF, 4); + $body .= '/' . str_repeat("=", 24) . $CR_LF; + $body .= G::LoadTranslation('ID_ABE_EMAIL_RESPONSE_BODY_NOTE') . $CR_LF; + $body .= '{' . Crypt::encryptString($bodyToCrypt) . '}' . $CR_LF; $body .= str_repeat("=", 24) . '/'; return $body; }