This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-02-13 15:53:21 -04:00
parent 469bb0dfff
commit da2ea4c865
8 changed files with 182 additions and 49 deletions

View File

@@ -23,9 +23,16 @@ class ActionsByEmailCoreClass extends PMPlugin
}
/**
* @param $data
* @param $dataAbe
* 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)
{
@@ -246,14 +253,22 @@ class ActionsByEmailCoreClass extends PMPlugin
$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;
$currentUser = $RBAC->aUserInfo['USER_INFO'];
$emailFrom = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>');
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"])) {

View File

@@ -1359,9 +1359,20 @@ class PmDynaform
exit();
}
/**
* Print PmDynaform for Action by Email.
*
* @param array $record
* @return string
*
* @see ActionsByEmailCoreClass->sendActionsByEmail()
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
*/
public function printPmDynaformAbe($record)
{
ob_clean();
if (ob_get_length() > 0) {
ob_clean();
}
$this->record = $record;
$json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json);

View File

@@ -48,6 +48,17 @@ class AbeConfiguration extends BaseAbeConfiguration
}
}
/**
* Create or update.
*
* @param array $data
* @throws Exception
*
* @see Processes->createActionsByEmail()
* @see ProcessMaker\BusinessModel\ActionsByEmail->saveConfiguration()
* @see ProcessMaker\BusinessModel\ActionsByEmail->saveConfiguration2()
* @link https://wiki.processmaker.com/3.3/Actions_by_Email#Configuration
*/
public function createOrUpdate($data)
{
foreach ($data as $field => $value) {
@@ -70,6 +81,11 @@ class AbeConfiguration extends BaseAbeConfiguration
} else {
$abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($data['ABE_UID']);
}
//Only the 'FIELD' and 'LINK' types have a DYN_UID,
//the DYN_UID field is empty when the type is 'CUSTOM'.
if ($data['ABE_TYPE'] === 'CUSTOM') {
$data['DYN_UID'] = '';
}
if (isset($data['ABE_CUSTOM_GRID'])) {
$data['ABE_CUSTOM_GRID'] = serialize($data['ABE_CUSTOM_GRID']);

View File

@@ -169,9 +169,14 @@ class AppNotes extends BaseAppNotes
$configuration['MESS_ENGINE'] = '';
}
$users = new Users();
$userInfo = $users->load($usrUid);
$authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>';
//This value can be empty when the previous task is: 'Script Task', 'Timer Event' or other without user.
if (!empty($usrUid)) {
$users = new Users();
$userInfo = $users->load($usrUid);
$authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>';
} else {
$authorName = G::LoadTranslation('UID_UNDEFINED_USER');
}
$cases = new Cases();
$fieldCase = $cases->loadCase($appUid, $delIndex);