PM-4471 No se muestra las unidades en los resultados de KPIs
This commit is contained in:
@@ -1033,5 +1033,20 @@ class Process extends BaseProcess
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllConfiguredCurrencies()
|
||||
{
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_UNIT_COST);
|
||||
$oCriteria->setDistinct();
|
||||
$oDataSet = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$aProc = Array ();
|
||||
while ($oDataSet->next()) {
|
||||
$row = $oDataSet->getRow();
|
||||
$aProc[$row['PRO_UNIT_COST']] = $row['PRO_UNIT_COST'];
|
||||
}
|
||||
return $aProc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,7 @@ class StrategicDashboard extends Controller
|
||||
$this->usrId = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
|
||||
$user = new Users();
|
||||
$user = $user->load($RBAC->aUserInfo['USER_INFO']['USR_UID']);
|
||||
$this->usrUnitCost = '$';
|
||||
if (isset($user['USR_UNIT_COST'])) {
|
||||
$this->usrUnitCost = $user['USR_UNIT_COST'];
|
||||
}
|
||||
|
||||
$this->usrUnitCost = $this->currencySymbolToShow($user);
|
||||
$this->urlProxy = '/api/1.0/' . SYS_SYS . '/';
|
||||
//change
|
||||
$clientId = 'x-pm-local-client';
|
||||
@@ -67,6 +63,28 @@ class StrategicDashboard extends Controller
|
||||
$this->clientToken["client_secret"] = $client['CLIENT_SECRET'];
|
||||
}
|
||||
|
||||
private function currencySymbolToShow($user)
|
||||
{
|
||||
$result = '$';
|
||||
if (isset($user['USR_UNIT_COST']) && !empty($user['USR_UNIT_COST'])) {
|
||||
$result = $user['USR_UNIT_COST'];
|
||||
}
|
||||
else {
|
||||
$processModel = new Process();
|
||||
$processList = $processModel->getAllConfiguredCurrencies();
|
||||
$defaultProcessCurrency = '';
|
||||
foreach ($processList as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
$defaultProcessCurrency = $value;
|
||||
}
|
||||
}
|
||||
if (!empty($defaultProcessCurrency)) {
|
||||
$result = $defaultProcessCurrency;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function getClientCredentials($clientId)
|
||||
{
|
||||
$oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo($this->getDsn());
|
||||
|
||||
Reference in New Issue
Block a user