Cambiar la lógica para obtener los contadores

HOR-1447
Cambiar la lógica para obtener los contadores
This commit is contained in:
dheeyi william
2016-07-28 14:20:04 -04:00
parent d1507fdacf
commit c901b6052a
10 changed files with 229 additions and 46 deletions

View File

@@ -460,5 +460,45 @@ class ListUnassigned extends BaseListUnassigned
return $tasks;
}
/**
* Returns the number of cases of a user
* @param $userUid
* @return int
*/
public function getCountList($userUid)
{
$criteria = new Criteria('workflow');
$tasks = $this->getSelfServiceTasks($userUid);
$arrayAppAssignSelfServiceValueData = $this->getSelfServiceCasesByEvaluate($userUid);
if (!empty($arrayAppAssignSelfServiceValueData)) {
//Self Service Value Based Assignment
$criterionAux = null;
foreach ($arrayAppAssignSelfServiceValueData 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
);
}
}
$criteria->add(
$criterionAux->addOr($criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN))
);
} else {
//Self Service
$criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN);
}
$total = ListUnassignedPeer::doCount($criteria);
return (int)$total;
}
}