HOR-4601
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -102,11 +102,19 @@ class ChangeLog
|
||||
}
|
||||
if ($index < $start) {
|
||||
$index += $this->updateData(
|
||||
$data, $row, $this->hasPermission($row['DYN_UID']), false);
|
||||
$data,
|
||||
$row,
|
||||
$this->hasPermission($row['DYN_UID']),
|
||||
false
|
||||
);
|
||||
continue;
|
||||
}
|
||||
$a = $this->updateData($data, $row,
|
||||
$this->hasPermission($row['DYN_UID']), true);
|
||||
$a = $this->updateData(
|
||||
$data,
|
||||
$row,
|
||||
$this->hasPermission($row['DYN_UID']),
|
||||
true
|
||||
);
|
||||
$limit-= $a;
|
||||
$index+= $a;
|
||||
}
|
||||
@@ -154,12 +162,12 @@ class ChangeLog
|
||||
$node = new StdClass();
|
||||
$node->field = $key;
|
||||
$previousValue = !isset($this->values[$key]) ? null : $this->values[$key];
|
||||
if(!is_array($previousValue)){
|
||||
if (!is_array($previousValue)) {
|
||||
$node->previousValue = (string) $previousValue;
|
||||
} else {
|
||||
$node->previousValue = "<br />".nl2br(print_r($previousValue, true));
|
||||
}
|
||||
if(!is_array($value)){
|
||||
if (!is_array($value)) {
|
||||
$node->currentValue = (string) $value;
|
||||
} else {
|
||||
$node->currentValue = "<br />".nl2br(print_r($value, true));
|
||||
@@ -250,7 +258,7 @@ class ChangeLog
|
||||
*/
|
||||
private function hasPermission($uid)
|
||||
{
|
||||
if(array_search($uid, $this->reservedSteps)!==false) {
|
||||
if (array_search($uid, $this->reservedSteps)!==false) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->permissions as $type => $ids) {
|
||||
@@ -260,4 +268,4 @@ class ChangeLog
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Files;
|
||||
|
||||
abstract class Files
|
||||
{
|
||||
/**
|
||||
* @var string Path of the directory where the files are stored.
|
||||
*/
|
||||
protected $pathFiles;
|
||||
|
||||
/**
|
||||
* Files constructor.
|
||||
*
|
||||
* @param $path
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->pathFiles = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get path files
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPathFiles()
|
||||
{
|
||||
return $this->pathFiles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function get the list of the log files
|
||||
*
|
||||
* @param string $filter
|
||||
* @param string $sort
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $dir related to order the column
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getAllFiles(
|
||||
$filter = '',
|
||||
$sort = '',
|
||||
$start = 0,
|
||||
$limit = 20,
|
||||
$dir = 'ASC'
|
||||
);
|
||||
|
||||
/**
|
||||
* Download file
|
||||
*
|
||||
* @param array files
|
||||
*/
|
||||
abstract public function download($files);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Files;
|
||||
|
||||
use Chumper\Zipper\Zipper;
|
||||
use Configurations;
|
||||
use Exception;
|
||||
use G;
|
||||
use ProcessMaker\Core\System;
|
||||
use SplFileInfo;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
class FilesLogs extends Files
|
||||
{
|
||||
/**
|
||||
* Date format in list
|
||||
* @var string
|
||||
*/
|
||||
private $dateFormat = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* Path of the directory where the files are stored.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $pathData = '';
|
||||
|
||||
/**
|
||||
* FilesLogs constructor .
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$system = System::getSystemConfiguration();
|
||||
$configuration = new Configurations();
|
||||
$generalConfig = $configuration->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
if (isset($generalConfig['casesListDateFormat']) && !empty($generalConfig['casesListDateFormat'])) {
|
||||
$this->setDateFormat($generalConfig['casesListDateFormat']);
|
||||
}
|
||||
$path = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
|
||||
if (isset($system['logs_location']) && !empty($system['logs_location']) && is_dir($system['logs_location'])) {
|
||||
$path = $system['logs_location'];
|
||||
}
|
||||
$this->setPathDataSaveFile(PATH_DATA_PUBLIC);
|
||||
parent::__construct($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Date Format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDateFormat()
|
||||
{
|
||||
return $this->dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Date Format
|
||||
*
|
||||
* @param string $dateFormat
|
||||
*/
|
||||
public function setDateFormat($dateFormat)
|
||||
{
|
||||
$this->dateFormat = $dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Path data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPathDataSaveFile()
|
||||
{
|
||||
return $this->pathData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set path data
|
||||
*
|
||||
* @param string $pathData
|
||||
*/
|
||||
public function setPathDataSaveFile($pathData)
|
||||
{
|
||||
G::mk_dir($pathData);
|
||||
$this->pathData = $pathData;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get the list of the log files
|
||||
*
|
||||
* @param string $filter
|
||||
* @param string $sort
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $dir related to order the column
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllFiles($filter = '', $sort = 'fileCreated', $start = 0, $limit = 20, $dir = 'DESC')
|
||||
{
|
||||
if (!file_exists($this->getPathFiles())) {
|
||||
return [
|
||||
'totalRows' => 0,
|
||||
'data' => []
|
||||
];
|
||||
}
|
||||
|
||||
$finder = new Finder();
|
||||
$finder->files()
|
||||
->in($this->getPathFiles())
|
||||
->name('processmaker*.log')
|
||||
->name('audit*.log');
|
||||
|
||||
if (!empty($filter)) {
|
||||
$finder->filter(function (SplFileInfo $file) use ($filter) {
|
||||
if (stristr($file->getFilename(), $filter) === false &&
|
||||
stristr($file->getSize(), $filter) === false &&
|
||||
stristr($file->getMTime(), $filter) === false
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//get files
|
||||
$iterator = $finder->getIterator();
|
||||
$files = iterator_to_array($iterator);
|
||||
|
||||
//sort files
|
||||
switch ($sort) {
|
||||
case 'fileSize':
|
||||
uasort($files, function (SplFileInfo $a, SplFileInfo $b) use ($dir) {
|
||||
$size1 = $a->getSize();
|
||||
$size2 = $b->getSize();
|
||||
if ($dir === 'ASC') {
|
||||
return $size1 > $size2;
|
||||
} else {
|
||||
return $size1 < $size2;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'fileCreated':
|
||||
uasort($files, function ($a, $b) use ($dir) {
|
||||
$time1 = $a->getMTime();
|
||||
$time2 = $b->getMTime();
|
||||
if ($dir === 'ASC') {
|
||||
return $time1 > $time2;
|
||||
} else {
|
||||
return $time1 < $time2;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'fileName':
|
||||
default:
|
||||
uasort($files, function ($a, $b) use ($dir) {
|
||||
$name1 = $a->getFilename();
|
||||
$name2 = $b->getFilename();
|
||||
if ($dir === 'ASC') {
|
||||
return strcmp($name1, $name2);
|
||||
} else {
|
||||
return strcmp($name2, $name1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
//count files
|
||||
$total = count($files);
|
||||
|
||||
//limit files
|
||||
$files = array_slice(
|
||||
$files, !empty($start) ? $start : 0, !empty($limit) ? $limit : 20
|
||||
);
|
||||
|
||||
//create out element
|
||||
$result = [];
|
||||
foreach ($files as $file) {
|
||||
$result[] = [
|
||||
'fileName' => $file->getFilename(),
|
||||
'fileSize' => $this->size($file->getSize()),
|
||||
'fileCreated' => date($this->getDateFormat(), $file->getMTime())
|
||||
];
|
||||
}
|
||||
return [
|
||||
'totalRows' => $total,
|
||||
'data' => $result
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the size of a file in bytes to its literal equivalent
|
||||
*
|
||||
* @param int $size file size in bytes
|
||||
* @param string $format
|
||||
* @return string
|
||||
*/
|
||||
private function size($size, $format = null)
|
||||
{
|
||||
$sizes = ['Bytes', 'Kbytes', 'Mbytes', 'Gbytes', 'Tbytes', 'Pbytes', 'Ebytes', 'Zbytes', 'Ybytes'];
|
||||
if ($format === null) {
|
||||
$format = ' % 01.2f % s';
|
||||
}
|
||||
$lastSizesLabel = end($sizes);
|
||||
foreach ($sizes as $sizeLabel) {
|
||||
if ($size < 1024) {
|
||||
break;
|
||||
}
|
||||
if ($sizeLabel !== $lastSizesLabel) {
|
||||
$size /= 1024;
|
||||
}
|
||||
}
|
||||
if ($sizeLabel === $sizes[0]) {
|
||||
// Format bytes
|
||||
$format = '%01d %s';
|
||||
}
|
||||
return sprintf($format, $size, $sizeLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create file zip
|
||||
*
|
||||
* @param array $files file name
|
||||
*
|
||||
* @return string path file
|
||||
* @throws Exception
|
||||
*/
|
||||
private function createZip($files)
|
||||
{
|
||||
try {
|
||||
$zipper = new Zipper();
|
||||
$name = str_replace('.log', '.zip', $files[0]);
|
||||
if (count($files) > 1) {
|
||||
$name = 'processmaker_logs.zip';
|
||||
}
|
||||
|
||||
$zipper->zip($this->getPathDataSaveFile() . $name);
|
||||
|
||||
$pathFileLogs = $this->getPathFiles();
|
||||
$pathSep = '/';
|
||||
if (strpos($pathFileLogs, '\\') !== false) {
|
||||
$pathSep = '\\';
|
||||
}
|
||||
if (substr($pathFileLogs, -1, strlen($pathSep)) !== $pathSep) {
|
||||
$pathFileLogs .= $pathSep;
|
||||
}
|
||||
|
||||
foreach ($files as $key => $file) {
|
||||
$info = pathinfo($file);
|
||||
if (file_exists($pathFileLogs . $info['basename'])) {
|
||||
$zipper->add($pathFileLogs . $info['basename']);
|
||||
}
|
||||
}
|
||||
$zipper->close();
|
||||
|
||||
return $this->getPathDataSaveFile() . $name;
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download log files compressed in a Zip format
|
||||
*
|
||||
* @param array $files files names
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function download($files)
|
||||
{
|
||||
try {
|
||||
$fileZip = $this->createZip($files);
|
||||
|
||||
if (file_exists($fileZip)) {
|
||||
G::streamFile($fileZip, true);
|
||||
} else {
|
||||
throw new Exception('File not exist.');
|
||||
}
|
||||
G::rm_dir($fileZip);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \UsersPeer;
|
||||
use \PMLicensedFeatures;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
class Lists {
|
||||
class Lists
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
@@ -82,17 +86,17 @@ class Lists {
|
||||
* Get list for Cases
|
||||
*
|
||||
* @access public
|
||||
* @param array $dataList, Data for list
|
||||
* @param array $dataList , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
*/
|
||||
public function getList($listName = 'inbox', $dataList = array(), $total = false)
|
||||
{
|
||||
Validator::isArray($dataList, '$dataList');
|
||||
if (!isset($dataList["userId"])) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId',''))));
|
||||
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId', ''))));
|
||||
} else {
|
||||
Validator::usrUid($dataList["userId"], "userId");
|
||||
}
|
||||
@@ -156,7 +160,7 @@ class Lists {
|
||||
$filters["start"] = (int)$filters["start"];
|
||||
$filters["start"] = abs($filters["start"]);
|
||||
if ($filters["start"] != 0) {
|
||||
$filters["start"]+1;
|
||||
$filters["start"] + 1;
|
||||
}
|
||||
|
||||
$filters["limit"] = (int)$filters["limit"];
|
||||
@@ -205,25 +209,25 @@ class Lists {
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$value) {
|
||||
if (isset($value['DEL_PREVIOUS_USR_UID'])) {
|
||||
$value['PREVIOUS_USR_UID'] = $value['DEL_PREVIOUS_USR_UID'];
|
||||
$value['PREVIOUS_USR_USERNAME'] = $value['DEL_PREVIOUS_USR_USERNAME'];
|
||||
$value['PREVIOUS_USR_UID'] = $value['DEL_PREVIOUS_USR_UID'];
|
||||
$value['PREVIOUS_USR_USERNAME'] = $value['DEL_PREVIOUS_USR_USERNAME'];
|
||||
$value['PREVIOUS_USR_FIRSTNAME'] = $value['DEL_PREVIOUS_USR_FIRSTNAME'];
|
||||
$value['PREVIOUS_USR_LASTNAME'] = $value['DEL_PREVIOUS_USR_LASTNAME'];
|
||||
$value['PREVIOUS_USR_LASTNAME'] = $value['DEL_PREVIOUS_USR_LASTNAME'];
|
||||
}
|
||||
if (isset($value['DEL_DUE_DATE'])) {
|
||||
$value['DEL_TASK_DUE_DATE'] = $value['DEL_DUE_DATE'];
|
||||
}
|
||||
if (isset($value['APP_PAUSED_DATE'])) {
|
||||
$value['APP_UPDATE_DATE'] = $value['APP_PAUSED_DATE'];
|
||||
$value['APP_UPDATE_DATE'] = $value['APP_PAUSED_DATE'];
|
||||
}
|
||||
if (isset($value['DEL_CURRENT_USR_USERNAME'])) {
|
||||
$value['USR_USERNAME'] = $value['DEL_CURRENT_USR_USERNAME'];
|
||||
$value['USR_FIRSTNAME'] = $value['DEL_CURRENT_USR_FIRSTNAME'];
|
||||
$value['USR_LASTNAME'] = $value['DEL_CURRENT_USR_LASTNAME'];
|
||||
$value['APP_UPDATE_DATE'] = $value['DEL_DELEGATE_DATE'];
|
||||
$value['USR_USERNAME'] = $value['DEL_CURRENT_USR_USERNAME'];
|
||||
$value['USR_FIRSTNAME'] = $value['DEL_CURRENT_USR_FIRSTNAME'];
|
||||
$value['USR_LASTNAME'] = $value['DEL_CURRENT_USR_LASTNAME'];
|
||||
$value['APP_UPDATE_DATE'] = $value['DEL_DELEGATE_DATE'];
|
||||
}
|
||||
if (isset($value['APP_STATUS'])) {
|
||||
$value['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$value['APP_STATUS']}" );
|
||||
$value['APP_STATUS_LABEL'] = G::LoadTranslation("ID_{$value['APP_STATUS']}");
|
||||
}
|
||||
|
||||
|
||||
@@ -233,19 +237,19 @@ class Lists {
|
||||
$response = array();
|
||||
if ($filters["paged"]) {
|
||||
$filtersData = array();
|
||||
$filtersData['start'] = $filters["start"];
|
||||
$filtersData['limit'] = $filters["limit"];
|
||||
$filtersData['sort'] = G::toLower($filters["sort"]);
|
||||
$filtersData['dir'] = G::toLower($filters["dir"]);
|
||||
$filtersData['cat_uid'] = $filters["category"];
|
||||
$filtersData['pro_uid'] = $filters["process"];
|
||||
$filtersData['search'] = $filters["search"];
|
||||
$filtersData['date_from'] = $filters["dateFrom"];
|
||||
$filtersData['date_to'] = $filters["dateTo"];
|
||||
$response['filters'] = $filtersData;
|
||||
$response['data'] = $result;
|
||||
$filtersData['action'] = $filters["action"];
|
||||
$response['totalCount'] = $list->getCountList($userUid, $filtersData);
|
||||
$filtersData['start'] = $filters["start"];
|
||||
$filtersData['limit'] = $filters["limit"];
|
||||
$filtersData['sort'] = G::toLower($filters["sort"]);
|
||||
$filtersData['dir'] = G::toLower($filters["dir"]);
|
||||
$filtersData['cat_uid'] = $filters["category"];
|
||||
$filtersData['pro_uid'] = $filters["process"];
|
||||
$filtersData['search'] = $filters["search"];
|
||||
$filtersData['date_from'] = $filters["dateFrom"];
|
||||
$filtersData['date_to'] = $filters["dateTo"];
|
||||
$response['filters'] = $filtersData;
|
||||
$response['data'] = $result;
|
||||
$filtersData['action'] = $filters["action"];
|
||||
$response['totalCount'] = $list->getCountList($userUid, $filtersData);
|
||||
} else {
|
||||
$response = $result;
|
||||
}
|
||||
@@ -264,12 +268,12 @@ class Lists {
|
||||
foreach ($list as $listObject => $item) {
|
||||
switch ($listObject) {
|
||||
case 'ListDraft':
|
||||
$total = $this->$listObject->getCountList($userId, array('action'=>'draft'));
|
||||
$total = $this->$listObject->getCountList($userId, array('action' => 'draft'));
|
||||
array_push($response, (array('count' => $total, 'item' => $item)));
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'ListConsolidated':
|
||||
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
|
||||
$total = $this->$listObject->getCountList($userId);
|
||||
array_push($response, (array('count' => $total, 'item' => $item)));
|
||||
@@ -284,4 +288,4 @@ class Lists {
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ReportTablesMigrator implements Importable, Exportable
|
||||
if (!$replace) {
|
||||
$additionalTable = new \AdditionalTables();
|
||||
|
||||
if ($additionalTable->loadByName($arrayTable['ADD_TAB_NAME']) !== false) {
|
||||
if ($additionalTable->loadByName($arrayTable['ADD_TAB_NAME'])) {
|
||||
$arrayTablesToExclude[] = $arrayTable['ADD_TAB_NAME'];
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use Behat\Behat\Exception\Exception;
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \ObjectPermissionPeer;
|
||||
use \Exception as StandardException;
|
||||
use BasePeer;
|
||||
use Criteria;
|
||||
use G;
|
||||
use ObjectPermission;
|
||||
use ObjectPermissionPeer;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -13,6 +14,7 @@ use \Exception as StandardException;
|
||||
*/
|
||||
class ProcessPermissions
|
||||
{
|
||||
const DOES_NOT_APPLY = 'N/A';
|
||||
/**
|
||||
* Get list for Process Permissions
|
||||
*
|
||||
@@ -20,8 +22,6 @@ class ProcessPermissions
|
||||
* @var string $op_uid. Uid for Process Permission
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -42,6 +42,14 @@ class ProcessPermissions
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
//Participated
|
||||
if ($aRow['OP_PARTICIPATE'] == 0) {
|
||||
$participated = G::LoadTranslation('ID_NO');
|
||||
} else {
|
||||
$participated = G::LoadTranslation('ID_YES');
|
||||
}
|
||||
//Obtain action (permission)
|
||||
$action = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
|
||||
//Obtain task target
|
||||
if (($aRow['TAS_UID'] != '') && ($aRow['TAS_UID'] != '0')) {
|
||||
try {
|
||||
@@ -87,97 +95,87 @@ class ProcessPermissions
|
||||
//Obtain object and type
|
||||
switch ($aRow['OP_OBJ_TYPE']) {
|
||||
case 'ALL':
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY': //For backward compatibility (some process with ANY instead of ALL
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
/* case 'ANY_DYNAFORM':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY_INPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_INPUT');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY_OUTPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_OUTPUT');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break; */
|
||||
case 'DYNAFORM':
|
||||
$sObjectType = G::LoadTranslation('ID_DYNAFORM');
|
||||
$objectType = G::LoadTranslation('ID_DYNAFORM');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oDynaform = new \Dynaform();
|
||||
try {
|
||||
$aFields = $oDynaform->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['DYN_TITLE'];
|
||||
$object = $aFields['DYN_TITLE'];
|
||||
} catch (\Exception $errorNotExists) {
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
|
||||
$oDataset->next();
|
||||
continue 2;
|
||||
}
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'INPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
|
||||
$objectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oInputDocument = new \InputDocument();
|
||||
try {
|
||||
$aFields = $oInputDocument->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['INP_DOC_TITLE'];
|
||||
$object = $aFields['INP_DOC_TITLE'];
|
||||
} catch (\Exception $errorNotExists) {
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
|
||||
$oDataset->next();
|
||||
continue 2;
|
||||
}
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'OUTPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
|
||||
$objectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oOutputDocument = new \OutputDocument();
|
||||
try {
|
||||
$aFields = $oOutputDocument->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['OUT_DOC_TITLE'];
|
||||
$object = $aFields['OUT_DOC_TITLE'];
|
||||
} catch (\Exception $errorNotExists) {
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
|
||||
$oDataset->next();
|
||||
continue 2;
|
||||
}
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'CASES_NOTES':
|
||||
$sObjectType = G::LoadTranslation('ID_CASES_NOTES');
|
||||
$sObject = 'N/A';
|
||||
$objectType = G::LoadTranslation('ID_CASES_NOTES');
|
||||
$object = self::DOES_NOT_APPLY;
|
||||
break;
|
||||
case 'MSGS_HISTORY':
|
||||
$sObjectType = G::LoadTranslation('MSGS_HISTORY');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('MSGS_HISTORY');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'REASSIGN_MY_CASES':
|
||||
$objectType = G::LoadTranslation('ID_REASSIGN_MY_CASES');
|
||||
$object = self::DOES_NOT_APPLY;
|
||||
$aRow['OP_ACTION'] = self::DOES_NOT_APPLY;
|
||||
$participated = self::DOES_NOT_APPLY;
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
default:
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
|
||||
break;
|
||||
}
|
||||
//Participated
|
||||
if ($aRow['OP_PARTICIPATE'] == 0) {
|
||||
$sParticipated = G::LoadTranslation('ID_NO');
|
||||
} else {
|
||||
$sParticipated = G::LoadTranslation('ID_YES');
|
||||
}
|
||||
//Obtain action (permission)
|
||||
$sAction = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
|
||||
|
||||
//Add to array
|
||||
$arrayTemp = array();
|
||||
$arrayTemp = array_merge($aRow, array(
|
||||
@@ -185,10 +183,10 @@ class ProcessPermissions
|
||||
'TASK_TARGET' => $sTaskTarget,
|
||||
'GROUP_USER' => $sUserGroup,
|
||||
'TASK_SOURCE' => $sTaskSource,
|
||||
'OBJECT_TYPE' => $sObjectType,
|
||||
'OBJECT' => $sObject,
|
||||
'PARTICIPATED' => $sParticipated,
|
||||
'ACTION' => $sAction,
|
||||
'OBJECT_TYPE' => $objectType,
|
||||
'OBJECT' => $object,
|
||||
'PARTICIPATED' => $participated,
|
||||
'ACTION' => $action,
|
||||
'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS'])
|
||||
);
|
||||
$aObjectsPermissions[] = array_change_key_case($arrayTemp, CASE_LOWER);
|
||||
@@ -213,7 +211,7 @@ class ProcessPermissions
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return void
|
||||
* @return void|array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveProcessPermission($data, $opUid = '')
|
||||
@@ -226,7 +224,7 @@ class ProcessPermissions
|
||||
$opUid = $this->validateOpUid($opUid);
|
||||
}
|
||||
if (empty($data['USR_UID']) || (isset($data['USR_UID']) && $data['USR_UID'] === "null")) {
|
||||
throw (new StandardException(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
|
||||
throw (new Exception(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
|
||||
}
|
||||
if ($data['OP_USER_RELATION'] == "1") {
|
||||
$this->validateUsrUid($data['USR_UID']);
|
||||
@@ -244,50 +242,59 @@ class ProcessPermissions
|
||||
$data['OP_TASK_SOURCE'] = '';
|
||||
}
|
||||
|
||||
$sObjectUID = '';
|
||||
$opCaseStatus = !empty($data['OP_CASE_STATUS']) ? $data['OP_CASE_STATUS'] : '0';
|
||||
$opObjectUid = '';
|
||||
switch ($data['OP_OBJ_TYPE']) {
|
||||
case 'ANY':
|
||||
//case 'ANY_DYNAFORM':CASES_NOTES
|
||||
//case 'ANY_INPUT':
|
||||
//case 'ANY_OUTPUT':
|
||||
$sObjectUID = '';
|
||||
$opObjectUid = '';
|
||||
break;
|
||||
case 'DYNAFORM':
|
||||
$data['DYNAFORMS'] = $data['DYNAFORMS'] == 0 ? '': $data['DYNAFORMS'];
|
||||
if ($data['DYNAFORMS'] != '') {
|
||||
$this->validateDynUid($data['DYNAFORMS']);
|
||||
}
|
||||
$sObjectUID = $data['DYNAFORMS'];
|
||||
$opObjectUid = $data['DYNAFORMS'];
|
||||
break;
|
||||
case 'ATTACHED':
|
||||
$sObjectUID = '';
|
||||
$opObjectUid = '';
|
||||
break;
|
||||
case 'INPUT':
|
||||
$data['INPUTS'] = $data['INPUTS'] == 0 ? '': $data['INPUTS'];
|
||||
if ($data['INPUTS'] != '') {
|
||||
$this->validateInpUid($data['INPUTS']);
|
||||
}
|
||||
$sObjectUID = $data['INPUTS'];
|
||||
$opObjectUid = $data['INPUTS'];
|
||||
break;
|
||||
case 'OUTPUT':
|
||||
$data['OUTPUTS'] = $data['OUTPUTS'] == 0 ? '': $data['OUTPUTS'];
|
||||
if ($data['OUTPUTS'] != '') {
|
||||
$this->validateOutUid($data['OUTPUTS']);
|
||||
}
|
||||
$sObjectUID = $data['OUTPUTS'];
|
||||
$opObjectUid = $data['OUTPUTS'];
|
||||
break;
|
||||
case 'REASSIGN_MY_CASES':
|
||||
$opCaseStatus = 'TO_DO';
|
||||
$data['OP_ACTION'] = '';
|
||||
break;
|
||||
}
|
||||
$oOP = new \ObjectPermission();
|
||||
$objectPermission = new ObjectPermission();
|
||||
$permissionUid = ($opUid != '') ? $opUid : G::generateUniqueID();
|
||||
$data['OP_UID'] = $permissionUid;
|
||||
$data['OP_OBJ_UID'] = $sObjectUID;
|
||||
$opParticipate = empty($data['OP_PARTICIPATE']) ? ObjectPermission::OP_PARTICIPATE_NO : $data['OP_PARTICIPATE'];
|
||||
$data['OP_PARTICIPATE'] = $opParticipate;
|
||||
$data['OP_CASE_STATUS'] = $opCaseStatus;
|
||||
$data['OP_OBJ_UID'] = $opObjectUid;
|
||||
|
||||
if ($opUid == '') {
|
||||
$oOP->fromArray( $data, \BasePeer::TYPE_FIELDNAME );
|
||||
$oOP->save();
|
||||
$daraRes = $oOP->load($permissionUid);
|
||||
$daraRes = array_change_key_case($daraRes, CASE_LOWER);
|
||||
return $daraRes;
|
||||
if (empty($opUid)) {
|
||||
$objectPermission->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$objectPermission->save();
|
||||
$newPermission = $objectPermission->load($permissionUid);
|
||||
$newPermission = array_change_key_case($newPermission, CASE_LOWER);
|
||||
|
||||
return $newPermission;
|
||||
} else {
|
||||
$data['TAS_UID'] = $data['TAS_UID'] != '' ? $data['TAS_UID'] : '0';
|
||||
$data['OP_TASK_SOURCE'] = $data['OP_TASK_SOURCE'] != '' ? $data['OP_TASK_SOURCE'] : '0';
|
||||
@@ -296,7 +303,8 @@ class ProcessPermissions
|
||||
$data['OP_OBJ_UID'] = $data['OP_OBJ_UID'] != '' ? $data['OP_OBJ_UID'] : '0';
|
||||
$data['OP_ACTION'] = $data['OP_ACTION'] != '' ? $data['OP_ACTION'] : '0';
|
||||
$data['OP_CASE_STATUS'] = $data['OP_CASE_STATUS'] != '' ? $data['OP_CASE_STATUS'] : '0';
|
||||
$oOP->update($data);
|
||||
|
||||
$objectPermission->update($data);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -105,7 +105,7 @@ class ReportTable
|
||||
|
||||
$arrayAdditionalTableData = $additionalTable->loadByName($tableName);
|
||||
|
||||
if ($arrayAdditionalTableData !== false) {
|
||||
if ($arrayAdditionalTableData) {
|
||||
$flagIsPmTable = $arrayAdditionalTableData['PRO_UID'] == '';
|
||||
|
||||
if ($flagIsPmTable && !empty($contentData)) {
|
||||
@@ -275,7 +275,7 @@ class ReportTable
|
||||
|
||||
if ($flagFromAdmin) {
|
||||
if ($flagIsPmTable) {
|
||||
if ($arrayAdditionalTableData !== false && !$flagOverwrite) {
|
||||
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||
$arrayError[$i]['ERROR_TYPE'] = 1; //ERROR_PM_TABLES_OVERWRITE
|
||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_PMTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||
@@ -290,7 +290,7 @@ class ReportTable
|
||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||
} else {
|
||||
if ($arrayAdditionalTableData !== false && !$flagOverwrite) {
|
||||
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||
$arrayError[$i]['ERROR_TYPE'] = 3; //ERROR_RP_TABLES_OVERWRITE
|
||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_RPTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||
@@ -307,14 +307,14 @@ class ReportTable
|
||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||
} else {
|
||||
if ($tableProUid != $processUid) {
|
||||
if ($tableProUid !== $processUid) {
|
||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||
$arrayError[$i]['ERROR_TYPE'] = 5; //ERROR_OVERWRITE_RELATED_PROCESS
|
||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_RELATED_PROCESS', [$contentSchema['ADD_TAB_NAME']]);
|
||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||
} else {
|
||||
if ($arrayAdditionalTableData !== false && !$flagOverwrite) {
|
||||
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||
$arrayError[$i]['ERROR_TYPE'] = 3; //ERROR_RP_TABLES_OVERWRITE
|
||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_RPTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||
@@ -419,7 +419,7 @@ class ReportTable
|
||||
}
|
||||
|
||||
//Validations
|
||||
if (is_array($additionalTable->loadByName($arrayData['REP_TAB_NAME']))) {
|
||||
if ($additionalTable->loadByName($arrayData['REP_TAB_NAME'])) {
|
||||
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_ALREADY_EXISTS', [$arrayData['REP_TAB_NAME']]));
|
||||
}
|
||||
|
||||
@@ -664,11 +664,11 @@ class ReportTable
|
||||
|
||||
//Overwrite
|
||||
if ($flagOverwrite2) {
|
||||
if ($arrayAdditionalTableData !== false) {
|
||||
if ($arrayAdditionalTableData) {
|
||||
$additionalTable->deleteAll($arrayAdditionalTableData['ADD_TAB_UID']);
|
||||
}
|
||||
} else {
|
||||
if ($arrayAdditionalTableData !== false) {
|
||||
if ($arrayAdditionalTableData) {
|
||||
//Some table exists with the same name
|
||||
//renaming...
|
||||
$tNameOld = $contentSchema['ADD_TAB_NAME'];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
@@ -17,28 +18,28 @@ class ReportingIndicators
|
||||
*
|
||||
* return decimal value
|
||||
*/
|
||||
public function getHistoricData($indicatorUid, $initDate, $endDate, $periodicity, $language)
|
||||
public function getHistoricData($indicatorUid, $initDate, $endDate, $periodicity, $language)
|
||||
{
|
||||
$retval = "";
|
||||
$retval = "";
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
$arr = $calculator->indicatorData($indicatorUid);
|
||||
$indicator = $arr[0];
|
||||
$processesId = $indicator['DAS_UID_PROCESS'];
|
||||
$indicatorType = $indicator['DAS_IND_TYPE'];
|
||||
switch ($indicatorType) {
|
||||
case \ReportingIndicatorTypeEnum::PEI:
|
||||
$retval = $calculator->peiHistoric($processesId, $initDate, $endDate, \ReportingPeriodicityEnum::fromValue($periodicity));
|
||||
break;
|
||||
case \ReportingIndicatorTypeEnum::UEI:
|
||||
$retval = $calculator->ueiHistoric($processesId, $initDate, $endDate, \ReportingPeriodicityEnum::fromValue($periodicity));
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Can't retrive historic Data becasuse de indicator type " + $indicator['DAS_IND_TYPE'] + " has no operation associated.");
|
||||
break;
|
||||
}
|
||||
$processesId = $indicator['DAS_UID_PROCESS'];
|
||||
$indicatorType = $indicator['DAS_IND_TYPE'];
|
||||
switch ($indicatorType) {
|
||||
case \ReportingIndicatorTypeEnum::PEI:
|
||||
$retval = $calculator->peiHistoric($processesId, $initDate, $endDate, \ReportingPeriodicityEnum::fromValue($periodicity));
|
||||
break;
|
||||
case \ReportingIndicatorTypeEnum::UEI:
|
||||
$retval = $calculator->ueiHistoric($processesId, $initDate, $endDate, \ReportingPeriodicityEnum::fromValue($periodicity));
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Can't retrive historic Data becasuse de indicator type " + $indicator['DAS_IND_TYPE'] + " has no operation associated.");
|
||||
break;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Lists tasks of a process and it's statistics (efficiency, average times, etc.)
|
||||
@@ -50,24 +51,30 @@ class ReportingIndicators
|
||||
*
|
||||
* return decimal value
|
||||
*/
|
||||
public function getPeiCompleteData($indicatorUid, $compareDate, $measureDate, $language)
|
||||
public function getPeiCompleteData($indicatorUid, $compareDate, $measureDate, $language)
|
||||
{
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
$processes = $calculator->peiProcesses($indicatorUid, $measureDate, $measureDate, $language);
|
||||
$arr = $calculator->indicatorData($indicatorUid);
|
||||
$indicator = $arr[0];
|
||||
$processesId = $indicator['DAS_UID_PROCESS'];
|
||||
$peiValue = current(reset($calculator->peiHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$peiCost = current(reset($calculator->peiCostHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$peiCompare = current(reset($calculator->peiHistoric($processesId, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$processesId = $indicator['DAS_UID_PROCESS'];
|
||||
$peiValue = $calculator->peiHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$peiValue = reset($peiValue);
|
||||
$peiValue = current($peiValue);
|
||||
$peiCost = $calculator->peiCostHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$peiCost = reset($peiCost);
|
||||
$peiCost = current($peiCost);
|
||||
$peiCompare = $calculator->peiHistoric($processesId, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE);
|
||||
$peiCompare = reset($peiCompare);
|
||||
$peiCompare = current($peiCompare);
|
||||
|
||||
$retval = array(
|
||||
"id" => $indicatorUid,
|
||||
"efficiencyIndex" => $peiValue,
|
||||
"efficiencyIndexToCompare" => $peiCompare,
|
||||
"efficiencyVariation" => ($peiValue-$peiCompare),
|
||||
"inefficiencyCost" => $peiCost,
|
||||
"data"=>$processes);
|
||||
$retval = array(
|
||||
"id" => $indicatorUid,
|
||||
"efficiencyIndex" => $peiValue,
|
||||
"efficiencyIndexToCompare" => $peiCompare,
|
||||
"efficiencyVariation" => ($peiValue - $peiCompare),
|
||||
"inefficiencyCost" => $peiCost,
|
||||
"data" => $processes);
|
||||
return $retval;
|
||||
}
|
||||
|
||||
@@ -81,25 +88,31 @@ class ReportingIndicators
|
||||
*
|
||||
* return decimal value
|
||||
*/
|
||||
public function getUeiCompleteData($indicatorUid, $compareDate, $measureDate,$language)
|
||||
public function getUeiCompleteData($indicatorUid, $compareDate, $measureDate, $language)
|
||||
{
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
$groups = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
|
||||
|
||||
//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)));
|
||||
$ueiValue = $calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$ueiValue = reset($ueiValue);
|
||||
$ueiValue = current($ueiValue);
|
||||
$arrCost = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
|
||||
|
||||
$ueiCost = current(reset($calculator->ueiCostHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$ueiCompare = current(reset($calculator->ueiHistoric(null, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$ueiCost = $calculator->ueiCostHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$ueiCost = reset($ueiCost);
|
||||
$ueiCost = is_array($ueiCost) ? current($ueiCost) : $ueiCost;
|
||||
$ueiCompare = $calculator->ueiHistoric(null, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE);
|
||||
$ueiCompare = reset($ueiCompare);
|
||||
$ueiCompare = current($ueiCompare);
|
||||
|
||||
$retval = array(
|
||||
"id" => $indicatorUid,
|
||||
"efficiencyIndex" => $ueiValue,
|
||||
"efficiencyVariation" => ($ueiValue-$ueiCompare),
|
||||
"inefficiencyCost" => $ueiCost,
|
||||
"efficiencyIndexToCompare" => $ueiCompare,
|
||||
"data"=>$groups);
|
||||
$retval = array(
|
||||
'id' => $indicatorUid,
|
||||
'efficiencyIndex' => $ueiValue,
|
||||
'efficiencyVariation' => $ueiValue - $ueiCompare,
|
||||
'inefficiencyCost' => $ueiCost,
|
||||
'efficiencyIndexToCompare' => $ueiCompare,
|
||||
'data' => $groups);
|
||||
return $retval;
|
||||
}
|
||||
|
||||
@@ -154,27 +167,33 @@ class ReportingIndicators
|
||||
$arr = $calculator->generalIndicatorData($indicatorId, $initDate, $endDate, \ReportingPeriodicityEnum::NONE);
|
||||
$value = $arr[0]['value'];
|
||||
$dataList1 = $calculator->
|
||||
generalIndicatorData($indicatorId,
|
||||
$initDate, $endDate,
|
||||
\ReportingPeriodicityEnum::fromValue($arr[0]['frequency1Type']));
|
||||
generalIndicatorData(
|
||||
$indicatorId,
|
||||
$initDate,
|
||||
$endDate,
|
||||
\ReportingPeriodicityEnum::fromValue($arr[0]['frequency1Type'])
|
||||
);
|
||||
|
||||
$dataList2 = $calculator->
|
||||
generalIndicatorData($indicatorId,
|
||||
$initDate, $endDate,
|
||||
\ReportingPeriodicityEnum::fromValue($arr[0]['frequency2Type']));
|
||||
generalIndicatorData(
|
||||
$indicatorId,
|
||||
$initDate,
|
||||
$endDate,
|
||||
\ReportingPeriodicityEnum::fromValue($arr[0]['frequency2Type'])
|
||||
);
|
||||
|
||||
$returnValue = array("index" => $value,
|
||||
"graph1XLabel"=>$arr[0]['graph1XLabel'],
|
||||
"graph1YLabel"=>$arr[0]['graph1YLabel'],
|
||||
"graph2XLabel"=>$arr[0]['graph2XLabel'],
|
||||
"graph2YLabel"=>$arr[0]['graph2YLabel'],
|
||||
"graph1Type"=>$arr[0]['graph1Type'],
|
||||
"graph2Type"=>$arr[0]['graph2Type'],
|
||||
"frequency1Type"=>$arr[0]['frequency1Type'],
|
||||
"frequency2Type"=>$arr[0]['frequency2Type'],
|
||||
"graph1Data"=>$dataList1,
|
||||
"graph2Data"=>$dataList2
|
||||
);
|
||||
"graph1XLabel" => $arr[0]['graph1XLabel'],
|
||||
"graph1YLabel" => $arr[0]['graph1YLabel'],
|
||||
"graph2XLabel" => $arr[0]['graph2XLabel'],
|
||||
"graph2YLabel" => $arr[0]['graph2YLabel'],
|
||||
"graph1Type" => $arr[0]['graph1Type'],
|
||||
"graph2Type" => $arr[0]['graph2Type'],
|
||||
"frequency1Type" => $arr[0]['frequency1Type'],
|
||||
"frequency2Type" => $arr[0]['frequency2Type'],
|
||||
"graph1Data" => $dataList1,
|
||||
"graph2Data" => $dataList2
|
||||
);
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
@@ -182,7 +201,7 @@ class ReportingIndicators
|
||||
* Get list status indicator
|
||||
*
|
||||
* @access public
|
||||
* @param array $options, Data for list
|
||||
* @param array $options , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||
@@ -192,11 +211,10 @@ class ReportingIndicators
|
||||
{
|
||||
Validator::isArray($options, '$options');
|
||||
|
||||
$usrUid = isset( $options["usrUid"] ) ? $options["usrUid"] : "";
|
||||
$usrUid = isset($options["usrUid"]) ? $options["usrUid"] : "";
|
||||
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
$result = $calculator->statusIndicator($usrUid);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ class Table
|
||||
|
||||
// validations
|
||||
if ($createRep) {
|
||||
if (is_array( $oAdditionalTables->loadByName( $tableName ) )) {
|
||||
if ($oAdditionalTables->loadByName($tableName)) {
|
||||
throw new \Exception(G::loadTranslation('ID_PMTABLE_ALREADY_EXISTS', array($tableName)));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user