Merged in develop (pull request #5841)

Develop

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Paula Quispe
2017-08-03 20:57:37 +00:00
6 changed files with 646 additions and 416 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -214,15 +214,13 @@ class ListUnassigned extends BaseListUnassigned
* This function get the information in the corresponding cases list * This function get the information in the corresponding cases list
* @param string $usr_uid, must be show cases related to this user * @param string $usr_uid, must be show cases related to this user
* @param array $filters for apply in the result * @param array $filters for apply in the result
* @param null $callbackRecord * @param callable $callbackRecord
* @return array $data * @return array $data
* @throws PropelException * @throws PropelException
*/ */
public function loadList($usr_uid, $filters = array(), $callbackRecord = null) public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
{ {
$resp = array();
$pmTable = new PmTable(); $pmTable = new PmTable();
$tasks = $this->getSelfServiceTasks($usr_uid);
$criteria = $pmTable->addPMFieldsToList('unassigned'); $criteria = $pmTable->addPMFieldsToList('unassigned');
$this->additionalClassName = $pmTable->tableClassName; $this->additionalClassName = $pmTable->tableClassName;
$additionalColumns = $criteria->getSelectColumns(); $additionalColumns = $criteria->getSelectColumns();
@@ -244,60 +242,7 @@ class ListUnassigned extends BaseListUnassigned
$criteria->addSelectColumn(ListUnassignedPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListUnassignedPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListUnassignedPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListUnassignedPeer::DEL_PRIORITY);
//Self Service Value Based Assignment //Self Service Value Based Assignment
$aSelfServiceValueBased = $this->getSelfServiceCasesByEvaluate($usr_uid); $criteria = $this->getCriteriaWhereSelfService($criteria, $usr_uid);
if (!empty($aSelfServiceValueBased)) {
$criterionAux = null;
//Load Self Service Value Based Assignment
foreach ($aSelfServiceValueBased as $value) {
if (is_null($criterionAux)) {
$criterionAux = $criteria->getNewCriterion(
ListUnassignedPeer::APP_UID,
$value["APP_UID"],
Criteria::EQUAL
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::DEL_INDEX,
$value["DEL_INDEX"],
Criteria::EQUAL
)
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$value["TAS_UID"],
Criteria::EQUAL
)
);
} else {
$criterionAux = $criteria->getNewCriterion(
ListUnassignedPeer::APP_UID,
$value["APP_UID"],
Criteria::EQUAL
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::DEL_INDEX,
$value["DEL_INDEX"],
Criteria::EQUAL
)
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$value["TAS_UID"],
Criteria::EQUAL
)
)->addOr(
$criterionAux
);
}
}
//And Load Selfservice
$criteria->add(
$criterionAux->addOr($criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN))
);
} else {
//Load Selfservice
$criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN);
}
//Apply some filters //Apply some filters
self::loadFilters($criteria, $filters, $additionalColumns); self::loadFilters($criteria, $filters, $additionalColumns);
@@ -346,10 +291,11 @@ class ListUnassigned extends BaseListUnassigned
} }
/** /**
* Get Selfservice Value Based * Get SelfService Value Based
* *
* @param string $userUid * @param string $userUid
* @return array criteria $arrayAppAssignSelfServiceValueData * @return array $arrayAppAssignSelfServiceValueData
* @throws Exception
*/ */
public function getSelfServiceCasesByEvaluate($userUid) public function getSelfServiceCasesByEvaluate($userUid)
{ {
@@ -402,8 +348,8 @@ class ListUnassigned extends BaseListUnassigned
/** /**
* get user's SelfService tasks * get user's SelfService tasks
* @param string $sUIDUser * @param string $userUid
* @return $rows * @return array $tasks
*/ */
public function getSelfServiceTasks($userUid = '') public function getSelfServiceTasks($userUid = '')
{ {
@@ -465,62 +411,78 @@ class ListUnassigned extends BaseListUnassigned
/** /**
* Returns the number of cases of a user * Returns the number of cases of a user
* @param $userUid * @param string $userUid
* @param array $filters * @param array $filters
* @return int * @return int $total
*/ */
public function getCountList($userUid, $filters = array()) public function getCountList($userUid, $filters = array())
{ {
$criteria = new Criteria('workflow'); $criteria = new Criteria('workflow');
$tasks = $this->getSelfServiceTasks($userUid); $this->getCriteriaWhereSelfService($criteria, $userUid);
$arrayAppAssignSelfServiceValueData = $this->getSelfServiceCasesByEvaluate($userUid); $total = ListUnassignedPeer::doCount($criteria);
return (int)$total;
}
if (!empty($arrayAppAssignSelfServiceValueData)) { /**
* This function get the where criteria for the SelfService and SelfService value based
*
* @param criteria $criteria
* @param string $userUid
* @return criteria $criteria
*/
public function getCriteriaWhereSelfService($criteria, $userUid)
{
$tasks = $this->getSelfServiceTasks($userUid);
$aSelfServiceValueBased = $this->getSelfServiceCasesByEvaluate($userUid);
if (!empty($aSelfServiceValueBased)) {
//Self Service Value Based Assignment //Self Service Value Based Assignment
$criterionAux = null; $criterionAux = null;
foreach ($arrayAppAssignSelfServiceValueData as $value) { //Load Self Service Value Based Assignment
if (is_null($criterionAux)) { $firstRow = current($aSelfServiceValueBased);
$criterionAux = $criteria->getNewCriterion( $criterionAux = sprintf(
ListUnassignedPeer::APP_UID, "((
$value["APP_UID"], LIST_UNASSIGNED.APP_UID='%s' AND
Criteria::EQUAL LIST_UNASSIGNED.DEL_INDEX=%d AND
)->addAnd( LIST_UNASSIGNED.TAS_UID='%s'
$criteria->getNewCriterion(ListUnassignedPeer::DEL_INDEX, $value["DEL_INDEX"], Criteria::EQUAL) ) ",
)->addAnd( $firstRow["APP_UID"],
$criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $value["TAS_UID"], Criteria::EQUAL) $firstRow["DEL_INDEX"],
); $firstRow["TAS_UID"]
} else { );
$criterionAux = $criteria->getNewCriterion( foreach (array_slice($aSelfServiceValueBased, 1) as $value) {
ListUnassignedPeer::APP_UID, $criterionAux .= sprintf(
$value["APP_UID"], " OR (
Criteria::EQUAL LIST_UNASSIGNED.APP_UID='%s' AND
)->addAnd( LIST_UNASSIGNED.DEL_INDEX=%d AND
$criteria->getNewCriterion( LIST_UNASSIGNED.TAS_UID='%s'
ListUnassignedPeer::DEL_INDEX, ) ",
$value["DEL_INDEX"], $value["APP_UID"],
Criteria::EQUAL $value["DEL_INDEX"],
) $value["TAS_UID"]
)->addAnd( );
$criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$value["TAS_UID"],
Criteria::EQUAL
)
)->addOr(
$criterionAux
);
}
} }
$criterionAux .= ")";
//And Load SelfService
$criteria->add( $criteria->add(
$criterionAux->addOr($criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN)) $criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$tasks,
Criteria::IN
)->addOr(
$criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$criterionAux,
Criteria::CUSTOM
)
)
); );
} else { } else {
//Self Service //Self Service
$criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN); $criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN);
} }
$total = ListUnassignedPeer::doCount($criteria);
return (int)$total; return $criteria;
} }
} }

View File

@@ -132,6 +132,7 @@ class Users extends BaseUsers
$c->addSelectColumn( UsersPeer::USR_LASTNAME ); $c->addSelectColumn( UsersPeer::USR_LASTNAME );
$c->add( UsersPeer::USR_EMAIL, $sUsrEmail ); $c->add( UsersPeer::USR_EMAIL, $sUsrEmail );
$c->add( UsersPeer::USR_STATUS, array('INACTIVE', 'CLOSED'), Criteria::NOT_IN );
return $c; return $c;
} }

View File

@@ -297,6 +297,9 @@
<parameter name="Comment" value=""/> <parameter name="Comment" value=""/>
</vendor> </vendor>
</index> </index>
<index name="indexAppUid">
<index-column name="APP_UID"/>
</index>
</table> </table>
<table name="APP_MESSAGE" idMethod="native"> <table name="APP_MESSAGE" idMethod="native">
<vendor type="mysql"> <vendor type="mysql">

View File

@@ -132,7 +132,8 @@ CREATE TABLE `APP_DOCUMENT`
`SYNC_WITH_DRIVE` VARCHAR(32) default 'UNSYNCHRONIZED' NOT NULL, `SYNC_WITH_DRIVE` VARCHAR(32) default 'UNSYNCHRONIZED' NOT NULL,
`SYNC_PERMISSIONS` MEDIUMTEXT, `SYNC_PERMISSIONS` MEDIUMTEXT,
PRIMARY KEY (`APP_DOC_UID`,`DOC_VERSION`), PRIMARY KEY (`APP_DOC_UID`,`DOC_VERSION`),
KEY `indexAppDocument`(`FOLDER_UID`, `APP_DOC_UID`) KEY `indexAppDocument`(`FOLDER_UID`, `APP_DOC_UID`),
KEY `indexAppUid`(`APP_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documents in an Application'; )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documents in an Application';
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#-- APP_MESSAGE #-- APP_MESSAGE

View File

@@ -1005,6 +1005,8 @@ class Light extends Api
$fields = $case->loadCase($app_uid, $del_index); $fields = $case->loadCase($app_uid, $del_index);
$caseVariables = array_merge($fields['APP_DATA'], $caseVariables = array_merge($fields['APP_DATA'],
\ProcessMaker\BusinessModel\Cases::getGlobalVariables($fields['APP_DATA'])); \ProcessMaker\BusinessModel\Cases::getGlobalVariables($fields['APP_DATA']));
$caseVariables = DateTime::convertUtcToTimeZone($caseVariables);
} }
\G::LoadClass("pmDynaform"); \G::LoadClass("pmDynaform");