Merged in develop (pull request #5762)
Develop Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
@@ -3283,4 +3283,50 @@ class Cases
|
||||
}
|
||||
return $delIndex;
|
||||
}
|
||||
/**
|
||||
* This function will be return the criteria for the search filter
|
||||
*
|
||||
* We considered in the search criteria the custom cases list,
|
||||
* the titles related to: caseTitle taskTitle processTitle and
|
||||
* the case number
|
||||
* @param Criteria $criteria, must be contain the initial criteria for search
|
||||
* @param string $listPeer, name of the list class
|
||||
* @param string $search, the parameter for search in the table
|
||||
* @param string $additionalClassName, name of the className of pmtable
|
||||
* @param array $additionalColumns, columns related to the custom cases list
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getSearchCriteriaListCases(&$criteria, $listPeer ,$search, $additionalClassName = '', $additionalColumns = array() )
|
||||
{
|
||||
$oTmpCriteria = '';
|
||||
//If we have additional tables configured in the custom cases list, prepare the variables for search
|
||||
if (count($additionalColumns) > 0) {
|
||||
require_once(PATH_DATA_SITE . 'classes' . PATH_SEP . $additionalClassName . '.php');
|
||||
$oNewCriteria = new \Criteria("workflow");
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion(current($additionalColumns), "%" . $search . "%", \Criteria::LIKE);
|
||||
|
||||
//We prepare the query related to the custom cases list
|
||||
foreach (array_slice($additionalColumns, 1) as $value) {
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion($value, "%" . $search . "%", \Criteria::LIKE)->addOr($oTmpCriteria);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($oTmpCriteria)) {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_NUMBER, $search, \Criteria::EQUAL)->addOr(
|
||||
$oTmpCriteria
|
||||
))))
|
||||
);
|
||||
} else {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_NUMBER, $search, \Criteria::EQUAL))))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ class Light
|
||||
{
|
||||
$response = array("status" => "fail");
|
||||
$oCase = new \Cases();
|
||||
$iDelIndex = $oCase->getCurrentDelegation( $sAppUid, $userUid );
|
||||
$iDelIndex = $oCase->getCurrentDelegation( $sAppUid, '', true );
|
||||
|
||||
$oAppDelegation = new \AppDelegation();
|
||||
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
|
||||
|
||||
@@ -13,14 +13,14 @@ class Tracker
|
||||
}
|
||||
|
||||
/**
|
||||
* authenticaction for case tracker
|
||||
* Authentication for case tracker
|
||||
*
|
||||
* @param $case numbre case
|
||||
* @param $pin code pin access for case tracek
|
||||
* @param int $case number case
|
||||
* @param int $pin code pin access for case track
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function authentication($case, $pin)
|
||||
public static function authentication($case, $pin)
|
||||
{
|
||||
$cases = new \Cases();
|
||||
$response = array();
|
||||
|
||||
@@ -12,6 +12,7 @@ class GranularExporter
|
||||
protected $generator;
|
||||
protected $data;
|
||||
protected $prjuid;
|
||||
protected $prjName = '';
|
||||
/**
|
||||
* GranularExporter constructor.
|
||||
*/
|
||||
@@ -60,6 +61,7 @@ class GranularExporter
|
||||
$objectList = func_get_args()[0];
|
||||
$bpmnProject = Project\Bpmn::load($this->prjuid);
|
||||
$projectData = $bpmnProject->getProject();
|
||||
$this->prjName = $projectData['PRJ_NAME'];
|
||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
||||
@@ -172,7 +174,7 @@ class GranularExporter
|
||||
}
|
||||
}
|
||||
}
|
||||
return $migratorData;
|
||||
return $migratorData;
|
||||
}
|
||||
|
||||
public function publish()
|
||||
@@ -184,4 +186,12 @@ class GranularExporter
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Get the project name
|
||||
*/
|
||||
public function getProjectName()
|
||||
{
|
||||
return $this->prjName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1461,4 +1461,37 @@ class ProcessSupervisor
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check if the user is supervisor for some process
|
||||
*
|
||||
* @param string $userUid Unique id of User
|
||||
*
|
||||
* @return bool Return
|
||||
*/
|
||||
public function isUserSupervisor($userUid)
|
||||
{
|
||||
//Check if the user is defined as supervisor
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria->add(\ProcessUserPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ProcessUserPeer::PU_TYPE, 'SUPERVISOR', \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessUserPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
return true;
|
||||
}
|
||||
//Check if the user is in a group defined as supervisor
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria->addSelectColumn(\ProcessUserPeer::USR_UID);
|
||||
$criteria->addJoin(\ProcessUserPeer::USR_UID, \GroupUserPeer::GRP_UID, \Criteria::LEFT_JOIN);
|
||||
$criteria->add(\ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR', \Criteria::EQUAL);
|
||||
$criteria->add(\GroupUserPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessUserPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1544,5 +1544,163 @@ class User
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function get the list of users
|
||||
*
|
||||
* @param string $authSource, authentication source
|
||||
* @param string $filter
|
||||
* @param string $sort
|
||||
* @param integer $start
|
||||
* @param integer $limit
|
||||
* @param string $dir related to order the column
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getAllUsersWithAuthSource(
|
||||
$authSource = '',
|
||||
$filter = '',
|
||||
$sort = '',
|
||||
$start = 0,
|
||||
$limit = 20,
|
||||
$dir = 'ASC'
|
||||
)
|
||||
{
|
||||
global $RBAC;
|
||||
$aUsers = array();
|
||||
if ($authSource != '') {
|
||||
$aUsers = $RBAC->getListUsersByAuthSource($authSource);
|
||||
}
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
|
||||
if ($filter != '') {
|
||||
$cc = $oCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, '%' . $filter . '%', \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME, '%' . $filter . '%', \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_EMAIL, '%' . $filter . '%', \Criteria::LIKE))));
|
||||
$oCriteria->add($cc);
|
||||
}
|
||||
$oCriteria->add(\UsersPeer::USR_STATUS, array('CLOSED'), \Criteria::NOT_IN);
|
||||
|
||||
if ($authSource != '') {
|
||||
$totalRows = sizeof($aUsers);
|
||||
} else {
|
||||
$oDataset = \UsersPeer::DoSelectRs($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
$totalRows = $row['CNT'];
|
||||
}
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_ROLE);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_DUE_DATE);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_STATUS);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_UX);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::DEP_UID);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_LAST_LOGIN);
|
||||
$oCriteria->addAsColumn('LAST_LOGIN', 0);
|
||||
$oCriteria->addAsColumn('DEP_TITLE', 0);
|
||||
$oCriteria->addAsColumn('TOTAL_CASES', 0);
|
||||
$oCriteria->addAsColumn('DUE_DATE_OK', 1);
|
||||
$sep = "'";
|
||||
$oCriteria->add(\UsersPeer::USR_STATUS, array('CLOSED'), \Criteria::NOT_IN);
|
||||
if ($filter != '') {
|
||||
$cc = $oCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, '%' . $filter . '%', \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME, '%' . $filter . '%', \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_EMAIL, '%' . $filter . '%', \Criteria::LIKE))));
|
||||
$oCriteria->add($cc);
|
||||
}
|
||||
if (sizeof($aUsers) > 0) {
|
||||
$oCriteria->add(\UsersPeer::USR_UID, $aUsers, \Criteria::IN);
|
||||
} elseif ($totalRows == 0 && $authSource != '') {
|
||||
$oCriteria->add(\UsersPeer::USR_UID, '', \Criteria::IN);
|
||||
}
|
||||
if ($sort != '') {
|
||||
if ($dir == 'ASC') {
|
||||
$oCriteria->addAscendingOrderByColumn($sort);
|
||||
} else {
|
||||
$oCriteria->addDescendingOrderByColumn($sort);
|
||||
}
|
||||
}
|
||||
$oCriteria->setOffset($start);
|
||||
$oCriteria->setLimit($limit);
|
||||
$oDataset = \UsersPeer::DoSelectRs($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
return $oDataset;
|
||||
}
|
||||
/**
|
||||
* This function get additional information related to the user
|
||||
* Information about the department, rol, cases, authentication
|
||||
*
|
||||
* @param criteria $oDatasetUsers, criteria for search users
|
||||
*
|
||||
* @return array $dataUsers array of users with the additional information
|
||||
*/
|
||||
public function getAdditionalInfoFromUsers($oDatasetUsers)
|
||||
{
|
||||
global $RBAC;
|
||||
//Get the information about the department
|
||||
$Department = new \Department();
|
||||
$aDepart = $Department->getAllDepartmentsByUser();
|
||||
|
||||
//Get the authentication sources
|
||||
$aAuthSources = $RBAC->getAllAuthSourcesByUser();
|
||||
|
||||
//Get roles
|
||||
$oRoles = new \Roles();
|
||||
|
||||
//Get cases
|
||||
$oParticipated = new \ListParticipatedLast();
|
||||
$oAppCache = new \AppCacheView();
|
||||
|
||||
$rows = array();
|
||||
$uRole = array();
|
||||
$totalRows = 0;
|
||||
$dataUsers = array();
|
||||
while ($oDatasetUsers->next()) {
|
||||
$totalRows++;
|
||||
$row = $oDatasetUsers->getRow();
|
||||
|
||||
//Add the role information related to the user
|
||||
try {
|
||||
$uRole = $oRoles->loadByCode($row['USR_ROLE']);
|
||||
} catch (\exception $oError) {
|
||||
$uRole['ROL_NAME'] = G::loadTranslation('ID_DELETED');
|
||||
}
|
||||
$row['USR_ROLE_ID'] = $row['USR_ROLE'];
|
||||
$row['USR_ROLE'] = isset($uRole['ROL_NAME']) ? ($uRole['ROL_NAME'] != '' ? $uRole['ROL_NAME'] : $uRole['ROL_CODE']) : $uRole['ROL_CODE'];
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (true) {
|
||||
$total = $oParticipated->getCountList($row['USR_UID']);
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$total = $oAppCache->getListCounters('sent', $row['USR_UID'], false);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$row['TOTAL_CASES'] = $total;
|
||||
|
||||
$row['DUE_DATE_OK'] = (date('Y-m-d') > date('Y-m-d', strtotime($row['USR_DUE_DATE']))) ? 0 : 1;
|
||||
$row['LAST_LOGIN'] = isset($row['USR_LAST_LOGIN']) ? \ProcessMaker\Util\DateTime::convertUtcToTimeZone($row['USR_LAST_LOGIN']) : '';
|
||||
//Add the department information related to the user
|
||||
$row['DEP_TITLE'] = isset($aDepart[$row['USR_UID']]) ? $aDepart[$row['USR_UID']] : '';
|
||||
//Add the authentication information related to the user
|
||||
$row['USR_AUTH_SOURCE'] = isset($aAuthSources[$row['USR_UID']]) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)';
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
$dataUsers['data'] = $rows;
|
||||
$dataUsers['totalCount'] = $totalRows;
|
||||
|
||||
return $dataUsers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ class Tracker extends Api
|
||||
public function Authentication($case, $pin)
|
||||
{
|
||||
try {
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
|
||||
$response = $oMobile->authentication($case, $pin);
|
||||
$response = \ProcessMaker\BusinessModel\Light\Tracker::authentication($case, $pin);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -163,6 +163,9 @@ class Project extends Api
|
||||
PATH_SEP . $outputFilename;
|
||||
$httpStream = new HttpStream();
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
|
||||
\G::auditLog('ExportProcess','Export process "' . $granularExporter->getProjectName() . '"');
|
||||
|
||||
$httpStream->loadFromFile($outputFilename);
|
||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||
$httpStream->send();
|
||||
@@ -188,6 +191,8 @@ class Project extends Api
|
||||
$httpStream = new \ProcessMaker\Util\IO\HttpStream();
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
|
||||
\G::auditLog('ExportProcess','Export process "' . $exporter->getProjectName() . '"');
|
||||
|
||||
$httpStream->loadFromFile($outputFilename);
|
||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||
$httpStream->send();
|
||||
|
||||
Reference in New Issue
Block a user