Merged in 3.1 (pull request #4761)

Updating branch HOR-1500 with last changes (2016-08-13)
This commit is contained in:
Julio Cesar Laura Avendaño
2016-08-13 11:16:50 -04:00
25 changed files with 3073 additions and 2567 deletions

View File

@@ -71,12 +71,18 @@ try {
$classLoader->add(PATH_TRUNK . 'framework' . PATH_SEP . 'src' . PATH_SEP, 'Maveriks');
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP, 'ProcessMaker');
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP);
$classLoader->addClass('Bootstrap', PATH_TRUNK . 'gulliver' . PATH_SEP . 'system' . PATH_SEP . 'class.bootstrap.php');
Bootstrap::initVendors();
//Enable Monolog
Bootstrap::LoadSystem( 'monologProvider' );
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
//Load classes
G::LoadThirdParty('propel', 'Propel');
G::LoadClass('system');
G::LoadClass('tasks');
G::LoadClass('pmException');
$arraySystemConfiguration = System::getSystemConfiguration();

View File

@@ -7060,7 +7060,10 @@ class Cases
$rows = array();
$rs->next();
while ($row = $rs->getRow()) {
$rows[$row['USR_UID']] = $row;
//In some cases the thread does not have a User Script task, Itee
if($row['USR_UID'] !== ''){
$rows[$row['USR_UID']] = $row;
}
$rs->next();
}
$response['criteria'] = $c;

View File

@@ -678,6 +678,7 @@ class pmDynaform
var sysLang = \"" . SYS_LANG . "\";
var isRTL = \"" . $this->isRTL . "\";
var pathRTLCss = \"" . $this->pathRTLCss . "\";
var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";
$(window).load(function ()
{
var data = jsondata;
@@ -736,6 +737,7 @@ class pmDynaform
"var sysLang = '" . SYS_LANG . "';\n" .
"var isRTL = " . $this->isRTL . ";\n" .
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";\n" .
"$(window).load(function () {\n" .
" var data = jsondata;\n" .
" window.dynaform = new PMDynaform.core.Project({\n" .
@@ -811,6 +813,7 @@ class pmDynaform
"var sysLang = '" . SYS_LANG . "';\n" .
"var isRTL = " . $this->isRTL . ";\n" .
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
@@ -866,6 +869,7 @@ class pmDynaform
var sysLang = \"" . SYS_LANG . "\";
var isRTL = \"" . $this->isRTL . "\";
var pathRTLCss = \"" . $this->pathRTLCss . "\";
var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";
</script>
<script type=\"text/javascript\" src=\"/jscore/cases/core/pmDynaform.js\"></script>
@@ -908,6 +912,7 @@ class pmDynaform
"var sysLang = '" . SYS_LANG . "';\n" .
"var isRTL = " . $this->isRTL . ";\n" .
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
"<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
@@ -948,6 +953,7 @@ class pmDynaform
"var sysLang = '" . SYS_LANG . "';\n" .
"var isRTL = " . $this->isRTL . ";\n" .
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
"<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
@@ -1007,6 +1013,7 @@ class pmDynaform
"var sysLang = '" . SYS_LANG . "';\n" .
"var isRTL = " . $this->isRTL . ";\n" .
"var pathRTLCss = '" . $this->pathRTLCss . "';\n" .
"var delIndex = " . (isset($this->fields["DEL_INDEX"]) ? $this->fields["DEL_INDEX"] : "null") . ";\n" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
"<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .

View File

@@ -2874,10 +2874,6 @@ class wsBase
*/
$oCriteria = new Criteria( 'workflow' );
$aConditions = array ();
// $aConditions[] = array(AppDelegationPeer::USR_UID, TaskUserPeer::USR_UID);
// $aConditions[] = array(AppDelegationPeer::TAS_UID, TaskUserPeer::TAS_UID);
// $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
//$oCriteria->addJoin(AppDelegationPeer::USR_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
$oCriteria->add( AppDelegationPeer::USR_UID, $userIdSource );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $delIndex );

View File

@@ -738,6 +738,20 @@ class AppDelegation extends BaseAppDelegation
return $data['TAS_UID'];
}
public function getCurrentUsers($appUid, $index)
{
$oCriteria = new Criteria();
$oCriteria->addSelectColumn( AppDelegationPeer::USR_UID );
$oCriteria->add( AppDelegationPeer::APP_UID, $appUid );
$oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
$oCriteria->add( AppDelegationPeer::DEL_INDEX, $index );
$oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria );
$oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oRuleSet->next();
$data = $oRuleSet->getRow();
return $data;
}
/**
* Verify if the current case is already routed.
*

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ProcessMaker (Branch 3.1)\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2016-07-29 18:36:34\n"
"PO-Revision-Date: 2016-08-12 23:48:36\n"
"Last-Translator: \n"
"Language-Team: Colosa Developers Team <developers@colosa.com>\n"
"MIME-Version: 1.0\n"
@@ -27599,6 +27599,54 @@ msgstr "Expand all"
msgid "Collapse all"
msgstr "Collapse all"
# TRANSLATION
# LABEL/ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED
#: LABEL/ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED
msgid "The Script-Task with {0}: \"{1}\" already registered"
msgstr "The Script-Task with {0}: \"{1}\" already registered"
# TRANSLATION
# LABEL/ID_CASE_CANCELLED_PARALLEL
#: LABEL/ID_CASE_CANCELLED_PARALLEL
msgid "To cancel a case, no parallel threads must be active. Only cases with one active thread can be canceled."
msgstr "To cancel a case, no parallel threads must be active. Only cases with one active thread can be canceled."
# TRANSLATION
# LABEL/ID_REASSIGNMENT_ERROR
#: LABEL/ID_REASSIGNMENT_ERROR
msgid "The case was already derivated to other person. Try to open again the case to reassign."
msgstr "The case was already derivated to other person. Try to open again the case to reassign."
# TRANSLATION
# LABEL/ID_REASSIGNMENT_PAUSED_ERROR
#: LABEL/ID_REASSIGNMENT_PAUSED_ERROR
msgid "The case is paused and can't be reasigned."
msgstr "The case is paused and can't be reasigned."
# TRANSLATION
# LABEL/ID_MAFE_1de162d73f017a9243ce0c939064a014
#: LABEL/ID_MAFE_1de162d73f017a9243ce0c939064a014
msgid "Enable gallery"
msgstr "Enable gallery"
# TRANSLATION
# LABEL/ID_MAFE_4e357e7345689cff230335282b201a11
#: LABEL/ID_MAFE_4e357e7345689cff230335282b201a11
msgid "Enable camera"
msgstr "Enable camera"
# TRANSLATION
# LABEL/ID_MAFE_5582ead0a9ee86a54da29c20caee6f57
#: LABEL/ID_MAFE_5582ead0a9ee86a54da29c20caee6f57
msgid "Force user login"
msgstr "Force user login"
# TRANSLATION
# LABEL/ID_MAFE_f82e519e2e82239be5f49d78b24ea228
#: LABEL/ID_MAFE_f82e519e2e82239be5f49d78b24ea228
msgid "Supported Controls: Multiple File."
msgstr "Supported Controls: Multiple File."
# additionalTables/additionalTablesData.xml?ADD_TAB_NAME
# additionalTables/additionalTablesData.xml
#: text - ADD_TAB_NAME
@@ -37140,8 +37188,8 @@ msgstr "Cancel"
# login/licenseExpired.xml?thetitle
# login/licenseExpired.xml
#: title - thetitle
msgid "Your license has expired or the System does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
msgstr "Your license has expired or the System does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
msgid "Your license has expired or the system does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
msgstr "Your license has expired or the system does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
# login/licenseExpired.xml?licenseFile
# login/licenseExpired.xml
@@ -37158,8 +37206,8 @@ msgstr "Update License"
# login/licenseExpiredpm3.xml?thetitle
# login/licenseExpiredpm3.xml
#: title - thetitle
msgid "[login/licenseExpiredpm3.xml?thetitle] Your license has expired or the System does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
msgstr "Your license has expired or the System does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
msgid "[login/licenseExpiredpm3.xml?thetitle] Your license has expired or the system does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
msgstr "Your license has expired or the system does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license"
# login/licenseExpiredpm3.xml?licenseFile
# login/licenseExpiredpm3.xml

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -70,6 +70,7 @@ $(window).load(function () {
var data = jsondata;
window.dynaform = new PMDynaform.core.Project({
data: data,
delIndex: delIndex,
onBeforePrintHandler : function () {
var nodeClone = $(".pmdynaform-container").clone();
nodeClone.addClass("printing-form");

View File

@@ -194,7 +194,9 @@ class Ajax
$options[] = Array('text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase');
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
$options[] = Array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
$options[] = Array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
}
}
break;
case 'TO_DO':
@@ -211,7 +213,9 @@ class Ajax
$options[] = Array('text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase');
}
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
$options[] = Array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
$options[] = Array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
}
}
break;
case 'CANCELLED':
@@ -597,18 +601,39 @@ class Ajax
$user = new Users();
$app = new Application();
$result = new stdclass();
$oAppDel = new AppDelegation();
$TO_USR_UID = $_POST['USR_UID'];
try {
$cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID);
//Current users of OPEN DEL_INDEX thread
if(isset($_SESSION['APPLICATION']) && isset($_SESSION['INDEX'])){
$aCurUser = $oAppDel->getCurrentUsers($_SESSION['APPLICATION'], $_SESSION['INDEX']);
}
$flagReassign = true;
if(!empty($aCurUser)){
foreach ($aCurUser as $key => $value) {
if($value === $TO_USR_UID){
$flagReassign = false;
}
}
} else {
//DEL_INDEX is CLOSED
throw new Exception(G::LoadTranslation('ID_REASSIGNMENT_ERROR'));
}
//If the currentUser is diferent to nextUser, create the thread
if($flagReassign){
$cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID);
}
$caseData = $app->load($_SESSION['APPLICATION']);
$userData = $user->load($TO_USR_UID);
//print_r($caseData);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$data['USER'] = $userData['USR_LASTNAME'] . ' ' . $userData['USR_FIRSTNAME']; //TODO change with the farmated username from environment conf
$result->status = 0;
$result->msg = G::LoadTranslation('ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data);
// Save the note reassign reason
if (isset($_POST['NOTE_REASON']) && $_POST['NOTE_REASON'] !== '') {
require_once ("classes/model/AppNotes.php");

View File

@@ -28,8 +28,7 @@ foreach ($items as $item) {
$dataUids = explode( "|", $item );
$appSelectedUids[] = $dataUids[0];
}
// var_dump($aData);
//var_dump($appSelectedUids);
$casesReassignedCount = 0;
$serverResponse = array ();
G::LoadClass( 'case' );
@@ -37,6 +36,7 @@ $oCases = new Cases();
require_once ('classes/model/Task.php');
require_once ('classes/model/AppCacheView.php');
$oAppCacheView = new AppCacheView();
$oAppDel = new AppDelegation();
$oCasesReassignList = $oAppCacheView->getToReassignListCriteria(null);
if (isset( $_POST['selected'] ) && $_POST['selected'] == 'true') {
$oCasesReassignList->add( AppCacheViewPeer::APP_UID, $appSelectedUids, Criteria::IN );
@@ -47,9 +47,7 @@ if (empty( $aData )) {
echo G::json_encode( $serverResponse );
die();
}
// $params = array ();
// $sql = BasePeer::createSelectSql($oCasesReassignList, $params);
// var_dump($sql);
if (is_array( $aData )) {
$currentCasesReassigned = 0;
require_once ("classes/model/AppNotes.php");
@@ -61,13 +59,31 @@ if (is_array( $aData )) {
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
//$aCase = $oCases->loadCaseInCurrentDelegation( $data->APP_UID );
$oCases->reassignCase( $row['APP_UID'], $row['DEL_INDEX'], ($row['USR_UID'] != '' ? $row['USR_UID'] : $_SESSION['USER_LOGGED']), $data->APP_REASSIGN_USER_UID );
//Current users of OPEN DEL_INDEX thread
$aCurUser = $oAppDel->getCurrentUsers($row['APP_UID'], $row['DEL_INDEX']);
$flagReassign = true;
if(!empty($aCurUser)){
foreach ($aCurUser as $key => $value) {
if($value === $data->APP_REASSIGN_USER_UID){
$flagReassign = false;
}
}
} else {
//DEL_INDEX is CLOSED
throw new Exception(G::LoadTranslation('ID_REASSIGNMENT_ERROR'));
}
//If the currentUser is diferent to nextUser, create the thread
if($flagReassign){
$oCases->reassignCase( $row['APP_UID'], $row['DEL_INDEX'], ($row['USR_UID'] != '' ? $row['USR_UID'] : $_SESSION['USER_LOGGED']), $data->APP_REASSIGN_USER_UID );
}
$currentCasesReassigned ++;
$casesReassignedCount ++;
$serverResponse[] = array ('APP_REASSIGN_USER' => $data->APP_REASSIGN_USER,'APP_TITLE' => $data->APP_TITLE,'TAS_TITLE' => $data->APP_TAS_TITLE,'REASSIGNED_CASES' => $currentCasesReassigned
);
// Save the note reassign reason
if (isset($data->NOTE_REASON) && $data->NOTE_REASON !== '') {
$appNotes = new AppNotes();
@@ -86,11 +102,28 @@ if (is_array( $aData )) {
while (is_array( $row )) {
$APP_UID = $row['APP_UID'];
$aCase = $oCases->loadCaseInCurrentDelegation( $APP_UID );
$oCases->reassignCase( $aCase['APP_UID'], $aCase['DEL_INDEX'], ($aCase['USR_UID'] != '' ? $aCase['USR_UID'] : $_SESSION['USER_LOGGED']), $aData->APP_REASSIGN_USER_UID );
//Current users of OPEN DEL_INDEX thread
$aCurUser = $oAppDel->getCurrentUsers($APP_UID, $aCase['DEL_INDEX']);
$flagReassign = true;
if(!empty($aCurUser)){
foreach ($aCurUser as $key => $value) {
if($value === $aData->APP_REASSIGN_USER_UID){
$flagReassign = false;
}
}
} else {
//DEL_INDEX is CLOSED
throw new Exception(G::LoadTranslation('ID_REASSIGNMENT_ERROR'));
}
//If the currentUser is diferent to nextUser, create the thread
if($flagReassign){
$oCases->reassignCase( $aCase['APP_UID'], $aCase['DEL_INDEX'], ($aCase['USR_UID'] != '' ? $aCase['USR_UID'] : $_SESSION['USER_LOGGED']), $aData->APP_REASSIGN_USER_UID );
}
$currentCasesReassigned ++;
$casesReassignedCount ++;
// var_dump($aCase);
// echo ("<br>");
$rs->next();
$row = $rs->getRow();
}

View File

@@ -19,8 +19,8 @@ class Calendar
private $arrayWorkHourFieldDefinition = array(
"DAY" => array("type" => "int", "required" => true, "empty" => false, "defaultValues" => array(0, 1, 2, 3, 4, 5, 6, 7), "fieldNameAux" => "day"),
"HOUR_START" => array("type" => "hour", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "hourStart"),
"HOUR_END" => array("type" => "hour", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "hourEnd")
'HOUR_START' => array('type' => 'hour', 'required' => true, 'empty' => false, 'defaultValues' => array(), 'fieldNameAux' => 'hourStart', 'regexp' => '/^(?:[0-1]\d|2[0-3])\:[0-5]\d$/'),
'HOUR_END' => array('type' => 'hour', 'required' => true, 'empty' => false, 'defaultValues' => array(), 'fieldNameAux' => 'hourEnd', 'regexp' => '/^(?:[0-1]\d|2[0-3])\:[0-5]\d$/')
);
private $arrayHolidayFieldDefinition = array(
@@ -751,4 +751,3 @@ class Calendar
}
}
}

View File

@@ -2887,6 +2887,53 @@ class Cases
$dataResponse = $data;
//Verify data
$arrayCasesToReassign = $data['cases'];
$arrayMsg = [];
foreach($arrayCasesToReassign as $key => $value) {
$appDelegation = \AppDelegationPeer::retrieveByPK($value['APP_UID'], $value['DEL_INDEX']);
if (is_null($appDelegation)) {
$arrayMsg[] = [
'app_uid' => $value['APP_UID'],
'del_index' => $value['DEL_INDEX'],
'result' => 0,
'status' => 'DELEGATION_NOT_EXISTS'
];
}
}
if (!empty($arrayMsg)) {
return ['cases' => $arrayMsg];
}
$task = new \ProcessMaker\BusinessModel\Task();
$userUid = $data['usr_uid_target'];
foreach($arrayCasesToReassign as $value) {
$appDelegation = \AppDelegationPeer::retrieveByPK($value['APP_UID'], $value['DEL_INDEX']);
//Verify data
$taskUid = $appDelegation->getTasUid();
$flagBoolean = $task->checkUserOrGroupAssignedTask($taskUid, $userUid);
if (!$flagBoolean) {
$arrayMsg[] = [
'app_uid' => $value['APP_UID'],
'del_index' => $value['DEL_INDEX'],
'result' => 0,
'status' => 'USER_NOT_ASSIGNED_TO_TASK'
];
}
}
if (!empty($arrayMsg)) {
return ['cases' => $arrayMsg];
}
G::LoadClass( 'case' );
$oCases = new \Cases();
$appDelegation = new \AppDelegation();
@@ -2904,15 +2951,60 @@ class Cases
$fields = $appDelegation->load($val['APP_UID'], $val['DEL_INDEX']);
$usrUid = $fields['USR_UID'];
}
//Will be not able reassign a case when is paused
$flagReassign = true;
if (!\AppDelay::isPaused($val['APP_UID'], $val['INDEX'])) {
$dataResponse['cases'][$key]['result'] = 0;
$dataResponse['cases'][$key]['status'] = \G::LoadTranslation('ID_REASSIGNMENT_PAUSED_ERROR');
$flagReassign = false;
}
$reassigned = $oCases->reassignCase($val['APP_UID'], $val['DEL_INDEX'], $usrUid, $data['usr_uid_target']);
$result = $reassigned ? 1 : 0 ;
//Current users of OPEN DEL_INDEX thread
$aCurUser = $oAppDel->getCurrentUsers($val['APP_UID'], $val['INDEX']);
if(!empty($aCurUser)){
foreach ($aCurUser as $key => $value) {
if($value === $data['usr_uid_target']){
$flagReassign = false;
$result = 1;
}
}
}else {
//DEL_INDEX is CLOSED
$dataResponse['cases'][$key]['result'] = 0;
$dataResponse['cases'][$key]['status'] = \G::LoadTranslation('ID_REASSIGNMENT_ERROR');
}
if($flagReassign) {
$reassigned = $oCases->reassignCase($val['APP_UID'], $val['DEL_INDEX'], $usrUid, $data['usr_uid_target']);
$result = $reassigned ? 1 : 0 ;
}
$dataResponse['cases'][$key]['result'] = $result;
$dataResponse['cases'][$key]['status'] = 'SUCCESS';
}
}
unset($dataResponse['usr_uid_target']);
return G::json_encode($dataResponse);
}
/**
* if case already routed
*
* @param type $app_uid
* @param type $del_index
* @param type $usr_uid
* @throws type
*/
public function caseAlreadyRouted($app_uid, $del_index, $usr_uid = '')
{
$c = new \Criteria('workflow');
$c->add(\AppDelegationPeer::APP_UID, $app_uid);
$c->add(\AppDelegationPeer::DEL_INDEX, $del_index);
if (!empty($usr_uid)) {
$c->add(\AppDelegationPeer::USR_UID, $usr_uid);
}
$c->add(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL);
return !(boolean) \AppDelegationPeer::doCount($c);
}
}

View File

@@ -228,7 +228,13 @@ class Process
}
break;
case "hour":
if (!preg_match('/^' . $regexpTime . '$/', $fieldValue)) {
$regexpTime = '/^' . $regexpTime . '$/';
if (array_key_exists('regexp', $arrayFieldDefinition[$fieldName])) {
$regexpTime = $arrayFieldDefinition[$fieldName]['regexp'];
}
if (!preg_match($regexpTime, $fieldValue)) {
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE', [$fieldNameAux]));
}
break;
@@ -532,16 +538,16 @@ class Process
$trigger = new \ProcessMaker\BusinessModel\Trigger();
/**
* Try catch block is added to escape the exception and continue editing
* the properties of the process, otherwise there is no way to edit
* the properties that the exception is thrown: trigger nonexistent.
* Try catch block is added to escape the exception and continue editing
* the properties of the process, otherwise there is no way to edit
* the properties that the exception is thrown: trigger nonexistent.
* The same goes for the similar blocks.
*/
if (isset($arrayData["PRO_TRI_DELETED"]) && $arrayData["PRO_TRI_DELETED"] . "" != "") {
try {
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_DELETED"], $processUid, $this->arrayFieldNameForException["processTriDeleted"]);
} catch (\Exception $e) {
}
}
@@ -549,7 +555,7 @@ class Process
try {
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_CANCELED"], $processUid, $this->arrayFieldNameForException["processTriCanceled"]);
} catch (\Exception $e) {
}
}
@@ -557,7 +563,7 @@ class Process
try {
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_PAUSED"], $processUid, $this->arrayFieldNameForException["processTriPaused"]);
} catch (\Exception $e) {
}
}
@@ -565,7 +571,7 @@ class Process
try {
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_REASSIGNED"], $processUid, $this->arrayFieldNameForException["processTriReassigned"]);
} catch (\Exception $e) {
}
}
@@ -1834,4 +1840,3 @@ class Process
}
}

View File

@@ -1972,4 +1972,52 @@ class Task
);
return $aTypes;
}
/**
* Check user to group assigned Task (Normal and/or Ad-Hoc Users)
*
* @param string $taskUid Unique uid of Task
* @param string $userUid Unique uid of User
*
* return bool
*/
public function checkUserOrGroupAssignedTask($taskUid, $usrUid)
{
$criteriaUser = new \Criteria('workflow');
$criteriaUser->add(\TaskUserPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
$criteriaUser->add(\TaskUserPeer::USR_UID, $usrUid, \Criteria::EQUAL);
$criteriaUser->add(\TaskUserPeer::TU_RELATION, 1, \Criteria::EQUAL);
$rsCriteria = \TaskUserPeer::doSelectRS($criteriaUser);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
return true;
}
$criteriaGroup = new \Criteria('workflow');
$criteriaGroup->addSelectColumn(\TaskUserPeer::USR_UID);
$criteriaGroup->add(\TaskUserPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
$criteriaGroup->add(\TaskUserPeer::TU_RELATION, 2, \Criteria::EQUAL);
$rsCriteriaGroup = \TaskUserPeer::doSelectRS($criteriaGroup);
$rsCriteriaGroup->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteriaGroup->next()) {
$row = $rsCriteriaGroup->getRow();
$groupUid = $row['USR_UID'];
$obj = \GroupUserPeer::retrieveByPK($groupUid, $usrUid);
if (!is_null($obj)) {
return true;
}
}
//Return
return false;
}
}

View File

@@ -29,6 +29,53 @@ class Cases extends Api
"note_date"
];
public function __isAllowed()
{
try {
$methodName = $this->restler->apiMethodInfo->methodName;
switch ($methodName) {
case 'doPostReassign':
$arrayParameters = $this->parameters[0]['cases'];
$usrUid = $this->getUserId();
//Check if the user is supervisor process
$case = new \ProcessMaker\BusinessModel\Cases();
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$user = new \ProcessMaker\BusinessModel\User();
$count = 0;
foreach ($arrayParameters as $value) {
$arrayApplicationData = $case->getApplicationRecordByPk($value['APP_UID'], [], false);
if (!empty($arrayApplicationData)) {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid);
if ($flagps) {
if (!$user->checkPermission($usrUid, 'PM_REASSIGNCASE')) {
$count = $count + 1;
}
} else {
$count = $count + 1;
}
}
}
if ($count == 0) {
return true;
}
break;
}
//Return
return false;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* Get list Cases To Do
*
@@ -1154,6 +1201,11 @@ class Cases extends Api
* Batch reassign
* @url POST /reassign
*
* @access protected
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
*
* @param array $request_data
*
*/
public function doPostReassign($request_data)
{
@@ -1165,5 +1217,4 @@ class Cases extends Api
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -1188,7 +1188,8 @@ class Light extends Api
'CREATOR' => 'caseCreator',
'CREATE_DATE' => 'caseCreateDate',
'UPDATE_DATE' => 'caseUpdateData',
'DESCRIPTION' => 'caseDescription'
'DESCRIPTION' => 'caseDescription',
'PRO_UID' => 'processUid'
),
'task' => array(
'TAS_TITLE' => 'taskTitle',
@@ -1196,7 +1197,8 @@ class Light extends Api
'DEL_DELEGATE_DATE' => 'delDelegateDate',
'DEL_INIT_DATE' => 'delInitDate',
'DEL_TASK_DUE_DATE' => 'delDueDate',
'DEL_FINISH_DATE' => 'delFinishDate'
'DEL_FINISH_DATE' => 'delFinishDate',
'TAS_UID' => 'taskUid'
)
);
@@ -1542,8 +1544,16 @@ class Light extends Api
public function doPutCaseVariables($app_uid, $request_data, $dyn_uid = '', $del_index = 0)
{
try {
if ($del_index === null) {
throw (new \Exception(G::LoadTranslation('ID_CAN_NOT_BE_NULL', array('del_index')), Api::STAT_APP_EXCEPTION));
}
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
if ($del_index > 0) {
if ($cases->caseAlreadyRouted($app_uid, $del_index, $usr_uid)) {
throw (new \Exception(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), Api::STAT_APP_EXCEPTION));
}
}
$request_data = \ProcessMaker\Util\DateTime::convertDataToUtc($request_data);
$cases->setCaseVariables($app_uid, $request_data, $dyn_uid, $usr_uid, $del_index);
} catch (\Exception $e) {

View File

@@ -238,7 +238,7 @@ class Assignee extends Api
public function doGetActivityAssigneesAll($prjUid, $actUid, $filter = null, $start = null, $limit = null, $type = null)
{
try {
$arrayData = $this->task->getTaskAssigneesAll($prjUid, $actUid, $filter, $start, $limit, $type);
$response = $this->task->getTaskAssigneesAll($prjUid, $actUid, $filter, $start, $limit, $type);
return $response;
} catch (\Exception $e) {