HOR-4921
This commit is contained in:
1
Rakefile
1
Rakefile
@@ -141,6 +141,7 @@ def generateEnviromentVariables()
|
|||||||
file = File.read('./config/enviromentvariables.json')
|
file = File.read('./config/enviromentvariables.json')
|
||||||
dataUser = JSON.parse(file)
|
dataUser = JSON.parse(file)
|
||||||
content = content + "__env.USER_GUEST = " + JSON.generate(dataUser['constants']['userguest'])
|
content = content + "__env.USER_GUEST = " + JSON.generate(dataUser['constants']['userguest'])
|
||||||
|
content = content + "; __env.pmVariable = " + JSON.generate(dataUser['validation']['pmVariable'])
|
||||||
dir = "vendor/colosa/MichelangeloFE/src/enviroment/"
|
dir = "vendor/colosa/MichelangeloFE/src/enviroment/"
|
||||||
# create a directory enviroment
|
# create a directory enviroment
|
||||||
FileUtils.mkdir_p(dir)
|
FileUtils.mkdir_p(dir)
|
||||||
|
|||||||
10
config/constants.php
Normal file
10
config/constants.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'validation' => [
|
||||||
|
'pmVariable' => [
|
||||||
|
'regEx' => '/^[a-zA-Z\_]{1}\w+$/'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
@@ -8,5 +8,10 @@
|
|||||||
"lastname": "Guest",
|
"lastname": "Guest",
|
||||||
"username": "guest"
|
"username": "guest"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"validation": {
|
||||||
|
"pmVariable": {
|
||||||
|
"regEx": "/^[a-zA-Z\\_]{1}\\w+$/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
use ProcessMaker\Util\DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class.bootstrap.php
|
* class.bootstrap.php
|
||||||
@@ -2658,7 +2659,7 @@ class Bootstrap
|
|||||||
* @param int $level The logging level
|
* @param int $level The logging level
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
* @param string $workspace name workspace
|
* @param string $workspace @todo we need to remove this parameter this is not necessary
|
||||||
* @param string $file name file
|
* @param string $file name file
|
||||||
* @param boolean $readLoggingLevel
|
* @param boolean $readLoggingLevel
|
||||||
*
|
*
|
||||||
@@ -2669,8 +2670,8 @@ class Bootstrap
|
|||||||
$level,
|
$level,
|
||||||
$message,
|
$message,
|
||||||
$context,
|
$context,
|
||||||
$workspace,
|
$workspace = '',
|
||||||
$file = 'cron.log',
|
$file = 'processmaker.log',
|
||||||
$readLoggingLevel = true
|
$readLoggingLevel = true
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -2681,17 +2682,34 @@ class Bootstrap
|
|||||||
/**
|
/**
|
||||||
* Get the default information from the context
|
* Get the default information from the context
|
||||||
*
|
*
|
||||||
* @return array $aContext void
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getDefaultContextLog(){
|
public static function getDefaultContextLog()
|
||||||
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
{
|
||||||
$date = \ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s'));
|
|
||||||
$aContext = array(
|
global $RBAC;
|
||||||
'ip' => \G::getIpAddress()
|
$info = [
|
||||||
,'timeZone' => $date
|
'ip' => G::getIpAddress(),
|
||||||
,'workspace' => $sysSys
|
'workspace' => !empty(config('system.workspace')) ? config('system.workspace') : 'Undefined Workspace',
|
||||||
);
|
'timeZone' => DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s'))
|
||||||
return $aContext;
|
];
|
||||||
|
|
||||||
|
if ($RBAC !== null) {
|
||||||
|
$userInfo = [
|
||||||
|
'usrUid' => $RBAC->aUserInfo['USER_INFO']['USR_UID']
|
||||||
|
];
|
||||||
|
$info = array_merge($info, $userInfo);
|
||||||
|
}
|
||||||
|
//Some endpoints can defined the USER_LOGGED
|
||||||
|
if (empty($info['usrUid'])) {
|
||||||
|
$user = !empty($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : G::LoadTranslation('UID_UNDEFINED_USER');
|
||||||
|
$userInfo = [
|
||||||
|
'usrUid' => $user
|
||||||
|
];
|
||||||
|
$info = array_merge($info, $userInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class MonologProvider
|
|||||||
private $registerLogger;
|
private $registerLogger;
|
||||||
|
|
||||||
//the default format "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
|
//the default format "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
|
||||||
private $output = "<%level%> %datetime% %channel% %level_name%: %message% %context% %extra%\n";
|
private $output = "<%level%> %datetime% %channel% %level_name%: %message% %context%\n";
|
||||||
private $dateFormat = 'M d H:i:s';
|
private $dateFormat = 'M d H:i:s';
|
||||||
/**
|
/**
|
||||||
* The maximal amount of files to keep (0 means unlimited)
|
* The maximal amount of files to keep (0 means unlimited)
|
||||||
|
|||||||
36
gulpfile.js
36
gulpfile.js
@@ -471,6 +471,37 @@ gulp.task('clean', function () {
|
|||||||
cleanDirectory('workflow/public_html/lib');
|
cleanDirectory('workflow/public_html/lib');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports from the config/constants.php the configuration constants to the
|
||||||
|
* enviromentvariables.json file
|
||||||
|
*/
|
||||||
|
gulp.task('exportBackendConstants', function () {
|
||||||
|
var runner = require('child_process');
|
||||||
|
gutil.log(gutil.colors.green('Export ProcessMaker constants...'));
|
||||||
|
|
||||||
|
var envVarsJsonFile = 'config/enviromentvariables.json';
|
||||||
|
|
||||||
|
var code = 'require_once "gulliver/system/class.g.php";' +
|
||||||
|
'require_once "bootstrap/autoload.php";' +
|
||||||
|
'require_once "bootstrap/app.php";' +
|
||||||
|
'app()->make(Illuminate\\Foundation\\Http\\Kernel::class)->bootstrap();' +
|
||||||
|
'print(json_encode(config("constants", JSON_UNESCAPED_SLASHES)));';
|
||||||
|
|
||||||
|
runner.exec(
|
||||||
|
'php -r \'' + code + '\'',
|
||||||
|
function (err, stdout, stderr) {
|
||||||
|
var pmConstants = JSON.parse(stdout);
|
||||||
|
var envVar = JSON.parse(fs.readFileSync(envVarsJsonFile));
|
||||||
|
|
||||||
|
for (var attr in pmConstants) {
|
||||||
|
envVar[attr] = pmConstants[attr];
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(envVarsJsonFile, JSON.stringify(envVar, null, 2));
|
||||||
|
return pmConstants;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This scheduled task is to be able to create the guest user constants
|
* This scheduled task is to be able to create the guest user constants
|
||||||
*/
|
*/
|
||||||
@@ -490,7 +521,7 @@ gulp.task('__env', function (cb) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['clean', '__env'], function (cb) {
|
gulp.task('default', ['clean', 'exportBackendConstants', '__env'], function (cb) {
|
||||||
var i, tasks = [];
|
var i, tasks = [];
|
||||||
|
|
||||||
gutil.log(gutil.colors.green('Initializing ProcessMaker building...'));
|
gutil.log(gutil.colors.green('Initializing ProcessMaker building...'));
|
||||||
@@ -499,4 +530,5 @@ gulp.task('default', ['clean', '__env'], function (cb) {
|
|||||||
tasks.push(_.bind(processTask, config[i]));
|
tasks.push(_.bind(processTask, config[i]));
|
||||||
}
|
}
|
||||||
executeSequence(tasks, cb);
|
executeSequence(tasks, cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,12 @@ require_once __DIR__ . '/../../../bootstrap/app.php';
|
|||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
use ProcessMaker\Plugins\PluginRegistry;
|
||||||
|
|
||||||
register_shutdown_function(
|
$fn = '
|
||||||
create_function(
|
if (class_exists("Propel")) {
|
||||||
'',
|
Propel::close();
|
||||||
'
|
}
|
||||||
if (class_exists("Propel")) {
|
';
|
||||||
Propel::close();
|
register_shutdown_function(create_function('', $fn));
|
||||||
}
|
|
||||||
'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
ini_set('memory_limit', '512M');
|
ini_set('memory_limit', '512M');
|
||||||
|
|
||||||
@@ -45,8 +41,7 @@ try {
|
|||||||
$cronName = $argv[4];
|
$cronName = $argv[4];
|
||||||
$workspace = $argv[5];
|
$workspace = $argv[5];
|
||||||
$dateSystem = $argv[6];
|
$dateSystem = $argv[6];
|
||||||
$sNow = $argv[7]; //$date
|
$sNow = $argv[7]; //date
|
||||||
|
|
||||||
//Defines constants
|
//Defines constants
|
||||||
define('PATH_SEP', ($osIsLinux) ? '/' : '\\');
|
define('PATH_SEP', ($osIsLinux) ? '/' : '\\');
|
||||||
|
|
||||||
@@ -68,10 +63,7 @@ try {
|
|||||||
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP);
|
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP);
|
||||||
|
|
||||||
//Add vendors to autoloader
|
//Add vendors to autoloader
|
||||||
//$classLoader->add(PATH_TRUNK . 'vendor' . PATH_SEP . 'luracast' . PATH_SEP . 'restler' . PATH_SEP . 'vendor', 'Luracast');
|
$classLoader->addClass('Bootstrap', PATH_TRUNK . 'gulliver' . PATH_SEP . 'system' . PATH_SEP . 'class.bootstrap.php');
|
||||||
//$classLoader->add(PATH_TRUNK . 'vendor' . PATH_SEP . 'bshaffer' . PATH_SEP . 'oauth2-server-php' . PATH_SEP . 'src' . PATH_SEP, 'OAuth2');
|
|
||||||
$classLoader->addClass('Bootstrap',
|
|
||||||
PATH_TRUNK . 'gulliver' . PATH_SEP . 'system' . PATH_SEP . 'class.bootstrap.php');
|
|
||||||
|
|
||||||
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
|
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
|
||||||
|
|
||||||
@@ -89,7 +81,6 @@ try {
|
|||||||
ini_set('error_reporting', $e_all);
|
ini_set('error_reporting', $e_all);
|
||||||
ini_set('short_open_tag', 'On');
|
ini_set('short_open_tag', 'On');
|
||||||
ini_set('default_charset', 'UTF-8');
|
ini_set('default_charset', 'UTF-8');
|
||||||
//ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
|
|
||||||
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
||||||
ini_set('date.timezone', $arraySystemConfiguration['time_zone']);
|
ini_set('date.timezone', $arraySystemConfiguration['time_zone']);
|
||||||
|
|
||||||
@@ -99,9 +90,6 @@ try {
|
|||||||
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
|
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
|
||||||
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
|
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
|
||||||
|
|
||||||
//require_once(PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php');
|
|
||||||
//define('PATH_GULLIVER_HOME', PATH_TRUNK . 'gulliver' . PATH_SEP);
|
|
||||||
|
|
||||||
spl_autoload_register(['Bootstrap', 'autoloadClass']);
|
spl_autoload_register(['Bootstrap', 'autoloadClass']);
|
||||||
|
|
||||||
//Set variables
|
//Set variables
|
||||||
@@ -168,8 +156,7 @@ try {
|
|||||||
while (!feof($fileDb)) {
|
while (!feof($fileDb)) {
|
||||||
$buffer = fgets($fileDb, 4096); //Read a line
|
$buffer = fgets($fileDb, 4096); //Read a line
|
||||||
|
|
||||||
$phpCode .= preg_replace('/define\s*\(\s*[\x22\x27](.*)[\x22\x27]\s*,\s*(\x22.*\x22|\x27.*\x27)\s*\)\s*;/i',
|
$phpCode .= preg_replace('/define\s*\(\s*[\x22\x27](.*)[\x22\x27]\s*,\s*(\x22.*\x22|\x27.*\x27)\s*\)\s*;/i', '$$1 = $2;', $buffer);
|
||||||
'$$1 = $2;', $buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($fileDb);
|
fclose($fileDb);
|
||||||
@@ -189,8 +176,6 @@ try {
|
|||||||
$dsnRbac .= '?encoding=utf8';
|
$dsnRbac .= '?encoding=utf8';
|
||||||
break;
|
break;
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
//$dsn .= '?sendStringAsUnicode=false';
|
|
||||||
//$dsnRbac .= '?sendStringAsUnicode=false';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -203,15 +188,12 @@ try {
|
|||||||
$pro['datasources']['rbac']['adapter'] = $DB_ADAPTER;
|
$pro['datasources']['rbac']['adapter'] = $DB_ADAPTER;
|
||||||
$pro['datasources']['rp']['connection'] = $dsnRp;
|
$pro['datasources']['rp']['connection'] = $dsnRp;
|
||||||
$pro['datasources']['rp']['adapter'] = $DB_ADAPTER;
|
$pro['datasources']['rp']['adapter'] = $DB_ADAPTER;
|
||||||
//$pro['datasources']['dbarray']['connection'] = 'dbarray://user:pass@localhost/pm_os';
|
|
||||||
//$pro['datasources']['dbarray']['adapter'] = 'dbarray';
|
|
||||||
|
|
||||||
$oFile = fopen(PATH_CORE . 'config' . PATH_SEP . '_databases_.php', 'w');
|
$oFile = fopen(PATH_CORE . 'config' . PATH_SEP . '_databases_.php', 'w');
|
||||||
fwrite($oFile, '<?php global $pro; return $pro; ?>');
|
fwrite($oFile, '<?php global $pro; return $pro; ?>');
|
||||||
fclose($oFile);
|
fclose($oFile);
|
||||||
|
|
||||||
Propel::init(PATH_CORE . 'config' . PATH_SEP . '_databases_.php');
|
Propel::init(PATH_CORE . 'config' . PATH_SEP . '_databases_.php');
|
||||||
//Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
|
|
||||||
|
|
||||||
//Enable RBAC
|
//Enable RBAC
|
||||||
$rbac = RBAC::getSingleton(PATH_DATA, session_id());
|
$rbac = RBAC::getSingleton(PATH_DATA, session_id());
|
||||||
@@ -226,7 +208,7 @@ try {
|
|||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||||
$systemUtcTimeZone = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
|
$systemUtcTimeZone = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1;
|
||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
@@ -234,6 +216,12 @@ try {
|
|||||||
|
|
||||||
define('TIME_ZONE', ini_get('date.timezone'));
|
define('TIME_ZONE', ini_get('date.timezone'));
|
||||||
|
|
||||||
|
//UTC time zone
|
||||||
|
if ($systemUtcTimeZone) {
|
||||||
|
$sNow = convertToSystemUtcTimeZone($sNow);
|
||||||
|
$dateSystem = convertToSystemUtcTimeZone($dateSystem);
|
||||||
|
}
|
||||||
|
|
||||||
//Processing
|
//Processing
|
||||||
eprintln('Processing workspace: ' . $workspace, 'green');
|
eprintln('Processing workspace: ' . $workspace, 'green');
|
||||||
|
|
||||||
@@ -261,7 +249,7 @@ try {
|
|||||||
case 'timereventcron':
|
case 'timereventcron':
|
||||||
$timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
|
$timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
|
||||||
|
|
||||||
$timerEvent->startContinueCaseByTimerEvent(date('Y-m-d H:i:s'), true);
|
$timerEvent->startContinueCaseByTimerEvent($sNow, true);
|
||||||
break;
|
break;
|
||||||
case 'sendnotificationscron':
|
case 'sendnotificationscron':
|
||||||
sendNotifications();
|
sendNotifications();
|
||||||
@@ -434,7 +422,6 @@ function executePlugins()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Executing registered cron files
|
// Executing registered cron files
|
||||||
|
|
||||||
// -> Get registered cron files
|
// -> Get registered cron files
|
||||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||||
$cronFiles = $oPluginRegistry->getCronFiles();
|
$cronFiles = $oPluginRegistry->getCronFiles();
|
||||||
@@ -445,7 +432,7 @@ function executePlugins()
|
|||||||
/**
|
/**
|
||||||
* @var \ProcessMaker\Plugins\Interfaces\CronFile $cronFile
|
* @var \ProcessMaker\Plugins\Interfaces\CronFile $cronFile
|
||||||
*/
|
*/
|
||||||
foreach($cronFiles as $cronFile) {
|
foreach ($cronFiles as $cronFile) {
|
||||||
$path = PATH_PLUGINS . $cronFile->getNamespace() . PATH_SEP . 'bin' . PATH_SEP . $cronFile->getCronFile() . '.php';
|
$path = PATH_PLUGINS . $cronFile->getNamespace() . PATH_SEP . 'bin' . PATH_SEP . $cronFile->getCronFile() . '.php';
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
executeCustomCronFunction($path, $cronFile->getCronFile());
|
executeCustomCronFunction($path, $cronFile->getCronFile());
|
||||||
@@ -503,8 +490,8 @@ function calculateDuration()
|
|||||||
saveLog('calculateDuration', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
|
saveLog('calculateDuration', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
function calculateAppDuration()
|
function calculateAppDuration()
|
||||||
{
|
{
|
||||||
global $argvx;
|
global $argvx;
|
||||||
@@ -527,7 +514,6 @@ function calculateAppDuration()
|
|||||||
saveLog('calculateDurationByApp', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
|
saveLog('calculateDurationByApp', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
function executeEvents($sLastExecution, $sNow = null)
|
function executeEvents($sLastExecution, $sNow = null)
|
||||||
@@ -559,7 +545,6 @@ function executeEvents($sLastExecution, $sNow = null)
|
|||||||
|
|
||||||
setExecutionMessage("|- End Execution events");
|
setExecutionMessage("|- End Execution events");
|
||||||
setExecutionResultMessage("Processed $n");
|
setExecutionResultMessage("Processed $n");
|
||||||
//saveLog('executeEvents', 'action', $res );
|
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $oError) {
|
||||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||||
eprintln(" '-" . $oError->getMessage(), 'red');
|
eprintln(" '-" . $oError->getMessage(), 'red');
|
||||||
@@ -581,10 +566,8 @@ function executeScheduledCases($sNow = null)
|
|||||||
setExecutionMessage("Executing the scheduled starting cases");
|
setExecutionMessage("Executing the scheduled starting cases");
|
||||||
setExecutionResultMessage('PROCESSING');
|
setExecutionResultMessage('PROCESSING');
|
||||||
|
|
||||||
$runDate = runDateForScheduledCases($sNow);
|
|
||||||
|
|
||||||
$oCaseScheduler = new CaseScheduler();
|
$oCaseScheduler = new CaseScheduler();
|
||||||
$oCaseScheduler->caseSchedulerCron($runDate, $log, 1);
|
$oCaseScheduler->caseSchedulerCron($sNow, $log, 1);
|
||||||
|
|
||||||
foreach ($log as $value) {
|
foreach ($log as $value) {
|
||||||
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
|
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
|
||||||
@@ -601,7 +584,7 @@ function executeScheduledCases($sNow = null)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function runDateForScheduledCases($sNow)
|
function convertToSystemUtcTimeZone($sNow)
|
||||||
{
|
{
|
||||||
global $arraySystemConfiguration;
|
global $arraySystemConfiguration;
|
||||||
|
|
||||||
@@ -610,7 +593,7 @@ function runDateForScheduledCases($sNow)
|
|||||||
$systemUtcTimeZone = false;
|
$systemUtcTimeZone = false;
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||||
$systemUtcTimeZone = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
|
$systemUtcTimeZone = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1;
|
||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
@@ -766,7 +749,7 @@ function executeCaseSelfService()
|
|||||||
$appcacheDelDelegateDate,
|
$appcacheDelDelegateDate,
|
||||||
$taskSelfServiceTime,
|
$taskSelfServiceTime,
|
||||||
$taskSelfServiceTimeUnit //HOURS|DAYS|MINUTES
|
$taskSelfServiceTimeUnit //HOURS|DAYS|MINUTES
|
||||||
//1
|
//1
|
||||||
);
|
);
|
||||||
|
|
||||||
if (time() > $dueDate["DUE_DATE_SECONDS"] && $flag == false) {
|
if (time() > $dueDate["DUE_DATE_SECONDS"] && $flag == false) {
|
||||||
@@ -898,8 +881,8 @@ function setExecutionResultMessage($m, $t = '')
|
|||||||
|
|
||||||
eprintln("[$m]", $c);
|
eprintln("[$m]", $c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
function fillReportByUser()
|
function fillReportByUser()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -1017,7 +1000,6 @@ function synchronizeGmailLabels()
|
|||||||
saveLog("synchronizeGmailLabels", "error", "Error when synchronizing Gmail labels: " . $e->getMessage());
|
saveLog("synchronizeGmailLabels", "error", "Error when synchronizing Gmail labels: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
function sendNotifications()
|
function sendNotifications()
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ class Applications
|
|||||||
if ($columnSearch === 'APP_NUMBER' || $columnSearch === 'APP_TITLE') {
|
if ($columnSearch === 'APP_NUMBER' || $columnSearch === 'APP_TITLE') {
|
||||||
$sqlSearch = "SELECT APPLICATION.APP_NUMBER FROM APPLICATION";
|
$sqlSearch = "SELECT APPLICATION.APP_NUMBER FROM APPLICATION";
|
||||||
$sqlSearch .= " WHERE APPLICATION.{$columnSearch} LIKE '%{$search}%'";
|
$sqlSearch .= " WHERE APPLICATION.{$columnSearch} LIKE '%{$search}%'";
|
||||||
|
$orderByColumnSearch = " ORDER BY APPLICATION.{$columnSearch} " . $dir;
|
||||||
switch ($columnSearch) {
|
switch ($columnSearch) {
|
||||||
case 'APP_TITLE':
|
case 'APP_TITLE':
|
||||||
break;
|
break;
|
||||||
@@ -166,6 +167,7 @@ class Applications
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$sqlSearch .= $orderByColumnSearch;
|
||||||
if (!empty($start)) {
|
if (!empty($start)) {
|
||||||
$sqlSearch .= " LIMIT $start, " . $limit;
|
$sqlSearch .= " LIMIT $start, " . $limit;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -912,7 +912,7 @@ class Cases
|
|||||||
$appDataWithoutDynContentHistory = serialize($FieldsDifference);
|
$appDataWithoutDynContentHistory = serialize($FieldsDifference);
|
||||||
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
|
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
|
||||||
$appHistory->insertHistory($aFieldsHistory);
|
$appHistory->insertHistory($aFieldsHistory);
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$type = isset($Fields['OBJECT_TYPE']) ?
|
$type = isset($Fields['OBJECT_TYPE']) ?
|
||||||
$Fields['OBJECT_TYPE'] : ChangeLog::getChangeLog()->getObjectNameById(ChangeLog::DYNAFORM);
|
$Fields['OBJECT_TYPE'] : ChangeLog::getChangeLog()->getObjectNameById(ChangeLog::DYNAFORM);
|
||||||
@@ -1152,12 +1152,13 @@ class Cases
|
|||||||
$nameFiles .= $node['file'] . ":" . $node['function'] . "(" . $node['line'] . ")\n";
|
$nameFiles .= $node['file'] . ":" . $node['function'] . "(" . $node['line'] . ")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$dataLog = \Bootstrap::getDefaultContextLog();
|
|
||||||
$dataLog['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : G::LoadTranslation('UID_UNDEFINED_USER');
|
/** ProcessMaker log*/
|
||||||
$dataLog['appUid'] = $sAppUid;
|
$context = Bootstrap::getDefaultContextLog();
|
||||||
$dataLog['request'] = $nameFiles;
|
$context['appUid'] = $sAppUid;
|
||||||
$dataLog['action'] = 'DeleteCases';
|
$context['request'] = $nameFiles;
|
||||||
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $dataLog, $dataLog['workspace'], 'processmaker.log');
|
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $context);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} catch (exception $e) {
|
} catch (exception $e) {
|
||||||
throw ($e);
|
throw ($e);
|
||||||
@@ -4543,11 +4544,14 @@ class Cases
|
|||||||
$appDelay = new AppDelay();
|
$appDelay = new AppDelay();
|
||||||
$appDelay->create($newData);
|
$appDelay->create($newData);
|
||||||
|
|
||||||
//update searchindex
|
//Update searchindex
|
||||||
if ($this->appSolr != null) {
|
if ($this->appSolr != null) {
|
||||||
$this->appSolr->updateApplicationSearchIndex($appUid);
|
$this->appSolr->updateApplicationSearchIndex($appUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Execute trigger
|
||||||
|
$this->getExecuteTriggerProcess($appUid, 'REASSIGNED');
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$participated = new ListParticipatedLast();
|
$participated = new ListParticipatedLast();
|
||||||
$participated->remove($newData['APP_UID'], $newUserUid, $delIndex);
|
$participated->remove($newData['APP_UID'], $newUserUid, $delIndex);
|
||||||
@@ -4567,9 +4571,7 @@ class Cases
|
|||||||
$criteriaSet = new Criteria("workflow");
|
$criteriaSet = new Criteria("workflow");
|
||||||
$criteriaSet->add(ListInboxPeer::DEL_INDEX, $newData['DEL_INDEX']);
|
$criteriaSet->add(ListInboxPeer::DEL_INDEX, $newData['DEL_INDEX']);
|
||||||
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
|
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$this->getExecuteTriggerProcess($appUid, 'REASSIGNED');
|
|
||||||
|
|
||||||
//Delete record of the table LIST_UNASSIGNED
|
//Delete record of the table LIST_UNASSIGNED
|
||||||
$unassigned = new ListUnassigned();
|
$unassigned = new ListUnassigned();
|
||||||
@@ -7139,57 +7141,38 @@ class Cases
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the case is deleted will be removed the case from the report tables related
|
||||||
|
*
|
||||||
|
* @param string $applicationUid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function reportTableDeleteRecord($applicationUid)
|
public function reportTableDeleteRecord($applicationUid)
|
||||||
{
|
{
|
||||||
$criteria1 = new Criteria("workflow");
|
$app = new Application();
|
||||||
|
$applicationFields = $app->Load($applicationUid);
|
||||||
//SELECT
|
if (!empty($applicationFields["PRO_UID"])) {
|
||||||
$criteria1->addSelectColumn(ApplicationPeer::PRO_UID);
|
$additionalTables = new AdditionalTables();
|
||||||
|
$listTables = $additionalTables->getReportTables($applicationFields["PRO_UID"]);
|
||||||
//FROM
|
$pmTable = new PmTable();
|
||||||
//WHERE
|
foreach ($listTables as $row) {
|
||||||
$criteria1->add(ApplicationPeer::APP_UID, $applicationUid);
|
try {
|
||||||
|
$tableName = $row["ADD_TAB_NAME"];
|
||||||
//QUERY
|
$pmTableName = $pmTable->toCamelCase($tableName);
|
||||||
$rsCriteria1 = ApplicationPeer::doSelectRS($criteria1);
|
require_once(PATH_WORKSPACE . 'classes' . PATH_SEP . $pmTableName . '.php');
|
||||||
$rsCriteria1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$criteria = new Criteria("workflow");
|
||||||
|
$pmTablePeer = $pmTableName . 'Peer';
|
||||||
$rsCriteria1->next();
|
$criteria->add($pmTablePeer::APP_UID, $applicationUid);
|
||||||
$row1 = $rsCriteria1->getRow();
|
$pmTablePeer::doDelete($criteria);
|
||||||
|
} catch (Exception $e) {
|
||||||
$processUid = $row1["PRO_UID"];
|
$context = Bootstrap::getDefaultContextLog();
|
||||||
|
$context['appUid'] = $applicationUid;
|
||||||
$criteria2 = new Criteria("workflow");
|
$context['proUid'] = $applicationFields["PRO_UID"];
|
||||||
|
$context['reportTable'] = $tableName;
|
||||||
//SELECT
|
Bootstrap::registerMonolog('DeleteCases', 400, $e->getMessage(), $context);
|
||||||
$criteria2->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
}
|
||||||
|
|
||||||
//FROM
|
|
||||||
//WHERE
|
|
||||||
|
|
||||||
$criteria2->add(AdditionalTablesPeer::PRO_UID, $processUid);
|
|
||||||
|
|
||||||
//QUERY
|
|
||||||
$rsCriteria2 = AdditionalTablesPeer::doSelectRS($criteria2);
|
|
||||||
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
$pmTable = new PmTable();
|
|
||||||
|
|
||||||
while ($rsCriteria2->next()) {
|
|
||||||
try {
|
|
||||||
$row2 = $rsCriteria2->getRow();
|
|
||||||
$tableName = $row2["ADD_TAB_NAME"];
|
|
||||||
$pmTableName = $pmTable->toCamelCase($tableName);
|
|
||||||
|
|
||||||
//DELETE
|
|
||||||
require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
|
|
||||||
|
|
||||||
$criteria3 = new Criteria("workflow");
|
|
||||||
|
|
||||||
eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);");
|
|
||||||
eval($pmTableName . "Peer::doDelete(\$criteria3);");
|
|
||||||
} catch (Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1768,25 +1768,33 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Create "Process User" records
|
* Create "Process User" records
|
||||||
*
|
*
|
||||||
* @param array $arrayData Data to create
|
* @param array $arrayData
|
||||||
*
|
*
|
||||||
* return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createProcessUser(array $arrayData)
|
public function createProcessUser(array $arrayData)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$processUser = new ProcessUser();
|
$con = Propel::getConnection(ProcessUserPeer::DATABASE_NAME);
|
||||||
|
$con->begin();
|
||||||
foreach ($arrayData as $value) {
|
foreach ($arrayData as $row) {
|
||||||
$record = $value;
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(ProcessUserPeer::DATABASE_NAME);
|
||||||
if ($processUser->Exists($record["PU_UID"])) {
|
$criteria->addSelectColumn('*');
|
||||||
$result = $processUser->remove($record["PU_UID"]);
|
$criteria->add(ProcessUserPeer::PU_UID, $row['PU_UID']);
|
||||||
}
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
$result = $processUser->create($record);
|
$criteria = new Criteria(ProcessUserPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(ProcessUserPeer::PU_UID, $row['PU_UID']);
|
||||||
|
$criteria->add(ProcessUserPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(ProcessUserPeer::USR_UID, $row['USR_UID']);
|
||||||
|
$criteria->add(ProcessUserPeer::PU_TYPE, $row['PU_TYPE']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
|
$con->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1832,23 +1840,41 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Create "Process Variables" records
|
* Create "Process Variables" records
|
||||||
*
|
*
|
||||||
* @param array $arrayData Data to create
|
* @param array $arrayData
|
||||||
*
|
*
|
||||||
* return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createProcessVariables(array $arrayData)
|
public function createProcessVariables(array $arrayData)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
foreach ($arrayData as $value) {
|
$con = Propel::getConnection(ProcessVariablesPeer::DATABASE_NAME);
|
||||||
$processVariables = new ProcessVariables();
|
$con->begin();
|
||||||
$record = $value;
|
foreach ($arrayData as $row) {
|
||||||
|
//Prepare the delete
|
||||||
if ($processVariables->Exists($record["VAR_UID"])) {
|
$criteria = new Criteria(ProcessVariablesPeer::DATABASE_NAME);
|
||||||
$result = $processVariables->remove($record["VAR_UID"]);
|
$criteria->addSelectColumn('*');
|
||||||
}
|
$criteria->add(ProcessVariablesPeer::VAR_UID, $row['VAR_UID']);
|
||||||
$result = $processVariables->create($record);
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(ProcessVariablesPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_UID, $row['VAR_UID']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::PRJ_UID, $row['PRJ_UID']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_NAME, $row['VAR_NAME']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_FIELD_TYPE, $row['VAR_FIELD_TYPE']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_FIELD_SIZE, $row['VAR_FIELD_SIZE']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_LABEL, $row['VAR_LABEL']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_DBCONNECTION, $row['VAR_DBCONNECTION']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_SQL, $row['VAR_SQL']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_NULL, $row['VAR_NULL']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_DEFAULT, $row['VAR_DEFAULT']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, $row['VAR_ACCEPTED_VALUES']);
|
||||||
|
$criteria->add(ProcessVariablesPeer::INP_DOC_UID, $row['INP_DOC_UID']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
|
$con->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1895,47 +1921,86 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Gets Input Documents Rows from aProcess.
|
* Gets Input Documents Rows from aProcess.
|
||||||
*
|
*
|
||||||
* @param $sProUid string.
|
* @param string $proUid
|
||||||
* @return void
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getInputRows($sProUid)
|
public function getInputRows($proUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$aInput = array();
|
$inputList = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->add(InputDocumentPeer::PRO_UID, $sProUid);
|
$criteria->add(InputDocumentPeer::PRO_UID, $proUid);
|
||||||
$oDataset = InputDocumentPeer::doSelectRS($oCriteria);
|
$dataset = InputDocumentPeer::doSelectRS($criteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$dataset->next();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$oInput = new InputDocument();
|
$input = new InputDocument();
|
||||||
$aInput[] = $oInput->load($aRow['INP_DOC_UID']);
|
$infoInput = $input->load($row['INP_DOC_UID']);
|
||||||
$oDataset->next();
|
unset($infoInput['INP_DOC_ID']);
|
||||||
|
$inputList[] = $infoInput;
|
||||||
|
$dataset->next();
|
||||||
}
|
}
|
||||||
return $aInput;
|
|
||||||
} catch (Exception $oError) {
|
return $inputList;
|
||||||
throw ($oError);
|
} catch (Exception $error) {
|
||||||
|
throw ($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Input Documents Rows from an array, removing those Objects
|
* Create Input Documents
|
||||||
* with the same UID, and recreaiting the records from the array data.
|
*
|
||||||
|
* @param array $input
|
||||||
*
|
*
|
||||||
* @param $aInput array.
|
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createInputRows($aInput)
|
public function createInputRows($input)
|
||||||
{
|
{
|
||||||
foreach ($aInput as $key => $row) {
|
try {
|
||||||
$oInput = new InputDocument();
|
$con = Propel::getConnection(InputDocumentPeer::DATABASE_NAME);
|
||||||
//unset ($row['TAS_UID']);
|
$con->begin();
|
||||||
if ($oInput->InputExists($row['INP_DOC_UID'])) {
|
foreach ($input as $key => $row) {
|
||||||
$oInput->remove($row['INP_DOC_UID']);
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(InputDocumentPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_UID, $row['INP_DOC_UID']);
|
||||||
|
//Get the INP_DOC_ID column
|
||||||
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
if ($dataSet->next()) {
|
||||||
|
$inputInfo = $dataSet->getRow();
|
||||||
|
$row['INP_DOC_ID'] = $inputInfo['INP_DOC_ID'];
|
||||||
|
} else {
|
||||||
|
$row['INP_DOC_ID'] = null;
|
||||||
|
}
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(InputDocumentPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_ID, $row['INP_DOC_ID']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_UID, $row['INP_DOC_UID']);
|
||||||
|
$criteria->add(InputDocumentPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_TITLE, $row['INP_DOC_TITLE']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_DESCRIPTION, $row['INP_DOC_DESCRIPTION']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_FORM_NEEDED, $row['INP_DOC_FORM_NEEDED']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_ORIGINAL, $row['INP_DOC_ORIGINAL']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_PUBLISHED, $row['INP_DOC_PUBLISHED']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_VERSIONING, $row['INP_DOC_VERSIONING']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_DESTINATION_PATH, $row['INP_DOC_DESTINATION_PATH']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_TAGS, $row['INP_DOC_TAGS']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $row['INP_DOC_TYPE_FILE']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE, $row['INP_DOC_MAX_FILESIZE']);
|
||||||
|
$criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, $row['INP_DOC_MAX_FILESIZE_UNIT']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
$res = $oInput->create($row);
|
$con->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2029,47 +2094,96 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Gets the Output Documents Rows from a Process.
|
* Gets the Output Documents Rows from a Process.
|
||||||
*
|
*
|
||||||
* @param $sProUid string.
|
* @param string $proUid
|
||||||
* @return $aOutput array
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getOutputRows($sProUid)
|
public function getOutputRows($proUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$aOutput = array();
|
$outputList = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->add(OutputDocumentPeer::PRO_UID, $sProUid);
|
$criteria->add(OutputDocumentPeer::PRO_UID, $proUid);
|
||||||
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
|
$dataset = OutputDocumentPeer::doSelectRS($criteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$dataset->next();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$oOutput = new OutputDocument();
|
$output = new OutputDocument();
|
||||||
$aOutput[] = $oOutput->Load($aRow['OUT_DOC_UID']);
|
$infoOutput = $output->Load($row['OUT_DOC_UID']);
|
||||||
$oDataset->next();
|
unset($infoOutput['OUT_DOC_ID']);
|
||||||
|
$outputList[] = $infoOutput;
|
||||||
|
$dataset->next();
|
||||||
}
|
}
|
||||||
return $aOutput;
|
|
||||||
} catch (Exception $oError) {
|
return $outputList;
|
||||||
throw ($oError);
|
} catch (Exception $error) {
|
||||||
|
throw ($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Input Documents Rows from an array, removing those Objects
|
* Create Input Documents
|
||||||
* with the same UID, and recreaiting the records from the array data.
|
*
|
||||||
|
* @param array $output
|
||||||
*
|
*
|
||||||
* @param $aOutput array.
|
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createOutputRows($aOutput)
|
public function createOutputRows($output)
|
||||||
{
|
{
|
||||||
foreach ($aOutput as $key => $row) {
|
try {
|
||||||
$oOutput = new OutputDocument();
|
$con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
||||||
//unset ($row['TAS_UID']);
|
$con->begin();
|
||||||
if ($oOutput->OutputExists($row['OUT_DOC_UID'])) {
|
foreach ($output as $key => $row) {
|
||||||
$oOutput->remove($row['OUT_DOC_UID']);
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(OutputDocumentPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_UID, $row['OUT_DOC_UID']);
|
||||||
|
//Get the OUT_DOC_ID column
|
||||||
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
if ($dataSet->next()) {
|
||||||
|
$outputInfo = $dataSet->getRow();
|
||||||
|
$row['OUT_DOC_ID'] = $outputInfo['OUT_DOC_ID'];
|
||||||
|
} else {
|
||||||
|
$row['OUT_DOC_ID'] = null;
|
||||||
|
}
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(OutputDocumentPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_ID, $row['OUT_DOC_ID']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_UID, $row['OUT_DOC_UID']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_TITLE, $row['OUT_DOC_TITLE']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_DESCRIPTION, $row['OUT_DOC_DESCRIPTION']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_FILENAME, $row['OUT_DOC_FILENAME']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_TEMPLATE, $row['OUT_DOC_TEMPLATE']);
|
||||||
|
$criteria->add(OutputDocumentPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR, $row['OUT_DOC_REPORT_GENERATOR']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_LANDSCAPE, $row['OUT_DOC_LANDSCAPE']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_MEDIA, $row['OUT_DOC_MEDIA']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, $row['OUT_DOC_LEFT_MARGIN']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, $row['OUT_DOC_RIGHT_MARGIN']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_TOP_MARGIN, $row['OUT_DOC_TOP_MARGIN']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, $row['OUT_DOC_BOTTOM_MARGIN']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_GENERATE, $row['OUT_DOC_GENERATE']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, $row['OUT_DOC_CURRENT_REVISION']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, $row['OUT_DOC_FIELD_MAPPING']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_VERSIONING, $row['OUT_DOC_VERSIONING']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, $row['OUT_DOC_DESTINATION_PATH']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_TAGS, $row['OUT_DOC_TAGS']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, $row['OUT_DOC_PDF_SECURITY_ENABLED']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, $row['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, $row['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, $row['OUT_DOC_PDF_SECURITY_PERMISSIONS']);
|
||||||
|
$criteria->add(OutputDocumentPeer::OUT_DOC_OPEN_TYPE, $row['OUT_DOC_OPEN_TYPE']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
$res = $oOutput->create($row);
|
$con->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2665,37 +2779,75 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Create Step Rows from a Process
|
* Create Step Rows from a Process
|
||||||
*
|
*
|
||||||
* @param $aStep array.
|
* @param array $step
|
||||||
|
*
|
||||||
* @return void.
|
* @return void.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createStepRows($aStep)
|
public function createStepRows($step)
|
||||||
{
|
{
|
||||||
foreach ($aStep as $key => $row) {
|
try {
|
||||||
$oStep = new Step();
|
$con = Propel::getConnection(StepPeer::DATABASE_NAME);
|
||||||
if (isset($row['STEP_UID'])) {
|
$con->begin();
|
||||||
if ($oStep->StepExists($row['STEP_UID'])) {
|
foreach ($step as $key => $row) {
|
||||||
$oStep->remove($row['STEP_UID']);
|
if (isset($row['STEP_UID'])) {
|
||||||
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(StepPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(StepPeer::STEP_UID, $row['STEP_UID']);
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(StepPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(StepPeer::STEP_UID, $row['STEP_UID']);
|
||||||
|
$criteria->add(StepPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(StepPeer::TAS_UID, $row['TAS_UID']);
|
||||||
|
$criteria->add(StepPeer::STEP_TYPE_OBJ, $row['STEP_TYPE_OBJ']);
|
||||||
|
$criteria->add(StepPeer::STEP_UID_OBJ, $row['STEP_UID_OBJ']);
|
||||||
|
$criteria->add(StepPeer::STEP_CONDITION, $row['STEP_CONDITION']);
|
||||||
|
$criteria->add(StepPeer::STEP_POSITION, $row['STEP_POSITION']);
|
||||||
|
$criteria->add(StepPeer::STEP_MODE, $row['STEP_MODE']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
$res = $oStep->create($row);
|
|
||||||
}
|
}
|
||||||
|
$con->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Step Supervisor Rows for a Process from an array of data
|
* Create Step Supervisor Rows for a Process from an array of data
|
||||||
*
|
*
|
||||||
* @param $aStepSupervisor array.
|
* @param array $stepSupervisor
|
||||||
|
*
|
||||||
* @return void.
|
* @return void.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createStepSupervisorRows($aStepSupervisor)
|
public function createStepSupervisorRows($stepSupervisor)
|
||||||
{
|
{
|
||||||
foreach ($aStepSupervisor as $key => $row) {
|
try {
|
||||||
$oStepSupervisor = new StepSupervisor();
|
$con = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME);
|
||||||
if ($oStepSupervisor->Exists($row['STEP_UID'])) {
|
$con->begin();
|
||||||
$oStepSupervisor->remove($row['STEP_UID']);
|
foreach ($stepSupervisor as $key => $row) {
|
||||||
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(StepSupervisorPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(StepSupervisorPeer::STEP_UID, $row['STEP_UID']);
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(StepSupervisorPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(StepSupervisorPeer::STEP_UID, $row['STEP_UID']);
|
||||||
|
$criteria->add(StepSupervisorPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $row['STEP_TYPE_OBJ']);
|
||||||
|
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $row['STEP_UID_OBJ']);
|
||||||
|
$criteria->add(StepSupervisorPeer::STEP_POSITION, $row['STEP_POSITION']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
$oStepSupervisor->create($row);
|
$con->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2764,26 +2916,31 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Get Dynaform Rows from a Process
|
* Get Dynaform Rows from a Process
|
||||||
*
|
*
|
||||||
* @param string $sProUid
|
* @param string $proUid
|
||||||
* @return $aDynaform array
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getDynaformRows($sProUid)
|
public function getDynaformRows($proUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$aDynaform = array();
|
$dynaformList = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->add(DynaformPeer::PRO_UID, $sProUid);
|
$criteria->add(DynaformPeer::PRO_UID, $proUid);
|
||||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
$dataset = DynaformPeer::doSelectRS($criteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$dataset->next();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$oDynaform = new Dynaform();
|
$dynaform = new Dynaform();
|
||||||
$aDynaform[] = $oDynaform->Load($aRow['DYN_UID']);
|
$infoDyn = $dynaform->Load($row['DYN_UID']);
|
||||||
$oDataset->next();
|
unset($infoDyn['DYN_ID']);
|
||||||
|
$dynaformList[] = $infoDyn;
|
||||||
|
$dataset->next();
|
||||||
}
|
}
|
||||||
return $aDynaform;
|
|
||||||
} catch (Exception $oError) {
|
return $dynaformList;
|
||||||
throw ($oError);
|
} catch (Exception $error) {
|
||||||
|
throw ($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2906,22 +3063,53 @@ class Processes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Dynaform Rows for a Process form an array
|
* Create dynaforms for a process
|
||||||
|
*
|
||||||
|
* @param array $dynaforms
|
||||||
*
|
*
|
||||||
* @param array $aDynaform
|
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createDynaformRows($aDynaform)
|
public function createDynaformRows($dynaforms)
|
||||||
{
|
{
|
||||||
foreach ($aDynaform as $key => $row) {
|
try {
|
||||||
$oDynaform = new Dynaform();
|
$con = Propel::getConnection(DynaformPeer::DATABASE_NAME);
|
||||||
//unset ($row['TAS_UID']);
|
$con->begin();
|
||||||
if ($oDynaform->exists($row['DYN_UID'])) {
|
foreach ($dynaforms as $key => $row) {
|
||||||
$oDynaform->remove($row['DYN_UID']);
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(DynaformPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(DynaformPeer::DYN_UID, $row['DYN_UID']);
|
||||||
|
//Get the DYN_ID column
|
||||||
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
if ($dataSet->next()) {
|
||||||
|
$dynInfo = $dataSet->getRow();
|
||||||
|
$row['DYN_ID'] = $dynInfo['DYN_ID'];
|
||||||
|
} else {
|
||||||
|
$row['DYN_ID'] = null;
|
||||||
|
}
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(DynaformPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(DynaformPeer::DYN_ID, $row['DYN_ID']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_UID, $row['DYN_UID']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_TITLE, $row['DYN_TITLE']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_DESCRIPTION, $row['DYN_DESCRIPTION']);
|
||||||
|
$criteria->add(DynaformPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_TYPE, $row['DYN_TYPE']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_FILENAME, $row['DYN_FILENAME']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_CONTENT, $row['DYN_CONTENT']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_LABEL, $row['DYN_LABEL']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_VERSION, $row['DYN_VERSION']);
|
||||||
|
$criteria->add(DynaformPeer::DYN_UPDATE_DATE, $row['DYN_UPDATE_DATE']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
$res = $oDynaform->create($row);
|
$con->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3035,20 +3223,38 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Create Step Trigger Rows for a Process form an array
|
* Create Step Trigger Rows for a Process form an array
|
||||||
*
|
*
|
||||||
* @param array $aTrigger
|
* @param array $trigger
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createTriggerRows($aTrigger)
|
public function createTriggerRows($trigger)
|
||||||
{
|
{
|
||||||
foreach ($aTrigger as $key => $row) {
|
try {
|
||||||
$oTrigger = new Triggers();
|
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
||||||
//unset ($row['TAS_UID']);
|
$con->begin();
|
||||||
if ($oTrigger->TriggerExists($row['TRI_UID'])) {
|
foreach ($trigger as $key => $row) {
|
||||||
$oTrigger->remove($row['TRI_UID']);
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(TriggersPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(TriggersPeer::TRI_UID, $row['TRI_UID']);
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(TriggersPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(TriggersPeer::TRI_UID, $row['TRI_UID']);
|
||||||
|
$criteria->add(TriggersPeer::TRI_TITLE, $row['TRI_TITLE']);
|
||||||
|
$criteria->add(TriggersPeer::TRI_DESCRIPTION, $row['TRI_DESCRIPTION']);
|
||||||
|
$criteria->add(TriggersPeer::PRO_UID, $row['PRO_UID']);
|
||||||
|
$criteria->add(TriggersPeer::TRI_TYPE, $row['TRI_TYPE']);
|
||||||
|
$criteria->add(TriggersPeer::TRI_WEBBOT, $row['TRI_WEBBOT']);
|
||||||
|
$criteria->add(TriggersPeer::TRI_PARAM, $row['TRI_PARAM']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
$res = $oTrigger->create($row);
|
$con->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3736,21 +3942,40 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Get Task User Rows from an array of data
|
* Get Task User Rows from an array of data
|
||||||
*
|
*
|
||||||
* @param array $aTaskUser
|
* @param array $taskUser
|
||||||
* @return array $aStepTrigger
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createTaskUserRows($aTaskUser)
|
public function createTaskUserRows($taskUser)
|
||||||
{
|
{
|
||||||
if (is_array($aTaskUser)) {
|
try {
|
||||||
foreach ($aTaskUser as $key => $row) {
|
if (is_array($taskUser)) {
|
||||||
$oTaskUser = new TaskUser();
|
$con = Propel::getConnection(TaskUserPeer::DATABASE_NAME);
|
||||||
if ($oTaskUser->TaskUserExists($row['TAS_UID'], $row['USR_UID'], $row['TU_TYPE'], $row['TU_RELATION'])) {
|
$con->begin();
|
||||||
$oTaskUser->remove($row['TAS_UID'], $row['USR_UID'], $row['TU_TYPE'], $row['TU_RELATION']);
|
foreach ($taskUser as $key => $row) {
|
||||||
|
//Prepare the delete
|
||||||
|
$criteria = new Criteria(TaskUserPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(TaskUserPeer::TAS_UID, $row['TAS_UID']);
|
||||||
|
$criteria->add(TaskUserPeer::USR_UID, $row['USR_UID']);
|
||||||
|
$criteria->add(TaskUserPeer::TU_TYPE, $row['TU_TYPE']);
|
||||||
|
$criteria->add(TaskUserPeer::TU_RELATION, $row['TU_RELATION']);
|
||||||
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
|
if (!$dataSet->next()) {
|
||||||
|
/** The validation added in method TaskUser->create is not required,
|
||||||
|
* because in the current method only assigned GROUPS are present.
|
||||||
|
* if (RBAC::isGuestUserUid($row['USR_UID']) && !$bmWebEntry->isTaskAWebEntry($row['TAS_UID'])) {...
|
||||||
|
*/
|
||||||
|
BasePeer::doInsert($criteria, $con, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$res = $oTaskUser->create($row);
|
$con->commit();
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3794,21 +4019,42 @@ class Processes
|
|||||||
* @param array $group
|
* @param array $group
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createGroupRow($group)
|
public function createGroupRow($group)
|
||||||
{
|
{
|
||||||
foreach ($group as $key => $row) {
|
try {
|
||||||
$groupInfo = [];
|
$con = Propel::getConnection(GroupwfPeer::DATABASE_NAME);
|
||||||
$groupWf = new Groupwf();
|
$con->begin();
|
||||||
if ($groupWf->GroupwfExists($row['GRP_UID'])) {
|
foreach ($group as $key => $row) {
|
||||||
$groupInfo = $groupWf->Load($row['GRP_UID']);
|
//Prepare the delete
|
||||||
$groupWf->remove($row['GRP_UID']);
|
$criteria = new Criteria(GroupwfPeer::DATABASE_NAME);
|
||||||
|
$criteria->addSelectColumn('*');
|
||||||
|
$criteria->add(GroupwfPeer::GRP_UID, $row['GRP_UID']);
|
||||||
|
//Get the GRP_ID column
|
||||||
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
if ($dataSet->next()) {
|
||||||
|
$groupInfo = $dataSet->getRow();
|
||||||
|
$row['GRP_ID'] = $groupInfo['GRP_ID'];
|
||||||
|
} else {
|
||||||
|
$row['GRP_ID'] = null;
|
||||||
|
}
|
||||||
|
BasePeer::doDelete($criteria, $con);
|
||||||
|
//Prepare the insert
|
||||||
|
$criteria = new Criteria(GroupwfPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(GroupwfPeer::GRP_ID, $row['GRP_ID']);
|
||||||
|
$criteria->add(GroupwfPeer::GRP_UID, $row['GRP_UID']);
|
||||||
|
$criteria->add(GroupwfPeer::GRP_TITLE, $row['GRP_TITLE']);
|
||||||
|
$criteria->add(GroupwfPeer::GRP_STATUS, $row['GRP_STATUS']);
|
||||||
|
$criteria->add(GroupwfPeer::GRP_LDAP_DN, $row['GRP_LDAP_DN']);
|
||||||
|
$criteria->add(GroupwfPeer::GRP_UX, $row['GRP_UX']);
|
||||||
|
BasePeer::doInsert($criteria, $con);
|
||||||
}
|
}
|
||||||
//We will to keep the GRP_ID
|
$con->commit();
|
||||||
if (!empty($groupInfo['GRP_ID'])) {
|
} catch (Exception $e) {
|
||||||
$row['GRP_ID'] = $groupInfo['GRP_ID'];
|
$con->rollback();
|
||||||
}
|
throw $e;
|
||||||
$res = $groupWf->create($row);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4212,7 +4458,8 @@ class Processes
|
|||||||
* @param string $processUid Unique id of Process
|
* @param string $processUid Unique id of Process
|
||||||
* @param array $arrayData Data
|
* @param array $arrayData Data
|
||||||
*
|
*
|
||||||
* return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function createActionsByEmail($processUid, array $arrayData)
|
public function createActionsByEmail($processUid, array $arrayData)
|
||||||
{
|
{
|
||||||
@@ -4784,45 +5031,35 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* function checkExistingGroups
|
* function checkExistingGroups
|
||||||
* checkExistingGroups check if any of the groups listed in the parameter
|
* checkExistingGroups check if any of the groups listed in the parameter
|
||||||
* array exist and wich are those, that is the result $sFilteredGroups array.
|
* array exist and which are those, that is the result $sFilteredGroups array.
|
||||||
*
|
*
|
||||||
* @author gustavo cruz gustavo-at-colosa.com
|
* @param array $groupList, array of a group list
|
||||||
* @param $sGroupList array of a group list
|
* @return array|null, array of existing groups or null
|
||||||
* @return $existingGroupList array of existing groups or null
|
|
||||||
*/
|
*/
|
||||||
public function checkExistingGroups($sGroupList)
|
public function checkExistingGroups($groupList)
|
||||||
{
|
{
|
||||||
$aGroupwf = array();
|
$existingGroupList = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
|
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
|
||||||
$oCriteria->addSelectColumn(GroupwfPeer::GRP_TITLE);
|
$criteria->addSelectColumn(GroupwfPeer::GRP_TITLE);
|
||||||
$oDataset = GroupwfPeer::doSelectRS($oCriteria);
|
$dataset = GroupwfPeer::doSelectRS($criteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$dataset->next();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$aGroupwf[] = $aRow;
|
foreach ($groupList as $group) {
|
||||||
$oDataset->next();
|
//Check if any group name exists in the database
|
||||||
}
|
if ($row['GRP_TITLE'] === $group['GRP_TITLE'] && $row['GRP_UID'] !== $group['GRP_UID']) {
|
||||||
//check if any group name exists in the dbase
|
$groupWf = GroupwfPeer::retrieveByPk($group['GRP_UID']);
|
||||||
if (is_array($sGroupList)) {
|
if (is_object($groupWf) && get_class($groupWf) == 'Groupwf') {
|
||||||
foreach ($aGroupwf as $groupBase) {
|
$group['GRP_UID'] = G::generateUniqueID();
|
||||||
foreach ($sGroupList as $group) {
|
|
||||||
if ($groupBase['GRP_TITLE'] == $group['GRP_TITLE'] && $groupBase['GRP_UID'] != $group['GRP_UID']) {
|
|
||||||
$oPro = GroupwfPeer::retrieveByPk( $group['GRP_UID'] );
|
|
||||||
if(is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') {
|
|
||||||
$group['GRP_UID'] = G::generateUniqueID();
|
|
||||||
}
|
|
||||||
$existingGroupList[] = $group;
|
|
||||||
}
|
}
|
||||||
|
$existingGroupList[] = $group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$dataset->next();
|
||||||
}
|
}
|
||||||
//return $sGroupList;
|
|
||||||
if (isset($existingGroupList)) {
|
return !empty($existingGroupList) ? $existingGroupList : null;
|
||||||
return $existingGroupList;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5499,54 +5736,21 @@ class Processes
|
|||||||
|
|
||||||
$this->createProcessPropertiesFromData($oData);
|
$this->createProcessPropertiesFromData($oData);
|
||||||
|
|
||||||
// $this->createLaneRows( $oData->lanes );
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (isset( $oData->gateways )) {
|
|
||||||
// $this->createGatewayRows( $oData->gateways );
|
|
||||||
// }
|
|
||||||
// $this->createDynaformRows( $oData->dynaforms );
|
|
||||||
// $this->createInputRows( $oData->inputs );
|
|
||||||
// $this->createOutputRows( $oData->outputs );
|
|
||||||
// $this->createStepRows( $oData->steps );
|
|
||||||
// $this->createStepSupervisorRows( isset( $oData->stepSupervisor ) ? $oData->stepSupervisor : array () );
|
|
||||||
// $this->createTriggerRows( $oData->triggers );
|
|
||||||
// $this->createStepTriggerRows( $oData->steptriggers );
|
|
||||||
// $this->createTaskUserRows( $oData->taskusers );
|
|
||||||
// $this->createGroupRow( $oData->groupwfs );
|
|
||||||
// $this->createDBConnectionsRows( isset( $oData->dbconnections ) ? $oData->dbconnections : array () );
|
|
||||||
// $this->createReportTables( isset( $oData->reportTables ) ? $oData->reportTables : array (), isset( $oData->reportTablesVars ) ? $oData->reportTablesVars : array () );
|
|
||||||
// $this->createSubProcessRows( isset( $oData->subProcess ) ? $oData->subProcess : array () );
|
|
||||||
// $this->createCaseTrackerRows( isset( $oData->caseTracker ) ? $oData->caseTracker : array () );
|
|
||||||
// $this->createCaseTrackerObjectRows( isset( $oData->caseTrackerObject ) ? $oData->caseTrackerObject : array () );
|
|
||||||
// $this->createObjectPermissionsRows( isset( $oData->objectPermissions ) ? $oData->objectPermissions : array () );
|
|
||||||
// $this->createStageRows( isset( $oData->stage ) ? $oData->stage : array () );
|
|
||||||
//
|
|
||||||
// $this->createFieldCondition( isset( $oData->fieldCondition ) ? $oData->fieldCondition : array (), $oData->dynaforms );
|
|
||||||
//
|
|
||||||
// // Create before to createRouteRows for avoid duplicates
|
|
||||||
// $this->createEventRows( isset( $oData->event ) ? $oData->event : array () );
|
|
||||||
//
|
|
||||||
// $this->createCaseSchedulerRows( isset( $oData->caseScheduler ) ? $oData->caseScheduler : array () );
|
|
||||||
//
|
|
||||||
// //Create data related to Configuration table
|
|
||||||
// $this->createTaskExtraPropertiesRows( isset( $oData->taskExtraProperties ) ? $oData->taskExtraProperties : array () );
|
|
||||||
|
|
||||||
// and finally create the files, dynaforms (xml and html), emailTemplates and Public files
|
|
||||||
$this->createFiles($oData, $pmFilename);
|
$this->createFiles($oData, $pmFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates a new Process, defined in the object $oData
|
||||||
|
*
|
||||||
|
* @param object $oData
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function createProcessPropertiesFromData($oData)
|
public function createProcessPropertiesFromData($oData)
|
||||||
{
|
{
|
||||||
$arrayProcessData = $oData->process;
|
$arrayProcessData = $oData->process;
|
||||||
|
|
||||||
// (*) Creating process dependencies
|
|
||||||
// creating the process category
|
|
||||||
$this->createProcessCategoryRow(isset($oData->processCategory) ? $oData->processCategory : null);
|
$this->createProcessCategoryRow(isset($oData->processCategory) ? $oData->processCategory : null);
|
||||||
|
|
||||||
$this->createLaneRows($oData->lanes);
|
$this->createLaneRows($oData->lanes);
|
||||||
|
|
||||||
|
|
||||||
if (isset($oData->gateways)) {
|
if (isset($oData->gateways)) {
|
||||||
$this->createGatewayRows($oData->gateways);
|
$this->createGatewayRows($oData->gateways);
|
||||||
}
|
}
|
||||||
@@ -5557,8 +5761,8 @@ class Processes
|
|||||||
$this->createStepSupervisorRows(isset($oData->stepSupervisor) ? $oData->stepSupervisor : array());
|
$this->createStepSupervisorRows(isset($oData->stepSupervisor) ? $oData->stepSupervisor : array());
|
||||||
$this->createTriggerRows($oData->triggers);
|
$this->createTriggerRows($oData->triggers);
|
||||||
$this->createStepTriggerRows($oData->steptriggers);
|
$this->createStepTriggerRows($oData->steptriggers);
|
||||||
$this->createTaskUserRows($oData->taskusers);
|
|
||||||
$this->createGroupRow($oData->groupwfs);
|
$this->createGroupRow($oData->groupwfs);
|
||||||
|
$this->createTaskUserRows($oData->taskusers);
|
||||||
$this->createDBConnectionsRows(isset($oData->dbconnections) ? $oData->dbconnections : array());
|
$this->createDBConnectionsRows(isset($oData->dbconnections) ? $oData->dbconnections : array());
|
||||||
$this->createReportTables(isset($oData->reportTables) ? $oData->reportTables : array(), isset($oData->reportTablesVars) ? $oData->reportTablesVars : array());
|
$this->createReportTables(isset($oData->reportTables) ? $oData->reportTables : array(), isset($oData->reportTablesVars) ? $oData->reportTablesVars : array());
|
||||||
$this->createSubProcessRows(isset($oData->subProcess) ? $oData->subProcess : array());
|
$this->createSubProcessRows(isset($oData->subProcess) ? $oData->subProcess : array());
|
||||||
@@ -5566,17 +5770,14 @@ class Processes
|
|||||||
$this->createCaseTrackerObjectRows(isset($oData->caseTrackerObject) ? $oData->caseTrackerObject : array());
|
$this->createCaseTrackerObjectRows(isset($oData->caseTrackerObject) ? $oData->caseTrackerObject : array());
|
||||||
$this->createObjectPermissionsRows(isset($oData->objectPermissions) ? $oData->objectPermissions : array());
|
$this->createObjectPermissionsRows(isset($oData->objectPermissions) ? $oData->objectPermissions : array());
|
||||||
$this->createStageRows(isset($oData->stage) ? $oData->stage : array());
|
$this->createStageRows(isset($oData->stage) ? $oData->stage : array());
|
||||||
|
|
||||||
$this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms);
|
$this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms);
|
||||||
|
|
||||||
// Create before to createRouteRows for avoid duplicates
|
// Create before to createRouteRows for avoid duplicates
|
||||||
$this->createEventRows(isset($oData->event) ? $oData->event : array());
|
$this->createEventRows(isset($oData->event) ? $oData->event : array());
|
||||||
|
|
||||||
$this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array());
|
$this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array());
|
||||||
|
|
||||||
//Create data related to Configuration table
|
//Create data related to Configuration table
|
||||||
$this->createTaskExtraPropertiesRows(isset($oData->taskExtraProperties) ? $oData->taskExtraProperties : array());
|
$this->createTaskExtraPropertiesRows(isset($oData->taskExtraProperties) ? $oData->taskExtraProperties : array());
|
||||||
|
|
||||||
$this->createProcessUser((isset($oData->processUser)) ? $oData->processUser : array());
|
$this->createProcessUser((isset($oData->processUser)) ? $oData->processUser : array());
|
||||||
$this->createProcessVariables((isset($oData->processVariables)) ? $oData->processVariables : array());
|
$this->createProcessVariables((isset($oData->processVariables)) ? $oData->processVariables : array());
|
||||||
$this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry)) ? $oData->webEntry : array());
|
$this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry)) ? $oData->webEntry : array());
|
||||||
@@ -5715,10 +5916,12 @@ class Processes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this function creates a new Process, defined in the object $oData
|
* This function creates a new Process, defined in the object $oData
|
||||||
*
|
*
|
||||||
* @param string $sProUid
|
* @param object $oData
|
||||||
* @return boolean
|
* @param string $pmFilename
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function updateProcessFromData($oData, $pmFilename)
|
public function updateProcessFromData($oData, $pmFilename)
|
||||||
{
|
{
|
||||||
@@ -5736,8 +5939,8 @@ class Processes
|
|||||||
$this->createStepSupervisorRows($oData->stepSupervisor);
|
$this->createStepSupervisorRows($oData->stepSupervisor);
|
||||||
$this->createTriggerRows($oData->triggers);
|
$this->createTriggerRows($oData->triggers);
|
||||||
$this->createStepTriggerRows($oData->steptriggers);
|
$this->createStepTriggerRows($oData->steptriggers);
|
||||||
$this->createTaskUserRows($oData->taskusers);
|
|
||||||
$this->createGroupRow($oData->groupwfs);
|
$this->createGroupRow($oData->groupwfs);
|
||||||
|
$this->createTaskUserRows($oData->taskusers);
|
||||||
$this->createDBConnectionsRows($oData->dbconnections);
|
$this->createDBConnectionsRows($oData->dbconnections);
|
||||||
$this->updateReportTables($oData->reportTables, $oData->reportTablesVars);
|
$this->updateReportTables($oData->reportTables, $oData->reportTablesVars);
|
||||||
$this->createFiles($oData, $pmFilename);
|
$this->createFiles($oData, $pmFilename);
|
||||||
|
|||||||
@@ -3215,7 +3215,7 @@ function PMFGetGroupName($grpUid, $lang = SYS_LANG) {
|
|||||||
* @param string | $text | Text
|
* @param string | $text | Text
|
||||||
* @param string | $category | Category
|
* @param string | $category | Category
|
||||||
* @param string | $proUid | ProcessUid
|
* @param string | $proUid | ProcessUid
|
||||||
* @param string | $lang | Languaje
|
* @param string | $lang | Language
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function PMFGetUidFromText($text, $category, $proUid = null, $lang = SYS_LANG)
|
function PMFGetUidFromText($text, $category, $proUid = null, $lang = SYS_LANG)
|
||||||
@@ -3467,14 +3467,28 @@ function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null
|
|||||||
if ($arrayApplicationData === false) {
|
if ($arrayApplicationData === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$conf = new Configurations();
|
||||||
|
$envSkin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', '');
|
||||||
$workspace = (!empty($workspace)) ? $workspace : config("system.workspace");
|
$workspace = (!empty($workspace)) ? $workspace : config("system.workspace");
|
||||||
$language = (!empty($language)) ? $language : SYS_LANG;
|
$language = (!empty($language)) ? $language : SYS_LANG;
|
||||||
$skin = (!empty($skin)) ? $skin : SYS_SKIN;
|
$skin = (!empty($skin)) ? $skin : $envSkin;
|
||||||
|
|
||||||
$uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid;
|
$uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid;
|
||||||
|
|
||||||
//Return
|
$envHost = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : SERVER_NAME;
|
||||||
return ((G::is_https()) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $uri;
|
$envProtocol = defined("REQUEST_SCHEME") && REQUEST_SCHEME === "https";
|
||||||
|
if (isset($_SERVER['SERVER_PORT'])) {
|
||||||
|
$envPort = ($_SERVER['SERVER_PORT'] != "80") ? ":" . $_SERVER['SERVER_PORT'] : "";
|
||||||
|
} else if (defined('SERVER_PORT')) {
|
||||||
|
$envPort = (SERVER_PORT . "" != "80") ? ":" . SERVER_PORT : "";
|
||||||
|
} else {
|
||||||
|
$envPort = "";
|
||||||
|
}
|
||||||
|
if (!empty($envPort) && strpos($envHost, $envPort) === false) {
|
||||||
|
$envHost = $envHost . $envPort;
|
||||||
|
}
|
||||||
|
$link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . $uri;
|
||||||
|
return $link;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,41 @@ function validateType($value, $type)
|
|||||||
|
|
||||||
class AdditionalTables extends BaseAdditionalTables
|
class AdditionalTables extends BaseAdditionalTables
|
||||||
{
|
{
|
||||||
public $fields = array();
|
const FLD_TYPE_VALUES = [
|
||||||
public $primaryKeys = array();
|
'BIGINT',
|
||||||
|
'BOOLEAN',
|
||||||
|
'CHAR',
|
||||||
|
'DATE',
|
||||||
|
'DATETIME',
|
||||||
|
'DECIMAL',
|
||||||
|
'DOUBLE',
|
||||||
|
'FLOAT',
|
||||||
|
'INTEGER',
|
||||||
|
'LONGVARCHAR',
|
||||||
|
'REAL',
|
||||||
|
'SMALLINT',
|
||||||
|
'TIME',
|
||||||
|
'TIMESTAMP',
|
||||||
|
'TINYINT',
|
||||||
|
'VARCHAR'
|
||||||
|
];
|
||||||
|
const FLD_TYPE_WITH_AUTOINCREMENT = [
|
||||||
|
'BIGINT',
|
||||||
|
'INTEGER',
|
||||||
|
'SMALLINT',
|
||||||
|
'TINYINT'
|
||||||
|
];
|
||||||
|
const FLD_TYPE_WITH_SIZE = [
|
||||||
|
'BIGINT',
|
||||||
|
'CHAR',
|
||||||
|
'DECIMAL',
|
||||||
|
'FLOAT',
|
||||||
|
'INTEGER',
|
||||||
|
'LONGVARCHAR',
|
||||||
|
'VARCHAR'
|
||||||
|
];
|
||||||
|
public $fields = [];
|
||||||
|
public $primaryKeys = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function load
|
* Function load
|
||||||
@@ -707,85 +740,84 @@ class AdditionalTables extends BaseAdditionalTables
|
|||||||
*/
|
*/
|
||||||
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '', $addTabUid = '')
|
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '', $addTabUid = '')
|
||||||
{
|
{
|
||||||
require_once "classes/model/Application.php";
|
|
||||||
|
|
||||||
$this->className = $this->getPHPName($tableName);
|
$this->className = $this->getPHPName($tableName);
|
||||||
$this->classPeerName = $this->className . 'Peer';
|
$this->classPeerName = $this->className . 'Peer';
|
||||||
|
|
||||||
if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) {
|
if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) {
|
||||||
throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php'
|
throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php' . " class file doesn't exit!");
|
||||||
. " class file doesn't exit!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||||
|
|
||||||
|
//get fields
|
||||||
|
$fieldTypes = [];
|
||||||
|
if ($addTabUid != '') {
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
|
||||||
|
$dataset = FieldsPeer::doSelectRS($criteria);
|
||||||
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($dataset->next()) {
|
||||||
|
$row = $dataset->getRow();
|
||||||
|
switch ($row['FLD_TYPE']) {
|
||||||
|
case 'FLOAT':
|
||||||
|
case 'DOUBLE':
|
||||||
|
case 'INTEGER':
|
||||||
|
$fieldTypes[] = array($row['FLD_NAME'] => $row['FLD_TYPE']);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove old applications references
|
||||||
|
$connection = Propel::getConnection($sConnection);
|
||||||
|
$statement = $connection->createStatement();
|
||||||
|
$sql = "TRUNCATE " . $tableName;
|
||||||
|
$statement->executeQuery($sql);
|
||||||
|
|
||||||
|
$case = new Cases();
|
||||||
|
$context = Bootstrap::getDefaultContextLog();
|
||||||
|
|
||||||
//select cases for this Process, ordered by APP_NUMBER
|
//select cases for this Process, ordered by APP_NUMBER
|
||||||
$con = Propel::getConnection($sConnection);
|
|
||||||
$stmt = $con->createStatement();
|
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$criteria->add(ApplicationPeer::PRO_UID, $processUid);
|
$criteria->add(ApplicationPeer::PRO_UID, $processUid);
|
||||||
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||||
$dataset = ApplicationPeer::doSelectRS($criteria);
|
$dataset = ApplicationPeer::doSelectRS($criteria);
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($dataset->next()) {
|
while ($dataset->next()) {
|
||||||
$row = $dataset->getRow();
|
$row = $dataset->getRow();
|
||||||
//remove old applications references
|
|
||||||
$deleteSql = "DELETE FROM $tableName WHERE APP_UID = '" . $row['APP_UID'] . "'";
|
|
||||||
$rs = $stmt->executeQuery($deleteSql);
|
|
||||||
// getting the case data
|
|
||||||
$caseData = unserialize($row['APP_DATA']);
|
|
||||||
|
|
||||||
$fieldTypes = array();
|
//getting the case data
|
||||||
|
$appData = $case->unserializeData($row['APP_DATA']);
|
||||||
|
|
||||||
if ($addTabUid != '') {
|
//quick fix, map all empty values as NULL for Database
|
||||||
require_once 'classes/model/Fields.php';
|
foreach ($appData as $appDataKey => $appDataValue) {
|
||||||
$criteriaField = new Criteria('workflow');
|
if (is_array($appDataValue) && count($appDataValue)) {
|
||||||
$criteriaField->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
|
$j = key($appDataValue);
|
||||||
$datasetField = FieldsPeer::doSelectRS($criteriaField);
|
$appDataValue = is_array($appDataValue[$j]) ? $appDataValue : $appDataValue[$j];
|
||||||
$datasetField->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
while ($datasetField->next()) {
|
|
||||||
$rowfield = $datasetField->getRow();
|
|
||||||
switch ($rowfield['FLD_TYPE']) {
|
|
||||||
case 'FLOAT':
|
|
||||||
case 'DOUBLE':
|
|
||||||
case 'INTEGER':
|
|
||||||
$fieldTypes[] = array($rowfield['FLD_NAME'] => $rowfield['FLD_TYPE']);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
if (is_string($appDataValue)) {
|
||||||
|
|
||||||
// quick fix
|
|
||||||
// map all empty values as NULL for Database
|
|
||||||
foreach ($caseData as $dKey => $dValue) {
|
|
||||||
if (is_array($dValue) && count($dValue)) {
|
|
||||||
$j = key($dValue);
|
|
||||||
$dValue = (is_array($dValue[$j])) ? $dValue : $dValue[$j];
|
|
||||||
}
|
|
||||||
if (is_string($dValue)) {
|
|
||||||
foreach ($fieldTypes as $key => $fieldType) {
|
foreach ($fieldTypes as $key => $fieldType) {
|
||||||
foreach ($fieldType as $name => $theType) {
|
foreach ($fieldType as $fieldTypeKey => $fieldTypeValue) {
|
||||||
if (strtoupper($dKey) == $name) {
|
if (strtoupper($appDataKey) == $fieldTypeKey) {
|
||||||
$caseData[$dKey] = validateType($dValue, $theType);
|
$appData[$appDataKey] = validateType($appDataValue, $fieldTypeValue);
|
||||||
unset($name);
|
unset($fieldTypeKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// normal fields
|
// normal fields
|
||||||
if (trim($dValue) === '') {
|
if (trim($appDataValue) === '') {
|
||||||
$caseData[$dKey] = null;
|
$appData[$appDataKey] = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// grids
|
// grids
|
||||||
if (is_array($caseData[$dKey])) {
|
if (is_array($appData[$appDataKey])) {
|
||||||
foreach ($caseData[$dKey] as $dIndex => $dRow) {
|
foreach ($appData[$appDataKey] as $dIndex => $dRow) {
|
||||||
if (is_array($dRow)) {
|
if (is_array($dRow)) {
|
||||||
foreach ($dRow as $k => $v) {
|
foreach ($dRow as $k => $v) {
|
||||||
if (is_string($v) && trim($v) === '') {
|
if (is_string($v) && trim($v) === '') {
|
||||||
$caseData[$dKey][$dIndex][$k] = null;
|
$appData[$appDataKey][$dIndex][$k] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -794,33 +826,48 @@ class AdditionalTables extends BaseAdditionalTables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//populate data
|
||||||
|
$className = $this->className;
|
||||||
if ($type === 'GRID') {
|
if ($type === 'GRID') {
|
||||||
list($gridName, $gridUid) = explode('-', $gridKey);
|
list($gridName, $gridUid) = explode('-', $gridKey);
|
||||||
$gridData = isset($caseData[$gridName]) ? $caseData[$gridName] : array();
|
$gridData = isset($appData[$gridName]) ? $appData[$gridName] : [];
|
||||||
|
|
||||||
foreach ($gridData as $i => $gridRow) {
|
foreach ($gridData as $i => $gridRow) {
|
||||||
eval('$obj = new ' . $this->className . '();');
|
try {
|
||||||
$obj->fromArray($caseData, BasePeer::TYPE_FIELDNAME);
|
$obj = new $className();
|
||||||
|
$obj->fromArray($appData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
$obj->setAppUid($row['APP_UID']);
|
||||||
|
$obj->setAppNumber($row['APP_NUMBER']);
|
||||||
|
if (method_exists($obj, 'setAppStatus')) {
|
||||||
|
$obj->setAppStatus($row['APP_STATUS']);
|
||||||
|
}
|
||||||
|
$obj->fromArray(array_change_key_case($gridRow, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
||||||
|
$obj->setRow($i);
|
||||||
|
$obj->save();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$context["message"] = $e->getMessage();
|
||||||
|
$context["tableName"] = $tableName;
|
||||||
|
$context["appUid"] = $row['APP_UID'];
|
||||||
|
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
|
||||||
|
}
|
||||||
|
unset($obj);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$obj = new $className();
|
||||||
|
$obj->fromArray(array_change_key_case($appData, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
||||||
$obj->setAppUid($row['APP_UID']);
|
$obj->setAppUid($row['APP_UID']);
|
||||||
$obj->setAppNumber($row['APP_NUMBER']);
|
$obj->setAppNumber($row['APP_NUMBER']);
|
||||||
if (method_exists($obj, 'setAppStatus')) {
|
if (method_exists($obj, 'setAppStatus')) {
|
||||||
$obj->setAppStatus($row['APP_STATUS']);
|
$obj->setAppStatus($row['APP_STATUS']);
|
||||||
}
|
}
|
||||||
$obj->fromArray(array_change_key_case($gridRow, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
|
||||||
$obj->setRow($i);
|
|
||||||
$obj->save();
|
$obj->save();
|
||||||
eval('$obj = new ' . $this->className . '();');
|
} catch (Exception $e) {
|
||||||
|
$context["message"] = $e->getMessage();
|
||||||
|
$context["tableName"] = $tableName;
|
||||||
|
$context["appUid"] = $row['APP_UID'];
|
||||||
|
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
|
||||||
}
|
}
|
||||||
} else {
|
unset($obj);
|
||||||
eval('$obj = new ' . $this->className . '();');
|
|
||||||
$obj->fromArray(array_change_key_case($caseData, CASE_UPPER), BasePeer::TYPE_FIELDNAME);
|
|
||||||
$obj->setAppUid($row['APP_UID']);
|
|
||||||
$obj->setAppNumber($row['APP_NUMBER']);
|
|
||||||
if (method_exists($obj, 'setAppStatus')) {
|
|
||||||
$obj->setAppStatus($row['APP_STATUS']);
|
|
||||||
}
|
|
||||||
$obj->save();
|
|
||||||
$obj = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1022,94 +1069,181 @@ class AdditionalTables extends BaseAdditionalTables
|
|||||||
return $reportTables;
|
return $reportTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all data of AdditionalTables.
|
||||||
|
*
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
* @param string $filter
|
||||||
|
* @param array $process
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
|
public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
|
||||||
{
|
{
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
$criteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
$criteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||||
|
|
||||||
if (isset($process)) {
|
if (isset($process)) {
|
||||||
foreach ($process as $key => $pro_uid) {
|
foreach ($process as $key => $pro_uid) {
|
||||||
if ($key == 'equal') {
|
if ($key == 'equal') {
|
||||||
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL);
|
$criteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL);
|
||||||
} else {
|
} else {
|
||||||
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL);
|
$criteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filter != '' && is_string($filter)) {
|
if ($filter != '' && is_string($filter)) {
|
||||||
$oCriteria->add(
|
$subCriteria2 = $criteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%'
|
||||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr(
|
. $filter
|
||||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE)
|
. '%', Criteria::LIKE);
|
||||||
)
|
$subCriteria1 = $criteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%'
|
||||||
);
|
. $filter
|
||||||
|
. '%', Criteria::LIKE)
|
||||||
|
->addOr($subCriteria2);
|
||||||
|
$criteria->add($subCriteria1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['sort'])) {
|
$criteria->addAsColumn("PRO_TITLE", ProcessPeer::PRO_TITLE);
|
||||||
if ($_POST['dir'] == 'ASC') {
|
$criteria->addAsColumn("PRO_DESCRIPTION", ProcessPeer::PRO_DESCRIPTION);
|
||||||
eval('$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');');
|
$criteria->addJoin(AdditionalTablesPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||||
} else {
|
|
||||||
eval('$oCriteria->addDescendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');');
|
$stringBuild = '';
|
||||||
|
$stringSql = "ADDITIONAL_TABLES.ADD_TAB_NAME IN ("
|
||||||
|
. "SELECT TABLE_NAME "
|
||||||
|
. "FROM information_schema.tables "
|
||||||
|
. "WHERE table_schema = DATABASE()"
|
||||||
|
. ")";
|
||||||
|
$buildNumberRows = clone $criteria;
|
||||||
|
$buildNumberRows->clear();
|
||||||
|
$buildNumberRows->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||||
|
$buildNumberRows->addAsColumn("EXISTS_TABLE", $stringSql);
|
||||||
|
$dataset1 = AdditionalTablesPeer::doSelectRS($buildNumberRows);
|
||||||
|
$dataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($dataset1->next()) {
|
||||||
|
$row = $dataset1->getRow();
|
||||||
|
$stringCount = "'" . G::LoadTranslation('ID_TABLE_NOT_FOUND') . "'";
|
||||||
|
if ($row["EXISTS_TABLE"] === "1") {
|
||||||
|
$stringCount = "(SELECT COUNT(*) FROM " . $row["ADD_TAB_NAME"] . ")";
|
||||||
}
|
}
|
||||||
|
$stringBuild = $stringBuild
|
||||||
|
. "WHEN '" . $row["ADD_TAB_NAME"]
|
||||||
|
. "' THEN " . $stringCount
|
||||||
|
. " \n";
|
||||||
|
}
|
||||||
|
$clauseRows = empty($stringBuild) ? "''" : "(CASE "
|
||||||
|
. AdditionalTablesPeer::ADD_TAB_NAME
|
||||||
|
. " "
|
||||||
|
. $stringBuild
|
||||||
|
. " END)";
|
||||||
|
$criteria->addAsColumn("NUM_ROWS", $clauseRows);
|
||||||
|
|
||||||
|
if (empty($_POST['sort'])) {
|
||||||
|
$criteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||||
} else {
|
} else {
|
||||||
$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
$column = $_POST["sort"];
|
||||||
|
if (defined('AdditionalTablesPeer::' . $column)) {
|
||||||
|
$column = constant('AdditionalTablesPeer::' . $column);
|
||||||
|
}
|
||||||
|
if ($column === "NUM_ROWS") {
|
||||||
|
$column = "IF(" . $column . "='" . G::LoadTranslation('ID_TABLE_NOT_FOUND') . "',-1," . $column . ")";
|
||||||
|
}
|
||||||
|
if ($_POST['dir'] == 'ASC') {
|
||||||
|
$criteria->addAscendingOrderByColumn($column);
|
||||||
|
} else {
|
||||||
|
$criteria->addDescendingOrderByColumn($column);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteriaCount = clone $oCriteria;
|
$criteriaCount = clone $criteria;
|
||||||
$count = AdditionalTablesPeer::doCount($criteriaCount);
|
$count = AdditionalTablesPeer::doCount($criteriaCount);
|
||||||
|
|
||||||
$oCriteria->setLimit($limit);
|
$criteria->setLimit($limit);
|
||||||
$oCriteria->setOffset($start);
|
$criteria->setOffset($start);
|
||||||
|
|
||||||
$oDataset = AdditionalTablesPeer::doSelectRS($oCriteria);
|
$dataset = AdditionalTablesPeer::doSelectRS($criteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$addTables = array();
|
$addTables = [];
|
||||||
$proUids = array();
|
while ($dataset->next()) {
|
||||||
|
$row = $dataset->getRow();
|
||||||
while ($oDataset->next()) {
|
|
||||||
$row = $oDataset->getRow();
|
|
||||||
$row['PRO_TITLE'] = $row['PRO_DESCRIPTION'] = '';
|
|
||||||
$addTables[] = $row;
|
$addTables[] = $row;
|
||||||
if ($row['PRO_UID'] != '') {
|
|
||||||
$proUids[] = $row['PRO_UID'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//process details will have the info about the processes
|
return [
|
||||||
$procDetails = array();
|
'rows' => $addTables,
|
||||||
|
'count' => $count
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if (count($proUids) > 0) {
|
/**
|
||||||
//now get the labels for all process, using an array of Uids,
|
* Get the table properties
|
||||||
$c = new Criteria('workflow');
|
*
|
||||||
$c->add(ProcessPeer::PRO_UID, $proUids, Criteria::IN);
|
* @param string $tabUid
|
||||||
$dt = ProcessPeer::doSelectRS($c);
|
* @param array $tabData
|
||||||
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
* @param boolean $isReportTable
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getTableProperties($tabUid, $tabData = [], $isReportTable = false)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(AdditionalTablesPeer::ADD_TAB_UID, $tabUid, Criteria::EQUAL);
|
||||||
|
$dataset = AdditionalTablesPeer::doSelectOne($criteria);
|
||||||
|
|
||||||
while ($dt->next()) {
|
$dataValidate = [];
|
||||||
$row = $dt->getRow();
|
if (!is_null($dataset)) {
|
||||||
$procDetails[$row['PRO_UID']]['PRO_TITLE'] = $row['PRO_TITLE'];
|
$dataValidate['rep_tab_uid'] = $tabUid;
|
||||||
$procDetails[$row['PRO_UID']]['PRO_DESCRIPTION'] = $row['PRO_DESCRIPTION'];
|
|
||||||
|
$tableName = $dataset->getAddTabName();
|
||||||
|
if (substr($tableName, 0, 4) === 'PMT_') {
|
||||||
|
$tableNameWithoutPrefixPmt = substr($tableName, 4);
|
||||||
|
} else {
|
||||||
|
$tableNameWithoutPrefixPmt = $tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($addTables as $i => $addTable) {
|
$dataValidate['rep_tab_name'] = $tableNameWithoutPrefixPmt;
|
||||||
if (isset($procDetails[$addTable['PRO_UID']]['PRO_TITLE'])) {
|
$dataValidate['rep_tab_name_old_name'] = $tableName;
|
||||||
$addTables[$i]['PRO_TITLE'] = $procDetails[$addTable['PRO_UID']]['PRO_TITLE'];
|
$dataValidate['pro_uid'] = $dataset->getProUid();
|
||||||
}
|
$dataValidate['rep_tab_dsc'] = $dataset->getAddTabDescription();
|
||||||
|
$dataValidate['rep_tab_connection'] = $dataset->getDbsUid();
|
||||||
|
$dataValidate['rep_tab_type'] = $dataset->getAddTabType();
|
||||||
|
$dataValidate['rep_tab_grid'] = '';
|
||||||
|
|
||||||
if (isset($procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'])) {
|
if ($isReportTable) {
|
||||||
$addTables[$i]['PRO_DESCRIPTION'] = $procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'];
|
if (!empty($tabData['pro_uid']) && $dataValidate['pro_uid'] !== $tabData['pro_uid']) {
|
||||||
|
throw (new Exception("The property pro_uid: '". $tabData['pro_uid'] . "' is incorrect."));
|
||||||
|
}
|
||||||
|
if (!empty($tabData['rep_tab_name']) && $tableName !== $tabData['rep_tab_name']) {
|
||||||
|
throw (new Exception("The property rep_tab_name: '". $tabData['rep_tab_name'] . "' is incorrect."));
|
||||||
|
}
|
||||||
|
if (!empty($dataValidate['rep_tab_dsc'])) {
|
||||||
|
$dataValidate['rep_tab_dsc'] = $tabData['rep_tab_dsc'];
|
||||||
|
}
|
||||||
|
$tabGrid = $dataset->getAddTabGrid();
|
||||||
|
if (strpos($tabGrid, '-')) {
|
||||||
|
list($gridName, $gridId) = explode('-', $tabGrid);
|
||||||
|
$dataValidate['rep_tab_grid'] = $gridId;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!empty($tabData['rep_tab_name']) && $tableName !== $tabData['pmt_tab_name']) {
|
||||||
|
throw (new Exception("The property pmt_tab_name: '". $tabData['pmt_tab_name'] . "' is incorrect."));
|
||||||
|
}
|
||||||
|
if (!empty($dataValidate['pmt_tab_dsc'])) {
|
||||||
|
$dataValidate['rep_tab_dsc'] = $tabData['pmt_tab_dsc'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$dataValidate['fields'] = $tabData['fields'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('rows' => $addTables, 'count' => $count);
|
return $dataValidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8975,6 +8975,12 @@ msgstr "No skins to display"
|
|||||||
msgid "No users to display"
|
msgid "No users to display"
|
||||||
msgstr "No users to display"
|
msgstr "No users to display"
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_GRID_VARIABLE_NAME_ERROR
|
||||||
|
#: LABEL/ID_GRID_VARIABLE_NAME_ERROR
|
||||||
|
msgid "A valid variable starts with a letter or underscore, followed by any number of letters, numbers, or underscores. Variables with wrong names: {0}"
|
||||||
|
msgstr "A valid variable starts with a letter or underscore, followed by any number of letters, numbers, or underscores. Variables with wrong names: {0}"
|
||||||
|
|
||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_GRID_WIZARD
|
# LABEL/ID_GRID_WIZARD
|
||||||
#: LABEL/ID_GRID_WIZARD
|
#: LABEL/ID_GRID_WIZARD
|
||||||
@@ -17981,6 +17987,24 @@ msgstr "The mafe translation file is not writable. <br/>Please give write permis
|
|||||||
msgid "Your message has been sent successfully"
|
msgid "Your message has been sent successfully"
|
||||||
msgstr "Your message has been sent successfully"
|
msgstr "Your message has been sent successfully"
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_MAIL_STATUS_ERROR
|
||||||
|
#: LABEL/ID_MAIL_STATUS_ERROR
|
||||||
|
msgid "Error"
|
||||||
|
msgstr "Error"
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_MAIL_STATUS_PENDING
|
||||||
|
#: LABEL/ID_MAIL_STATUS_PENDING
|
||||||
|
msgid "Pending"
|
||||||
|
msgstr "Pending"
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_MAIL_STATUS_SENT
|
||||||
|
#: LABEL/ID_MAIL_STATUS_SENT
|
||||||
|
msgid "Sent"
|
||||||
|
msgstr "Sent"
|
||||||
|
|
||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_MAIL_TEST_SUCCESS
|
# LABEL/ID_MAIL_TEST_SUCCESS
|
||||||
#: LABEL/ID_MAIL_TEST_SUCCESS
|
#: LABEL/ID_MAIL_TEST_SUCCESS
|
||||||
@@ -20705,6 +20729,12 @@ msgstr "File \"{0}\" imported but with errors:"
|
|||||||
msgid "The following fields cannot be created because they contain the reserved words \"{0}\""
|
msgid "The following fields cannot be created because they contain the reserved words \"{0}\""
|
||||||
msgstr "The following fields cannot be created because they contain the reserved words \"{0}\""
|
msgstr "The following fields cannot be created because they contain the reserved words \"{0}\""
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_PMTABLE_INVALID_FIELD_NAME_VARIABLE
|
||||||
|
#: LABEL/ID_PMTABLE_INVALID_FIELD_NAME_VARIABLE
|
||||||
|
msgid "There is a conflict with some field names: \"{0}\", please rename them avoiding the use of numbers and considering that underscores are ignored when validating unique field names."
|
||||||
|
msgstr "There is a conflict with some field names: \"{0}\", please rename them avoiding the use of numbers and considering that underscores are ignored when validating unique field names."
|
||||||
|
|
||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_PMTABLE_INVALID_FILE
|
# LABEL/ID_PMTABLE_INVALID_FILE
|
||||||
#: LABEL/ID_PMTABLE_INVALID_FILE
|
#: LABEL/ID_PMTABLE_INVALID_FILE
|
||||||
|
|||||||
@@ -26,68 +26,70 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
* @param string $httpData->limit
|
* @param string $httpData->limit
|
||||||
* @param string $httpData->textFilter
|
* @param string $httpData->textFilter
|
||||||
*/
|
*/
|
||||||
public function getList ($httpData)
|
public function getList($httpData)
|
||||||
{
|
{
|
||||||
$configurations = new Configurations();
|
$configurations = new Configurations();
|
||||||
$processMap = new ProcessMap();
|
$processMap = new ProcessMap();
|
||||||
|
|
||||||
// setting parameters
|
// setting parameters
|
||||||
$config = $configurations->getConfiguration( 'additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
$config = $configurations->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
|
||||||
$env = $configurations->getConfiguration( 'ENVIRONMENT_SETTINGS', '' );
|
$env = $configurations->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||||
$limit_size = isset( $config->pageSize ) ? $config['pageSize'] : 20;
|
$limit_size = isset($config->pageSize) ? $config['pageSize'] : 20;
|
||||||
$start = isset( $httpData->start ) ? $httpData->start : 0;
|
$start = isset($httpData->start) ? $httpData->start : 0;
|
||||||
$limit = isset( $httpData->limit ) ? $httpData->limit : $limit_size;
|
$limit = isset($httpData->limit) ? $httpData->limit : $limit_size;
|
||||||
$filter = isset( $httpData->textFilter ) ? $httpData->textFilter : '';
|
$filter = isset($httpData->textFilter) ? $httpData->textFilter : '';
|
||||||
$pro_uid = isset( $httpData->pro_uid ) ? $httpData->pro_uid : null;
|
$pro_uid = isset($httpData->pro_uid) ? $httpData->pro_uid : null;
|
||||||
|
|
||||||
if ($pro_uid !== null) {
|
if ($pro_uid !== null) {
|
||||||
$process = $pro_uid == '' ? array ('not_equal' => $pro_uid
|
$process = $pro_uid == '' ? ['not_equal' => $pro_uid] : ['equal' => $pro_uid];
|
||||||
) : array ('equal' => $pro_uid);
|
$addTables = AdditionalTables::getAll(false, false, $filter, $process);
|
||||||
$addTables = AdditionalTables::getAll( false, false, $filter, $process );
|
|
||||||
|
|
||||||
$c = $processMap->getReportTablesCriteria( $pro_uid );
|
$c = $processMap->getReportTablesCriteria($pro_uid);
|
||||||
$oDataset = RoutePeer::doSelectRS( $c );
|
$oDataset = RoutePeer::doSelectRS($c);
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$reportTablesOldList = array ();
|
$reportTablesOldList = array();
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$reportTablesOldList[] = $oDataset->getRow();
|
$reportTablesOldList[] = $oDataset->getRow();
|
||||||
}
|
}
|
||||||
foreach ($reportTablesOldList as $i => $oldRepTab) {
|
foreach ($reportTablesOldList as $i => $oldRepTab) {
|
||||||
if($filter != ''){
|
if ($filter != '') {
|
||||||
if((stripos($oldRepTab['REP_TAB_NAME'], $filter) !== false) || (stripos($oldRepTab['REP_TAB_TITLE'], $filter) !== false)){
|
if ((stripos($oldRepTab['REP_TAB_NAME'], $filter) !== false) ||
|
||||||
$addTables['rows'][] = array ('ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],'PRO_UID' => $oldRepTab['PRO_UID'],'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'),'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],'TYPE' => 'CLASSIC' );
|
(stripos($oldRepTab['REP_TAB_TITLE'], $filter) !== false)) {
|
||||||
}
|
$addTables['rows'][] = [
|
||||||
} else {
|
'ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],
|
||||||
$addTables['rows'][] = array ('ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],'PRO_UID' => $oldRepTab['PRO_UID'],'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'),'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],'TYPE' => 'CLASSIC' );
|
'PRO_UID' => $oldRepTab['PRO_UID'],
|
||||||
}
|
'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'),
|
||||||
|
'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],
|
||||||
|
'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],
|
||||||
|
'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],
|
||||||
|
'TYPE' => 'CLASSIC'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$addTables['rows'][] = [
|
||||||
|
'ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],
|
||||||
|
'PRO_UID' => $oldRepTab['PRO_UID'],
|
||||||
|
'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'),
|
||||||
|
'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],
|
||||||
|
'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],
|
||||||
|
'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],
|
||||||
|
'TYPE' => 'CLASSIC'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$addTables['count'] = count($addTables['rows']);
|
$addTables['count'] = count($addTables['rows']);
|
||||||
if($start != 0){
|
if ($start != 0) {
|
||||||
$addTables['rows'] = array_splice($addTables['rows'], $start);
|
$addTables['rows'] = array_splice($addTables['rows'], $start);
|
||||||
}
|
}
|
||||||
$addTables['rows'] = array_splice($addTables['rows'], 0, $limit);
|
$addTables['rows'] = array_splice($addTables['rows'], 0, $limit);
|
||||||
} else {
|
} else {
|
||||||
$addTables = AdditionalTables::getAll( $start, $limit, $filter );
|
$addTables = AdditionalTables::getAll($start, $limit, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($addTables['rows'] as $i => $table) {
|
foreach ($addTables['rows'] as $i => $table) {
|
||||||
try {
|
//removing the prefix "PMT" to allow alphabetical order (just in view)
|
||||||
$con = Propel::getConnection( PmTable::resolveDbSource( $table['DBS_UID'] ) );
|
if (substr($addTables['rows'][$i]['ADD_TAB_NAME'], 0, 4) == 'PMT_') {
|
||||||
$stmt = $con->createStatement();
|
$addTables['rows'][$i]['ADD_TAB_NAME'] = substr($addTables['rows'][$i]['ADD_TAB_NAME'], 4);
|
||||||
$rs = $stmt->executeQuery( 'SELECT COUNT(*) AS NUM_ROWS from ' . $table['ADD_TAB_NAME'] );
|
|
||||||
if ($rs->next()) {
|
|
||||||
$r = $rs->getRow();
|
|
||||||
$addTables['rows'][$i]['NUM_ROWS'] = $r['NUM_ROWS'];
|
|
||||||
} else {
|
|
||||||
$addTables['rows'][$i]['NUM_ROWS'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//removing the prefix "PMT" to allow alphabetical order (just in view)
|
|
||||||
if (substr( $addTables['rows'][$i]['ADD_TAB_NAME'], 0, 4 ) == 'PMT_') {
|
|
||||||
$addTables['rows'][$i]['ADD_TAB_NAME'] = substr( $addTables['rows'][$i]['ADD_TAB_NAME'], 4 );
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$addTables['rows'][$i]['NUM_ROWS'] = G::LoadTranslation( 'ID_TABLE_NOT_FOUND' );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1152,7 +1154,13 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function genDataReport ($httpData)
|
/**
|
||||||
|
* It eliminates and generates the data report from the cases of a process.
|
||||||
|
*
|
||||||
|
* @param object $httpData
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function genDataReport($httpData)
|
||||||
{
|
{
|
||||||
$result = new stdClass();
|
$result = new stdClass();
|
||||||
|
|
||||||
@@ -1160,12 +1168,26 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$result->success = true;
|
$result->success = true;
|
||||||
|
|
||||||
$additionalTables = new AdditionalTables();
|
$additionalTables = new AdditionalTables();
|
||||||
$table = $additionalTables->load( $httpData->id );
|
$table = $additionalTables->load($httpData->id);
|
||||||
if ($table['PRO_UID'] != '') {
|
|
||||||
$additionalTables->populateReportTable( $table['ADD_TAB_NAME'], PmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] );
|
|
||||||
$result->message = 'generated for table ' . $table['ADD_TAB_NAME'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!empty($table) && $table['PRO_UID'] != '') {
|
||||||
|
try {
|
||||||
|
$additionalTables->populateReportTable($table['ADD_TAB_NAME'], PmTable::resolveDbSource($table['DBS_UID']), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID']);
|
||||||
|
$result->message = 'Generated for table ' . $table['ADD_TAB_NAME'];
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$context = Bootstrap::getDefaultContextLog();
|
||||||
|
$context['proUid'] = $table['PRO_UID'];
|
||||||
|
$context['tableName'] = $table['ADD_TAB_NAME'];
|
||||||
|
$context['message'] = $e->getMessage();
|
||||||
|
Bootstrap::registerMonolog('dataReport', 500, 'Generation of data report could not be completed', $context, $context['workspace'], 'processmaker.log');
|
||||||
|
|
||||||
|
$result->message = 'Generation of data report could not be completed. Please check the processmaker.log for more details.';
|
||||||
|
$result->success = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result->message = 'Unable to retrieve the table for this id: ' . $httpData->id . '.';
|
||||||
|
$result->success = false;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58323,6 +58323,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
|||||||
( 'LABEL','ID_GRID_PAGE_NO_ROWS_MESSAGE','en','No rows to display','2014-01-15') ,
|
( 'LABEL','ID_GRID_PAGE_NO_ROWS_MESSAGE','en','No rows to display','2014-01-15') ,
|
||||||
( 'LABEL','ID_GRID_PAGE_NO_SKIN_MESSAGE','en','No skins to display','2014-01-15') ,
|
( 'LABEL','ID_GRID_PAGE_NO_SKIN_MESSAGE','en','No skins to display','2014-01-15') ,
|
||||||
( 'LABEL','ID_GRID_PAGE_NO_USERS_MESSAGE','en','No users to display','2014-01-15') ,
|
( 'LABEL','ID_GRID_PAGE_NO_USERS_MESSAGE','en','No users to display','2014-01-15') ,
|
||||||
|
( 'LABEL','ID_GRID_VARIABLE_NAME_ERROR','en','A valid variable starts with a letter or underscore, followed by any number of letters, numbers, or underscores. Variables with wrong names: {0}','2017-11-16') ,
|
||||||
( 'LABEL','ID_GRID_WIZARD','en','ProcessMaker Grid Wizard','2014-01-15') ,
|
( 'LABEL','ID_GRID_WIZARD','en','ProcessMaker Grid Wizard','2014-01-15') ,
|
||||||
( 'LABEL','ID_GROUP','en','Group','2014-01-15') ,
|
( 'LABEL','ID_GROUP','en','Group','2014-01-15') ,
|
||||||
( 'LABEL','ID_GROUPS','en','Groups','2014-01-15') ,
|
( 'LABEL','ID_GROUPS','en','Groups','2014-01-15') ,
|
||||||
@@ -59834,6 +59835,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
|||||||
( 'LABEL','ID_MAFE_TRANSLATION_DIRECTORY','en','Mafe Translation Directory','2018-07-09') ,
|
( 'LABEL','ID_MAFE_TRANSLATION_DIRECTORY','en','Mafe Translation Directory','2018-07-09') ,
|
||||||
( 'LABEL','ID_MAFE_TRANSLATION_NOT_WRITEABLE','en','The mafe translation file is not writable. <br/>Please give write permission to file:','2018-07-09') ,
|
( 'LABEL','ID_MAFE_TRANSLATION_NOT_WRITEABLE','en','The mafe translation file is not writable. <br/>Please give write permission to file:','2018-07-09') ,
|
||||||
( 'LABEL','ID_MAIL_SENT_SUCCESSFULLY','en','Your message has been sent successfully','2014-01-15') ,
|
( 'LABEL','ID_MAIL_SENT_SUCCESSFULLY','en','Your message has been sent successfully','2014-01-15') ,
|
||||||
|
( 'LABEL','ID_MAIL_STATUS_ERROR','en','Error','2018-10-02') ,
|
||||||
|
( 'LABEL','ID_MAIL_STATUS_PENDING','en','Pending','2018-10-02') ,
|
||||||
|
( 'LABEL','ID_MAIL_STATUS_SENT','en','Sent','2018-10-02') ,
|
||||||
( 'LABEL','ID_MAIL_TEST_SUCCESS','en','Test message sent successfully','2014-01-15') ,
|
( 'LABEL','ID_MAIL_TEST_SUCCESS','en','Test message sent successfully','2014-01-15') ,
|
||||||
( 'LABEL','ID_MAIL_TO_NOT_VALID_ADDRESS','en','"Mail to" does not contain a valid email address format','2014-01-15') ,
|
( 'LABEL','ID_MAIL_TO_NOT_VALID_ADDRESS','en','"Mail to" does not contain a valid email address format','2014-01-15') ,
|
||||||
( 'LABEL','ID_MAINTENANCE','en','Maintenance','2014-01-15') ;
|
( 'LABEL','ID_MAINTENANCE','en','Maintenance','2014-01-15') ;
|
||||||
@@ -60300,6 +60304,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
|||||||
( 'LABEL','ID_PMTABLE_IMPORT_SUCCESS','en','File "{0}" imported successfully.','2014-01-15') ,
|
( 'LABEL','ID_PMTABLE_IMPORT_SUCCESS','en','File "{0}" imported successfully.','2014-01-15') ,
|
||||||
( 'LABEL','ID_PMTABLE_IMPORT_WITH_ERRORS','en','File "{0}" imported but with errors:','2016-02-18') ,
|
( 'LABEL','ID_PMTABLE_IMPORT_WITH_ERRORS','en','File "{0}" imported but with errors:','2016-02-18') ,
|
||||||
( 'LABEL','ID_PMTABLE_INVALID_FIELD_NAME','en','The following fields cannot be created because they contain the reserved words "{0}"','2014-10-21') ,
|
( 'LABEL','ID_PMTABLE_INVALID_FIELD_NAME','en','The following fields cannot be created because they contain the reserved words "{0}"','2014-10-21') ,
|
||||||
|
( 'LABEL','ID_PMTABLE_INVALID_FIELD_NAME_VARIABLE','en','There is a conflict with some field names: "{0}", please rename them avoiding the use of numbers and considering that underscores are ignored when validating unique field names.','2018-04-03') ,
|
||||||
( 'LABEL','ID_PMTABLE_INVALID_FILE','en','Invalid PM table(s) file, import aborted!','2014-01-15') ,
|
( 'LABEL','ID_PMTABLE_INVALID_FILE','en','Invalid PM table(s) file, import aborted!','2014-01-15') ,
|
||||||
( 'LABEL','ID_PMTABLE_INVALID_NAME','en','Could not create the table with the name "{0}" because it is a reserved word.','2014-01-15') ,
|
( 'LABEL','ID_PMTABLE_INVALID_NAME','en','Could not create the table with the name "{0}" because it is a reserved word.','2014-01-15') ,
|
||||||
( 'LABEL','ID_PMTABLE_NOT_FOUND','en','The PM Table associated with this DynaForm could not be found.','2014-11-12') ,
|
( 'LABEL','ID_PMTABLE_NOT_FOUND','en','The PM Table associated with this DynaForm could not be found.','2014-11-12') ,
|
||||||
|
|||||||
@@ -1,117 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function mktimeDate ($date)
|
use ProcessMaker\BusinessModel\Files\Cron;
|
||||||
{
|
|
||||||
$arrayAux = getdate( strtotime( $date ) );
|
|
||||||
|
|
||||||
$mktDate = mktime( $arrayAux["hours"], $arrayAux["minutes"], $arrayAux["seconds"], $arrayAux["mon"], $arrayAux["mday"], $arrayAux["year"] );
|
$option = isset($_REQUEST["option"]) ? $_REQUEST["option"] : null;
|
||||||
|
|
||||||
return $mktDate;
|
$response = [];
|
||||||
}
|
|
||||||
|
|
||||||
function cronArraySet ($str, $filter)
|
|
||||||
{
|
|
||||||
$arrayAux = explode( "|", $str );
|
|
||||||
|
|
||||||
$date = "";
|
|
||||||
$workspace = "";
|
|
||||||
$action = "";
|
|
||||||
$status = "";
|
|
||||||
$description = trim( $arrayAux[0] );
|
|
||||||
|
|
||||||
if (count( $arrayAux ) > 1) {
|
|
||||||
$date = (isset( $arrayAux[0] )) ? trim( $arrayAux[0] ) : "";
|
|
||||||
$workspace = (isset( $arrayAux[1] )) ? trim( $arrayAux[1] ) : "";
|
|
||||||
$action = (isset( $arrayAux[2] )) ? trim( $arrayAux[2] ) : "";
|
|
||||||
$status = (isset( $arrayAux[3] )) ? trim( $arrayAux[3] ) : "";
|
|
||||||
$description = (isset( $arrayAux[4] )) ? trim( $arrayAux[4] ) : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$mktDate = (! empty( $date )) ? mktimeDate( $date ) : 0;
|
|
||||||
|
|
||||||
//Filter
|
|
||||||
$sw = 1;
|
|
||||||
|
|
||||||
if ($filter["workspace"] != "ALL" && $workspace != $filter["workspace"]) {
|
|
||||||
$sw = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filter["status"] != "ALL") {
|
|
||||||
switch ($filter["status"]) {
|
|
||||||
case "COMPLETED":
|
|
||||||
if ($status != "action") {
|
|
||||||
$sw = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "FAILED":
|
|
||||||
if ($status == "action") {
|
|
||||||
$sw = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty( $filter["dateFrom"] ) && $mktDate > 0) {
|
|
||||||
if (! (mktimeDate( $filter["dateFrom"] ) <= $mktDate)) {
|
|
||||||
$sw = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty( $filter["dateTo"] ) && $mktDate > 0) {
|
|
||||||
if (! ($mktDate <= mktimeDate( $filter["dateTo"] . " 23:59:59" ))) {
|
|
||||||
$sw = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$arrayData = array ();
|
|
||||||
|
|
||||||
if ($sw == 1) {
|
|
||||||
$arrayData = array ("DATE" => $date, "ACTION" => $action, "STATUS" => $status, "DESCRIPTION" => $description
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arrayData;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cronDataGet ($filter, $r, $i)
|
|
||||||
{
|
|
||||||
$i = $i + 1;
|
|
||||||
|
|
||||||
$arrayData = array ();
|
|
||||||
$strAux = null;
|
|
||||||
$numRec = 0;
|
|
||||||
$cont = 0;
|
|
||||||
|
|
||||||
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
|
||||||
|
|
||||||
if (file_exists($file)) {
|
|
||||||
$arrayFileData = file($file);
|
|
||||||
|
|
||||||
for ($k = 0; $k <= count($arrayFileData) - 1; $k++) {
|
|
||||||
$strAux = $arrayFileData[$k];
|
|
||||||
|
|
||||||
if (!empty($strAux)) {
|
|
||||||
$arrayAux = cronArraySet($strAux, $filter);
|
|
||||||
|
|
||||||
if (count($arrayAux) > 0) {
|
|
||||||
$cont = $cont + 1;
|
|
||||||
|
|
||||||
if ($cont >= $i && count($arrayData) + 1 <= $r) {
|
|
||||||
$arrayData[] = $arrayAux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$numRec = $cont;
|
|
||||||
|
|
||||||
return array($numRec, $arrayData);
|
|
||||||
}
|
|
||||||
|
|
||||||
$option = (isset( $_REQUEST["option"] )) ? $_REQUEST["option"] : null;
|
|
||||||
|
|
||||||
$response = array ();
|
|
||||||
|
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case "LST":
|
case "LST":
|
||||||
@@ -121,40 +14,42 @@ switch ($option) {
|
|||||||
$dateFrom = $_REQUEST["dateFrom"];
|
$dateFrom = $_REQUEST["dateFrom"];
|
||||||
$dateTo = $_REQUEST["dateTo"];
|
$dateTo = $_REQUEST["dateTo"];
|
||||||
|
|
||||||
$arrayFilter = array ("workspace" => $workspace,"status" => $status,"dateFrom" => str_replace( "T00:00:00", null, $dateFrom ),"dateTo" => str_replace( "T00:00:00", null, $dateTo )
|
$filter = [
|
||||||
);
|
"workspace" => $workspace,
|
||||||
|
"status" => $status,
|
||||||
|
"dateFrom" => str_replace("T00:00:00", null, $dateFrom),
|
||||||
|
"dateTo" => str_replace("T00:00:00", null, $dateTo)
|
||||||
|
];
|
||||||
|
|
||||||
$limit = isset( $_REQUEST["limit"] ) ? $_REQUEST["limit"] : $pageSize;
|
$start = (int) isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
|
||||||
$start = isset( $_REQUEST["start"] ) ? $_REQUEST["start"] : 0;
|
$limit = (int) isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : $pageSize;
|
||||||
|
|
||||||
list ($numRec, $data) = cronDataGet( $arrayFilter, $limit, $start );
|
$cron = new Cron();
|
||||||
|
list ($count, $data) = $cron->getData($filter, $start, $limit);
|
||||||
|
|
||||||
$response = array ("success" => true,"resultTotal" => $numRec,"resultRoot" => $data
|
$response = [
|
||||||
);
|
"success" => true,
|
||||||
|
"resultTotal" => $count,
|
||||||
|
"resultRoot" => $data
|
||||||
|
];
|
||||||
break;
|
break;
|
||||||
case "EMPTY":
|
case "EMPTY":
|
||||||
$status = 1;
|
$status = 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
||||||
|
if (file_exists($file)) {
|
||||||
if (file_exists( $file )) {
|
unlink($file);
|
||||||
//file_put_contents($file, null);
|
|
||||||
unlink( $file );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response["status"] = "OK";
|
$response["status"] = "OK";
|
||||||
G::auditLog("ClearCron");
|
G::auditLog("ClearCron");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$response["message"] = $e->getMessage();
|
$response["message"] = $e->getMessage();
|
||||||
$status = 0;
|
$status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($status == 0) {
|
if ($status == 0) {
|
||||||
$response["status"] = "ERROR";
|
$response["status"] = "ERROR";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo G::json_encode( $response );
|
echo G::json_encode($response);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use AbeRequests;
|
|||||||
use AbeRequestsPeer;
|
use AbeRequestsPeer;
|
||||||
use AbeResponsesPeer;
|
use AbeResponsesPeer;
|
||||||
use ApplicationPeer;
|
use ApplicationPeer;
|
||||||
|
use AppDelegation;
|
||||||
use AppDelegationPeer;
|
use AppDelegationPeer;
|
||||||
use Criteria;
|
use Criteria;
|
||||||
use EmailServerPeer;
|
use EmailServerPeer;
|
||||||
@@ -23,6 +24,7 @@ use PMLicensedFeatures;
|
|||||||
use ProcessPeer;
|
use ProcessPeer;
|
||||||
use ResultSet;
|
use ResultSet;
|
||||||
use SpoolRun;
|
use SpoolRun;
|
||||||
|
use Users as ClassUsers;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use UsersPeer;
|
use UsersPeer;
|
||||||
use TaskPeer;
|
use TaskPeer;
|
||||||
@@ -266,11 +268,18 @@ class ActionsByEmail
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the information for the log
|
||||||
|
*
|
||||||
|
* @param array $arrayData
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function loadActionByEmail(array $arrayData)
|
public function loadActionByEmail(array $arrayData)
|
||||||
{
|
{
|
||||||
|
//Get the total
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$criteria->addSelectColumn('COUNT(*)');
|
$criteria->addSelectColumn('COUNT(*)');
|
||||||
|
|
||||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
||||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||||
@@ -288,7 +297,6 @@ class ActionsByEmail
|
|||||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE);
|
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE);
|
||||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
|
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||||
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
|
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
|
||||||
|
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||||
@@ -298,14 +306,10 @@ class ActionsByEmail
|
|||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||||
|
$criteria->addSelectColumn(AppDelegationPeer::APP_NUMBER);
|
||||||
$criteria->addSelectColumn(ApplicationPeer::APP_NUMBER);
|
|
||||||
|
|
||||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||||
|
$criteria->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
||||||
$criteria->addJoin(ApplicationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
|
||||||
|
|
||||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||||
$criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
$criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||||
@@ -313,66 +317,37 @@ class ActionsByEmail
|
|||||||
$criteria->setOffset($arrayData['start']);
|
$criteria->setOffset($arrayData['start']);
|
||||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$data = Array();
|
$data = [];
|
||||||
$arrayPro = Array();
|
|
||||||
$arrayTAS = Array();
|
|
||||||
$index = 0;
|
$index = 0;
|
||||||
|
|
||||||
while ($result->next()) {
|
while ($result->next()) {
|
||||||
$data[] = $result->getRow();
|
$row = $result->getRow();
|
||||||
$criteriaRes = new Criteria();
|
$row['ABE_REQ_STATUS'] = G::LoadTranslation('ID_MAIL_STATUS_' . $row['ABE_REQ_STATUS']);
|
||||||
|
$data[] = $row;
|
||||||
|
//Get the response
|
||||||
|
$abe = new AbeRequests();
|
||||||
|
$dataRes = $abe->load($data[$index]['ABE_REQ_UID']);
|
||||||
|
$data[$index]['ABE_RES_UID'] = !empty($dataRes['ABE_RES_UID']) ? $dataRes['ABE_RES_UID'] : '';
|
||||||
|
$data[$index]['ABE_RES_CLIENT_IP'] = !empty($dataRes['ABE_RES_CLIENT_IP']) ? $dataRes['ABE_RES_CLIENT_IP'] : '';
|
||||||
|
$data[$index]['ABE_RES_DATA'] = !empty($dataRes['ABE_RES_DATA']) ? $dataRes['ABE_RES_DATA'] : '';
|
||||||
|
$data[$index]['ABE_RES_STATUS'] = !empty($dataRes['ABE_RES_STATUS']) ? $dataRes['ABE_RES_STATUS'] : '';
|
||||||
|
$data[$index]['ABE_RES_MESSAGE'] = !empty($dataRes['ABE_RES_UID']) ? $dataRes['ABE_RES_MESSAGE'] : '';
|
||||||
|
|
||||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
|
//Get the previous user
|
||||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_CLIENT_IP);
|
$appDelegation = new AppDelegation();
|
||||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);
|
$usrUid = $appDelegation->getUserAssignedInThread($data[$index]['APP_UID'], $data[$index]['DEL_PREVIOUS']);
|
||||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_STATUS);
|
$users = new ClassUsers();
|
||||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_MESSAGE);
|
$dataRes = $users->load($usrUid);
|
||||||
|
if (!empty($dataRes)) {
|
||||||
$criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']);
|
|
||||||
|
|
||||||
$resultRes = AbeResponsesPeer::doSelectRS($criteriaRes);
|
|
||||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$resultRes->next();
|
|
||||||
$dataRes = Array();
|
|
||||||
|
|
||||||
if ($dataRes = $resultRes->getRow()) {
|
|
||||||
$data[$index]['ABE_RES_UID'] = $dataRes['ABE_RES_UID'];
|
|
||||||
$data[$index]['ABE_RES_CLIENT_IP'] = $dataRes['ABE_RES_CLIENT_IP'];
|
|
||||||
$data[$index]['ABE_RES_DATA'] = $dataRes['ABE_RES_DATA'];
|
|
||||||
$data[$index]['ABE_RES_STATUS'] = $dataRes['ABE_RES_STATUS'];
|
|
||||||
$data[$index]['ABE_RES_MESSAGE'] = $dataRes['ABE_RES_MESSAGE'];
|
|
||||||
} else {
|
|
||||||
$data[$index]['ABE_RES_UID'] = '';
|
|
||||||
$data[$index]['ABE_RES_CLIENT_IP'] = '';
|
|
||||||
$data[$index]['ABE_RES_DATA'] = '';
|
|
||||||
$data[$index]['ABE_RES_STATUS'] = '';
|
|
||||||
$data[$index]['ABE_RES_MESSAGE'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteriaRes = new Criteria();
|
|
||||||
|
|
||||||
$criteriaRes->addSelectColumn(AppDelegationPeer::USR_UID);
|
|
||||||
$criteriaRes->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
|
||||||
$criteriaRes->addSelectColumn(UsersPeer::USR_LASTNAME);
|
|
||||||
|
|
||||||
$criteria->addJoin(AppDelegationPeer::APP_UID, $data[$index]['APP_UID']);
|
|
||||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, $data[$index]['DEL_PREVIOUS']);
|
|
||||||
$criteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID);
|
|
||||||
$resultRes = AppDelegationPeer::doSelectRS($criteriaRes);
|
|
||||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$resultRes->next();
|
|
||||||
|
|
||||||
if ($dataRes = $resultRes->getRow()) {
|
|
||||||
$data[$index]['USER'] = $dataRes['USR_FIRSTNAME'] . ' ' . $dataRes['USR_LASTNAME'];
|
$data[$index]['USER'] = $dataRes['USR_FIRSTNAME'] . ' ' . $dataRes['USR_LASTNAME'];
|
||||||
} else {
|
} else {
|
||||||
$data[$index]['USER'] = '';
|
$data[$index]['USER'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[$index]['ABE_REQ_ANSWERED'] = ($data[$index]['ABE_REQ_ANSWERED'] == 1) ? 'YES' : 'NO';
|
$data[$index]['ABE_REQ_ANSWERED'] = ($data[$index]['ABE_REQ_ANSWERED'] == 1) ? G::LoadTranslation('ID_YES') : G::LoadTranslation('ID_NO');
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = array();
|
$response = [];
|
||||||
$response['totalCount'] = $totalCount;
|
$response['totalCount'] = $totalCount;
|
||||||
$response['data'] = $data;
|
$response['data'] = $data;
|
||||||
|
|
||||||
|
|||||||
@@ -386,11 +386,12 @@ class InputDocument
|
|||||||
*
|
*
|
||||||
* @param string $applicationUid
|
* @param string $applicationUid
|
||||||
* @param string $userUid
|
* @param string $userUid
|
||||||
|
* @param array $documentsCanAccess
|
||||||
*
|
*
|
||||||
* @return array Return an array with data of an InputDocument
|
* @return array Return an array with data of an InputDocument
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCasesInputDocuments($applicationUid, $userUid)
|
public function getCasesInputDocuments($applicationUid, $userUid, $documentsCanAccess = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data inbox
|
//Verify data inbox
|
||||||
@@ -415,7 +416,10 @@ class InputDocument
|
|||||||
$criteria = $this->getAppDocumentCriteriaByData($applicationUid);
|
$criteria = $this->getAppDocumentCriteriaByData($applicationUid);
|
||||||
|
|
||||||
if (!$flagInbox) {
|
if (!$flagInbox) {
|
||||||
$criteria->add(AppDocumentPeer::USR_UID, $userUid, Criteria::EQUAL);
|
$criteria->add(
|
||||||
|
$criteria->getNewCriterion(AppDocumentPeer::USR_UID, $userUid, Criteria::EQUAL)->addOr(
|
||||||
|
$criteria->getNewCriterion(AppDocumentPeer::APP_DOC_UID, $documentsCanAccess, Criteria::IN))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rsCriteria = AppDocumentPeer::doSelectRS($criteria);
|
$rsCriteria = AppDocumentPeer::doSelectRS($criteria);
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
|
use AdditionalTables;
|
||||||
use DynaformHandler;
|
use DynaformHandler;
|
||||||
|
use Exception;
|
||||||
|
use G;
|
||||||
|
use PmDynaform;
|
||||||
|
|
||||||
class DynaForm
|
class DynaForm
|
||||||
{
|
{
|
||||||
@@ -407,6 +411,8 @@ class DynaForm
|
|||||||
|
|
||||||
$this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]);
|
$this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]);
|
||||||
|
|
||||||
|
$this->throwExceptionIfTheColumnIdentifierIsNotValid($arrayData);
|
||||||
|
|
||||||
//Create
|
//Create
|
||||||
$dynaForm = new \Dynaform();
|
$dynaForm = new \Dynaform();
|
||||||
|
|
||||||
@@ -461,6 +467,8 @@ class DynaForm
|
|||||||
$this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"], $dynaFormUid);
|
$this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"], $dynaFormUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->throwExceptionIfTheColumnIdentifierIsNotValid($arrayData);
|
||||||
|
|
||||||
//Update
|
//Update
|
||||||
$arrayData["DYN_UID"] = $dynaFormUid;
|
$arrayData["DYN_UID"] = $dynaFormUid;
|
||||||
|
|
||||||
@@ -1131,4 +1139,74 @@ class DynaForm
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates if the grid columns tha will be stored have valid names, otherwise
|
||||||
|
* it throws an exception.
|
||||||
|
*
|
||||||
|
* @param array $arrayData, form data that will be saved
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfTheColumnIdentifierIsNotValid($arrayData)
|
||||||
|
{
|
||||||
|
if (isset($arrayData['DYN_CONTENT'])) {
|
||||||
|
$oldDynaform = $this->getDynaFormRecordByPk($arrayData['DYN_UID'], []);
|
||||||
|
$oldGrids = PmDynaform::getGridsAndFields($oldDynaform['DYN_CONTENT']);
|
||||||
|
$oldColumns = $this->getColumnsOfArrayGrids($oldGrids);
|
||||||
|
|
||||||
|
$grids = PmDynaform::getGridsAndFields($arrayData['DYN_CONTENT']);
|
||||||
|
$columns = $this->getColumnsOfArrayGrids($grids);
|
||||||
|
|
||||||
|
foreach ($oldColumns as $oldField) {
|
||||||
|
foreach ($columns as $key => $field) {
|
||||||
|
if ($oldField->id === $field->id) {
|
||||||
|
unset($columns[$key]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$invalids = [];
|
||||||
|
$identicals = [];
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
try {
|
||||||
|
Validator::isValidVariableName($column->id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$invalids[] = $column->id;
|
||||||
|
}
|
||||||
|
foreach ($oldColumns as $oldColumn) {
|
||||||
|
if (strtolower(AdditionalTables::getPHPName($column->id)) === strtolower(AdditionalTables::getPHPName($oldColumn->id))) {
|
||||||
|
$identicals[] = "'" . $column->id . "' - '" . $oldColumn->id . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($invalids) > 0) {
|
||||||
|
throw (new Exception(G::LoadTranslation("ID_GRID_VARIABLE_NAME_ERROR", [implode(', ', $invalids)])));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($identicals) > 0) {
|
||||||
|
throw (new Exception(G::LoadTranslation("DYNAFIELD_PHPNAME_ALREADY_EXIST", [implode(', ', $identicals)])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of all columns of the grid array.
|
||||||
|
*
|
||||||
|
* @param array $grids
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getColumnsOfArrayGrids($grids)
|
||||||
|
{
|
||||||
|
$columns = [];
|
||||||
|
foreach ($grids as $grid) {
|
||||||
|
if (isset($grid->columns)) {
|
||||||
|
$columns = array_merge($columns, $grid->columns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
146
workflow/engine/src/ProcessMaker/BusinessModel/Files/Cron.php
Normal file
146
workflow/engine/src/ProcessMaker/BusinessModel/Files/Cron.php
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\BusinessModel\Files;
|
||||||
|
|
||||||
|
use ProcessMaker\Util\DateTime;
|
||||||
|
|
||||||
|
class Cron
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Cron file log path.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $filepath = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->setFilepath(PATH_DATA . 'log' . PATH_SEP . 'cron.log');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the cron file log path.
|
||||||
|
*
|
||||||
|
* @param string $filepath
|
||||||
|
*/
|
||||||
|
public function setFilepath($filepath)
|
||||||
|
{
|
||||||
|
$this->filepath = $filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data from file.
|
||||||
|
*
|
||||||
|
* @param array $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getData($filter, $start = 0, $limit = 20)
|
||||||
|
{
|
||||||
|
if (!file_exists($this->filepath)) {
|
||||||
|
return [0, []];
|
||||||
|
}
|
||||||
|
$result = [];
|
||||||
|
$count = 0;
|
||||||
|
$array = file($this->filepath);
|
||||||
|
foreach ($array as $line) {
|
||||||
|
if (empty($line)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$row = $this->getRow($line, $filter);
|
||||||
|
if ($row === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$count = $count + 1;
|
||||||
|
if ($start < $count && count($result) < $limit) {
|
||||||
|
$row['DATE'] = DateTime::convertUtcToTimeZone($row['DATE']);
|
||||||
|
$result[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [$count, $result];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get registry from string line.
|
||||||
|
*
|
||||||
|
* @param string $line
|
||||||
|
* @param array $filter
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getRow($line, $filter)
|
||||||
|
{
|
||||||
|
$row = explode('|', $line);
|
||||||
|
$date = '';
|
||||||
|
$workspace = '';
|
||||||
|
$action = '';
|
||||||
|
$status = '';
|
||||||
|
$description = trim($row[0]);
|
||||||
|
|
||||||
|
if (!empty($row)) {
|
||||||
|
$date = isset($row[0]) ? trim($row[0]) : '';
|
||||||
|
$workspace = isset($row[1]) ? trim($row[1]) : '';
|
||||||
|
$action = isset($row[2]) ? trim($row[2]) : '';
|
||||||
|
$status = isset($row[3]) ? trim($row[3]) : '';
|
||||||
|
$description = isset($row[4]) ? trim($row[4]) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$isValid = true;
|
||||||
|
if ($filter['workspace'] != 'ALL' && $workspace != $filter['workspace']) {
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
if ($filter['status'] != 'ALL') {
|
||||||
|
switch ($filter['status']) {
|
||||||
|
case 'COMPLETED':
|
||||||
|
if ($status != 'action') {
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'FAILED':
|
||||||
|
if ($status == 'action') {
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mktDate = !empty($date) ? $this->mktimeDate($date) : 0;
|
||||||
|
if (!empty($filter['dateFrom']) && $mktDate > 0) {
|
||||||
|
if (!($this->mktimeDate($filter['dateFrom']) <= $mktDate)) {
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($filter['dateTo']) && $mktDate > 0) {
|
||||||
|
if (!($mktDate <= $this->mktimeDate($filter['dateTo'] . ' 23:59:59'))) {
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isValid) {
|
||||||
|
return [
|
||||||
|
'DATE' => $date,
|
||||||
|
'ACTION' => $action,
|
||||||
|
'STATUS' => $status,
|
||||||
|
'DESCRIPTION' => $description
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a timestamp from a string value.
|
||||||
|
*
|
||||||
|
* @param string $date
|
||||||
|
* @return int|false
|
||||||
|
*/
|
||||||
|
public function mktimeDate($date)
|
||||||
|
{
|
||||||
|
$array = getdate(strtotime($date));
|
||||||
|
$mktime = mktime($array['hours'], $array['minutes'], $array['seconds'], $array['mon'], $array['mday'], $array['year']);
|
||||||
|
return $mktime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
|
use AdditionalTables;
|
||||||
|
use AdditionalTablesPeer;
|
||||||
|
use G;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class ReportTable
|
class ReportTable
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get report table default columns
|
* Get report table default columns
|
||||||
*
|
*
|
||||||
@@ -101,7 +108,7 @@ class ReportTable
|
|||||||
if (isset($tableNameMap[$tableName])) {
|
if (isset($tableNameMap[$tableName])) {
|
||||||
$tableName = $tableNameMap[$tableName];
|
$tableName = $tableNameMap[$tableName];
|
||||||
|
|
||||||
$additionalTable = new \AdditionalTables();
|
$additionalTable = new AdditionalTables();
|
||||||
|
|
||||||
$arrayAdditionalTableData = $additionalTable->loadByName($tableName);
|
$arrayAdditionalTableData = $additionalTable->loadByName($tableName);
|
||||||
|
|
||||||
@@ -122,13 +129,7 @@ class ReportTable
|
|||||||
array_multisort($primaryKeyColumn, SORT_ASC, $contentData);
|
array_multisort($primaryKeyColumn, SORT_ASC, $contentData);
|
||||||
|
|
||||||
foreach ($contentData as $row) {
|
foreach ($contentData as $row) {
|
||||||
$arrayResult = $this->createRecord(
|
$arrayResult = $this->createRecord(['id' => $arrayAdditionalTableData['ADD_TAB_UID'], 'rows' => base64_encode(serialize($row)),], 'base64');
|
||||||
[
|
|
||||||
'id' => $arrayAdditionalTableData['ADD_TAB_UID'],
|
|
||||||
'rows' => base64_encode(serialize($row)),
|
|
||||||
],
|
|
||||||
'base64'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$arrayResult['success']) {
|
if (!$arrayResult['success']) {
|
||||||
$errors .= $arrayResult['message'];
|
$errors .= $arrayResult['message'];
|
||||||
@@ -141,7 +142,7 @@ class ReportTable
|
|||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $errors;
|
return $errors;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,21 +158,20 @@ class ReportTable
|
|||||||
public function createRecord(array $arrayData, $codification = 'json')
|
public function createRecord(array $arrayData, $codification = 'json')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$additionalTable = new \AdditionalTables();
|
$additionalTable = new AdditionalTables();
|
||||||
$arrayAdditionalTableData = $additionalTable->load($arrayData['id'], true);
|
$arrayAdditionalTableData = $additionalTable->load($arrayData['id'], true);
|
||||||
|
|
||||||
$additionalTableClassName = $arrayAdditionalTableData['ADD_TAB_CLASS_NAME'];
|
$additionalTableClassName = $arrayAdditionalTableData['ADD_TAB_CLASS_NAME'];
|
||||||
$additionalTableClassPeerName = $additionalTableClassName . 'Peer';
|
$additionalTableClassPeerName = $additionalTableClassName . 'Peer';
|
||||||
|
|
||||||
$row = ($codification == 'base64')?
|
$row = ($codification == 'base64') ? unserialize(base64_decode($arrayData['rows'])) : G::json_decode($arrayData['rows']);
|
||||||
unserialize(base64_decode($arrayData['rows'])) : \G::json_decode($arrayData['rows']);
|
$row = (array) ($row);
|
||||||
$row = (array)($row);
|
|
||||||
$row = array_merge(array_change_key_case($row, CASE_LOWER), array_change_key_case($row, CASE_UPPER));
|
$row = array_merge(array_change_key_case($row, CASE_LOWER), array_change_key_case($row, CASE_UPPER));
|
||||||
|
|
||||||
$flagSave = false;
|
$flagSave = false;
|
||||||
|
|
||||||
if (!file_exists(PATH_WORKSPACE . 'classes' . PATH_SEP . $additionalTableClassName . '.php')) {
|
if (!file_exists(PATH_WORKSPACE . 'classes' . PATH_SEP . $additionalTableClassName . '.php')) {
|
||||||
throw new Exception(\G::LoadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', [$additionalTableClassName]));
|
throw new Exception(G::LoadTranslation('ID_PMTABLE_CLASS_DOESNT_EXIST', [$additionalTableClassName]));
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once(PATH_WORKSPACE . 'classes' . PATH_SEP . $additionalTableClassName . '.php');
|
require_once(PATH_WORKSPACE . 'classes' . PATH_SEP . $additionalTableClassName . '.php');
|
||||||
@@ -188,17 +188,13 @@ class ReportTable
|
|||||||
$primaryKeysValues = [];
|
$primaryKeysValues = [];
|
||||||
|
|
||||||
foreach ($additionalTable->getPrimaryKeys() as $primaryKey) {
|
foreach ($additionalTable->getPrimaryKeys() as $primaryKey) {
|
||||||
$method = 'get' . \AdditionalTables::getPHPName($primaryKey['FLD_NAME']);
|
$method = 'get' . AdditionalTables::getPHPName($primaryKey['FLD_NAME']);
|
||||||
$primaryKeysValues[] = $obj->$method();
|
$primaryKeysValues[] = $obj->$method();
|
||||||
}
|
}
|
||||||
|
|
||||||
$index = \G::encrypt(implode(',', $primaryKeysValues), 'pmtable');
|
$index = G::encrypt(implode(',', $primaryKeysValues), 'pmtable');
|
||||||
|
|
||||||
\G::auditLog(
|
G::auditLog('AddDataPmtable', 'Table Name: ' . $arrayAdditionalTableData['ADD_TAB_NAME'] . ' Table ID: (' . $arrayAdditionalTableData['ADD_TAB_UID'] . ')');
|
||||||
'AddDataPmtable',
|
|
||||||
'Table Name: ' . $arrayAdditionalTableData['ADD_TAB_NAME'] .
|
|
||||||
' Table ID: (' . $arrayAdditionalTableData['ADD_TAB_UID'] . ')'
|
|
||||||
);
|
|
||||||
|
|
||||||
$flagSave = true;
|
$flagSave = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -208,10 +204,7 @@ class ReportTable
|
|||||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception(
|
throw new Exception(G::LoadTranslation('ID_ERROR_TRYING_INSERT') . '"' . $arrayAdditionalTableData['ADD_TAB_NAME'] . "\"\n" . $msg);
|
||||||
\G::LoadTranslation('ID_ERROR_TRYING_INSERT') .
|
|
||||||
'"' . $arrayAdditionalTableData['ADD_TAB_NAME'] . "\"\n" . $msg
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$flagSave = false;
|
$flagSave = false;
|
||||||
@@ -220,11 +213,11 @@ class ReportTable
|
|||||||
//Return
|
//Return
|
||||||
return [
|
return [
|
||||||
'success' => $flagSave,
|
'success' => $flagSave,
|
||||||
'message' => ($flagSave)? \G::LoadTranslation('ID_RECORD_SAVED_SUCCESFULLY') : '',
|
'message' => ($flagSave) ? G::LoadTranslation('ID_RECORD_SAVED_SUCCESFULLY') : '',
|
||||||
'rows' => ($flagSave)? $obj->toArray(\BasePeer::TYPE_FIELDNAME) : [],
|
'rows' => ($flagSave) ? $obj->toArray(\BasePeer::TYPE_FIELDNAME) : [],
|
||||||
'index' => ($flagSave)? $index : '',
|
'index' => ($flagSave) ? $index : '',
|
||||||
];
|
];
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,13 +233,8 @@ class ReportTable
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function checkPmtFileThrowErrors(
|
public function checkPmtFileThrowErrors(array $arrayTableSchema, $processUid, $flagFromAdmin, $flagOverwrite, $postProUid)
|
||||||
array $arrayTableSchema,
|
{
|
||||||
$processUid,
|
|
||||||
$flagFromAdmin,
|
|
||||||
$flagOverwrite,
|
|
||||||
$postProUid
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
$arrayError = [];
|
$arrayError = [];
|
||||||
|
|
||||||
@@ -254,7 +242,7 @@ class ReportTable
|
|||||||
$processMap = new \ProcessMap();
|
$processMap = new \ProcessMap();
|
||||||
$arrayProcessUid = [];
|
$arrayProcessUid = [];
|
||||||
|
|
||||||
foreach (\G::json_decode($processMap->getAllProcesses()) as $value) {
|
foreach (G::json_decode($processMap->getAllProcesses()) as $value) {
|
||||||
if ($value->value != '') {
|
if ($value->value != '') {
|
||||||
$arrayProcessUid[] = $value->value;
|
$arrayProcessUid[] = $value->value;
|
||||||
}
|
}
|
||||||
@@ -266,19 +254,19 @@ class ReportTable
|
|||||||
$contentSchema = $value;
|
$contentSchema = $value;
|
||||||
|
|
||||||
//The table exists?
|
//The table exists?
|
||||||
$additionalTable = new \AdditionalTables();
|
$additionalTable = new AdditionalTables();
|
||||||
|
|
||||||
$arrayAdditionalTableData = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
$arrayAdditionalTableData = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
||||||
|
|
||||||
$tableProUid = (isset($contentSchema['PRO_UID']))? $contentSchema['PRO_UID'] : $postProUid;
|
$tableProUid = (isset($contentSchema['PRO_UID'])) ? $contentSchema['PRO_UID'] : $postProUid;
|
||||||
$flagIsPmTable = ($contentSchema['PRO_UID'] == '')? true : false;
|
$flagIsPmTable = ($contentSchema['PRO_UID'] == '') ? true : false;
|
||||||
|
|
||||||
if ($flagFromAdmin) {
|
if ($flagFromAdmin) {
|
||||||
if ($flagIsPmTable) {
|
if ($flagIsPmTable) {
|
||||||
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
||||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||||
$arrayError[$i]['ERROR_TYPE'] = 1; //ERROR_PM_TABLES_OVERWRITE
|
$arrayError[$i]['ERROR_TYPE'] = 1; //ERROR_PM_TABLES_OVERWRITE
|
||||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_PMTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
$arrayError[$i]['ERROR_MESS'] = G::LoadTranslation('ID_OVERWRITE_PMTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||||
}
|
}
|
||||||
@@ -286,14 +274,14 @@ class ReportTable
|
|||||||
if (!in_array($tableProUid, $arrayProcessUid)) {
|
if (!in_array($tableProUid, $arrayProcessUid)) {
|
||||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||||
$arrayError[$i]['ERROR_TYPE'] = 2; //ERROR_PROCESS_NOT_EXIST
|
$arrayError[$i]['ERROR_TYPE'] = 2; //ERROR_PROCESS_NOT_EXIST
|
||||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_PROCESS_NOT_EXIST', [$contentSchema['ADD_TAB_NAME']]);
|
$arrayError[$i]['ERROR_MESS'] = G::LoadTranslation('ID_PROCESS_NOT_EXIST', [$contentSchema['ADD_TAB_NAME']]);
|
||||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||||
} else {
|
} else {
|
||||||
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
||||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||||
$arrayError[$i]['ERROR_TYPE'] = 3; //ERROR_RP_TABLES_OVERWRITE
|
$arrayError[$i]['ERROR_TYPE'] = 3; //ERROR_RP_TABLES_OVERWRITE
|
||||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_RPTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
$arrayError[$i]['ERROR_MESS'] = G::LoadTranslation('ID_OVERWRITE_RPTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||||
}
|
}
|
||||||
@@ -303,21 +291,21 @@ class ReportTable
|
|||||||
if ($flagIsPmTable) {
|
if ($flagIsPmTable) {
|
||||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||||
$arrayError[$i]['ERROR_TYPE'] = 4; //ERROR_NO_REPORT_TABLE
|
$arrayError[$i]['ERROR_TYPE'] = 4; //ERROR_NO_REPORT_TABLE
|
||||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_NO_REPORT_TABLE', [$contentSchema['ADD_TAB_NAME']]);
|
$arrayError[$i]['ERROR_MESS'] = G::LoadTranslation('ID_NO_REPORT_TABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||||
} else {
|
} else {
|
||||||
if ($tableProUid !== $processUid) {
|
if ($tableProUid !== $processUid) {
|
||||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||||
$arrayError[$i]['ERROR_TYPE'] = 5; //ERROR_OVERWRITE_RELATED_PROCESS
|
$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]['ERROR_MESS'] = G::LoadTranslation('ID_OVERWRITE_RELATED_PROCESS', [$contentSchema['ADD_TAB_NAME']]);
|
||||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||||
} else {
|
} else {
|
||||||
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
if ($arrayAdditionalTableData && !$flagOverwrite) {
|
||||||
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
$arrayError[$i]['NAME_TABLE'] = $contentSchema['ADD_TAB_NAME'];
|
||||||
$arrayError[$i]['ERROR_TYPE'] = 3; //ERROR_RP_TABLES_OVERWRITE
|
$arrayError[$i]['ERROR_TYPE'] = 3; //ERROR_RP_TABLES_OVERWRITE
|
||||||
$arrayError[$i]['ERROR_MESS'] = \G::LoadTranslation('ID_OVERWRITE_RPTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
$arrayError[$i]['ERROR_MESS'] = G::LoadTranslation('ID_OVERWRITE_RPTABLE', [$contentSchema['ADD_TAB_NAME']]);
|
||||||
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
$arrayError[$i]['IS_PMTABLE'] = $flagIsPmTable;
|
||||||
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
$arrayError[$i]['PRO_UID'] = $tableProUid;
|
||||||
}
|
}
|
||||||
@@ -330,7 +318,7 @@ class ReportTable
|
|||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $arrayError;
|
return $arrayError;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,9 +339,9 @@ class ReportTable
|
|||||||
$additionalTableUid = $arrayData['REP_TAB_UID'];
|
$additionalTableUid = $arrayData['REP_TAB_UID'];
|
||||||
$flagNew = 0;
|
$flagNew = 0;
|
||||||
|
|
||||||
$additionalTables = \AdditionalTablesPeer::retrieveByPK($arrayData['REP_TAB_UID']);
|
$additionalTables = AdditionalTablesPeer::retrieveByPK($arrayData['REP_TAB_UID']);
|
||||||
|
|
||||||
if (!is_null($additionalTables)){
|
if (!is_null($additionalTables)) {
|
||||||
$arrayData['REP_TAB_NAME'] = 'PMT_' . trim($arrayData['REP_TAB_NAME']);
|
$arrayData['REP_TAB_NAME'] = 'PMT_' . trim($arrayData['REP_TAB_NAME']);
|
||||||
|
|
||||||
if ($additionalTables->getAddTabName() != $arrayData['REP_TAB_NAME']) {
|
if ($additionalTables->getAddTabName() != $arrayData['REP_TAB_NAME']) {
|
||||||
@@ -365,7 +353,7 @@ class ReportTable
|
|||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$arrayData['PRO_UID'] = trim($arrayData['PRO_UID']);
|
$arrayData['PRO_UID'] = trim($arrayData['PRO_UID']);
|
||||||
$arrayData['columns'] = \G::json_decode(stripslashes($arrayData['columns'])); //Decofing data columns
|
$arrayData['columns'] = G::json_decode(stripslashes($arrayData['columns'])); //Decofing data columns
|
||||||
|
|
||||||
if ($flagNew == 1) {
|
if ($flagNew == 1) {
|
||||||
$arrayNewColumn = [];
|
$arrayNewColumn = [];
|
||||||
@@ -387,27 +375,27 @@ class ReportTable
|
|||||||
$arrayData['columns'] = $arrayNewColumn;
|
$arrayData['columns'] = $arrayNewColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
$additionalTable = new \AdditionalTables();
|
$additionalTable = new AdditionalTables();
|
||||||
|
|
||||||
$repTabClassName = $additionalTable->getPHPName($arrayData['REP_TAB_NAME']);
|
$repTabClassName = $additionalTable->getPHPName($arrayData['REP_TAB_NAME']);
|
||||||
$flagIsReportTable = ($arrayData['PRO_UID'] != '')? true : false;
|
$flagIsReportTable = ($arrayData['PRO_UID'] != '') ? true : false;
|
||||||
$columns = $arrayData['columns'];
|
$columns = $arrayData['columns'];
|
||||||
|
|
||||||
//Reserved Words Table
|
//Reserved Words Table
|
||||||
$reservedWords = [
|
$reservedWords = [
|
||||||
'ALTER', 'CLOSE', 'COMMIT', 'CREATE','DECLARE','DELETE','DROP','FETCH','FUNCTION','GRANT','INDEX',
|
'ALTER', 'CLOSE', 'COMMIT', 'CREATE', 'DECLARE', 'DELETE', 'DROP', 'FETCH', 'FUNCTION', 'GRANT', 'INDEX',
|
||||||
'INSERT','OPEN','REVOKE','ROLLBACK','SELECT','SYNONYM','TABLE','UPDATE','VIEW','APP_UID','ROW','PMTABLE'
|
'INSERT', 'OPEN', 'REVOKE', 'ROLLBACK', 'SELECT', 'SYNONYM', 'TABLE', 'UPDATE', 'VIEW', 'APP_UID', 'ROW', 'PMTABLE'
|
||||||
];
|
];
|
||||||
|
|
||||||
//Reserved Words Field
|
//Reserved Words Field
|
||||||
$reservedWordsPhp = [
|
$reservedWordsPhp = [
|
||||||
'case','catch','cfunction','class','clone','const','continue','declare','default','do','else','elseif',
|
'case', 'catch', 'cfunction', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'do', 'else', 'elseif',
|
||||||
'enddeclare','endfor','endforeach','endif','endswitch','endwhile','extends','final','for','foreach',
|
'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'extends', 'final', 'for', 'foreach',
|
||||||
'function','global','goto','if','implements','interface','instanceof','private','namespace','new',
|
'function', 'global', 'goto', 'if', 'implements', 'interface', 'instanceof', 'private', 'namespace', 'new',
|
||||||
'old_function','or','throw','protected','public','static','switch','xor','try','use','var','while'
|
'old_function', 'or', 'throw', 'protected', 'public', 'static', 'switch', 'xor', 'try', 'use', 'var', 'while'
|
||||||
];
|
];
|
||||||
|
|
||||||
$reservedWordsSql = \G::reservedWordsSql();
|
$reservedWordsSql = G::reservedWordsSql();
|
||||||
|
|
||||||
//Verify if exists
|
//Verify if exists
|
||||||
if ($arrayData['REP_TAB_UID'] == '' || (isset($arrayData['forceUid']) && $arrayData['forceUid'])) {
|
if ($arrayData['REP_TAB_UID'] == '' || (isset($arrayData['forceUid']) && $arrayData['forceUid'])) {
|
||||||
@@ -419,23 +407,25 @@ class ReportTable
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Validations
|
//Validations
|
||||||
if ($additionalTable->loadByName($arrayData['REP_TAB_NAME'])) {
|
if (is_array($additionalTable->loadByName($arrayData['REP_TAB_NAME']))) {
|
||||||
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_ALREADY_EXISTS', [$arrayData['REP_TAB_NAME']]));
|
throw new Exception(G::LoadTranslation('ID_PMTABLE_ALREADY_EXISTS', [$arrayData['REP_TAB_NAME']]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array(strtoupper($arrayData['REP_TAB_NAME']), $reservedWords) ||
|
if (in_array(strtoupper($arrayData['REP_TAB_NAME']), $reservedWords) ||
|
||||||
in_array(strtoupper($arrayData['REP_TAB_NAME']), $reservedWordsSql)
|
in_array(strtoupper($arrayData['REP_TAB_NAME']), $reservedWordsSql)
|
||||||
) {
|
) {
|
||||||
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_INVALID_NAME', [$arrayData['REP_TAB_NAME']]));
|
throw new Exception(G::LoadTranslation('ID_PMTABLE_INVALID_NAME', [$arrayData['REP_TAB_NAME']]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->validateFieldName($columns);
|
||||||
|
|
||||||
//Backward compatility
|
//Backward compatility
|
||||||
foreach ($columns as $i => $column) {
|
foreach ($columns as $i => $column) {
|
||||||
if (in_array(strtoupper($columns[$i]->field_name), $reservedWordsSql) ||
|
if (in_array(strtoupper($columns[$i]->field_name), $reservedWordsSql) ||
|
||||||
in_array(strtolower($columns[$i]->field_name), $reservedWordsPhp)
|
in_array(strtolower($columns[$i]->field_name), $reservedWordsPhp)
|
||||||
) {
|
) {
|
||||||
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_INVALID_FIELD_NAME', [$columns[$i]->field_name]));
|
throw new Exception(G::LoadTranslation('ID_PMTABLE_INVALID_FIELD_NAME', [$columns[$i]->field_name]));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($column->field_type) {
|
switch ($column->field_type) {
|
||||||
@@ -475,19 +465,19 @@ class ReportTable
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pmTable->build();
|
$pmTable->build();
|
||||||
|
|
||||||
$buildResult = ob_get_contents();
|
$buildResult = ob_get_contents();
|
||||||
|
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
//Updating additional table struture information
|
//Updating additional table struture information
|
||||||
$addTabData = [
|
$addTabData = [
|
||||||
'ADD_TAB_UID' => $arrayData['REP_TAB_UID'],
|
'ADD_TAB_UID' => $arrayData['REP_TAB_UID'],
|
||||||
'ADD_TAB_NAME' => $arrayData['REP_TAB_NAME'],
|
'ADD_TAB_NAME' => $arrayData['REP_TAB_NAME'],
|
||||||
'ADD_TAB_CLASS_NAME' => $repTabClassName,
|
'ADD_TAB_CLASS_NAME' => $repTabClassName,
|
||||||
'ADD_TAB_DESCRIPTION' => $arrayData['REP_TAB_DSC'],
|
'ADD_TAB_DESCRIPTION' => $arrayData['REP_TAB_DSC'],
|
||||||
'ADD_TAB_PLG_UID' => '',
|
'ADD_TAB_PLG_UID' => '',
|
||||||
'DBS_UID' => ($arrayData['REP_TAB_CONNECTION'])? $arrayData['REP_TAB_CONNECTION'] : 'workflow',
|
'DBS_UID' => ($arrayData['REP_TAB_CONNECTION']) ? $arrayData['REP_TAB_CONNECTION'] : 'workflow',
|
||||||
'PRO_UID' => $arrayData['PRO_UID'],
|
'PRO_UID' => $arrayData['PRO_UID'],
|
||||||
'ADD_TAB_TYPE' => $arrayData['REP_TAB_TYPE'],
|
'ADD_TAB_TYPE' => $arrayData['REP_TAB_TYPE'],
|
||||||
'ADD_TAB_GRID' => $arrayData['REP_TAB_GRID']
|
'ADD_TAB_GRID' => $arrayData['REP_TAB_GRID']
|
||||||
@@ -514,37 +504,30 @@ class ReportTable
|
|||||||
|
|
||||||
foreach ($columns as $i => $column) {
|
foreach ($columns as $i => $column) {
|
||||||
$field->create([
|
$field->create([
|
||||||
'FLD_UID' => $column->uid,
|
'FLD_UID' => $column->uid,
|
||||||
'FLD_INDEX' => $i,
|
'FLD_INDEX' => $i,
|
||||||
'ADD_TAB_UID' => $addTabUid,
|
'ADD_TAB_UID' => $addTabUid,
|
||||||
'FLD_NAME' => $column->field_name,
|
'FLD_NAME' => $column->field_name,
|
||||||
'FLD_DESCRIPTION' => $column->field_label,
|
'FLD_DESCRIPTION' => $column->field_label,
|
||||||
'FLD_TYPE' => $column->field_type,
|
'FLD_TYPE' => $column->field_type,
|
||||||
'FLD_SIZE' => ($column->field_size == '')? null : $column->field_size,
|
'FLD_SIZE' => ($column->field_size == '') ? null : $column->field_size,
|
||||||
'FLD_NULL' => ($column->field_null)? 1 : 0,
|
'FLD_NULL' => ($column->field_null) ? 1 : 0,
|
||||||
'FLD_AUTO_INCREMENT' => ($column->field_autoincrement)? 1 : 0,
|
'FLD_AUTO_INCREMENT' => ($column->field_autoincrement) ? 1 : 0,
|
||||||
'FLD_KEY' => ($column->field_key)? 1 : 0,
|
'FLD_KEY' => ($column->field_key) ? 1 : 0,
|
||||||
'FLD_TABLE_INDEX' => (isset($column->field_index) && $column->field_index)? 1 : 0,
|
'FLD_TABLE_INDEX' => (isset($column->field_index) && $column->field_index) ? 1 : 0,
|
||||||
'FLD_FOREIGN_KEY' => 0,
|
'FLD_FOREIGN_KEY' => 0,
|
||||||
'FLD_FOREIGN_KEY_TABLE' => '',
|
'FLD_FOREIGN_KEY_TABLE' => '',
|
||||||
'FLD_DYN_NAME' => $column->field_dyn,
|
'FLD_DYN_NAME' => $column->field_dyn,
|
||||||
'FLD_DYN_UID' => $column->field_uid,
|
'FLD_DYN_UID' => $column->field_uid,
|
||||||
'FLD_FILTER' => (isset($column->field_filter) && $column->field_filter)? 1 : 0
|
'FLD_FILTER' => (isset($column->field_filter) && $column->field_filter) ? 1 : 0
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($flagIsReportTable && $flagAlterTable) {
|
if ($flagIsReportTable && $flagAlterTable) {
|
||||||
//The table was create successfully but we're catching problems while populating table
|
//The table was create successfully but we're catching problems while populating table
|
||||||
try {
|
try {
|
||||||
$additionalTable->populateReportTable(
|
$additionalTable->populateReportTable($arrayData['REP_TAB_NAME'], $pmTable->getDataSource(), $arrayData['REP_TAB_TYPE'], $arrayData['PRO_UID'], $arrayData['REP_TAB_GRID'], $addTabUid);
|
||||||
$arrayData['REP_TAB_NAME'],
|
} catch (Exception $e) {
|
||||||
$pmTable->getDataSource(),
|
|
||||||
$arrayData['REP_TAB_TYPE'],
|
|
||||||
$arrayData['PRO_UID'],
|
|
||||||
$arrayData['REP_TAB_GRID'],
|
|
||||||
$addTabUid
|
|
||||||
);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$result->message = $result->msg = $e->getMessage();
|
$result->message = $result->msg = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -561,10 +544,7 @@ class ReportTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\G::auditLog(
|
G::auditLog((isset($arrayData['REP_TAB_UID']) && $arrayData['REP_TAB_UID'] == '') ? 'CreatePmtable' : 'UpdatePmtable', 'Fields: ' . $fieldsName);
|
||||||
(isset($arrayData['REP_TAB_UID']) && $arrayData['REP_TAB_UID'] == '')?
|
|
||||||
'CreatePmtable' : 'UpdatePmtable', 'Fields: ' . $fieldsName
|
|
||||||
);
|
|
||||||
|
|
||||||
$result->success = true;
|
$result->success = true;
|
||||||
$result->message = $result->msg = $buildResult;
|
$result->message = $result->msg = $buildResult;
|
||||||
@@ -575,12 +555,12 @@ class ReportTable
|
|||||||
$pmTablesProxy = new \pmTablesProxy();
|
$pmTablesProxy = new \pmTablesProxy();
|
||||||
|
|
||||||
$obj = new \stdClass();
|
$obj = new \stdClass();
|
||||||
$obj->rows = \G::json_encode([['id' => $additionalTableUid, 'type' => '']]);
|
$obj->rows = G::json_encode([['id' => $additionalTableUid, 'type' => '']]);
|
||||||
|
|
||||||
//Delete Report Table
|
//Delete Report Table
|
||||||
$resultDeleteReportTable = $pmTablesProxy->delete($obj);
|
$resultDeleteReportTable = $pmTablesProxy->delete($obj);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$buildResult = ob_get_contents();
|
$buildResult = ob_get_contents();
|
||||||
|
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
@@ -593,7 +573,7 @@ class ReportTable
|
|||||||
$result->type = ucfirst($pmTable->getDbConfig()->adapter);
|
$result->type = ucfirst($pmTable->getDbConfig()->adapter);
|
||||||
} else {
|
} else {
|
||||||
$result->message = $result->msg = $e->getMessage();
|
$result->message = $result->msg = $e->getMessage();
|
||||||
$result->type = \G::LoadTranslation('ID_EXCEPTION');
|
$result->type = G::LoadTranslation('ID_EXCEPTION');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result->trace = $e->getTraceAsString();
|
$result->trace = $e->getTraceAsString();
|
||||||
@@ -616,15 +596,8 @@ class ReportTable
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function createStructureOfTables(
|
public function createStructureOfTables(array $arrayTableSchema, array $arrayTableData, $processUid, $flagFromAdmin, $flagOverwrite = true, array $arrayTablesToExclude = [], array $arrayTablesToCreate = [])
|
||||||
array $arrayTableSchema,
|
{
|
||||||
array $arrayTableData,
|
|
||||||
$processUid,
|
|
||||||
$flagFromAdmin,
|
|
||||||
$flagOverwrite = true,
|
|
||||||
array $arrayTablesToExclude = [],
|
|
||||||
array $arrayTablesToCreate = []
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
$errors = '';
|
$errors = '';
|
||||||
|
|
||||||
@@ -636,7 +609,7 @@ class ReportTable
|
|||||||
$contentSchema = $value;
|
$contentSchema = $value;
|
||||||
|
|
||||||
if (!in_array($contentSchema['ADD_TAB_NAME'], $arrayTablesToExclude)) {
|
if (!in_array($contentSchema['ADD_TAB_NAME'], $arrayTablesToExclude)) {
|
||||||
$additionalTable = new \AdditionalTables();
|
$additionalTable = new AdditionalTables();
|
||||||
|
|
||||||
$arrayAdditionalTableData = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
$arrayAdditionalTableData = $additionalTable->loadByName($contentSchema['ADD_TAB_NAME']);
|
||||||
|
|
||||||
@@ -644,7 +617,7 @@ class ReportTable
|
|||||||
|
|
||||||
$tableData = new \stdClass();
|
$tableData = new \stdClass();
|
||||||
|
|
||||||
if (isset( $contentSchema['PRO_UID'] )) {
|
if (isset($contentSchema['PRO_UID'])) {
|
||||||
$tableData->PRO_UID = $contentSchema['PRO_UID'];
|
$tableData->PRO_UID = $contentSchema['PRO_UID'];
|
||||||
} else {
|
} else {
|
||||||
$tableData->PRO_UID = $_POST['form']['PRO_UID'];
|
$tableData->PRO_UID = $_POST['form']['PRO_UID'];
|
||||||
@@ -673,9 +646,9 @@ class ReportTable
|
|||||||
//renaming...
|
//renaming...
|
||||||
$tNameOld = $contentSchema['ADD_TAB_NAME'];
|
$tNameOld = $contentSchema['ADD_TAB_NAME'];
|
||||||
$newTableName = $contentSchema['ADD_TAB_NAME'] . '_' . date('YmdHis');
|
$newTableName = $contentSchema['ADD_TAB_NAME'] . '_' . date('YmdHis');
|
||||||
$contentSchema['ADD_TAB_UID'] = \G::generateUniqueID();
|
$contentSchema['ADD_TAB_UID'] = G::generateUniqueID();
|
||||||
$contentSchema['ADD_TAB_NAME'] = $newTableName;
|
$contentSchema['ADD_TAB_NAME'] = $newTableName;
|
||||||
$contentSchema['ADD_TAB_CLASS_NAME'] = \AdditionalTables::getPHPName($newTableName);
|
$contentSchema['ADD_TAB_CLASS_NAME'] = AdditionalTables::getPHPName($newTableName);
|
||||||
|
|
||||||
//Mapping the table name for posterior uses
|
//Mapping the table name for posterior uses
|
||||||
$tableNameMap[$tNameOld] = $contentSchema['ADD_TAB_NAME'];
|
$tableNameMap[$tNameOld] = $contentSchema['ADD_TAB_NAME'];
|
||||||
@@ -691,17 +664,17 @@ class ReportTable
|
|||||||
|
|
||||||
foreach ($contentSchema['FIELDS'] as $field) {
|
foreach ($contentSchema['FIELDS'] as $field) {
|
||||||
$columns[] = [
|
$columns[] = [
|
||||||
'uid' => '',
|
'uid' => '',
|
||||||
'field_uid' => '',
|
'field_uid' => '',
|
||||||
'field_name' => $field['FLD_NAME'],
|
'field_name' => $field['FLD_NAME'],
|
||||||
'field_dyn' => (isset($field['FLD_DYN_NAME']))? $field['FLD_DYN_NAME'] : '',
|
'field_dyn' => (isset($field['FLD_DYN_NAME'])) ? $field['FLD_DYN_NAME'] : '',
|
||||||
'field_label' => (isset($field['FLD_DESCRIPTION']))? $field['FLD_DESCRIPTION'] : '',
|
'field_label' => (isset($field['FLD_DESCRIPTION'])) ? $field['FLD_DESCRIPTION'] : '',
|
||||||
'field_type' => $field['FLD_TYPE'],
|
'field_type' => $field['FLD_TYPE'],
|
||||||
'field_size' => $field['FLD_SIZE'],
|
'field_size' => $field['FLD_SIZE'],
|
||||||
'field_key' => (isset($field['FLD_KEY']))? $field['FLD_KEY'] : 0,
|
'field_key' => (isset($field['FLD_KEY'])) ? $field['FLD_KEY'] : 0,
|
||||||
'field_null' => (isset($field['FLD_NULL']))? $field['FLD_NULL'] : 1,
|
'field_null' => (isset($field['FLD_NULL'])) ? $field['FLD_NULL'] : 1,
|
||||||
'field_autoincrement' => (isset($field['FLD_AUTO_INCREMENT']))?
|
'field_autoincrement' => (isset($field['FLD_AUTO_INCREMENT'])) ?
|
||||||
$field['FLD_AUTO_INCREMENT'] : 0
|
$field['FLD_AUTO_INCREMENT'] : 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,23 +682,21 @@ class ReportTable
|
|||||||
$tableData->REP_TAB_NAME = $contentSchema['ADD_TAB_NAME'];
|
$tableData->REP_TAB_NAME = $contentSchema['ADD_TAB_NAME'];
|
||||||
$tableData->REP_TAB_DSC = $contentSchema['ADD_TAB_DESCRIPTION'];
|
$tableData->REP_TAB_DSC = $contentSchema['ADD_TAB_DESCRIPTION'];
|
||||||
$tableData->REP_TAB_CONNECTION = $contentSchema['DBS_UID'];
|
$tableData->REP_TAB_CONNECTION = $contentSchema['DBS_UID'];
|
||||||
$tableData->REP_TAB_TYPE = (isset($contentSchema['ADD_TAB_TYPE']))? $contentSchema['ADD_TAB_TYPE'] : '';
|
$tableData->REP_TAB_TYPE = (isset($contentSchema['ADD_TAB_TYPE'])) ? $contentSchema['ADD_TAB_TYPE'] : '';
|
||||||
$tableData->REP_TAB_GRID = (isset($contentSchema['ADD_TAB_GRID']))? $contentSchema['ADD_TAB_GRID'] : '';
|
$tableData->REP_TAB_GRID = (isset($contentSchema['ADD_TAB_GRID'])) ? $contentSchema['ADD_TAB_GRID'] : '';
|
||||||
$tableData->columns = \G::json_encode($columns);
|
$tableData->columns = G::json_encode($columns);
|
||||||
$tableData->forceUid = true;
|
$tableData->forceUid = true;
|
||||||
|
|
||||||
//Save the table
|
//Save the table
|
||||||
$alterTable = false;
|
$alterTable = false;
|
||||||
$result = $this->saveStructureOfTable((array)($tableData), $alterTable);
|
$result = $this->saveStructureOfTable((array) ($tableData), $alterTable);
|
||||||
|
|
||||||
if ($result->success) {
|
if ($result->success) {
|
||||||
\G::auditLog(
|
G::auditLog('ImportTable', $contentSchema['ADD_TAB_NAME'] . ' (' . $contentSchema['ADD_TAB_UID'] . ')');
|
||||||
'ImportTable', $contentSchema['ADD_TAB_NAME'] . ' (' . $contentSchema['ADD_TAB_UID'] . ')'
|
|
||||||
);
|
|
||||||
|
|
||||||
$processQueueTables[$contentSchema['DBS_UID']][] = $contentSchema['ADD_TAB_NAME'];
|
$processQueueTables[$contentSchema['DBS_UID']][] = $contentSchema['ADD_TAB_NAME'];
|
||||||
} else {
|
} else {
|
||||||
$errors .= \G::LoadTranslation('ID_ERROR_CREATE_TABLE') . $tableData->REP_TAB_NAME . '-> ' . $result->message . '\n\n';
|
$errors .= G::LoadTranslation('ID_ERROR_CREATE_TABLE') . $tableData->REP_TAB_NAME . '-> ' . $result->message . '\n\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -747,9 +718,38 @@ class ReportTable
|
|||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $errors;
|
return $errors;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throw an exception if the column is not valid for the creation of the field
|
||||||
|
* in the classes managed by propel.
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function validateFieldName($columns)
|
||||||
|
{
|
||||||
|
$validFields = [];
|
||||||
|
$invalidFields = [];
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
try {
|
||||||
|
$fieldName = $column->field_name;
|
||||||
|
Validator::isValidVariableName($fieldName);
|
||||||
|
$fieldName = strtolower(AdditionalTables::getPHPName($fieldName));
|
||||||
|
if (in_array($fieldName, $validFields)) {
|
||||||
|
$invalidFields[] = $fieldName;
|
||||||
|
} else {
|
||||||
|
$validFields[] = $fieldName;
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$invalidFields[] = $fieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($invalidFields)) {
|
||||||
|
throw new Exception(G::LoadTranslation('ID_PMTABLE_INVALID_FIELD_NAME_VARIABLE', $invalidFields));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
use G;
|
|
||||||
use AdditionalTables;
|
use AdditionalTables;
|
||||||
use Fields;
|
|
||||||
use DynaformHandler;
|
use DynaformHandler;
|
||||||
|
use Exception;
|
||||||
|
use Fields;
|
||||||
|
use G;
|
||||||
|
use ProcessMaker\BusinessModel\ReportTable as BusinessModelRpt;
|
||||||
|
|
||||||
class Table
|
class Table
|
||||||
{
|
{
|
||||||
@@ -184,15 +186,16 @@ class Table
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save Data for Table
|
* Save Data for Table
|
||||||
|
*
|
||||||
* @var string $tab_data. Data for table
|
* @var string $tab_data. Data for table
|
||||||
* @var string $pro_uid. Uid for process
|
* @var string $pro_uid. Uid for process
|
||||||
* @var string $reportFlag. If is report table
|
* @var boolean $reportFlag. If is report table
|
||||||
* @var string $createRep. Flag for create table
|
* @var boolean $createRep. Flag for create table
|
||||||
*
|
*
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @deprecated Method deprecated in Release 3.3.1
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function saveTable($tab_data, $pro_uid = '', $reportFlag = false, $createRep = true)
|
public function saveTable($tab_data, $pro_uid = '', $reportFlag = false, $createRep = true)
|
||||||
{
|
{
|
||||||
@@ -508,59 +511,163 @@ class Table
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Data for Table
|
* Update Data for PmTable and Report Table
|
||||||
* @var string $tab_data. Data for table
|
|
||||||
* @var string $pro_uid. Uid for process
|
|
||||||
* @var string $reportFlag. If is report table
|
|
||||||
*
|
*
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @var string $tableData: Data for table
|
||||||
* @copyright Colosa - Bolivia
|
* @var string $pro_uid: Uid for process
|
||||||
|
* @var boolean $isReportTable: If is report table
|
||||||
*
|
*
|
||||||
* @return void
|
* @return object
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function updateTable($tab_data, $pro_uid = '', $reportFlag = false)
|
public function updateTable($tableData, $proUid = '', $isReportTable = false)
|
||||||
{
|
{
|
||||||
if ($reportFlag) {
|
$tableDsc = false;
|
||||||
$tab_uid = $tab_data['rep_uid'];
|
$tableFields = false;
|
||||||
$pro_uid = $this->validateProUid($pro_uid);
|
if ($isReportTable) {
|
||||||
|
$tabUid = $tableData['rep_uid'];
|
||||||
|
$proUid = $this->validateProUid($proUid);
|
||||||
|
$tableData['pro_uid'] = $proUid;
|
||||||
|
$errorMssg = "The property rep_uid: '$tabUid' is incorrect.";
|
||||||
} else {
|
} else {
|
||||||
$tab_uid = $tab_data['pmt_uid'];
|
$tabUid = $tableData['pmt_uid'];
|
||||||
|
$errorMssg = "The property pmt_uid: '$tabUid' is incorrect.";
|
||||||
|
}
|
||||||
|
$tabUid = $this->validateTabUid($tabUid, $isReportTable);
|
||||||
|
$addTables = new AdditionalTables();
|
||||||
|
$dataValidate = $addTables->getTableProperties($tabUid, $tableData, $isReportTable);
|
||||||
|
if (empty($dataValidate)) {
|
||||||
|
throw (new Exception($errorMssg));
|
||||||
|
}
|
||||||
|
if ($isReportTable) {
|
||||||
|
if (!empty($tableData['rep_tab_dsc'])) {
|
||||||
|
$dataValidate['rep_tab_dsc'] = $tableData['rep_tab_dsc'];
|
||||||
|
$tableDsc = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!empty($tableData['pmt_tab_dsc'])) {
|
||||||
|
$dataValidate['rep_tab_dsc'] = $tableData['pmt_tab_dsc'];
|
||||||
|
$tableDsc = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($tableData['fields'])) {
|
||||||
|
$dataValidate['fields'] = $tableData['fields'];
|
||||||
|
$tableFields = true;
|
||||||
|
} else {
|
||||||
|
throw (new Exception('Body doesn\'t contain fields arguments'));
|
||||||
|
}
|
||||||
|
if (!$tableDsc && !$tableFields) {
|
||||||
|
throw (new Exception('Body doesn\'t contain pmt_tad_dsc or fields arguments'));
|
||||||
}
|
}
|
||||||
$tab_uid = $this->validateTabUid($tab_uid, $reportFlag);
|
|
||||||
|
|
||||||
$dataValidate = array();
|
//We will validate the fields after update the pmTable structure
|
||||||
$oCriteria = new \Criteria('workflow');
|
$result = $this->validateTableBeforeUpdate($dataValidate);
|
||||||
$oCriteria->add(\AdditionalTablesPeer::ADD_TAB_UID, $tab_uid, \Criteria::EQUAL);
|
|
||||||
$oDataset = \AdditionalTablesPeer::doSelectRS($oCriteria);
|
|
||||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
if ($oDataset->next()) {
|
return $result;
|
||||||
$row = $oDataset->getRow();
|
}
|
||||||
if ($reportFlag) {
|
|
||||||
$dataValidate['rep_uid'] = $tab_uid;
|
/**
|
||||||
$dataValidate['rep_tab_name'] = $row['ADD_TAB_NAME'];
|
* Will be validate the fields before saveStructureOfTable
|
||||||
$dataValidate['rep_tab_dsc'] = $tab_data['rep_tab_dsc'];
|
*
|
||||||
$dataValidate['rep_tab_connection'] = $row['DBS_UID'];
|
* @param array $tableFields Properties for table
|
||||||
$dataValidate['rep_tab_type'] = $row['ADD_TAB_TYPE'];
|
*
|
||||||
$dataValidate['rep_tab_grid'] = '';
|
* @return object
|
||||||
if (strpos($row['ADD_TAB_GRID'], '-')) {
|
* @throws Exception
|
||||||
list($gridName, $gridId) = explode( '-', $row['ADD_TAB_GRID'] );
|
*/
|
||||||
$dataValidate['rep_tab_grid'] = $gridId;
|
public function validateTableBeforeUpdate($tableFields)
|
||||||
|
{
|
||||||
|
$propertiesUpdate = [];
|
||||||
|
if (!empty($tableFields)){
|
||||||
|
$propertiesUpdate = array_change_key_case($tableFields, CASE_UPPER);
|
||||||
|
$propertiesUpdate['keepData'] = '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnsTable = [];
|
||||||
|
$flagKey = false;
|
||||||
|
if (!empty($propertiesUpdate['FIELDS'])) {
|
||||||
|
$columns = $propertiesUpdate['FIELDS'];
|
||||||
|
foreach ($columns as $i => $column) {
|
||||||
|
$columnsTable[$i] = [];
|
||||||
|
//Required fld_uid
|
||||||
|
if (!empty($columns[$i]['fld_uid'])) {
|
||||||
|
$columnsTable[$i]['field_uid'] = $columnsTable[$i]['uid'] = G::toUpper($columns[$i]['fld_uid']);
|
||||||
|
} else {
|
||||||
|
throw (new Exception(G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", ['fld_uid'])));
|
||||||
}
|
}
|
||||||
} else {
|
//Not required fld_dyn
|
||||||
$dataValidate['pmt_uid'] = $tab_uid;
|
$columnsTable[$i]['field_dyn'] = '';
|
||||||
$dataValidate['pmt_tab_name'] = $row['ADD_TAB_NAME'];
|
if (!empty($columns[$i]['fld_dyn'])) {
|
||||||
$dataValidate['pmt_tab_dsc'] = $tab_data['pmt_tab_dsc'];
|
$columnsTable[$i]['field_dyn'] = G::toUpper($columns[$i]['fld_dyn']);
|
||||||
}
|
}
|
||||||
$dataValidate['fields'] = $tab_data['fields'];
|
//Required fld_name
|
||||||
} else {
|
if (!empty($columns[$i]['fld_name'])) {
|
||||||
if ($reportFlag) {
|
$columnsTable[$i]['field_name'] = G::toUpper($columns[$i]['fld_name']);
|
||||||
throw (new \Exception("The property rep_uid: '$tab_uid' is incorrect."));
|
} else {
|
||||||
} else {
|
throw (new Exception(G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", ['fld_name'])));
|
||||||
throw (new \Exception("The property pmt_uid: '$tab_uid' is incorrect."));
|
}
|
||||||
|
//Required fld_label
|
||||||
|
if (!empty($columns[$i]['fld_label'])) {
|
||||||
|
$columnsTable[$i]['field_label'] = G::toUpper($columns[$i]['fld_label']);
|
||||||
|
} else {
|
||||||
|
throw (new Exception(G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", ['fld_label'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
//We will to define the autoincrement
|
||||||
|
$columnsTable[$i]['field_autoincrement'] = false;
|
||||||
|
|
||||||
|
//Required fld_type
|
||||||
|
if (!empty($columns[$i]['fld_type'])) {
|
||||||
|
$columnsTable[$i]['field_type'] = G::toUpper($columns[$i]['fld_type']);
|
||||||
|
//Will be validate if is the correct type of column
|
||||||
|
if (!in_array($columnsTable[$i]['field_type'], AdditionalTables::FLD_TYPE_VALUES)) {
|
||||||
|
throw (new Exception("The property fld_type: '" . $columns[$i]['fld_type'] . "' is incorrect."));
|
||||||
|
}
|
||||||
|
//Will be review if the column type has the correct definition with autoincrement
|
||||||
|
if (!empty($columns[$i]['fld_autoincrement']) && $columns[$i]['fld_autoincrement']) {
|
||||||
|
if ($columns[$i]['fld_key'] && in_array($columns[$i]['fld_type'], AdditionalTables::FLD_TYPE_WITH_AUTOINCREMENT)) {
|
||||||
|
$columnsTable[$i]['field_autoincrement'] = true;
|
||||||
|
} else {
|
||||||
|
throw (new Exception("The property field_autoincrement: '" . $columns[$i]['fld_autoincrement'] . "' is incorrect. "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw (new Exception(G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", ['fld_type'])));
|
||||||
|
}
|
||||||
|
//Required fld_size depends of fld_type
|
||||||
|
$columnsTable[$i]['field_size'] = 0;
|
||||||
|
if (in_array($columns[$i]['fld_type'], AdditionalTables::FLD_TYPE_WITH_SIZE)) {
|
||||||
|
if (empty($columns[$i]['fld_size'])) {
|
||||||
|
throw (new Exception(G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", ['fld_size'])));
|
||||||
|
}
|
||||||
|
if ((integer)$columns[$i]['fld_size'] === 0) {
|
||||||
|
throw (new Exception("The property fld_size: '" . $columns[$i]['fld_size'] . "' is incorrect."));
|
||||||
|
}
|
||||||
|
$columnsTable[$i]['field_size'] = (integer)$columns[$i]['fld_size'];
|
||||||
|
}
|
||||||
|
//Required only for one column
|
||||||
|
$columnsTable[$i]['field_key'] = false;
|
||||||
|
if (!empty($columns[$i]['fld_key'])) {
|
||||||
|
$flagKey = true;
|
||||||
|
$columnsTable[$i]['field_key'] = (boolean)$columns[$i]['fld_key'];
|
||||||
|
}
|
||||||
|
//Not required fld_null
|
||||||
|
$columnsTable[$i]['field_null'] = false;
|
||||||
|
if (!empty($columns[$i]['fld_null'])) {
|
||||||
|
$columnsTable[$i]['field_null'] = G::toUpper($columns[$i]['fld_null']);
|
||||||
|
}
|
||||||
|
//Not required fld_filter
|
||||||
|
$columnsTable[$i]['field_filter'] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->saveTable($dataValidate, $pro_uid, $reportFlag, false);
|
if (!$flagKey) {
|
||||||
|
throw (new Exception("The table doesn't have a primary key 'fld_key'"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$propertiesUpdate['columns'] = G::json_encode($columnsTable);
|
||||||
|
$reportTable = new BusinessModelRpt();
|
||||||
|
$result = $reportTable->saveStructureOfTable($propertiesUpdate);
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use G;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validator fields
|
* Validator fields
|
||||||
*
|
*
|
||||||
@@ -13,8 +17,8 @@ class Validator
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Validate dep_uid
|
* Validate dep_uid
|
||||||
* @var string $dep_uid. Uid for Departament
|
* @var string $dep_uid . Uid for Departament
|
||||||
* @var string $nameField. Name of field for message
|
* @var string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -26,19 +30,19 @@ class Validator
|
|||||||
{
|
{
|
||||||
$dep_uid = trim($dep_uid);
|
$dep_uid = trim($dep_uid);
|
||||||
if ($dep_uid == '') {
|
if ($dep_uid == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField,''))));
|
throw (new Exception(G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField, ''))));
|
||||||
}
|
}
|
||||||
$oDepartment = new \Department();
|
$oDepartment = new \Department();
|
||||||
if (!($oDepartment->existsDepartment($dep_uid))) {
|
if (!($oDepartment->existsDepartment($dep_uid))) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField,$dep_uid))));
|
throw (new Exception(G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField, $dep_uid))));
|
||||||
}
|
}
|
||||||
return $dep_uid;
|
return $dep_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate dep_status
|
* Validate dep_status
|
||||||
* @var string $dep_uid. Uid for Departament
|
* @var string $dep_uid . Uid for Departament
|
||||||
* @var string $nameField. Name of field for message
|
* @var string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -51,7 +55,7 @@ class Validator
|
|||||||
$dep_status = trim($dep_status);
|
$dep_status = trim($dep_status);
|
||||||
$values = array('ACTIVE', 'INACTIVE');
|
$values = array('ACTIVE', 'INACTIVE');
|
||||||
if (!in_array($dep_status, $values)) {
|
if (!in_array($dep_status, $values)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_status',$dep_status))));
|
throw (new Exception(G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_status', $dep_status))));
|
||||||
}
|
}
|
||||||
return $dep_status;
|
return $dep_status;
|
||||||
}
|
}
|
||||||
@@ -59,7 +63,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate usr_uid
|
* Validate usr_uid
|
||||||
*
|
*
|
||||||
* @param string $usr_uid, Uid for user
|
* @param string $usr_uid , Uid for user
|
||||||
* @param string $nameField . Name of field for message
|
* @param string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
@@ -72,11 +76,11 @@ class Validator
|
|||||||
{
|
{
|
||||||
$usr_uid = trim($usr_uid);
|
$usr_uid = trim($usr_uid);
|
||||||
if ($usr_uid == '') {
|
if ($usr_uid == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField,''))));
|
throw (new Exception(G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField, ''))));
|
||||||
}
|
}
|
||||||
$oUsers = new \Users();
|
$oUsers = new \Users();
|
||||||
if (!($oUsers->userExists($usr_uid))) {
|
if (!($oUsers->userExists($usr_uid))) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField,$usr_uid))));
|
throw (new Exception(G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField, $usr_uid))));
|
||||||
}
|
}
|
||||||
return $usr_uid;
|
return $usr_uid;
|
||||||
}
|
}
|
||||||
@@ -84,7 +88,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate app_uid
|
* Validate app_uid
|
||||||
*
|
*
|
||||||
* @param string $app_uid, Uid for application
|
* @param string $app_uid , Uid for application
|
||||||
* @param string $nameField . Name of field for message
|
* @param string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
@@ -97,11 +101,11 @@ class Validator
|
|||||||
{
|
{
|
||||||
$app_uid = trim($app_uid);
|
$app_uid = trim($app_uid);
|
||||||
if ($app_uid == '') {
|
if ($app_uid == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField,''))));
|
throw (new Exception(G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField, ''))));
|
||||||
}
|
}
|
||||||
$oApplication = new \Application();
|
$oApplication = new \Application();
|
||||||
if (!($oApplication->exists($app_uid))) {
|
if (!($oApplication->exists($app_uid))) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField,$app_uid))));
|
throw (new Exception(G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField, $app_uid))));
|
||||||
}
|
}
|
||||||
return $app_uid;
|
return $app_uid;
|
||||||
}
|
}
|
||||||
@@ -109,7 +113,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate app_uid
|
* Validate app_uid
|
||||||
*
|
*
|
||||||
* @param string $tri_uid, Uid for trigger
|
* @param string $tri_uid , Uid for trigger
|
||||||
* @param string $nameField . Name of field for message
|
* @param string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
@@ -122,11 +126,11 @@ class Validator
|
|||||||
{
|
{
|
||||||
$tri_uid = trim($tri_uid);
|
$tri_uid = trim($tri_uid);
|
||||||
if ($tri_uid == '') {
|
if ($tri_uid == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField,''))));
|
throw (new Exception(G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField, ''))));
|
||||||
}
|
}
|
||||||
$oTriggers = new \Triggers();
|
$oTriggers = new \Triggers();
|
||||||
if (!($oTriggers->TriggerExists($tri_uid))) {
|
if (!($oTriggers->TriggerExists($tri_uid))) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField,$tri_uid))));
|
throw (new Exception(G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField, $tri_uid))));
|
||||||
}
|
}
|
||||||
return $tri_uid;
|
return $tri_uid;
|
||||||
}
|
}
|
||||||
@@ -134,7 +138,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate pro_uid
|
* Validate pro_uid
|
||||||
*
|
*
|
||||||
* @param string $pro_uid, Uid for process
|
* @param string $pro_uid , Uid for process
|
||||||
* @param string $nameField . Name of field for message
|
* @param string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
@@ -147,11 +151,11 @@ class Validator
|
|||||||
{
|
{
|
||||||
$pro_uid = trim($pro_uid);
|
$pro_uid = trim($pro_uid);
|
||||||
if ($pro_uid == '') {
|
if ($pro_uid == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField,''))));
|
throw (new Exception(G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField, ''))));
|
||||||
}
|
}
|
||||||
$oProcess = new \Process();
|
$oProcess = new \Process();
|
||||||
if (!($oProcess->exists($pro_uid))) {
|
if (!($oProcess->exists($pro_uid))) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField,$pro_uid))));
|
throw (new Exception(G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField, $pro_uid))));
|
||||||
}
|
}
|
||||||
return $pro_uid;
|
return $pro_uid;
|
||||||
}
|
}
|
||||||
@@ -159,7 +163,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate cat_uid
|
* Validate cat_uid
|
||||||
*
|
*
|
||||||
* @param string $cat_uid, Uid for category
|
* @param string $cat_uid , Uid for category
|
||||||
* @param string $nameField . Name of field for message
|
* @param string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
@@ -172,11 +176,11 @@ class Validator
|
|||||||
{
|
{
|
||||||
$cat_uid = trim($cat_uid);
|
$cat_uid = trim($cat_uid);
|
||||||
if ($cat_uid == '') {
|
if ($cat_uid == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_CATEGORY_NOT_EXIST", array($nameField,''))));
|
throw (new Exception(G::LoadTranslation("ID_CATEGORY_NOT_EXIST", array($nameField, ''))));
|
||||||
}
|
}
|
||||||
$oCategory = new \ProcessCategory();
|
$oCategory = new \ProcessCategory();
|
||||||
if (!($oCategory->exists($cat_uid))) {
|
if (!($oCategory->exists($cat_uid))) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_CATEGORY_NOT_EXIST", array($nameField,$cat_uid))));
|
throw (new Exception(G::LoadTranslation("ID_CATEGORY_NOT_EXIST", array($nameField, $cat_uid))));
|
||||||
}
|
}
|
||||||
return $cat_uid;
|
return $cat_uid;
|
||||||
}
|
}
|
||||||
@@ -184,7 +188,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate date
|
* Validate date
|
||||||
*
|
*
|
||||||
* @param string $date, Date for validate
|
* @param string $date , Date for validate
|
||||||
* @param string $nameField . Name of field for message
|
* @param string $nameField . Name of field for message
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
@@ -197,18 +201,18 @@ class Validator
|
|||||||
{
|
{
|
||||||
$date = trim($date);
|
$date = trim($date);
|
||||||
if ($date == '') {
|
if ($date == '') {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_DATE_NOT_VALID", array('',$format))));
|
throw (new Exception(G::LoadTranslation("ID_DATE_NOT_VALID", array('', $format))));
|
||||||
}
|
}
|
||||||
$d = \DateTime::createFromFormat($format, $date);
|
$d = \DateTime::createFromFormat($format, $date);
|
||||||
if (!($d && $d->format($format) == $date)) {
|
if (!($d && $d->format($format) == $date)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_DATE_NOT_VALID", array($date,$format))));
|
throw (new Exception(G::LoadTranslation("ID_DATE_NOT_VALID", array($date, $format))));
|
||||||
}
|
}
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate is array
|
* Validate is array
|
||||||
* @var array $field. Field type array
|
* @var array $field . Field type array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -219,13 +223,13 @@ class Validator
|
|||||||
static public function isArray($field, $nameField)
|
static public function isArray($field, $nameField)
|
||||||
{
|
{
|
||||||
if (!is_array($field)) {
|
if (!is_array($field)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ARRAY", array($nameField))));
|
throw (new Exception(G::LoadTranslation("ID_INVALID_VALUE_ARRAY", array($nameField))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate is string
|
* Validate is string
|
||||||
* @var array $field. Field type string
|
* @var array $field . Field type string
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -236,13 +240,13 @@ class Validator
|
|||||||
static public function isString($field, $nameField)
|
static public function isString($field, $nameField)
|
||||||
{
|
{
|
||||||
if (!is_string($field)) {
|
if (!is_string($field)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_STRING", array($nameField))));
|
throw (new Exception(G::LoadTranslation("ID_INVALID_VALUE_STRING", array($nameField))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate is integer
|
* Validate is integer
|
||||||
* @var array $field. Field type integer
|
* @var array $field . Field type integer
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -253,13 +257,13 @@ class Validator
|
|||||||
static public function isInteger($field, $nameField)
|
static public function isInteger($field, $nameField)
|
||||||
{
|
{
|
||||||
if (!is_integer($field)) {
|
if (!is_integer($field)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_INTEGER", array($nameField))));
|
throw (new Exception(G::LoadTranslation("ID_INVALID_VALUE_INTEGER", array($nameField))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate is boolean
|
* Validate is boolean
|
||||||
* @var boolean $field. Field type boolean
|
* @var boolean $field . Field type boolean
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -270,13 +274,13 @@ class Validator
|
|||||||
static public function isBoolean($field, $nameField)
|
static public function isBoolean($field, $nameField)
|
||||||
{
|
{
|
||||||
if (!is_bool($field)) {
|
if (!is_bool($field)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_BOOLEAN", array($nameField))));
|
throw (new Exception(G::LoadTranslation("ID_INVALID_VALUE_BOOLEAN", array($nameField))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate is boolean
|
* Validate is boolean
|
||||||
* @var boolean $field. Field type boolean
|
* @var boolean $field . Field type boolean
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
@@ -287,14 +291,28 @@ class Validator
|
|||||||
static public function isNotEmpty($field, $nameField)
|
static public function isNotEmpty($field, $nameField)
|
||||||
{
|
{
|
||||||
if (empty($field)) {
|
if (empty($field)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_IS_EMPTY", array($nameField))));
|
throw (new Exception(G::LoadTranslation("ID_INVALID_VALUE_IS_EMPTY", array($nameField))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate a variable name
|
||||||
|
* @param $nameField
|
||||||
|
* @throws \Exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
static public function isValidVariableName($nameField)
|
||||||
|
{
|
||||||
|
$resp = preg_match(config('constants.validation.pmVariable.regEx'), $nameField, $matches);
|
||||||
|
if (isset($resp) && $resp === 0) {
|
||||||
|
throw (new Exception(G::LoadTranslation("ID_INVALID_NAME", array($nameField))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if data is array
|
* Verify if data is array
|
||||||
*
|
*
|
||||||
* @param string $data Data
|
* @param string $data Data
|
||||||
* @param string $dataNameForException Data name for the exception
|
* @param string $dataNameForException Data name for the exception
|
||||||
*
|
*
|
||||||
* return void Throw exception if data is not array
|
* return void Throw exception if data is not array
|
||||||
@@ -303,9 +321,9 @@ class Validator
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($dataNameForException)));
|
throw new Exception(G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($dataNameForException)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,7 +331,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Verify if data is empty
|
* Verify if data is empty
|
||||||
*
|
*
|
||||||
* @param string $data Data
|
* @param string $data Data
|
||||||
* @param string $dataNameForException Data name for the exception
|
* @param string $dataNameForException Data name for the exception
|
||||||
*
|
*
|
||||||
* return void Throw exception if data is empty
|
* return void Throw exception if data is empty
|
||||||
@@ -322,9 +340,9 @@ class Validator
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($dataNameForException)));
|
throw new Exception(G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($dataNameForException)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,7 +350,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate data by ISO 8601 format
|
* Validate data by ISO 8601 format
|
||||||
*
|
*
|
||||||
* @param mixed $data Data
|
* @param mixed $data Data
|
||||||
* @param mixed $field Fields
|
* @param mixed $field Fields
|
||||||
*
|
*
|
||||||
* @return void Throw exception if data has an invalid value
|
* @return void Throw exception if data has an invalid value
|
||||||
@@ -352,7 +370,7 @@ class Validator
|
|||||||
switch (gettype($data)) {
|
switch (gettype($data)) {
|
||||||
case 'string':
|
case 'string':
|
||||||
if (trim($data) != '' && !preg_match('/^' . $regexpIso8601 . '$/', $data)) {
|
if (trim($data) != '' && !preg_match('/^' . $regexpIso8601 . '$/', $data)) {
|
||||||
throw new \Exception(\G::LoadTranslation('ID_ISO8601_INVALID_FORMAT', [(!is_null($field) && is_string($field))? $field : $data]));
|
throw new Exception(G::LoadTranslation('ID_ISO8601_INVALID_FORMAT', [(!is_null($field) && is_string($field)) ? $field : $data]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'array':
|
case 'array':
|
||||||
@@ -360,17 +378,17 @@ class Validator
|
|||||||
foreach ($field as $value) {
|
foreach ($field as $value) {
|
||||||
$fieldName = $value;
|
$fieldName = $value;
|
||||||
|
|
||||||
$fieldName = (isset($data[strtoupper($fieldName)]))? strtoupper($fieldName) : $fieldName;
|
$fieldName = (isset($data[strtoupper($fieldName)])) ? strtoupper($fieldName) : $fieldName;
|
||||||
$fieldName = (isset($data[strtolower($fieldName)]))? strtolower($fieldName) : $fieldName;
|
$fieldName = (isset($data[strtolower($fieldName)])) ? strtolower($fieldName) : $fieldName;
|
||||||
|
|
||||||
if (isset($data[$fieldName]) && trim($data[$fieldName]) != '' && !preg_match('/^' . $regexpIso8601 . '$/', $data[$fieldName])) {
|
if (isset($data[$fieldName]) && trim($data[$fieldName]) != '' && !preg_match('/^' . $regexpIso8601 . '$/', $data[$fieldName])) {
|
||||||
throw new \Exception(\G::LoadTranslation('ID_ISO8601_INVALID_FORMAT', [$fieldName]));
|
throw new Exception(G::LoadTranslation('ID_ISO8601_INVALID_FORMAT', [$fieldName]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,7 +396,7 @@ class Validator
|
|||||||
/**
|
/**
|
||||||
* Validate pager data
|
* Validate pager data
|
||||||
*
|
*
|
||||||
* @param array $arrayData Data
|
* @param array $arrayData Data
|
||||||
* @param array $arrayVariableNameForException Variable name for exception
|
* @param array $arrayVariableNameForException Variable name for exception
|
||||||
*
|
*
|
||||||
* @return mixed Returns TRUE when pager data is valid, Message Error otherwise
|
* @return mixed Returns TRUE when pager data is valid, Message Error otherwise
|
||||||
@@ -387,7 +405,7 @@ class Validator
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
foreach ($arrayPagerData as $key => $value) {
|
foreach ($arrayPagerData as $key => $value) {
|
||||||
$nameForException = (isset($arrayVariableNameForException[$key]))?
|
$nameForException = (isset($arrayVariableNameForException[$key])) ?
|
||||||
$arrayVariableNameForException[$key] : $key;
|
$arrayVariableNameForException[$key] : $key;
|
||||||
|
|
||||||
if (!is_null($value) &&
|
if (!is_null($value) &&
|
||||||
@@ -403,7 +421,7 @@ class Validator
|
|||||||
|
|
||||||
//Return
|
//Return
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -405,6 +405,7 @@ class Variable
|
|||||||
if (isset($aData["VAR_NAME"])) {
|
if (isset($aData["VAR_NAME"])) {
|
||||||
Validator::isString($aData['VAR_NAME'], '$var_name');
|
Validator::isString($aData['VAR_NAME'], '$var_name');
|
||||||
Validator::isNotEmpty($aData['VAR_NAME'], '$var_name');
|
Validator::isNotEmpty($aData['VAR_NAME'], '$var_name');
|
||||||
|
Validator::isValidVariableName($aData['VAR_NAME']);
|
||||||
}
|
}
|
||||||
if (isset($aData["VAR_FIELD_TYPE"])) {
|
if (isset($aData["VAR_FIELD_TYPE"])) {
|
||||||
Validator::isString($aData['VAR_FIELD_TYPE'], '$var_field_type');
|
Validator::isString($aData['VAR_FIELD_TYPE'], '$var_field_type');
|
||||||
@@ -462,7 +463,7 @@ class Variable
|
|||||||
if ($variableName === $row["VAR_NAME"]) {
|
if ($variableName === $row["VAR_NAME"]) {
|
||||||
throw new Exception(G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
throw new Exception(G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
||||||
}
|
}
|
||||||
if (AdditionalTables::getPHPName($variableName) === AdditionalTables::getPHPName($row["VAR_NAME"])) {
|
if (strtolower(AdditionalTables::getPHPName($variableName)) === strtolower(AdditionalTables::getPHPName($row["VAR_NAME"]))) {
|
||||||
throw new Exception(G::LoadTranslation("DYNAFIELD_PHPNAME_ALREADY_EXIST", array($row["VAR_NAME"])));
|
throw new Exception(G::LoadTranslation("DYNAFIELD_PHPNAME_ALREADY_EXIST", array($row["VAR_NAME"])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ abstract class Importer
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
$this->removeProject();
|
$this->removeProject(true);
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
} else {
|
} else {
|
||||||
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
||||||
@@ -300,8 +300,6 @@ abstract class Importer
|
|||||||
$this->preserveEmailEventConfiguration($emailEvent);
|
$this->preserveEmailEventConfiguration($emailEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->preserveCurrentId($this->importData["tables"]["workflow"]);
|
|
||||||
|
|
||||||
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
|
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
|
||||||
if (sizeof($objectList) > 0 && $processGranulate) {
|
if (sizeof($objectList) > 0 && $processGranulate) {
|
||||||
@@ -604,8 +602,6 @@ abstract class Importer
|
|||||||
foreach ($arrayWorkflowTables["emailEvent"] as &$emailEvent) {
|
foreach ($arrayWorkflowTables["emailEvent"] as &$emailEvent) {
|
||||||
$this->preserveEmailEventConfiguration($emailEvent);
|
$this->preserveEmailEventConfiguration($emailEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->preserveCurrentId($arrayWorkflowTables);
|
|
||||||
|
|
||||||
$this->importWfTables($arrayWorkflowTables);
|
$this->importWfTables($arrayWorkflowTables);
|
||||||
|
|
||||||
@@ -952,70 +948,4 @@ abstract class Importer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Restore id values for the dynaforms, input documents and output documents.
|
|
||||||
*
|
|
||||||
* @param type $arrayWorkflowTables
|
|
||||||
*/
|
|
||||||
private function preserveCurrentId(&$arrayWorkflowTables)
|
|
||||||
{
|
|
||||||
$currentProcess = $this->getCurrentProcess();
|
|
||||||
|
|
||||||
//dynaforms
|
|
||||||
foreach ($arrayWorkflowTables["dynaforms"] as &$data) {
|
|
||||||
if (!is_object($currentProcess)) {
|
|
||||||
unset($data['DYN_ID']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$currentElements = $currentProcess->dynaforms;
|
|
||||||
if (!is_array($currentElements)) {
|
|
||||||
unset($data['DYN_ID']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach ($currentElements as $currentElement) {
|
|
||||||
if ($currentElement["PRO_UID"] === $data["PRO_UID"] &&
|
|
||||||
$currentElement["DYN_UID"] === $data["DYN_UID"]) {
|
|
||||||
$data['DYN_ID'] = $currentElement["DYN_ID"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//input documents
|
|
||||||
foreach ($arrayWorkflowTables["inputs"] as &$data) {
|
|
||||||
if (!is_object($currentProcess)) {
|
|
||||||
unset($data['INP_DOC_ID']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$currentElements = $currentProcess->inputs;
|
|
||||||
if (!is_array($currentElements)) {
|
|
||||||
unset($data['INP_DOC_ID']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach ($currentElements as $currentElement) {
|
|
||||||
if ($currentElement["PRO_UID"] === $data["PRO_UID"] &&
|
|
||||||
$currentElement["INP_DOC_UID"] === $data["INP_DOC_UID"]) {
|
|
||||||
$data['INP_DOC_ID'] = $currentElement['INP_DOC_ID'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//output documents
|
|
||||||
foreach ($arrayWorkflowTables["outputs"] as &$data) {
|
|
||||||
if (!is_object($currentProcess)) {
|
|
||||||
unset($data['OUT_DOC_ID']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$currentElements = $currentProcess->outputs;
|
|
||||||
if (!is_array($currentElements)) {
|
|
||||||
unset($data['OUT_DOC_ID']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach ($currentElements as $currentElement) {
|
|
||||||
if ($currentElement["PRO_UID"] === $data["PRO_UID"] &&
|
|
||||||
$currentElement["OUT_DOC_UID"] === $data["OUT_DOC_UID"]) {
|
|
||||||
$data['OUT_DOC_ID'] = $currentElement['OUT_DOC_ID'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProcessMaker\Services\Api\Cases;
|
namespace ProcessMaker\Services\Api\Cases;
|
||||||
|
|
||||||
use \ProcessMaker\Services\Api;
|
|
||||||
use \Luracast\Restler\RestException;
|
|
||||||
use ProcessMaker\BusinessModel\Cases\InputDocument AS CasesInputDocument;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Luracast\Restler\RestException;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\InputDocument as CasesInputDocument;
|
||||||
|
use ProcessMaker\BusinessModel\Cases as BussinessModelCases;
|
||||||
|
use ProcessMaker\Services\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cases\InputDocument Api Controller
|
* Cases\InputDocument Api Controller
|
||||||
@@ -16,23 +17,44 @@ class InputDocument extends Api
|
|||||||
/**
|
/**
|
||||||
* @url GET /:app_uid/input-documents
|
* @url GET /:app_uid/input-documents
|
||||||
*
|
*
|
||||||
* @param string $app_uid {@min 32}{@max 32}
|
* @param string $app_uid {@min 32}{@max 32}
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function doGetInputDocuments($app_uid)
|
public function doGetInputDocuments($app_uid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$userUid = $this->getUserId();
|
$userUid = $this->getUserId();
|
||||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
//We will to get list of documents that the user can be access
|
||||||
|
$bmCases = new BussinessModelCases();
|
||||||
|
$arrayApplicationData = $bmCases->getApplicationRecordByPk($app_uid, [], false);
|
||||||
|
$userAuthorization = $bmCases->userAuthorization(
|
||||||
|
$userUid,
|
||||||
|
$arrayApplicationData['PRO_UID'],
|
||||||
|
$app_uid,
|
||||||
|
[],
|
||||||
|
['INPUT_DOCUMENTS' => 'VIEW', 'ATTACHMENTS' => 'VIEW'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$documentsCanAccess = array_merge(
|
||||||
|
$userAuthorization['objectPermissions']['INPUT_DOCUMENTS'],
|
||||||
|
$userAuthorization['objectPermissions']['ATTACHMENTS']
|
||||||
|
);
|
||||||
|
|
||||||
$response = $inputDocument->getCasesInputDocuments($app_uid, $userUid);
|
//We will to get documents information that the user uploaded and/or that the user has permission
|
||||||
|
$inputDocument = new CasesInputDocument();
|
||||||
|
//@todo we need to review the function getCasesInputDocuments with the ticket HOR-4755
|
||||||
|
$response = $inputDocument->getCasesInputDocuments($app_uid, $userUid, $documentsCanAccess);
|
||||||
|
|
||||||
if (empty($response)) {
|
//If the user is a supervisor we will to get the documents can be access
|
||||||
|
if (empty($response) && $userAuthorization['supervisor']) {
|
||||||
$response = $inputDocument->getCasesInputDocumentsBySupervisor($app_uid, $userUid);
|
$response = $inputDocument->getCasesInputDocumentsBySupervisor($app_uid, $userUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,28 +2,31 @@
|
|||||||
|
|
||||||
namespace ProcessMaker\Services\Api;
|
namespace ProcessMaker\Services\Api;
|
||||||
|
|
||||||
|
use AppDelegation;
|
||||||
use Bootstrap;
|
use Bootstrap;
|
||||||
|
use Cases as ClassesCases;
|
||||||
|
use Criteria;
|
||||||
|
use Exception;
|
||||||
use G;
|
use G;
|
||||||
|
use Luracast\Restler\RestException;
|
||||||
|
use PmDynaform;
|
||||||
|
use Process as ModelProcess;
|
||||||
|
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||||
|
use ProcessMaker\BusinessModel\DynaForm as BusinessModelDynaForm;
|
||||||
|
use ProcessMaker\BusinessModel\Light as BusinessModelLight;
|
||||||
|
use ProcessMaker\BusinessModel\Lists;
|
||||||
|
use ProcessMaker\BusinessModel\Process;
|
||||||
|
use ProcessMaker\BusinessModel\ProcessMap;
|
||||||
|
use ProcessMaker\BusinessModel\Task;
|
||||||
|
use ProcessMaker\BusinessModel\Validator;
|
||||||
use ProcessMaker\Project\Adapter;
|
use ProcessMaker\Project\Adapter;
|
||||||
use ProcessMaker\Services\Api;
|
use ProcessMaker\Services\Api;
|
||||||
use Luracast\Restler\RestException;
|
use ProcessMaker\Services\Api\Project\Activity\Step;
|
||||||
use ProcessMaker\BusinessModel\Validator;
|
|
||||||
use ProcessMaker\Util\DateTime;
|
use ProcessMaker\Util\DateTime;
|
||||||
use PmDynaform;
|
|
||||||
use Exception;
|
|
||||||
use ProcessMaker\BusinessModel\Light as BusinessModelLight;
|
|
||||||
use RBAC;
|
use RBAC;
|
||||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
|
||||||
use Cases as ClassesCases;
|
|
||||||
use AppDelegation;
|
|
||||||
use ProcessMaker\BusinessModel\Lists;
|
|
||||||
use ProcessMaker\BusinessModel\Task;
|
|
||||||
use ProcessMaker\BusinessModel\ProcessMap;
|
|
||||||
use ProcessMaker\BusinessModel\Process;
|
|
||||||
use Criteria;
|
|
||||||
use StepPeer;
|
|
||||||
use stdclass;
|
use stdclass;
|
||||||
use ProcessMaker\BusinessModel\DynaForm as BusinessModelDynaForm;
|
use StepPeer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Process Api Controller
|
* Process Api Controller
|
||||||
@@ -921,41 +924,57 @@ class Light extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get steps related to the task
|
||||||
|
* If the process is classic we does not return any step, this is not supported by Mobile
|
||||||
|
*
|
||||||
* @url GET /project/:prj_uid/activity/:act_uid/steps
|
* @url GET /project/:prj_uid/activity/:act_uid/steps
|
||||||
*
|
*
|
||||||
* @param string $act_uid {@min 32}{@max 32}
|
* @param string $act_uid {@min 32}{@max 32}
|
||||||
* @param string $prj_uid {@min 32}{@max 32}
|
* @param string $prj_uid {@min 32}{@max 32}
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function doGetActivitySteps($act_uid, $prj_uid)
|
public function doGetActivitySteps($act_uid, $prj_uid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$task = new Task();
|
$response = [];
|
||||||
$task->setFormatFieldNameInUppercase(false);
|
$process = new ModelProcess();
|
||||||
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
|
$isBpmn = $process->isBpmnProcess($prj_uid);
|
||||||
|
if ($isBpmn) {
|
||||||
|
$task = new Task();
|
||||||
|
$dynaForm = new BusinessModelDynaForm();
|
||||||
|
$mobile = new BusinessModelLight();
|
||||||
|
$step = new Step();
|
||||||
|
|
||||||
$activitySteps = $task->getSteps($act_uid);
|
$task->setFormatFieldNameInUppercase(false);
|
||||||
$_SESSION['PROCESS'] = $prj_uid;
|
$task->setArrayParamException(["taskUid" => "act_uid", "stepUid" => "step_uid"]);
|
||||||
$dynaForm = new BusinessModelDynaForm();
|
$activitySteps = $task->getSteps($act_uid);
|
||||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
$_SESSION['PROCESS'] = $prj_uid;
|
||||||
$oMobile = new BusinessModelLight();
|
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||||
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
|
|
||||||
$response = array();
|
for ($i = 0; $i < count($activitySteps); $i++) {
|
||||||
for ($i = 0; $i < count($activitySteps); $i++) {
|
if ($activitySteps[$i]['step_type_obj'] == "DYNAFORM") {
|
||||||
if ($activitySteps[$i]['step_type_obj'] == "DYNAFORM") {
|
$dataForm = $dynaForm->getDynaForm($activitySteps[$i]['step_uid_obj']);
|
||||||
$dataForm = $dynaForm->getDynaForm($activitySteps[$i]['step_uid_obj']);
|
$result = $this->parserDataDynaForm($dataForm);
|
||||||
$result = $this->parserDataDynaForm($dataForm);
|
$result["formUpdateDate"] = DateTime::convertUtcToIso8601($result["formUpdateDate"]);
|
||||||
$result["formUpdateDate"] = DateTime::convertUtcToIso8601($result["formUpdateDate"]);
|
$result['index'] = $i;
|
||||||
$result['index'] = $i;
|
$result['stepId'] = $activitySteps[$i]["step_uid"];
|
||||||
$result['stepId'] = $activitySteps[$i]["step_uid"];
|
$result['stepUidObj'] = $activitySteps[$i]["step_uid_obj"];
|
||||||
$result['stepUidObj'] = $activitySteps[$i]["step_uid_obj"];
|
$result['stepMode'] = $activitySteps[$i]['step_mode'];
|
||||||
$result['stepMode'] = $activitySteps[$i]['step_mode'];
|
$result['stepCondition'] = $activitySteps[$i]['step_condition'];
|
||||||
$result['stepCondition'] = $activitySteps[$i]['step_condition'];
|
$result['stepPosition'] = $activitySteps[$i]['step_position'];
|
||||||
$result['stepPosition'] = $activitySteps[$i]['step_position'];
|
$trigger = $mobile->statusTriggers(
|
||||||
$trigger = $oMobile->statusTriggers($step->doGetActivityStepTriggers($activitySteps[$i]["step_uid"],
|
$step->doGetActivityStepTriggers(
|
||||||
$act_uid, $prj_uid));
|
$activitySteps[$i]["step_uid"],
|
||||||
$result["triggers"] = $trigger;
|
$act_uid,
|
||||||
unset($result["formContent"]);
|
$prj_uid
|
||||||
$response[] = $result;
|
)
|
||||||
|
);
|
||||||
|
$result["triggers"] = $trigger;
|
||||||
|
unset($result["formContent"]);
|
||||||
|
$response[] = $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProcessMaker\Services\Api;
|
namespace ProcessMaker\Services\Api;
|
||||||
|
|
||||||
use \ProcessMaker\Services\Api;
|
use Exception;
|
||||||
use \Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
|
use ProcessMaker\BusinessModel\Table as BusinessModelTable;
|
||||||
|
use ProcessMaker\Services\Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pmtable Api Controller
|
* Pmtable Api Controller
|
||||||
@@ -149,6 +151,7 @@ class Pmtable extends Api
|
|||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
|
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
|
||||||
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function doPutPmTable(
|
public function doPutPmTable(
|
||||||
$pmt_uid,
|
$pmt_uid,
|
||||||
@@ -156,9 +159,9 @@ class Pmtable extends Api
|
|||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
$request_data['pmt_uid'] = $pmt_uid;
|
$request_data['pmt_uid'] = $pmt_uid;
|
||||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
$pmTable = new BusinessModelTable();
|
||||||
$response = $oReportTable->updateTable($request_data);
|
$response = $pmTable->updateTable($request_data);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -818,18 +818,27 @@ UpdatePageConfig = function(pageSize){
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
genDataReport = function()
|
/**
|
||||||
|
* Regenerate data report
|
||||||
|
*
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
genDataReport = function ()
|
||||||
{
|
{
|
||||||
Ext.Ajax.request({
|
genDataReportButton.setDisabled(true);
|
||||||
url: '../pmTablesProxy/genDataReport',
|
Ext.Ajax.request({
|
||||||
params: {id: tableDef.ADD_TAB_UID},
|
url: '../pmTablesProxy/genDataReport',
|
||||||
success: function(resp){
|
params: {id: tableDef.ADD_TAB_UID},
|
||||||
response = Ext.util.JSON.decode(resp.responseText);
|
success: function (resp) {
|
||||||
PMExt.notify(_('ID_UPDATE'), response.message)
|
genDataReportButton.setDisabled(false);
|
||||||
Ext.getCmp('infoGrid').store.reload();
|
response = Ext.util.JSON.decode(resp.responseText);
|
||||||
},
|
PMExt.notify(_('ID_UPDATE'), response.message)
|
||||||
failure: function(obj, resp){
|
Ext.getCmp('infoGrid').store.reload();
|
||||||
PMExt.error( _('ID_ERROR'), resp.result.message);
|
|
||||||
}
|
},
|
||||||
});
|
failure: function (obj, resp) {
|
||||||
|
genDataReportButton.setDisabled(false);
|
||||||
|
PMExt.error(_('ID_ERROR'), resp.result.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ Ext.onReady(function(){
|
|||||||
cmodelColumns.push({header: _('ID_NAME'), dataIndex: 'ADD_TAB_NAME', width: 300, align:'left', renderer: function(v,p,r){
|
cmodelColumns.push({header: _('ID_NAME'), dataIndex: 'ADD_TAB_NAME', width: 300, align:'left', renderer: function(v,p,r){
|
||||||
return r.get('TYPE') == 'CLASSIC'? v + ' <span style="font-size:9px; color:green">('+ _('ID_OLD_VERSION') +')</font>' : v;
|
return r.get('TYPE') == 'CLASSIC'? v + ' <span style="font-size:9px; color:green">('+ _('ID_OLD_VERSION') +')</font>' : v;
|
||||||
}});
|
}});
|
||||||
cmodelColumns.push({header: _('ID_DESCRIPTION'), dataIndex: 'ADD_TAB_DESCRIPTION', sortable:false, width: 400, hidden:false, align:'left', renderer: function(v,p,r){
|
cmodelColumns.push({header: _('ID_DESCRIPTION'), dataIndex: 'ADD_TAB_DESCRIPTION', sortable: true, width: 400, hidden: false, align: 'left', renderer: function (v, p, r) {
|
||||||
if (r.get('ADD_TAB_TAG')) {
|
if (r.get('ADD_TAB_TAG')) {
|
||||||
tag = r.get('ADD_TAB_TAG').replace('plugin@', '');
|
tag = r.get('ADD_TAB_TAG').replace('plugin@', '');
|
||||||
tag = tag.charAt(0).toUpperCase() + tag.slice(1);
|
tag = tag.charAt(0).toUpperCase() + tag.slice(1);
|
||||||
@@ -304,7 +304,9 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
cmodelColumns.push({dataIndex: "DBS_UID", hidden: true, hideable: false});
|
cmodelColumns.push({dataIndex: "DBS_UID", hidden: true, hideable: false});
|
||||||
|
|
||||||
cmodelColumns.push({header: _('ID_RECORDS'), dataIndex: 'NUM_ROWS', width: 90, align:'left'});
|
cmodelColumns.push({header: _('ID_RECORDS'), dataIndex: 'NUM_ROWS', width: 90, align:'left', renderer: function (v, p, r) {
|
||||||
|
return '<div style="text-align:' + (isNaN(v) ? 'left' : 'right') + ';">' + v + '</div>';
|
||||||
|
}});
|
||||||
|
|
||||||
if (PRO_UID === false) {
|
if (PRO_UID === false) {
|
||||||
cmodelColumns.push({header: _('ID_PROCESS'), dataIndex: 'PRO_TITLE', width: 180, align:'left'});
|
cmodelColumns.push({header: _('ID_PROCESS'), dataIndex: 'PRO_TITLE', width: 180, align:'left'});
|
||||||
|
|||||||
Reference in New Issue
Block a user