Merge remote-tracking branch 'origin/release/3.3.9' into bugfix/PMC-580

This commit is contained in:
Paula Quispe
2019-05-07 14:47:01 -04:00
32 changed files with 453 additions and 321 deletions

View File

@@ -327,6 +327,7 @@ function processWorkspace()
executeScheduledCases();
executeUpdateAppTitle();
executeCaseSelfService();
cleanSelfServiceTables();
executePlugins();
/*----------------------------------********---------------------------------*/
fillReportByUser();
@@ -1056,3 +1057,46 @@ function sendNotifications()
saveLog("ExecuteSendNotifications", "error", "Error when sending notifications " . $e->getMessage());
}
}
/**
* Clean unused records in tables related to the Self-Service Value Based feature
*
* @see processWorkspace()
*
* @link https://wiki.processmaker.com/3.2/Executing_cron.php#Syntax_of_cron.php_Options
*/
function cleanSelfServiceTables()
{
try {
global $argvx;
// Check if the action can be executed
if ($argvx !== "" && strpos($argvx, "clean-self-service-tables") === false) {
return false;
}
// Start message
setExecutionMessage("Clean unused records for Self-Service Value Based feature");
// Get Propel connection
$cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME);
// Delete related rows and missing relations, criteria don't execute delete with joins
$cnn->begin();
$stmt = $cnn->createStatement();
$stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . "
ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ")
WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL");
$cnn->commit();
// Success message
setExecutionResultMessage("DONE");
} catch (Exception $e) {
$cnn->rollback();
setExecutionResultMessage("WITH ERRORS", "error");
eprintln(" '-" . $e->getMessage(), "red");
saveLog("ExecuteCleanSelfServiceTables", "error", "Error when try to clean self-service tables " . $e->getMessage());
}
}

View File

@@ -468,44 +468,44 @@ class Cases
{
try {
$oApp = new Application;
$aFields = $oApp->Load($sAppUid);
$fields = $oApp->Load($sAppUid);
$appData = self::unserializeData($aFields['APP_DATA']);
$appData = self::unserializeData($fields['APP_DATA']);
$aFields['APP_DATA'] = G::array_merges(G::getSystemConstants(), $appData);
$fields['APP_DATA'] = G::array_merges(G::getSystemConstants(), $appData);
switch ($oApp->getAppStatus()) {
case 'COMPLETED':
$aFields['STATUS'] = G::LoadTranslation('ID_COMPLETED');
$fields['STATUS'] = G::LoadTranslation('ID_COMPLETED');
break;
case 'CANCELLED':
$aFields['STATUS'] = G::LoadTranslation('ID_CANCELLED');
$fields['STATUS'] = G::LoadTranslation('ID_CANCELLED');
break;
case 'PAUSED':
$aFields['STATUS'] = G::LoadTranslation('ID_PAUSED');
$fields['STATUS'] = G::LoadTranslation('ID_PAUSED');
break;
case 'DRAFT':
$aFields['STATUS'] = G::LoadTranslation('ID_DRAFT');
$fields['STATUS'] = G::LoadTranslation('ID_DRAFT');
break;
case 'TO_DO':
$aFields['STATUS'] = G::LoadTranslation('ID_TO_DO');
$fields['STATUS'] = G::LoadTranslation('ID_TO_DO');
break;
}
$oUser = new Users();
try {
$oUser->load($oApp->getAppInitUser());
$uFields = $oUser->toArray(BasePeer::TYPE_FIELDNAME);
$aFields['TITLE'] = $aFields['APP_TITLE'];
$aFields['DESCRIPTION'] = $aFields['APP_DESCRIPTION'];
$aFields['CREATOR'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
$aFields['CREATE_DATE'] = $oApp->getAppCreateDate();
$aFields['UPDATE_DATE'] = $oApp->getAppUpdateDate();
$fields['TITLE'] = $fields['APP_TITLE'];
$fields['DESCRIPTION'] = $fields['APP_DESCRIPTION'];
$fields['CREATOR'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
$fields['CREATE_DATE'] = $oApp->getAppCreateDate();
$fields['UPDATE_DATE'] = $oApp->getAppUpdateDate();
} catch (Exception $oError) {
$aFields['TITLE'] = $oApp->getAppTitle();
$aFields['DESCRIPTION'] = '';
$aFields['CREATOR'] = '(USER_DELETED)';
$aFields['CREATE_DATE'] = $oApp->getAppCreateDate();
$aFields['UPDATE_DATE'] = $oApp->getAppUpdateDate();
$fields['TITLE'] = $oApp->getAppTitle();
$fields['DESCRIPTION'] = '';
$fields['CREATOR'] = '(USER_DELETED)';
$fields['CREATE_DATE'] = $oApp->getAppCreateDate();
$fields['UPDATE_DATE'] = $oApp->getAppUpdateDate();
}
if ($iDelIndex > 0) {
@@ -513,50 +513,52 @@ class Cases
$oAppDel = new AppDelegation();
$oAppDel->Load($sAppUid, $iDelIndex);
$aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$aFields['TAS_UID'] = $aAppDel['TAS_UID'];
$aFields['DEL_INDEX'] = $aAppDel['DEL_INDEX'];
$aFields['DEL_PREVIOUS'] = $aAppDel['DEL_PREVIOUS'];
$aFields['DEL_TYPE'] = $aAppDel['DEL_TYPE'];
$aFields['DEL_PRIORITY'] = $aAppDel['DEL_PRIORITY'];
$aFields['DEL_THREAD_STATUS'] = $aAppDel['DEL_THREAD_STATUS'];
$aFields['DEL_THREAD'] = $aAppDel['DEL_THREAD'];
$aFields['DEL_DELEGATE_DATE'] = $aAppDel['DEL_DELEGATE_DATE'];
$aFields['DEL_INIT_DATE'] = $aAppDel['DEL_INIT_DATE'];
$aFields['DEL_TASK_DUE_DATE'] = $aAppDel['DEL_TASK_DUE_DATE'];
$aFields['DEL_FINISH_DATE'] = $aAppDel['DEL_FINISH_DATE'];
$aFields['CURRENT_USER_UID'] = $aAppDel['USR_UID'];
$fields['TAS_UID'] = $aAppDel['TAS_UID'];
$fields['DEL_INDEX'] = $aAppDel['DEL_INDEX'];
$fields['DEL_PREVIOUS'] = $aAppDel['DEL_PREVIOUS'];
$fields['DEL_TYPE'] = $aAppDel['DEL_TYPE'];
$fields['DEL_PRIORITY'] = $aAppDel['DEL_PRIORITY'];
$fields['DEL_THREAD_STATUS'] = $aAppDel['DEL_THREAD_STATUS'];
$fields['DEL_THREAD'] = $aAppDel['DEL_THREAD'];
$fields['DEL_DELEGATE_DATE'] = $aAppDel['DEL_DELEGATE_DATE'];
$fields['DEL_INIT_DATE'] = $aAppDel['DEL_INIT_DATE'];
$fields['DEL_TASK_DUE_DATE'] = $aAppDel['DEL_TASK_DUE_DATE'];
$fields['DEL_FINISH_DATE'] = $aAppDel['DEL_FINISH_DATE'];
$fields['CURRENT_USER_UID'] = $aAppDel['USR_UID'];
//Update the global variables
$aFields['TASK'] = $aAppDel['TAS_UID'];
$aFields['INDEX'] = $aAppDel['DEL_INDEX'];
$aFields['TAS_ID'] = $aAppDel['TAS_ID'];
$aFields['PRO_ID'] = $aAppDel['PRO_ID'];
$fields['TASK'] = $aAppDel['TAS_UID'];
$fields['INDEX'] = $aAppDel['DEL_INDEX'];
$fields['TAS_ID'] = $aAppDel['TAS_ID'];
$fields['PRO_ID'] = $aAppDel['PRO_ID'];
try {
$oCurUser = new Users();
if ($jump != '') {
$aCases = $oAppDel->LoadParallel($sAppUid);
$aFields['TAS_UID'] = '';
$aFields['CURRENT_USER'] = array();
foreach ($aCases as $key => $value) {
$oCurUser->load($value['USR_UID']);
$aFields['CURRENT_USER'][] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
$aFields['TAS_UID'] .= (($aFields['TAS_UID'] != '') ? '|' : '') . $value['TAS_UID'];
$cases = $oAppDel->LoadParallel($sAppUid);
if (!empty($cases)) {
$fields['TAS_UID'] = '';
}
$aFields['CURRENT_USER'] = implode(" - ", array_values($aFields['CURRENT_USER']));
$tasksArray = array_filter(explode('|', $aFields['TAS_UID']));
$fields['CURRENT_USER'] = array();
foreach ($cases as $key => $value) {
$oCurUser->load($value['USR_UID']);
$fields['CURRENT_USER'][] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
$fields['TAS_UID'] .= (($fields['TAS_UID'] != '') ? '|' : '') . $value['TAS_UID'];
}
$fields['CURRENT_USER'] = implode(" - ", array_values($fields['CURRENT_USER']));
$tasksArray = array_filter(explode('|', $fields['TAS_UID']));
if (count($tasksArray) == 1) {
$aFields['TAS_UID'] = $tasksArray[0];
$fields['TAS_UID'] = $tasksArray[0];
}
} else {
$oCurUser->load($aAppDel['USR_UID']);
$aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
$fields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
}
} catch (Exception $oError) {
$aFields['CURRENT_USER'] = '';
$fields['CURRENT_USER'] = '';
}
}
return $aFields;
return $fields;
} catch (exception $e) {
throw ($e);
}
@@ -963,10 +965,9 @@ class Cases
if (isset($Fields['CURRENT_USER_UID'])) {
$Fields['USR_UID'] = $Fields['CURRENT_USER_UID'];
}
/*----------------------------------********---------------------------------*/
$completed = new ListCompleted();
$completed->create(array_merge($Fields, $newTitleOrDescription));
/*----------------------------------********---------------------------------*/
//Will be update the status in the list Participated
$listParticipatedLast = new ListParticipatedLast();
$listParticipatedLast->refreshStatus($Fields['APP_UID'], 'COMPLETED');
}
/** Update case*/
@@ -1138,9 +1139,6 @@ class Cases
$oCriteria->add(ListParticipatedHistoryPeer::APP_UID, $sAppUid);
ListParticipatedHistoryPeer::doDelete($oCriteria);
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListCompletedPeer::APP_UID, $sAppUid);
ListCompletedPeer::doDelete($oCriteria);
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListUnassignedPeer::APP_UID, $sAppUid);
ListUnassignedPeer::doDelete($oCriteria);
/*----------------------------------********---------------------------------*/
@@ -3538,6 +3536,8 @@ class Cases
/**
* This section of code its related to the route the case with parallel task in the same time
* @link https://processmaker.atlassian.net/browse/PMC-2
*
* @todo: The solution for ticket HOR-4602 should be restated in another ticket, for now this change was reverted
*/
if ($oPMScript->executedOn() === $oPMScript::AFTER_ROUTING) {
//Get the variables changed with the trigger
@@ -3546,11 +3546,6 @@ class Cases
//We will be load the last appData because:
//Other thread execution can be changed the variables
$appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : '';
if (!empty($appUid)) {
$lastFieldsCase = $this->loadCase($appUid)['APP_DATA'];
//Update $fieldsCase with the last appData
$fieldsCase = array_merge($fieldsCase, $lastFieldsCase);
}
//Save the fields changed in the trigger
if (!$varInAfterRouting && !empty($fieldsTrigger)) {
@@ -5716,7 +5711,7 @@ class Cases
'',
'',
'pending',
'',
1,
$dataLastEmail['msgError'],
true,
isset($arrayData['APP_NUMBER']) ? $arrayData['APP_NUMBER'] : 0,

View File

@@ -74,6 +74,44 @@ class Groups
}
}
/**
* Get the IDs of the active groups for an user
*
* @param string $usrUid
*
* @return array
* @throws Exception
*/
public function getActiveGroupsForAnUserById($usrUid)
{
try {
$criteria = new Criteria();
$criteria->addSelectColumn(GroupUserPeer::GRP_ID);
$criteria->addJoin(GroupUserPeer::GRP_ID, GroupwfPeer::GRP_ID, Criteria::LEFT_JOIN);
//@todo: we need to add a new column GROUP_USER.USR_ID
$criteria->add(GroupUserPeer::USR_UID, $usrUid);
//@todo: we need to add a new column GROUPWF.GRP_STATUS_ID
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
$dataset = GroupUserPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
//If the user does not relate with any group we will to return a default value for avoiding problems with the IN
$groups = [-1];
$row = $dataset->getRow();
while (is_array($row)) {
$groups[] = $row['GRP_ID'];
$dataset->next();
$row = $dataset->getRow();
}
return $groups;
} catch (Exception $error) {
throw ($error);
}
}
/**
* Set a user to group
*

View File

@@ -2190,7 +2190,7 @@ class Processes
$labels = ['OUT_DOC_TITLE' => $row['OUT_DOC_TITLE'],
'OUT_DOC_DESCRIPTION' => !empty($row['OUT_DOC_DESCRIPTION']) ? $row['OUT_DOC_DESCRIPTION'] : '',
'OUT_DOC_FILENAME' => $row['OUT_DOC_FILENAME'],
'OUT_DOC_TEMPLATE' => $row['OUT_DOC_TEMPLATE']];
'OUT_DOC_TEMPLATE' => !empty($row['OUT_DOC_TEMPLATE']) ? $row['OUT_DOC_TEMPLATE'] : ''];
$this->insertToContentTable($con, $labels, $row['OUT_DOC_UID'], SYS_LANG);
}
$con->commit();

View File

@@ -2398,7 +2398,7 @@ class WorkspaceTools
return;
}
$arrayTable1 = ['ListInbox', 'ListMyInbox', 'ListCanceled', 'ListParticipatedLast', 'ListParticipatedHistory', 'ListPaused', 'ListCompleted'];
$arrayTable1 = ['ListInbox', 'ListMyInbox', 'ListCanceled', 'ListParticipatedLast', 'ListParticipatedHistory', 'ListPaused'];
$arrayTable2 = ['ListUnassigned', 'ListUnassignedGroup'];
$arrayTable = array_merge($arrayTable1, $arrayTable2);
@@ -2424,7 +2424,6 @@ class WorkspaceTools
}
if ($flagReinsert || !$flagListAll) {
$this->regenerateListCompleted($lang);
$this->regenerateListCanceled($lang);
$this->regenerateListMyInbox(); //This list require no translation
$this->regenerateListInbox(); //This list require no translation
@@ -2509,69 +2508,6 @@ class WorkspaceTools
CLI::logging("> Completed table LIST_CANCELED\n");
}
public function regenerateListCompleted($lang = 'en')
{
$this->initPropel(true);
$query = 'INSERT INTO ' . $this->dbName . '.LIST_COMPLETED
(APP_UID,
USR_UID,
TAS_UID,
PRO_UID,
APP_NUMBER,
APP_TITLE,
APP_PRO_TITLE,
APP_TAS_TITLE,
APP_CREATE_DATE,
APP_FINISH_DATE,
DEL_INDEX,
DEL_PREVIOUS_USR_UID,
DEL_CURRENT_USR_USERNAME,
DEL_CURRENT_USR_FIRSTNAME,
DEL_CURRENT_USR_LASTNAME)
SELECT
ACV.APP_UID,
ACV.USR_UID,
ACV.TAS_UID,
ACV.PRO_UID,
ACV.APP_NUMBER,
C_APP.CON_VALUE AS APP_TITLE,
C_PRO.CON_VALUE AS APP_PRO_TITLE,
C_TAS.CON_VALUE AS APP_TAS_TITLE,
ACV.APP_CREATE_DATE,
ACV.APP_FINISH_DATE,
ACV.DEL_INDEX,
PREV_AD.USR_UID AS DEL_PREVIOUS_USR_UID,
USR.USR_USERNAME AS DEL_CURRENT_USR_USERNAME,
USR.USR_FIRSTNAME AS DEL_CURRENT_USR_FIRSTNAME,
USR.USR_LASTNAME AS DEL_CURRENT_USR_LASTNAME
FROM
(' . $this->dbName . '.APP_CACHE_VIEW ACV
LEFT JOIN ' . $this->dbName . '.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID
AND C_APP.CON_CATEGORY = \'APP_TITLE\'
AND C_APP.CON_LANG = \'' . $lang . '\'
LEFT JOIN ' . $this->dbName . '.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID
AND C_PRO.CON_CATEGORY = \'PRO_TITLE\'
AND C_PRO.CON_LANG = \'' . $lang . '\'
LEFT JOIN ' . $this->dbName . '.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID
AND C_TAS.CON_CATEGORY = \'TAS_TITLE\'
AND C_TAS.CON_LANG = \'' . $lang . '\')
LEFT JOIN
(' . $this->dbName . '.APP_DELEGATION AD
INNER JOIN ' . $this->dbName . '.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID
AND AD.DEL_PREVIOUS = PREV_AD.DEL_INDEX) ON ACV.APP_UID = AD.APP_UID
AND ACV.DEL_INDEX = AD.DEL_INDEX
LEFT JOIN
' . $this->dbName . '.USERS USR ON ACV.USR_UID = USR.USR_UID
WHERE
ACV.APP_STATUS = \'COMPLETED\'
AND ACV.DEL_LAST_INDEX = 1';
$con = Propel::getConnection("workflow");
$stmt = $con->createStatement();
$stmt->executeQuery($query);
CLI::logging("> Completed table LIST_COMPLETED\n");
}
public function regenerateListMyInbox()
{
$this->initPropel(true);

View File

@@ -64,6 +64,12 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
*
* @return void
* @throws Exception
*
* @see \Cases->removeCase()
* @see \Cases->setCatchUser()
* @see \Cases->updateCase()
*
* @link https://wiki.processmaker.com/3.2/Tasks#Self_Service_Value_Based_Assignment
*/
public function remove($applicationUid, $delIndex = 0)
{
@@ -76,18 +82,7 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
$criteria->add(AppAssignSelfServiceValuePeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
}
$result = AppAssignSelfServiceValuePeer::doDelete($criteria);
// Delete related rows and missing relations, criteria don't execute delete with joins
$cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME);
$cnn->begin();
$stmt = $cnn->createStatement();
$rs = $stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . "
ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ")
WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL");
$cnn->commit();
AppAssignSelfServiceValuePeer::doDelete($criteria);
} catch (Exception $e) {
throw $e;
}

View File

@@ -160,7 +160,7 @@ class AppMessage extends BaseAppMessage
* @param string $appMsgTemplate,
* @param string $appMsgAttach,
* @param string $appMsgStatus,
* @param string $appMsgShowMsg,
* @param integer $appMsgShowMsg,
* @param string $appMsgError,
* @param boolean $contentTypeIsHtml
* @param integer $appNumber,
@@ -183,7 +183,7 @@ class AppMessage extends BaseAppMessage
$appMsgTemplate = '',
$appMsgAttach = '',
$appMsgStatus = 'pending',
$appMsgShowMsg = '',
$appMsgShowMsg = 1,
$appMsgError = '',
$contentTypeIsHtml = true,
$appNumber = 0,

View File

@@ -238,7 +238,7 @@ class AppNotes extends BaseAppNotes
'',
'',
'pending',
'',
1,
$msgError,
true,
(isset($fieldCase['APP_NUMBER'])) ? $fieldCase['APP_NUMBER'] : 0,

View File

@@ -223,14 +223,8 @@ class Dynaform extends BaseDynaform
$description = "Create from a PM Table: " . $addTabName . ", ";
}
G::auditLog("CreateDynaform", $description . "Dynaform Title: " . $aData['DYN_TITLE'] . ", Type: " . $aData['DYN_TYPE'] . ", Description: " . $aData['DYN_DESCRIPTION'] . ", Mode: " . $mode);
$sXml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$sXml .= '<dynaForm type="' . $this->getDynType() . '" name="' . $this->getProUid() . '/' . $this->getDynUid() . '" width="500" enabletemplate="0" mode="" nextstepsave="prompt">' . "\n";
$sXml .= '</dynaForm>';
G::verifyPath(PATH_DYNAFORM . $this->getProUid(), true);
$oFile = fopen(PATH_DYNAFORM . $this->getProUid() . '/' . $this->getDynUid() . '.xml', 'w');
fwrite($oFile, $sXml);
fclose($oFile);
Form::createXMLFile($this->getProUid(), $this->getDynUid(), $this->getDynType(), PATH_DYNAFORM);
return $this->getDynUid();
} else {
$msg = '';

View File

@@ -13,8 +13,8 @@ require_once 'classes/model/om/BaseListCompleted.php';
* long as it does not already exist in the output directory.
*
* @package classes.model
* @deprecated Method deprecated in Release 3.3.9
*/
// @codingStandardsIgnoreStart
class ListCompleted extends BaseListCompleted implements ListInterface
{
use ListBaseTrait;

View File

@@ -1,6 +1,7 @@
<?php
require_once 'classes/model/om/BaseListParticipatedLast.php';
use ProcessMaker\BusinessModel\Cases as BmCases;
/**
@@ -536,4 +537,25 @@ class ListParticipatedLast extends BaseListParticipatedLast implements ListInter
}
BasePeer::doUpdate($criteriaWhere, $criteriaSet, $con);
}
/**
* Update the column APP_STATUS
*
* @param string $appUid
* @param string $status, can be [TO_DO, COMPLETED, etc]
*
* @return void
*
* @see Cases::updateCase()
*/
public function refreshStatus($appUid, $status = 'TO_DO')
{
//Update - WHERE
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $appUid, Criteria::EQUAL);
//Update - SET
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, $status);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
}
}

View File

@@ -333,18 +333,16 @@ class ListUnassigned extends BaseListUnassigned implements ListInterface
{
try {
$arrayAppAssignSelfServiceValueData = [];
$criteria = new Criteria("workflow");
$group = new Groups();
//Get the GRP_ID related to the $userUid
$arrayId = $group->getActiveGroupsForAnUserById($userUid);
$sql = "("
. AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN ("
. " SELECT " . GroupUserPeer::GRP_ID . " "
. " FROM " . GroupUserPeer::TABLE_NAME . " "
. " LEFT JOIN " . GroupwfPeer::TABLE_NAME . " ON (" . GroupUserPeer::GRP_ID . "=" . GroupwfPeer::GRP_ID . ") "
. " WHERE " . GroupUserPeer::USR_UID . "='" . $userUid . "' AND " . GroupwfPeer::GRP_STATUS . "='ACTIVE'"
. " ) AND "
. " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . "=2 "
. ")";
. AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN (" . implode(",", $arrayId) . ") AND "
. " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . " = 2 "
. ")";
$criteria->setDistinct();
$criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID);

View File

@@ -394,6 +394,12 @@ class Ajax
print(G::json_encode($processData));
}
/**
* Get the task information of the current task
*
* @see workflow/engine/templates/cases/open->taskInformation()
* @link https://wiki.processmaker.com/3.3/Cases/Information#Task_Information
*/
public function getTaskInformation()
{
if (!isset($_SESSION['USER_LOGGED'])) {
@@ -408,7 +414,15 @@ class Ajax
if ($_SESSION['TASK'] == '-1') {
$_SESSION['TASK'] = $_SESSION['CURRENT_TASK'];
}
$taskData = $task->getDelegatedTaskData($_SESSION['TASK'], $_SESSION['APPLICATION'], $_SESSION['INDEX']);
$arrayTaskUid = explode('|', $_SESSION['TASK']);
if (count($arrayTaskUid) > 1) {
$arrayTaskUid = array_unique($arrayTaskUid);
}
$taskUid = $arrayTaskUid[0];
$taskData = $task->getDelegatedTaskData($taskUid, $_SESSION['APPLICATION'], $_SESSION['INDEX']);
$taskData = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($taskData);

View File

@@ -1,6 +1,7 @@
<?php
use ProcessMaker\Core\System;
use ProcessMaker\Util\DateTime;
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
@@ -85,6 +86,7 @@ switch ($actionAjax) {
if ($respMess == 'BLOCK' || $respMess == '') {
$appMessageArray[$index]['APP_MSG_BODY'] = '';
}
$appMessageArray[$index]['APP_MSG_DATE'] = DateTime::convertUtcToTimeZone($appMessageArray[$index]['APP_MSG_DATE']);
$messageList[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]);
}
}

View File

@@ -196,7 +196,8 @@ $oHeadPublisher->addExtJsScript('app/main', true);
$oHeadPublisher->addExtJsScript('cases/casesList', false); //adding a javascript file .js
$oHeadPublisher->addContent('cases/casesListExtJs'); //adding a html file .html.
$oHeadPublisher->assign('FORMATS', $c->getFormats());
$oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$oHeadPublisher->assign('userUid', $userUid);
$oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState($userUid));
$oHeadPublisher->assign('isIE', Bootstrap::isIE());
$oHeadPublisher->assign('__OPEN_APPLICATION_UID__', $openApplicationUid);

View File

@@ -1,6 +1,7 @@
<?php
use ProcessMaker\Core\System;
use ProcessMaker\Util\DateTime;
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET);
@@ -581,6 +582,7 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
while ($rs->next()) {
$result = $rs->getRow();
$result["TYPE"] = (array_key_exists($result["TYPE"], $arrayToTranslation)) ? $arrayToTranslation[$result["TYPE"]] : $result["TYPE"];
$result['CREATE_DATE'] = DateTime::convertUtcToTimeZone($result['CREATE_DATE']);
$aProcesses[] = $result;
}
@@ -622,7 +624,7 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$result["FILEDOCEXIST"] = ($result["FILEDOC"]);
$result["FILEPDFEXIST"] = ($result["FILEPDF"]);
$result["DELETE_FILE"] = (isset($result['ID_DELETE']) && $result['ID_DELETE'] == 'Delete') ? true : false;
$result['CREATE_DATE'] = DateTime::convertUtcToTimeZone($result['CREATE_DATE']);
$aProcesses[] = $result;
$rs->next();

View File

@@ -1,26 +1,6 @@
<?php
/**
* summary.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Util\DateTime;
try {
global $RBAC;
@@ -70,7 +50,7 @@ try {
if ($result->next()) {
$FieldsPmDynaform = $applicationFields;
$FieldsPmDynaform["CURRENT_DYNAFORM"] = $_REQUEST['DYN_UID'];
$a = new PmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform));
$a = new PmDynaform(DateTime::convertUtcToTimeZone($FieldsPmDynaform));
$a->printView();
}
if (file_exists( PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml' )) {

View File

@@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Cache;
use ProcessMaker\BusinessModel\User;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
@@ -23,6 +25,18 @@ try {
$frm = $_POST['form'];
$changePassword = false;
if (isset($_POST['form']['__USR_PASSWORD_CHANGE__'])) {
$value = Cache::pull($_POST['form']['__USR_PASSWORD_CHANGE__']);
$changePassword = !empty($value);
if ($changePassword === true) {
$_POST['form']['USER_ENV'] = $value['userEnvironment'];
$_POST['form']['BROWSER_TIME_ZONE_OFFSET'] = $value['browserTimeZoneOffset'];
$frm['USR_USERNAME'] = $value['usrUsername'];
$frm['USR_PASSWORD'] = $value['usrPassword'];
}
}
if (isset($frm['USR_USERNAME'])) {
$usr = mb_strtolower(trim($frm['USR_USERNAME']), 'UTF-8');
$pwd = trim($frm['USR_PASSWORD']);
@@ -317,6 +331,15 @@ try {
}
$userPropertyInfo = $userProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(G::encryptOld($pwd)))));
//change password
if ($changePassword === true) {
$user = new User();
$currentUser = $user->changePassword($_SESSION['USER_LOGGED'], $_POST['form']['USR_PASSWORD']);
G::header('Location: ' . $currentUser["__REDIRECT_PATH__"]);
return;
}
//Get the errors in the password
$errorInPassword = $userProperty->validatePassword(
$_POST['form']['USR_PASSWORD'],
@@ -345,13 +368,23 @@ try {
$G_PUBLISH = new Publisher;
$version = explode('.', trim(file_get_contents(PATH_GULLIVER . 'VERSION')));
$version = isset($version[0]) ? intval($version[0]) : 0;
if ($version >= 3) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/changePasswordpm3', '', $messPassword,
'changePassword');
$values = [
"usrUsername" => $usr,
"usrPassword" => $pwd,
"userEnvironment" => config("system.workspace"),
"browserTimeZoneOffset" => $_POST['form']['BROWSER_TIME_ZONE_OFFSET']
];
$messPassword['__USR_PASSWORD_CHANGE__'] = G::generateUniqueID();
Cache::put($messPassword['__USR_PASSWORD_CHANGE__'], $values, 2);
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/changePasswordpm3', '', $messPassword, 'sysLoginVerify');
G::RenderPage('publish');
session_destroy();
} else {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/changePassword', '', $messPassword, 'changePassword');
G::RenderPage('publish');
}
G::RenderPage('publish');
die;
}

View File

@@ -1,92 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUser = $oUser->load($_SESSION['USER_LOGGED']);
global $RBAC;
$aData['USR_UID'] = $aUser['USR_UID'];
$aData['USR_USERNAME'] = $aUser['USR_USERNAME'];
$aData['USR_PASSWORD'] = Bootstrap::hashPassword($_POST['form']['USR_PASSWORD']);
$aData['USR_FIRSTNAME'] = $aUser['USR_FIRSTNAME'];
$aData['USR_LASTNAME'] = $aUser['USR_LASTNAME'];
$aData['USR_EMAIL'] = $aUser['USR_EMAIL'];
$aData['USR_DUE_DATE'] = $aUser['USR_DUE_DATE'];
$aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
$RBAC->updateUser($aData, $aUser['USR_ROLE']);
$aData['USR_COUNTRY'] = $aUser['USR_COUNTRY'];
$aData['USR_CITY'] = $aUser['USR_CITY'];
$aData['USR_LOCATION'] = $aUser['USR_LOCATION'];
$aData['USR_ADDRESS'] = $aUser['USR_ADDRESS'];
$aData['USR_PHONE'] = $aUser['USR_PHONE'];
$aData['USR_ZIP_CODE'] = $aUser['USR_ZIP_CODE'];
$aData['USR_POSITION'] = $aUser['USR_POSITION'];
$oUser->update($aData);
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->load($_SESSION['USER_LOGGED']);
$aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']);
if (!is_array($aHistory)) {
$aHistory = array();
}
if (!defined('PPP_PASSWORD_HISTORY')) {
define('PPP_PASSWORD_HISTORY', 0);
}
if (PPP_PASSWORD_HISTORY > 0) {
if (count($aHistory) >= PPP_PASSWORD_HISTORY) {
array_shift($aHistory);
}
$aHistory[] = $_POST['form']['USR_PASSWORD'];
}
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
$aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory);
$oUserProperty->update($aUserProperty);
if (class_exists('redirectDetail')) {
//falta validar...
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = PluginRegistry::loadSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset($aRedirectLogin)) {
if (is_array($aRedirectLogin)) {
/** @var \ProcessMaker\Plugins\Interfaces\RedirectDetail $detail */
foreach ($aRedirectLogin as $detail) {
if (isset($detail->sPathMethod)) {
if ($detail->equalRoleCodeTo($userRole)) {
G::header(
'location: /sys' . SYS_TEMP . '/' . SYS_LANG .
'/' . SYS_SKIN . '/' . $detail->getPathMethod()
);
die;
}
}
}
}
}
}
//end plugin
if (isset($frm['USER_LANG'])) {
if ($frm['USER_LANG'] != '') {
$lang = $frm['USER_LANG'];
}
} else {
if (defined('SYS_LANG')) {
$lang = SYS_LANG;
} else {
$lang = 'en';
}
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
G::header('Location: ' . $sLocation);
die;
use ProcessMaker\BusinessModel\User;
$user = new User();
$currentUser = $user->changePassword($_SESSION['USER_LOGGED'], $_POST['form']['USR_PASSWORD'], isset($_POST['form']['USER_LANG']) ? $_POST['form']['USER_LANG'] : "");
G::header('Location: ' . $currentUser["__REDIRECT_PATH__"]);

View File

@@ -2,6 +2,7 @@
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Exception\RBACException;
use ProcessMaker\Util\DateTime;
$req = (isset($_REQUEST['request']) ? $_REQUEST['request'] : '');
@@ -131,6 +132,7 @@ switch ($req) {
while ($result->next()) {
$row = $result->getRow();
$row['APP_MSG_STATUS'] = ucfirst($row['APP_MSG_STATUS']);
$row['APP_MSG_DATE'] = DateTime::convertUtcToTimeZone($row['APP_MSG_DATE']);
switch ($filterBy) {
case 'CASES':

View File

@@ -3,7 +3,7 @@ CREATE TRIGGER CONTENT_UPDATE BEFORE UPDATE ON CONTENT
FOR EACH ROW
BEGIN
DECLARE str TEXT;
DECLARE str MEDIUMTEXT;
IF (NEW.CON_VALUE IS NULL) THEN
SET str = '';

View File

@@ -411,7 +411,7 @@ class ActionsByEmail
'',
'',
'pending',
'',
1,
'',
false,
isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : 0,

View File

@@ -2005,4 +2005,111 @@ class User
return $isSupervisor;
}
}
/**
* It changes the password of the user specified by its identifier, optionally
* the value of $userLang can be sent, otherwise the system value is taken.
* In case of success, the updated user returns.
*
* @global object $RBAC
* @param string $usrUid
* @param string $usrPassword
* @param string $userLang
*
* @return string
*
* @see workflow/engine/methods/login/authentication.php
* @see workflow/engine/methods/login/changePassword.php
* @link https://wiki.processmaker.com/3.0/Managing_Users#Creating_New_Users
*/
public function changePassword($usrUid, $usrPassword, $userLang = "")
{
global $RBAC;
$users = new Users();
$user = $users->load($usrUid);
$data = [];
$data['USR_UID'] = $user['USR_UID'];
$data['USR_USERNAME'] = $user['USR_USERNAME'];
$data['USR_PASSWORD'] = Bootstrap::hashPassword($usrPassword);
$data['USR_FIRSTNAME'] = $user['USR_FIRSTNAME'];
$data['USR_LASTNAME'] = $user['USR_LASTNAME'];
$data['USR_EMAIL'] = $user['USR_EMAIL'];
$data['USR_DUE_DATE'] = $user['USR_DUE_DATE'];
$data['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
$RBAC->updateUser($data, $user['USR_ROLE']);
$data['USR_COUNTRY'] = $user['USR_COUNTRY'];
$data['USR_CITY'] = $user['USR_CITY'];
$data['USR_LOCATION'] = $user['USR_LOCATION'];
$data['USR_ADDRESS'] = $user['USR_ADDRESS'];
$data['USR_PHONE'] = $user['USR_PHONE'];
$data['USR_ZIP_CODE'] = $user['USR_ZIP_CODE'];
$data['USR_POSITION'] = $user['USR_POSITION'];
$users->update($data);
$usersProperties = new UsersProperties();
$userProperty = $usersProperties->load($usrUid);
$history = unserialize($userProperty['USR_PASSWORD_HISTORY']);
if (!is_array($history)) {
$history = [];
}
if (!defined('PPP_PASSWORD_HISTORY')) {
define('PPP_PASSWORD_HISTORY', 0);
}
if (PPP_PASSWORD_HISTORY > 0) {
if (count($history) >= PPP_PASSWORD_HISTORY) {
array_shift($history);
}
$history[] = $usrPassword;
}
$userProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
$userProperty['USR_LOGGED_NEXT_TIME'] = 0;
$userProperty['USR_PASSWORD_HISTORY'] = serialize($history);
$usersProperties->update($userProperty);
if (class_exists('redirectDetail')) {
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$pluginRegistry = PluginRegistry::loadSingleton();
$redirectLogin = $pluginRegistry->getRedirectLogins();
if (isset($redirectLogin)) {
if (is_array($redirectLogin)) {
foreach ($redirectLogin as $detail) {
if (isset($detail->sPathMethod)) {
if ($detail->equalRoleCodeTo($userRole)) {
$user['__REDIRECT_PATH__'] = '/sys' . config('system.workspace') . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->getPathMethod();
return $user;
}
}
}
}
}
}
$lang = "";
if ($userLang !== "") {
$lang = $userLang;
} else {
if (defined('SYS_LANG')) {
$lang = SYS_LANG;
} else {
$lang = 'en';
}
}
$location = $usersProperties->redirectTo($usrUid, $lang);
$user['__REDIRECT_PATH__'] = $location;
return $user;
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="cases_Resume_Current_Task" type="xmlform" width="550px" labelWidth="150px">
<TAS_TITLE type="text" mode="view">
<en><![CDATA[Task]]></en>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="cases_Resume_Current_Task" type="xmlform" width="550px" labelWidth="150px">
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="cases_Resume_Current_Task_Title" type="xmlform" width="550px" labelWidth="150px">
<TITLE2 type="title">
<en><![CDATA[Current Task(s) Properties]]></en>
</TITLE2>

View File

@@ -14,6 +14,7 @@
</label>
{$form.USR_PASSWORD}
{$form.USR_PASSWORD_CONFIRM}
{$form.__USR_PASSWORD_CHANGE__}
</fieldset>
<fieldset>
<label class="panel-login">

View File

@@ -13,6 +13,7 @@
<USR_PASSWORD_CONFIRM type="password" size="30" maxlength="32">
<en><![CDATA[Re-Type Password]]></en>
</USR_PASSWORD_CONFIRM>
<__USR_PASSWORD_CHANGE__ type="hidden"/>
<btnSave type="button" onclick="verifyPassword();">
<en><![CDATA[Save]]></en>
</btnSave>