Merged in victorsl/processmaker/PM-2576 (pull request #2414)

PM-2576 "Support for Timer-Event (End-points and Backend)" SOLVED
This commit is contained in:
Julio Cesar Laura Avendaño
2015-07-10 18:26:30 -04:00
11 changed files with 967 additions and 68 deletions

View File

@@ -2028,16 +2028,21 @@ class Cases
{
if ($sTasUid != '') {
try {
$this->Task = new Task;
$Fields = $this->Task->Load($sTasUid);
$task = TaskPeer::retrieveByPK($sTasUid);
if (is_null($task)) {
throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", array("TAS_UID", $sTasUid)));
}
//To allow Self Service as the first task
if (($Fields['TAS_ASSIGN_TYPE'] != 'SELF_SERVICE') && ($sUsrUid == '')) {
$arrayTaskTypeToExclude = array("START-TIMER-EVENT");
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $task->getTasAssignType() != "SELF_SERVICE" && $sUsrUid == "") {
throw (new Exception('You tried to start a new case without send the USER UID!'));
}
//Process
$sProUid = $this->Task->getProUid();
$sProUid = $task->getProUid();
$this->Process = new Process;
$proFields = $this->Process->Load($sProUid);

View File

@@ -439,20 +439,21 @@ class Derivation
*/
function getNextAssignedUser ($tasInfo)
{
$oUser = new Users();
//$oUser = new Users();
$nextAssignedTask = $tasInfo['NEXT_TASK'];
$lastAssigned = $tasInfo['NEXT_TASK']['TAS_LAST_ASSIGNED'];
$sTasUid = $tasInfo['NEXT_TASK']['TAS_UID'];
// to do: we can increase the LOCATION by COUNTRY, STATE and LOCATION
/* Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */
$assignLocation = '';
if ($tasInfo['NEXT_TASK']['TAS_ASSIGN_LOCATION'] == 'TRUE') {
$oUser->load( $tasInfo['USER_UID'] );
krumo( $oUser->getUsrLocation() );
//to do: assign for location
//$assignLocation = " AND USR_LOCATION = " . $oUser->Fields['USR_LOCATION'];
}
/* End - Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */
//// to do: we can increase the LOCATION by COUNTRY, STATE and LOCATION
///* Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */
//$assignLocation = '';
//if ($tasInfo['NEXT_TASK']['TAS_ASSIGN_LOCATION'] == 'TRUE') {
// $oUser->load( $tasInfo['USER_UID'] );
// krumo( $oUser->getUsrLocation() );
// //to do: assign for location
// //$assignLocation = " AND USR_LOCATION = " . $oUser->Fields['USR_LOCATION'];
//}
///* End - Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */
$uidUser = '';
switch ($nextAssignedTask['TAS_ASSIGN_TYPE']) {
@@ -507,7 +508,7 @@ class Derivation
$userFields['USR_EMAIL'] = '';
//get the report_to user & its full info
$useruid = $this->checkReplacedByUser( $this->getDenpendentUser( $tasInfo['USER_UID'] ) );
$useruid = ($tasInfo["USER_UID"] != "")? $this->checkReplacedByUser($this->getDenpendentUser($tasInfo["USER_UID"])) : "";
if (isset( $useruid ) && $useruid != '') {
$userFields = $this->getUsersFullNameFromArray( $useruid );

View File

@@ -1985,7 +1985,11 @@ class wsBase
}
}
if ($founded == '') {
$task = TaskPeer::retrieveByPK($taskId);
$arrayTaskTypeToExclude = array("START-TIMER-EVENT");
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $founded == "") {
$result = new wsResponse( 14, G::loadTranslation( 'ID_TASK_INVALID_USER_NOT_ASSIGNED_TASK' ) );
$g->sessionVarRestore();
@@ -2227,6 +2231,7 @@ class wsBase
}
}
$aData = array();
$aData['APP_UID'] = $caseId;
$aData['DEL_INDEX'] = $delIndex;
$aData['USER_UID'] = $userId;
@@ -2482,14 +2487,20 @@ class wsBase
}
}
$oUser = new Users();
$aUser = $oUser->load( $userId );
$sFromName = "";
if (trim( $aUser['USR_EMAIL'] ) == '') {
$aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST'];
if ($userId != "") {
$user = new Users();
$arrayUserData = $user->load($userId);
if (trim($arrayUserData["USR_EMAIL"]) == "") {
$arrayUserData["USR_EMAIL"] = "info@" . $_SERVER["HTTP_HOST"];
}
$sFromName = "\"" . $arrayUserData["USR_FIRSTNAME"] . " " . $arrayUserData["USR_LASTNAME"] . "\" <" . $arrayUserData["USR_EMAIL"] . ">";
}
$sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>';
$oCase->sendNotifications( $appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName );
//Save data - Start

View File

@@ -113,6 +113,10 @@ class ListParticipatedLast extends BaseListParticipatedLast
{
$data['APP_STATUS'] = (empty($data['APP_STATUS'])) ? 'TO_DO' : $data['APP_STATUS'];
if (!$isSelfService) {
if ($data["USR_UID"] == "") {
return;
}
$criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);

View File

@@ -261,7 +261,7 @@ class Users extends BaseUsers
//Calendar
$calendar = new Calendar();
$calendarInfo = $calendar->getCalendarFor( $userUid, $userUid, $userUid );
$aFields["USR_CALENDAR"] = ($calendarInfo["CALENDAR_APPLIED"] != "DEFAULT") ? $calendarInfo["CALENDAR_UID"] : "";
$aFields["USR_CALENDAR"] = ($calendarInfo["CALENDAR_APPLIED"] != "DEFAULT") ? $calendarInfo["CALENDAR_UID"] : "";
//Photo
$pathPhoto = PATH_IMAGES_ENVIRONMENT_USERS . $userUid . ".gif";
@@ -290,12 +290,12 @@ class Users extends BaseUsers
if(strlen($arrayData["replacedby"] != 0)){
$oUser = UsersPeer::retrieveByPK( $arrayData["replacedby"] );
$arrayData["replacedbyfullname"] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
}
}
$arrayData["duedate"] = $aFields["USR_DUE_DATE"];
$arrayData["calendar"] = $aFields["USR_CALENDAR"];
if(strlen($aFields["USR_CALENDAR"] != 0)){
$arrayData["calendarname"] = $calendar->calendarName( $aFields["USR_CALENDAR"] );
}
$arrayData["calendarname"] = $calendar->calendarName( $aFields["USR_CALENDAR"] );
}
$arrayData["status"] = $aFields["USR_STATUS"];
$arrayData["department"] = $aFields["DEP_UID"];
if (strlen($arrayData["department"]) != 0) {
@@ -399,6 +399,10 @@ class Users extends BaseUsers
public function refreshTotal ($userId, $type = 'add', $list = "inbox", $total = 1)
{
if ($userId == "") {
return;
}
$nameList = self::getNameTotal($list);
$criteria = new Criteria();
$criteria->addSelectColumn( $nameList );

View File

@@ -77,11 +77,11 @@ class TimerEventMapBuilder
$tMap->addColumn('TMREVN_END_DATE', 'TmrevnEndDate', 'int', CreoleTypes::DATE, false, null);
$tMap->addColumn('TMREVN_DAY', 'TmrevnDay', 'string', CreoleTypes::VARCHAR, true, 2);
$tMap->addColumn('TMREVN_DAY', 'TmrevnDay', 'string', CreoleTypes::VARCHAR, true, 5);
$tMap->addColumn('TMREVN_HOUR', 'TmrevnHour', 'string', CreoleTypes::VARCHAR, true, 2);
$tMap->addColumn('TMREVN_HOUR', 'TmrevnHour', 'string', CreoleTypes::VARCHAR, true, 5);
$tMap->addColumn('TMREVN_MINUTE', 'TmrevnMinute', 'string', CreoleTypes::VARCHAR, true, 2);
$tMap->addColumn('TMREVN_MINUTE', 'TmrevnMinute', 'string', CreoleTypes::VARCHAR, true, 5);
$tMap->addColumn('TMREVN_CONFIGURATION_DATA', 'TmrevnConfigurationData', 'string', CreoleTypes::LONGVARCHAR, true, null);