Merged colosa/processmaker into master
This commit is contained in:
@@ -18,7 +18,7 @@ class ReportingIndicators
|
||||
*
|
||||
* return decimal value
|
||||
*/
|
||||
public function getPeiCompleteData($indicatorUid, $measureDate, $compareDate, $language)
|
||||
public function getPeiCompleteData($indicatorUid, $compareDate, $measureDate, $language)
|
||||
{
|
||||
G::loadClass('indicatorsCalculator');
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
@@ -30,7 +30,10 @@ class ReportingIndicators
|
||||
$peiCost = current(reset($calculator->peiCostHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$peiCompare = current(reset($calculator->peiHistoric($processesId, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
|
||||
$retval = array("efficiencyIndex" => $peiValue,
|
||||
$retval = array(
|
||||
"id" => $indicatorUid,
|
||||
"efficiencyIndex" => $peiValue,
|
||||
"efficiencyIndexCompare" => $peiCompare,
|
||||
"efficiencyVariation" => ($peiValue-$peiCompare),
|
||||
"inefficiencyCost" => $peiCost,
|
||||
"data"=>$processes);
|
||||
@@ -47,32 +50,22 @@ class ReportingIndicators
|
||||
*
|
||||
* return decimal value
|
||||
*/
|
||||
public function getUeiCompleteData($indicatorUid, $measureDate, $compareDate, $language)
|
||||
public function getUeiCompleteData($indicatorUid, $compareDate, $measureDate,$language)
|
||||
{
|
||||
G::loadClass('indicatorsCalculator');
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
$groups = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
|
||||
|
||||
$groupIds = array();
|
||||
foreach($groups as $p) {
|
||||
array_push($groupIds, $p['uid']);
|
||||
}
|
||||
|
||||
if (sizeof($groupIds) == 0) {
|
||||
$groupIds = null;
|
||||
}
|
||||
|
||||
//TODO think what if each indicators has a group or user subset assigned. Now are all
|
||||
$ueiValue = current(reset($calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$arrCost = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
|
||||
|
||||
$ueiCost = (sizeof($arrCost) > 0)
|
||||
? $arrCost[0]['inefficiencyCost']
|
||||
: null;
|
||||
|
||||
$ueiCost = current(reset($calculator->ueiCostHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$ueiCompare = current(reset($calculator->ueiHistoric(null, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
|
||||
$retval = array("efficiencyIndex" => $ueiValue,
|
||||
$retval = array(
|
||||
"id" => $indicatorUid,
|
||||
"efficiencyIndex" => $ueiValue,
|
||||
"efficiencyVariation" => ($ueiValue-$ueiCompare),
|
||||
"inefficiencyCost" => $ueiCost,
|
||||
"data"=>$groups);
|
||||
@@ -296,5 +289,27 @@ class ReportingIndicators
|
||||
);
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list status indicator
|
||||
*
|
||||
* @access public
|
||||
* @param array $options, Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getStatusIndicator($options = array())
|
||||
{
|
||||
Validator::isArray($options, '$options');
|
||||
|
||||
$usrUid = isset( $options["usrUid"] ) ? $options["usrUid"] : "";
|
||||
|
||||
G::loadClass('indicatorsCalculator');
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
$result = $calculator->statusIndicator($usrUid);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,223 +71,6 @@ class ReportingIndicators extends Api
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns the aggregate Efficiency of a employee or set of employees
|
||||
// *
|
||||
// * @param string $employee_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /employee-efficiency-index
|
||||
// */
|
||||
// public function doGetEmployeeEfficiencyIndex($employee_list, $init_date, $end_date)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($employee_list) > 1)
|
||||
// ? $listArray = explode(',', $employee_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getEmployeeEfficiencyIndex($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date));
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Lists tasks of a employee and it's statistics (efficiency, average times, etc.)
|
||||
// *
|
||||
// * @param string $employee_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @param string $language {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /employee-tasks
|
||||
// */
|
||||
// public function doGetEmployeeTasksInfo($employee_list, $init_date, $end_date, $language)
|
||||
// {
|
||||
// if ($employee_list == null || strlen($employee_list) <= 1)
|
||||
// throw new InvalidArgumentException ('employee_list must have at least a value', 0);
|
||||
//
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = $listArray = explode(',', $employee_list);
|
||||
// $response = $indicatorsObj->getEmployeeTasksInfoList($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date),
|
||||
// $language);
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the percent of Cases with Overdue time
|
||||
// *
|
||||
// * @param string $$process_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /percent-overdue-cases
|
||||
// */
|
||||
// public function doGetPercentOverdueByProcess($process_list, $init_date, $end_date)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($process_list) > 1)
|
||||
// ? $listArray = explode(',', $process_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getPercentOverdueCasesByProcess($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date));
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the percent of Cases with Overdue time with the selected periodicity
|
||||
// *
|
||||
// * @param string $$process_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @param string $periodicity {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /percent-overdue-cases-history
|
||||
// */
|
||||
// public function doGetPercentOverdueByProcessHistory($process_list, $init_date, $end_date, $periodicity)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($process_list) > 1)
|
||||
// ? $listArray = explode(',', $process_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getPercentOverdueCasesByProcessHistory($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date),
|
||||
// $periodicity);
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the total of Cases with New time
|
||||
// *
|
||||
// * @param string $$process_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /total-new-cases
|
||||
// */
|
||||
// public function doGetTotalNewByProcess($process_list, $init_date, $end_date)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($process_list) > 1)
|
||||
// ? $listArray = explode(',', $process_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getPercentNewCasesByProcess($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date));
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the total of Cases with New time with the selected periodicity
|
||||
// *
|
||||
// * @param string $$process_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @param string $periodicity {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /total-new-cases-history
|
||||
// */
|
||||
// public function doGetTotalNewByProcessHistory($process_list, $init_date, $end_date, $periodicity)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($process_list) > 1)
|
||||
// ? $listArray = explode(',', $process_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getPercentNewCasesByProcessHistory($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date),
|
||||
// $periodicity);
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the total of Cases with Completed time
|
||||
// *
|
||||
// * @param string $$process_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /total-completed-cases
|
||||
// */
|
||||
// public function doGetTotalCompletedByProcess($process_list, $init_date, $end_date)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($process_list) > 1)
|
||||
// ? $listArray = explode(',', $process_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getPercentCompletedCasesByProcess($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date));
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the total of Cases with Completed time with the selected periodicity
|
||||
// *
|
||||
// * @param string $$process_list {@from path}
|
||||
// * @param string $init_date {@from path}
|
||||
// * @param string $end_date {@from path}
|
||||
// * @param string $periodicity {@from path}
|
||||
// * @return array
|
||||
// *
|
||||
// * @url GET /total-completed-cases-history
|
||||
// */
|
||||
// public function doGetTotalCompletedByProcessHistory($process_list, $init_date, $end_date, $periodicity)
|
||||
// {
|
||||
// try {
|
||||
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
// $listArray = (strlen($process_list) > 1)
|
||||
// ? $listArray = explode(',', $process_list)
|
||||
// : null;
|
||||
// $response = $indicatorsObj->getPercentCompletedCasesByProcessHistory($listArray,
|
||||
// new \DateTime($init_date),
|
||||
// new \DateTime($end_date),
|
||||
// $periodicity);
|
||||
// return $response;
|
||||
// } catch (\Exception $e) {
|
||||
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* Returns the total of Cases with Completed time with the selected periodicity
|
||||
*
|
||||
@@ -299,7 +82,7 @@ class ReportingIndicators extends Api
|
||||
*
|
||||
* @url GET /process-efficiency-data
|
||||
*/
|
||||
public function doGetProcessEficciencyData($indicator_uid, $measure_date, $compare_date, $language)
|
||||
public function doGetProcessEficciencyData($indicator_uid, $compare_date, $measure_date, $language)
|
||||
{
|
||||
try {
|
||||
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
@@ -324,7 +107,7 @@ class ReportingIndicators extends Api
|
||||
*
|
||||
* @url GET /employee-efficiency-data
|
||||
*/
|
||||
public function doGetEmployeeEficciencyData($indicator_uid, $measure_date, $compare_date, $language)
|
||||
public function doGetEmployeeEficciencyData($indicator_uid, $compare_date, $measure_date, $language)
|
||||
{
|
||||
try {
|
||||
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
@@ -390,6 +173,29 @@ class ReportingIndicators extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Status indicator
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /status-indicator
|
||||
*/
|
||||
public function doGetStatusIndicator() {
|
||||
try {
|
||||
$options['usrUid'] = $this->getUserId();
|
||||
|
||||
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
|
||||
$response = $indicatorsObj->getStatusIndicator($options);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -175,9 +175,11 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
||||
{
|
||||
$access_token = new \OauthAccessTokens();
|
||||
$access_token->load($token);
|
||||
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE ACCESS_TOKEN = :token', $this->config['access_token_table']));
|
||||
$stmt->execute(compact('token'));
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE EXPIRES>%s', $this->config['refresh_token_table'], "'".Date('Y-m-d H:i:s')."'"));
|
||||
|
||||
$stmt = $this->db->prepare(sprintf("DELETE FROM %s WHERE EXPIRES < %s", $this->config["refresh_token_table"], "'" . date("Y-m-d H:i:s") . "'"));
|
||||
return $stmt->execute(compact('token'));
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,10 @@ class Server implements iAuthenticate
|
||||
$this->server->addGrantType(new \ProcessMaker\Services\OAuth2\PmClientCredentials($this->storage));
|
||||
|
||||
// Add the "Refresh token" grant type
|
||||
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken($this->storage));
|
||||
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken(
|
||||
$this->storage,
|
||||
array("always_issue_new_refresh_token" => true)
|
||||
));
|
||||
|
||||
// create some users in memory
|
||||
//$users = array('bshaffer' => array('password' => 'brent123', 'first_name' => 'Brent', 'last_name' => 'Shaffer'));
|
||||
@@ -261,7 +264,9 @@ class Server implements iAuthenticate
|
||||
if ($returnResponse) {
|
||||
return $response;
|
||||
} else {
|
||||
die($response->send());
|
||||
$response->send();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,9 +284,11 @@ class Server implements iAuthenticate
|
||||
if ($request == null) {
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
}
|
||||
$response = $this->server->handleTokenRequest($request);
|
||||
|
||||
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
|
||||
|
||||
$token = $response->getParameters();
|
||||
|
||||
if (array_key_exists('access_token', $token)
|
||||
&& array_key_exists('refresh_token', $token)
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user