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

@@ -2683,30 +2683,54 @@ class Bootstrap
* Get the default information from the context * Get the default information from the context
* *
* @return array * @return array
*
* @see AdditionalTables->populateReportTable
* @see AppAssignSelfServiceValueGroup->createRow
* @see Bootstrap->registerMonologPhpUploadExecution()
* @see Cases->loadDataSendEmail()
* @see Cases->removeCase()
* @see Cases->reportTableDeleteRecord()
* @see Derivation->derivate
* @see G->logTriggerExecution()
* @see LdapAdvanced->VerifyLogin
* @see ldapadvancedClassCron->executeCron
* @see PmDynaform->__construct
* @see pmTablesProxy->genDataReport
* @see Processes->createFiles
* @see ProcessMaker\AuditLog\AuditLog->register
* @see ProcessMaker\Util\ParseSoapVariableName->buildVariableName
* @see RBAC->checkAutomaticRegister()
* @see workflow/engine/classes/class.pmFunctions.php::executeQuery
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
* @link https://wiki.processmaker.com/3.2/ProcessMaker_Functions
* @link https://wiki.processmaker.com/3.1/Report_Tables
* @link https://wiki.processmaker.com/3.2/Cases/Running_Cases
* @link https://wiki.processmaker.com/3.3/login
* @link https://wiki.processmaker.com/3.2/Executing_cron.php
* @link https://wiki.processmaker.com/3.2/HTML5_Responsive_DynaForm_Designer
* @link https://wiki.processmaker.com/3.2/Audit_Log
* @link https://wiki.processmaker.com/3.0/ProcessMaker_WSDL_Web_Services
*/ */
public static function getDefaultContextLog() public static function getDefaultContextLog()
{ {
global $RBAC;
$info = [ $info = [
'ip' => G::getIpAddress(), 'ip' => G::getIpAddress(),
'workspace' => !empty(config('system.workspace')) ? config('system.workspace') : 'Undefined Workspace', 'workspace' => !empty(config('system.workspace')) ? config('system.workspace') : 'Undefined Workspace',
'timeZone' => DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')) 'timeZone' => DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')),
'usrUid' => G::LoadTranslation('UID_UNDEFINED_USER')
]; ];
if ($RBAC !== null) { global $RBAC;
$userInfo = [ if (!empty($RBAC) && !empty($RBAC->aUserInfo['USER_INFO']) && !empty($RBAC->aUserInfo['USER_INFO']['USR_UID'])) {
'usrUid' => $RBAC->aUserInfo['USER_INFO']['USR_UID'] $info['usrUid'] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
]; return $info;
$info = array_merge($info, $userInfo);
} }
//Some endpoints can defined the USER_LOGGED
if (empty($info['usrUid'])) { //if default session exists
$user = !empty($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : G::LoadTranslation('UID_UNDEFINED_USER'); if (!empty($_SESSION['USER_LOGGED'])) {
$userInfo = [ $info['usrUid'] = $_SESSION['USER_LOGGED'];
'usrUid' => $user return $info;
];
$info = array_merge($info, $userInfo);
} }
return $info; return $info;

View File

@@ -1,5 +1,16 @@
<?php <?php
/**
* @see workflow/engine/bin/cron.php
* @see workflow/engine/bin/messageeventcron.php
* @see workflow/engine/bin/timereventcron.php
* @see workflow/engine/bin/ldapcron.php
* @see workflow/engine/bin/sendnotificationscron.php
* @see workflow/engine/methods/setup/cron.php
*
* @link https://wiki.processmaker.com/3.2/Executing_cron.php
*/
use Illuminate\Foundation\Http\Kernel; use Illuminate\Foundation\Http\Kernel;
require_once __DIR__ . '/../../../gulliver/system/class.g.php'; require_once __DIR__ . '/../../../gulliver/system/class.g.php';
@@ -202,6 +213,22 @@ try {
if (!defined('DB_ADAPTER')) { if (!defined('DB_ADAPTER')) {
define('DB_ADAPTER', $DB_ADAPTER); define('DB_ADAPTER', $DB_ADAPTER);
} }
if (!defined('DB_HOST')) {
define('DB_HOST', $DB_HOST);
}
if (!defined('DB_NAME')) {
define('DB_NAME', $DB_NAME);
}
if (!defined('DB_USER')) {
define('DB_USER', $DB_USER);
}
if (!defined('DB_PASS')) {
define('DB_PASS', $DB_PASS);
}
if (!defined('SYS_SKIN')) {
$conf = new Configurations();
define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', ''));
}
//Set Time Zone //Set Time Zone
$systemUtcTimeZone = false; $systemUtcTimeZone = false;

View File

@@ -23,9 +23,16 @@ class ActionsByEmailCoreClass extends PMPlugin
} }
/** /**
* @param $data * Send Actions By Email.
* @param $dataAbe *
* @global object $RBAC
* @param object $data
* @param array $dataAbe
* @return type
* @throws Exception * @throws Exception
*
* @see AppDelegation->createAppDelegation()
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
*/ */
public function sendActionsByEmail($data, $dataAbe) public function sendActionsByEmail($data, $dataAbe)
{ {
@@ -246,14 +253,22 @@ class ActionsByEmailCoreClass extends PMPlugin
$user = new Users(); $user = new Users();
$emailFrom = '';
if (!$configuration['ABE_MAILSERVER_OR_MAILCURRENT'] && $configuration['ABE_TYPE'] !== '') { if (!$configuration['ABE_MAILSERVER_OR_MAILCURRENT'] && $configuration['ABE_TYPE'] !== '') {
if ($data->PREVIOUS_USR_UID !== '') { if ($data->PREVIOUS_USR_UID !== '') {
$userDetails = $user->loadDetails($data->PREVIOUS_USR_UID); $userDetails = $user->loadDetails($data->PREVIOUS_USR_UID);
$emailFrom = ($userDetails["USR_FULLNAME"] . ' <' . $userDetails["USR_EMAIL"] . '>'); $emailFrom = ($userDetails["USR_FULLNAME"] . ' <' . $userDetails["USR_EMAIL"] . '>');
} else { } else {
global $RBAC; global $RBAC;
$currentUser = $RBAC->aUserInfo['USER_INFO']; if ($RBAC != null && is_array($RBAC->aUserInfo['USER_INFO'])) {
$emailFrom = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); $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 { } else {
if (isset($emailSetup["MESS_FROM_NAME"]) && isset($emailSetup["MESS_FROM_MAIL"])) { if (isset($emailSetup["MESS_FROM_NAME"]) && isset($emailSetup["MESS_FROM_MAIL"])) {

View File

@@ -1359,9 +1359,20 @@ class PmDynaform
exit(); 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) public function printPmDynaformAbe($record)
{ {
ob_clean(); if (ob_get_length() > 0) {
ob_clean();
}
$this->record = $record; $this->record = $record;
$json = G::json_decode($this->record["DYN_CONTENT"]); $json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json); $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) public function createOrUpdate($data)
{ {
foreach ($data as $field => $value) { foreach ($data as $field => $value) {
@@ -70,6 +81,11 @@ class AbeConfiguration extends BaseAbeConfiguration
} else { } else {
$abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($data['ABE_UID']); $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'])) { if (isset($data['ABE_CUSTOM_GRID'])) {
$data['ABE_CUSTOM_GRID'] = serialize($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'] = ''; $configuration['MESS_ENGINE'] = '';
} }
$users = new Users(); //This value can be empty when the previous task is: 'Script Task', 'Timer Event' or other without user.
$userInfo = $users->load($usrUid); if (!empty($usrUid)) {
$authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>'; $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(); $cases = new Cases();
$fieldCase = $cases->loadCase($appUid, $delIndex); $fieldCase = $cases->loadCase($appUid, $delIndex);

View File

@@ -265,12 +265,15 @@ class ActionsByEmail
} }
/** /**
* Get the information for the log * Get the information for the log.
* *
* @param array $arrayData * @param array $arrayData
*
* @return array * @return array
*/ *
* @see ProcessMaker\Services\Api\ActionsByEmail->loadActionByEmail()
* @see workflow/engine/methods/actionsByEmail/actionsByEmailAjax.php
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
*/
public function loadActionByEmail(array $arrayData) public function loadActionByEmail(array $arrayData)
{ {
//Get the total //Get the total
@@ -331,10 +334,15 @@ class ActionsByEmail
//Get the previous user //Get the previous user
$appDelegation = new AppDelegation(); $appDelegation = new AppDelegation();
$usrUid = $appDelegation->getUserAssignedInThread($data[$index]['APP_UID'], $data[$index]['DEL_PREVIOUS']); $usrUid = $appDelegation->getUserAssignedInThread($data[$index]['APP_UID'], $data[$index]['DEL_PREVIOUS']);
$users = new ClassUsers(); //This value can be empty when the previous task is: 'Script Task', 'Timer Event' or other without user.
$dataRes = $users->load($usrUid); if (!empty($usrUid)) {
if (!empty($dataRes)) { $users = new ClassUsers();
$data[$index]['USER'] = $dataRes['USR_FIRSTNAME'] . ' ' . $dataRes['USR_LASTNAME']; $dataRes = $users->load($usrUid);
if (!empty($dataRes)) {
$data[$index]['USER'] = $dataRes['USR_FIRSTNAME'] . ' ' . $dataRes['USR_LASTNAME'];
} else {
$data[$index]['USER'] = '';
}
} else { } else {
$data[$index]['USER'] = ''; $data[$index]['USER'] = '';
} }
@@ -435,10 +443,14 @@ class ActionsByEmail
} }
/** /**
* Get the decision from Actions By Email and check if is Bpmn Process * Get the decision from Actions By Email and check if is Bpmn Process.
* @param array $arrayData * @param array $arrayData
* *
* @return string $message * @return string $message
*
* @see workflow/engine/methods/actionsByEmail/actionsByEmailAjax.php
* @see ProcessMaker\Services\Api\ActionsByEmail->viewForm()
* @link https://wiki.processmaker.com/3.3/Actions_by_Email#Actions_by_Email_Log
*/ */
public function viewForm(array $arrayData) public function viewForm(array $arrayData)
{ {
@@ -453,6 +465,7 @@ class ActionsByEmail
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TYPE);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID); $criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
@@ -468,17 +481,21 @@ class ActionsByEmail
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$resultRes->next(); $resultRes->next();
$dataRes = Array(); $dataRes = [];
$message = G::LoadTranslation('ID_USER_NOT_RESPONDED_REQUEST'); $message = G::LoadTranslation('ID_USER_NOT_RESPONDED_REQUEST');
if ($dataRes = $resultRes->getRow()) { if ($dataRes = $resultRes->getRow()) {
$_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']); $_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']);
$process = new \Process(); $process = new \Process();
$isBpmn = $process->isBpmnProcess($dataRes['PRO_UID']); $isBpmn = $process->isBpmnProcess($dataRes['PRO_UID']);
if($isBpmn) { if ($isBpmn) {
$message = $this->viewFormBpmn($dataRes); if ($dataRes['ABE_TYPE'] === 'FIELD') {
$message = $this->viewFormBpmn($dataRes);
} else {
$message = G::LoadTranslation('ID_CASE_RESPONSE_NOT_AVAILABLE');
}
} else { } else {
$message = $this->viewFormClassic($dataRes); $message = $this->viewFormClassic($dataRes); //to do, review this function
} }
} }
@@ -538,11 +555,13 @@ class ActionsByEmail
} }
/** /**
* Get the decision from Actions By Email by BPMN dynaform * Get the decision from Actions By Email by BPMN dynaform.
* *
* @param array $dataRes * @param array $dataRes
* * @return string
* @return string $message *
* @see ActionsByEmail->viewForm()
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
*/ */
public function viewFormBpmn(array $dataRes) public function viewFormBpmn(array $dataRes)
{ {
@@ -599,9 +618,15 @@ class ActionsByEmail
case 'dropdown': case 'dropdown':
case 'radiogroup': case 'radiogroup':
case 'radio': case 'radio':
$message = $field->label . ': '; if (!empty($field->options[$value])) {
$message .= $field->options[$value]; $message = $field->label . ': ';
$message .= $field->options[$value];
}
break; break;
/**
* 'yesno' is deprecated in version ProcessMaker 3.x.x.
* @deprecated
*/
case 'yesno': case 'yesno':
$message = $field->label . ': '; $message = $field->label . ': ';
$message .= $value == 1 ? G::LoadTranslation('ID_YES') : G::LoadTranslation('ID_NO'); $message .= $value == 1 ? G::LoadTranslation('ID_YES') : G::LoadTranslation('ID_NO');
@@ -609,13 +634,18 @@ class ActionsByEmail
case 'checkgroup': case 'checkgroup':
case 'checkbox': case 'checkbox':
$message = $field->label . ': '; $message = $field->label . ': ';
$message .= $value == 'On' ? G::LoadTranslation('ID_CHECK') : G::LoadTranslation('ID_UNCHECK'); if (!empty($value)) {
/**
* Value 'On' is deprecated in version ProcessMaker 3.x.x.
* now return '1'.
* @deprecated
*/
$message .= ($value == 'On' || $value == '1') ? G::LoadTranslation('ID_CHECK') : G::LoadTranslation('ID_UNCHECK');
}
break; break;
} }
} }
} }
//Return
return $message; return $message;
} }

View File

@@ -1200,11 +1200,14 @@ class TimerEvent
/** /**
* Start/Continue case by Timer-Event * Start/Continue case by Timer-Event
* *
* @param string $datetime Datetime (yyyy-mm-dd hh:ii:ss) * @param string $datetime Datetime (yyyy-mm-dd hh:ii:ss)
* @param bool $frontEnd Flag to represent the terminal front-end * @param bool $frontEnd Flag to represent the terminal front-end
* * @throws \Exception
* return void *
* @see workflow/engine/bin/cron_single.php
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
* @link https://wiki.processmaker.com/3.2/Executing_cron.php
*/ */
public function startContinueCaseByTimerEvent($datetime, $frontEnd = false) public function startContinueCaseByTimerEvent($datetime, $frontEnd = false)
{ {
@@ -1622,6 +1625,8 @@ class TimerEvent
$delIndex = $row["DEL_INDEX"]; $delIndex = $row["DEL_INDEX"];
$delDelegateDate = $row["DEL_DELEGATE_DATE"]; $delDelegateDate = $row["DEL_DELEGATE_DATE"];
$bpmnEventName = $row["EVN_NAME"]; $bpmnEventName = $row["EVN_NAME"];
$taskUid = !empty($arrayApplicationData['APP_DATA']) && !empty($arrayApplicationData['APP_DATA']['TASK']) ?
$arrayApplicationData['APP_DATA']['TASK'] : '';
//Continue the case //Continue the case
$continueCaseDate = $delDelegateDate; $continueCaseDate = $delDelegateDate;