Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Wendy Nestor
2014-03-17 16:49:50 -04:00
18 changed files with 621 additions and 310 deletions

View File

@@ -66,7 +66,8 @@ Feature: Case Scheduler Resources
"sch_start_day_opt_2": "",
"sch_months": "1|6|12",
"sch_repeat_every": "",
"sch_repeat_until": ""
"sch_repeat_until": "",
"sch_state": "ACTIVE"
}
"""
And that I want to update a resource with the key "sch_uid" stored in session array

View File

@@ -113,7 +113,8 @@ Feature: Case Scheduler Main Tests
"sch_start_day_opt_1": "<sch_start_day_opt_1>",
"sch_months": "<sch_months>",
"sch_start_day_opt_2": "<sch_start_day_opt_2>",
"sch_repeat_every": "<sch_repeat_every>"
"sch_repeat_every": "<sch_repeat_every>",
"sch_state": "<sch_state>"
}
"""
And that I want to update a resource with the key "sch_uid" stored in session array as variable "sch_uid_<sch_uid_number>"
@@ -124,12 +125,12 @@ Feature: Case Scheduler Main Tests
Examples:
| test_description | sch_uid_number | sch_del_user_name | sch_del_user_pass | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every |
| Update Daily | 1 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Daily 123@#$ | 1 | 2014-02-30 | 2014-03-20 | 12:30 | | | | | | |
| Update Weekly, sch_week_days=monday | 2 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Weekly monday 345%$# | 2 | 2014-03-20 | 2014-04-20 | 08:30 | 2 | | | | | |
| Update Monthly and day of month, day of month=1, of the month(s)=3,4 | 4 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Monthly 567&^% 1 | 3 | 2014-04-21 | 2014-05-18 | 18:30 | | 1 | 18 | 3\|4\|5 | | |
| Update One time only | 12 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-One Time only 678%$@ | 4 | | | 20:30 | | | | | | |
| Update Every | 13 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Every 987&%@ | 5 | | | | | | | | | 18.30 |
| test_description | sch_uid_number | sch_del_user_name | sch_del_user_pass | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every |sch_state |
| Update Daily | 1 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Daily 123@#$ | 1 | 2014-02-30 | 2014-03-20 | 12:30 | | | | | | |ACTIVE |
| Update Weekly, sch_week_days=monday | 2 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Weekly monday 345%$# | 2 | 2014-03-20 | 2014-04-20 | 08:30 | 2 | | | | | |ACTIVE |
| Update Monthly and day of month, day of month=1, of the month(s)=3,4 | 4 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Monthly 567&^% 1 | 3 | 2014-04-21 | 2014-05-18 | 18:30 | | 1 | 18 | 3\|4\|5 | | |ACTIVE |
| Update One time only | 12 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-One Time only 678%$@ | 4 | | | 20:30 | | | | | | |ACTIVE |
| Update Every | 13 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Every 987&%@ | 5 | | | | | | | | | 18.30 |ACTIVE |
Scenario Outline: Get a single case scheduler of a project and check some properties

View File

@@ -73,10 +73,6 @@ class WebApplication
public function run($type = "")
{
switch ($type) {
case self::REDIRECT_DEFAULT:
//TODO we can set a configurable redirect url
header("location: /sys/en/neoclassic/login/login");
break;
case self::SERVICE_API:
$request = $this->parseApiRequestUri();
$this->loadEnvironment($request["workspace"]);
@@ -236,7 +232,7 @@ class WebApplication
);
}
public function loadEnvironment($workspace)
public function loadEnvironment($workspace = "")
{
$lang = "en";
@@ -330,6 +326,10 @@ class WebApplication
define("PATH_TEMPORAL", PATH_C . "dynEditor/");
define("PATH_DB", PATH_DATA . "sites" . PATH_SEP);
if (empty($workspace)) {
return true;
}
define("SYS_SYS", $workspace);
if (! file_exists( PATH_DB . SYS_SYS . "/db.php" )) {
@@ -371,5 +371,7 @@ class WebApplication
//$memcache = PMmemcached::getSingleton( SYS_SYS );
\Propel::init(PATH_CONFIG . "databases.php");
return true;
}
}

View File

@@ -25,59 +25,80 @@
* @author Alexandre Rosenfeld <alexandre@colosa.com>
*/
/* Windows supports both / and \ as path separators, so use the Unix separator
* for maximum compatibility.
*/
define('PATH_SEP', '/');
// /* Windows supports both / and \ as path separators, so use the Unix separator
// * for maximum compatibility.
// */
// define('PATH_SEP', '/');
//
// define('PATH_HOME', WORKFLOW_PATH );
// define('PATH_TRUNK', PROCESSMAKER_PATH );
// define('PATH_OUTTRUNK', realpath(PROCESSMAKER_PATH.'/..') );
//
///* Most definitions (including the G class) is done in paths.php
// * This mostly simulates a sysGeneric.php call.
// */
//if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) {
// require_once(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php");
//}
//
//require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php");
//
//require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php");
//require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php");
//require_once (PATH_CORE . "config" . PATH_SEP . "environments.php");
//require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
//
//require_once (PATH_GULLIVER . "class.bootstrap.php");
//
//spl_autoload_register(array("Bootstrap", "autoloadClass"));
//
//Bootstrap::registerSystemClasses();
//
//$config = System::getSystemConfiguration(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "env.ini");
//
// $e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL;
// $e_all = defined('E_STRICT') ? E_ALL & ~E_STRICT : $e_all;
// $e_all = $e_all & E_WARNING; // show warning
// $e_all = $e_all & ~E_NOTICE; // don't notices
//
// // Do not change any of these settings directly, use env.ini instead
// ini_set('display_errors', $config['debug']);
// ini_set('error_reporting', $e_all);
// ini_set('short_open_tag', 'On');
// ini_set('default_charset', "UTF-8");
// ini_set('memory_limit', $config['memory_limit']);
// ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
// ini_set('date.timezone', $config['time_zone']);
//
// define ('DEBUG_SQL_LOG', $config['debug_sql']);
// define ('DEBUG_TIME_LOG', $config['debug_time']);
// define ('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
// define ('MEMCACHED_ENABLED', $config['memcached']);
// define ('MEMCACHED_SERVER', $config['memcached_server']);
// define ('TIME_ZONE', $config['time_zone']);
define('PATH_HOME', WORKFLOW_PATH );
define('PATH_TRUNK', PROCESSMAKER_PATH );
define('PATH_OUTTRUNK', realpath(PROCESSMAKER_PATH.'/..') );
$rootDir = PROCESSMAKER_PATH;
require $rootDir . "framework/src/Maveriks/Util/ClassLoader.php";
/* Most definitions (including the G class) is done in paths.php
* This mostly simulates a sysGeneric.php call.
*/
if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) {
require_once(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php");
}
$loader = Maveriks\Util\ClassLoader::getInstance();
$loader->add($rootDir . 'framework/src/', "Maveriks");
$loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker");
$loader->add($rootDir . 'workflow/engine/src/');
require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php");
// add vendors to autoloader
$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php');
require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php");
require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php");
require_once (PATH_CORE . "config" . PATH_SEP . "environments.php");
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
$loader->addModelClassPath($rootDir . "workflow/engine/classes/model/");
require_once (PATH_GULLIVER . "class.bootstrap.php");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$app->loadEnvironment();
spl_autoload_register(array("Bootstrap", "autoloadClass"));
require PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php";
require PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php";
Bootstrap::registerSystemClasses();
$config = System::getSystemConfiguration(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "env.ini");
$e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL;
$e_all = defined('E_STRICT') ? E_ALL & ~E_STRICT : $e_all;
$e_all = $e_all & E_WARNING; // show warning
$e_all = $e_all & ~E_NOTICE; // don't notices
// Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $config['debug']);
ini_set('error_reporting', $e_all);
ini_set('short_open_tag', 'On');
ini_set('default_charset', "UTF-8");
ini_set('memory_limit', $config['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
ini_set('date.timezone', $config['time_zone']);
define ('DEBUG_SQL_LOG', $config['debug_sql']);
define ('DEBUG_TIME_LOG', $config['debug_time']);
define ('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
define ('MEMCACHED_ENABLED', $config['memcached']);
define ('MEMCACHED_SERVER', $config['memcached_server']);
define ('TIME_ZONE', $config['time_zone']);
G::LoadClass("cli");
G::LoadClass("cli");
// trap -V before pake
if (in_array('-v', $argv) || in_array('-V', $argv) || in_array('--version', $argv))

View File

@@ -8,7 +8,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskRun(runBrowserCacheFiles);
CLI::taskRun("runBrowserCacheFiles");
function runBrowserCacheFiles($command, $args)
{

View File

@@ -8,7 +8,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskRun(runHotfixInstall);
CLI::taskRun("runHotfixInstall");
function runHotfixInstall($command, $args)
{

View File

@@ -35,7 +35,7 @@ EOT
);
CLI::taskArg('plugin', false);
CLI::taskArg('lang', false);
CLI::taskRun(run_update);
CLI::taskRun("run_update");
CLI::taskName('plugins-translation-create');
CLI::taskDescription(<<<EOT
@@ -45,7 +45,7 @@ EOT
);
CLI::taskArg('plugin', true);
CLI::taskArg('lang', true);
CLI::taskRun(run_create);
CLI::taskRun("run_create");
function run_create($command, $args)

View File

@@ -34,7 +34,7 @@ CLI::taskDescription(<<<EOT
EOT
);
//CLI::taskOpt("minify", "If the option is enabled, performs the build only with minified files", "min", "buildmin");
CLI::taskRun(minify_javascript);
CLI::taskRun("minify_javascript");
function minify_javascript($command, $args)
{

View File

@@ -37,7 +37,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskOpt("buildACV", "If the option is enabled, performs the Build Cache View.", "ACV", "buildACV");
CLI::taskRun(run_upgrade);
CLI::taskRun("run_upgrade");
/**

View File

@@ -33,7 +33,7 @@ Print information about the current system and any specified workspaces.
EOT
);
CLI::taskArg('workspace-name', true, true);
CLI::taskRun(run_info);
CLI::taskRun("run_info");
CLI::taskName('workspace-backup');
CLI::taskDescription(<<<EOT
@@ -53,7 +53,7 @@ EOT
CLI::taskArg('workspace', false);
CLI::taskArg('backup-file', true);
CLI::taskOpt("filesize", "Set the max size of the compressed splitted files, by default the max is 1000 Mb.", "s:","filesize=");
CLI::taskRun(run_workspace_backup);
CLI::taskRun("run_workspace_backup");
CLI::taskName('workspace-restore');
CLI::taskDescription(<<<EOT
@@ -75,7 +75,7 @@ CLI::taskOpt("multiple", "Restore from multiple compresed enumerated files.", "m
CLI::taskOpt("workspace", "Select which workspace to restore if multiple workspaces are present in the archive.",
"w:", "workspace=");
CLI::taskOpt("lang", "You must specify language on which rebuild of the case cache list builder will be done; if you don't specify this, it will use 'en' by default", "l:","lang=");
CLI::taskRun(run_workspace_restore);
CLI::taskRun("run_workspace_restore");
CLI::taskName('cacheview-repair');
CLI::taskDescription(<<<EOT
@@ -93,7 +93,7 @@ EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskOpt("lang", "You must specify language on which rebuild of the case cache list builder will be done; if you don't specify this, it will use 'en' by default", "l:","lang=");
CLI::taskRun(run_cacheview_upgrade);
CLI::taskRun("run_cacheview_upgrade");
CLI::taskName('database-upgrade');
CLI::taskDescription(<<<EOT
@@ -110,7 +110,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskRun(run_database_upgrade);
CLI::taskRun("run_database_upgrade");
CLI::taskName('plugins-database-upgrade');
CLI::taskDescription(<<<EOT
@@ -125,7 +125,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskRun(run_plugins_database_upgrade);
CLI::taskRun("run_plugins_database_upgrade");
CLI::taskName('workspace-upgrade');
CLI::taskDescription(<<<EOT
@@ -143,7 +143,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskArg('workspace-name', true, true);
CLI::taskRun(run_workspace_upgrade);
CLI::taskRun("run_workspace_upgrade");
CLI::taskName('translation-repair');
CLI::taskDescription(<<<EOT
@@ -158,7 +158,7 @@ CLI::taskDescription(<<<EOT
EOT
);
CLI::taskArg('workspace-name', true, true);
CLI::taskRun(run_translation_upgrade);
CLI::taskRun("run_translation_upgrade");
CLI::taskName('migrate-cases-folders');
CLI::taskDescription(<<<EOT
@@ -170,7 +170,7 @@ EOT
//CLI::taskArg('workspace', true);
CLI::taskOpt("workspace", "Select which workspace to migrate the cases folders, if multiple workspaces are present in the server.",
"w:", "workspace=");
CLI::taskRun(runStructureDirectories);
CLI::taskRun("runStructureDirectories");
/**
* Function run_info
@@ -431,7 +431,7 @@ function run_workspace_backup($args, $opts) {
function run_workspace_restore($args, $opts) {
$filename = $args[0];
G::verifyPath(PATH_DATA . 'upgrade', true);
G::verifyPath(PATH_DATA . 'upgrade', true);
if (strpos($filename, "/") === false && strpos($filename, '\\') === false) {
$filename = PATH_DATA . "backups/$filename";

View File

@@ -24,38 +24,38 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/Route.php';
require_once 'classes/model/SwimlanesElements.php';
require_once 'classes/model/InputDocument.php';
require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/OutputDocument.php';
require_once 'classes/model/Step.php';
require_once 'classes/model/StepTrigger.php';
require_once 'classes/model/Dynaform.php';
require_once 'classes/model/Triggers.php';
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/ReportTable.php';
require_once 'classes/model/ReportVar.php';
require_once 'classes/model/DbSource.php';
require_once 'classes/model/StepSupervisor.php';
require_once 'classes/model/SubProcess.php';
require_once 'classes/model/CaseTracker.php';
require_once 'classes/model/CaseTrackerObject.php';
require_once 'classes/model/Stage.php';
require_once 'classes/model/TaskUser.php';
require_once 'classes/model/FieldCondition.php';
require_once 'classes/model/Event.php';
require_once 'classes/model/CaseScheduler.php';
require_once 'classes/model/ProcessCategory.php';
require_once 'classes/model/Configuration.php';
//require_once 'classes/model/Content.php';
//require_once 'classes/model/Process.php';
//require_once 'classes/model/Task.php';
//require_once 'classes/model/Route.php';
//require_once 'classes/model/SwimlanesElements.php';
//require_once 'classes/model/InputDocument.php';
//require_once 'classes/model/ObjectPermission.php';
//require_once 'classes/model/OutputDocument.php';
//require_once 'classes/model/Step.php';
//require_once 'classes/model/StepTrigger.php';
//require_once 'classes/model/Dynaform.php';
//require_once 'classes/model/Triggers.php';
//require_once 'classes/model/Groupwf.php';
//require_once 'classes/model/ReportTable.php';
//require_once 'classes/model/ReportVar.php';
//require_once 'classes/model/DbSource.php';
//require_once 'classes/model/StepSupervisor.php';
//require_once 'classes/model/SubProcess.php';
//require_once 'classes/model/CaseTracker.php';
//require_once 'classes/model/CaseTrackerObject.php';
//require_once 'classes/model/Stage.php';
//require_once 'classes/model/TaskUser.php';
//require_once 'classes/model/FieldCondition.php';
//require_once 'classes/model/Event.php';
//require_once 'classes/model/CaseScheduler.php';
//require_once 'classes/model/ProcessCategory.php';
//require_once 'classes/model/Configuration.php';
G::LoadClass( 'tasks' );
G::LoadClass( 'reportTables' );
G::LoadClass( 'processMap' );
G::LoadThirdParty( 'pear/json', 'class.json' );
//G::LoadClass( 'tasks' );
//G::LoadClass( 'reportTables' );
//G::LoadClass( 'processMap' );
//G::LoadThirdParty( 'pear/json', 'class.json' );
class Processes
{

View File

@@ -25,43 +25,43 @@
*/
//It works with the table CONFIGURATION in a WF dataBase
require_once ("classes/model/Application.php");
require_once ("classes/model/AppCacheView.php");
require_once ("classes/model/AppDelegation.php");
require_once ("classes/model/AppDocument.php");
require_once ("classes/model/AppDelay.php");
require_once ("classes/model/AppNotes.php");
require_once ("classes/model/AppThread.php");
require_once ("classes/model/Department.php");
require_once ("classes/model/Dynaform.php");
require_once ("classes/model/Groupwf.php");
require_once ("classes/model/InputDocument.php");
require_once ("classes/model/Language.php");
require_once ("classes/model/OutputDocument.php");
require_once ("classes/model/Process.php");
require_once ("classes/model/ReportTable.php");
require_once ("classes/model/ReportVar.php");
require_once ("classes/model/Route.php");
require_once ("classes/model/Step.php");
require_once ("classes/model/StepTrigger.php");
require_once ("classes/model/Task.php");
require_once ("classes/model/TaskUser.php");
require_once ("classes/model/Triggers.php");
require_once ("classes/model/Users.php");
require_once ("classes/model/Session.php");
require_once ("classes/model/Content.php");
G::LoadClass( "ArrayPeer" );
G::LoadClass( "BasePeer" );
//require_once ("classes/model/Application.php");
//require_once ("classes/model/AppCacheView.php");
//require_once ("classes/model/AppDelegation.php");
//require_once ("classes/model/AppDocument.php");
//require_once ("classes/model/AppDelay.php");
//require_once ("classes/model/AppNotes.php");
//require_once ("classes/model/AppThread.php");
//require_once ("classes/model/Department.php");
//require_once ("classes/model/Dynaform.php");
//require_once ("classes/model/Groupwf.php");
//require_once ("classes/model/InputDocument.php");
//require_once ("classes/model/Language.php");
//require_once ("classes/model/OutputDocument.php");
//require_once ("classes/model/Process.php");
//require_once ("classes/model/ReportTable.php");
//require_once ("classes/model/ReportVar.php");
//require_once ("classes/model/Route.php");
//require_once ("classes/model/Step.php");
//require_once ("classes/model/StepTrigger.php");
//require_once ("classes/model/Task.php");
//require_once ("classes/model/TaskUser.php");
//require_once ("classes/model/Triggers.php");
//require_once ("classes/model/Users.php");
//require_once ("classes/model/Session.php");
//require_once ("classes/model/Content.php");
//G::LoadClass( "ArrayPeer" );
//G::LoadClass( "BasePeer" );
G::LoadClass( 'case' );
G::LoadClass( 'derivation' );
G::LoadClass( 'groups' );
G::LoadClass( 'sessions' );
G::LoadClass( 'processes' );
G::LoadClass( 'processMap' );
G::LoadClass( 'pmScript' );
G::LoadClass( 'spool' );
G::LoadClass( 'tasks' );
G::LoadClass( 'wsResponse' );
//G::LoadClass( 'derivation' );
//G::LoadClass( 'groups' );
//G::LoadClass( 'sessions' );
//G::LoadClass( 'processes' );
//G::LoadClass( 'processMap' );
//G::LoadClass( 'pmScript' );
//G::LoadClass( 'spool' );
//G::LoadClass( 'tasks' );
//G::LoadClass( 'wsResponse' );
/**
* Copyright (C) 2009 COLOSA

View File

@@ -246,7 +246,7 @@ class CaseScheduler
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
$userIsAssigned = \GroupUserPeer::doCount( $oCriteria );
if (! ($userIsAssigned >= 1)) {
throw (new \Exception( "The User `" . $sWS_USER . "` doesn't have the activity `" . $sTASKS . "` assigned"));
throw (new \Exception( "The User \'" . $sWS_USER . "\' doesn't have the activity \'" . $sTASKS . "\' assigned"));
}
}
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
@@ -290,7 +290,7 @@ class CaseScheduler
throw (new \Exception( 'Task not found for id: '. $aData['TAS_UID']));
}
if ($aData['SCH_NAME']=='') {
throw (new \Exception( '`sch_name` can`t be empty'));
throw (new \Exception( '\'sch_name\' can\'t be empty'));
}
if ($this->existsName($sProcessUID, $aData['SCH_NAME'])) {
throw (new \Exception( 'Duplicate Case Scheduler name'));
@@ -304,23 +304,23 @@ class CaseScheduler
if ($sOption != '5') {
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
if (!preg_match($pattern, $aData['SCH_START_TIME'])) {
throw (new \Exception( 'Invalid value specified for `sch_start_time`. Expecting time in HH:MM format (The time can not be increased to 23:59)'));
throw (new \Exception( 'Invalid value specified for \'sch_start_time\'. Expecting time in HH:MM format (The time can not be increased to 23:59)'));
}
}
$patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/";
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if (!preg_match($patternDate, $aData['SCH_START_DATE'])) {
throw (new \Exception( 'Invalid value specified for `sch_start_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_date\'. Expecting date in \'YYYY-MM-DD\' format, such as \'2014-01-01\''));
}
}
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if (!preg_match($patternDate, $aData['SCH_END_DATE'])) {
throw (new \Exception( 'Invalid value specified for `sch_end_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
throw (new \Exception( 'Invalid value specified for \'sch_end_date\'. Expecting date in \'YYYY-MM-DD\' format, such as \'2014-01-01\''));
}
}
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if ($aData['SCH_START_DATE'] == "") {
throw (new \Exception( '`sch_start_date` can`t be null'));
throw (new \Exception( '\'sch_start_date\' can\'t be null'));
}
}
if ($sOption == '2') {
@@ -368,7 +368,7 @@ class CaseScheduler
break;
case '2': // If the option is zero, set by default 1
if ($aData['SCH_WEEK_DAYS'] == "") {
throw (new \Exception( '`sch_week_days` can`t be null'));
throw (new \Exception( '\'sch_week_days\' can\'t be null'));
} else {
$weeks = $aData['SCH_WEEK_DAYS'];
$weeks = explode("|", $weeks);
@@ -376,7 +376,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7") {
$aData['SCH_WEEK_DAYS'] = $aData['SCH_WEEK_DAYS'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_week_days`'));
throw (new \Exception( 'Invalid value specified for \'sch_week_days\''));
}
}
}
@@ -397,50 +397,50 @@ class CaseScheduler
case '3':
$nStartDay = $aData['SCH_START_DAY'];
if ($nStartDay == "") {
throw (new \Exception( '`sch_start_day` can`t be null'));
throw (new \Exception( '\'sch_start_day\' can\'t be null'));
}
if ($nStartDay == 1) {
if ($aData['SCH_START_DAY_OPT_1'] == "") {
throw (new \Exception( '`sch_start_day_opt_1` can`t be null'));
throw (new \Exception( '\'sch_start_day_opt_1\' can\'t be null'));
}
$temp = $aData['SCH_START_DAY_OPT_1'];
$temp = (int)$temp;
if ($temp >= 1 && $temp <= 31) {
$aData['SCH_START_DAY_OPT_1'] = $aData['SCH_START_DAY_OPT_1'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_1`. Must be between 1 and 31'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_1\'. Must be between 1 and 31'));
}
$aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_1'];
} else {
if ($aData['SCH_START_DAY_OPT_2'] == "") {
throw (new \Exception( '`sch_start_day_opt_2` can`t be null'));
throw (new \Exception( '\'sch_start_day_opt_2\' can\'t be null'));
}
$aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_2'];
$optionTwo = $aData['SCH_START_DAY_OPT_2']{0};
if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") {
$aData['SCH_START_DAY_OPT_2'] = $aData['SCH_START_DAY_OPT_2'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_2`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_2\''));
}
$pipelineTwo = $aData['SCH_START_DAY_OPT_2']{1};
if ($pipelineTwo == "|") {
$aData['SCH_START_DAY_OPT_2'] = $aData['SCH_START_DAY_OPT_2'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_2`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_2\''));
}
$dayTwo = $aData['SCH_START_DAY_OPT_2']{2};
if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") {
$aData['SCH_START_DAY_OPT_2'] = $aData['SCH_START_DAY_OPT_2'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_2`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_2\''));
}
}
if ($nStartDay == "") {
throw (new \Exception( '`sch_start_day` can`t be null'));
throw (new \Exception( '\'sch_start_day\' can\'t be null'));
}
$sMonths = '';
if ($aData['SCH_MONTHS'] == "") {
throw (new \Exception( '`sch_months` can`t be null'));
throw (new \Exception( '\'sch_months\' can\'t be null'));
}
if (! empty( $aData['SCH_MONTHS'] )) {
$aMonths = $aData['SCH_MONTHS'];
@@ -449,7 +449,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7"|| $row == "8" || $row == "9" || $row == "10"|| $row == "11" || $row == "12") {
$aData['SCH_MONTHS'] = $aData['SCH_MONTHS'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_months`'));
throw (new \Exception( 'Invalid value specified for \'sch_months\''));
}
}
}
@@ -508,11 +508,11 @@ class CaseScheduler
$aData['SCH_START_TIME'] = time();
$aData['SCH_START_DATE'] = $aData['SCH_START_TIME'];
if ($aData['SCH_REPEAT_EVERY'] == "") {
throw (new \Exception( '`sch_repeat_every` can`t be null'));
throw (new \Exception( '\'sch_repeat_every\' can\'t be null'));
}
$patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/";
if (!preg_match($patternHour, $aData['SCH_REPEAT_EVERY'])) {
throw (new \Exception( 'Invalid value specified for `sch_repeat_every`. Expecting time in HH.MM format'));
throw (new \Exception( 'Invalid value specified for \'sch_repeat_every\'. Expecting time in HH.MM format'));
}
$nextRun = $aData['SCH_REPEAT_EVERY'] * 60 * 60;
$aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY'];
@@ -581,7 +581,7 @@ class CaseScheduler
throw (new \Exception( 'Task not found for id: '. $aData['TAS_UID']));
}
if ($aData['SCH_NAME']=='') {
throw (new \Exception( '`sch_name` can`t be empty'));
throw (new \Exception( '\'sch_name\' can\'t be empty'));
}
if ($this->existsNameUpdate($sSchUID, $aData['SCH_NAME'])) {
throw (new \Exception( 'Duplicate Case Scheduler name'));
@@ -595,23 +595,23 @@ class CaseScheduler
if ($sOption != '5') {
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
if (!preg_match($pattern, $aData['SCH_START_TIME'])) {
throw (new \Exception( 'Invalid value specified for `sch_start_time`. Expecting time in HH:MM format (The time can not be increased to 23:59)'));
throw (new \Exception( 'Invalid value specified for \'sch_start_time\'. Expecting time in HH:MM format (The time can not be increased to 23:59)'));
}
}
$patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/";
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if (!preg_match($patternDate, $aData['SCH_START_DATE'])) {
throw (new \Exception( 'Invalid value specified for `sch_start_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_date\'. Expecting date in \'YYYY-MM-DD\' format, such as \'2014-01-01\''));
}
}
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if (!preg_match($patternDate, $aData['SCH_END_DATE'])) {
throw (new \Exception( 'Invalid value specified for `sch_end_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
throw (new \Exception( 'Invalid value specified for \'sch_end_date\'. Expecting date in \'YYYY-MM-DD\' format, such as \'2014-01-01\''));
}
}
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if ($aData['SCH_START_DATE'] == "") {
throw (new \Exception( '`sch_start_date` can`t be null'));
throw (new \Exception( '\'sch_start_date\' can\'t be null'));
}
}
if ($sOption == '2') {
@@ -622,8 +622,15 @@ class CaseScheduler
$oCaseScheduler = new \CaseScheduler();
$aData['SCH_UID'] = $sSchUID;
$aData['PRO_UID'] = $sProcessUID;
$aData['SCH_STATE'] = 'ACTIVE';
$aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE';
if ($aData['SCH_STATE'] == "" || $aData['SCH_STATE'] == null) {
throw (new \Exception( '\'sch_state\' can\'t be null'));
} else {
if ($aData['SCH_STATE'] == 'ACTIVE') {
$aData['SCH_LAST_STATE'] = 'CREATED';
} else {
$aData['SCH_LAST_STATE'] = 'ACTIVE';
}
}
$aData['USR_UID'] = $userUID;
$aData['SCH_DEL_USER_UID'] = $aData['USR_UID'];
$sTimeTmp = $aData['SCH_START_TIME'];
@@ -659,7 +666,7 @@ class CaseScheduler
break;
case '2': // If the option is zero, set by default 1
if ($aData['SCH_WEEK_DAYS'] == "") {
throw (new \Exception( '`sch_week_days` can`t be null'));
throw (new \Exception( '\'sch_week_days\' can\'t be null'));
} else {
$weeks = $aData['SCH_WEEK_DAYS'];
$weeks = explode("|", $weeks);
@@ -667,7 +674,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7") {
$aData['SCH_WEEK_DAYS'] = $aData['SCH_WEEK_DAYS'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_week_days`'));
throw (new \Exception( 'Invalid value specified for \'sch_week_days\''));
}
}
}
@@ -688,50 +695,50 @@ class CaseScheduler
case '3':
$nStartDay = $aData['SCH_START_DAY'];
if ($nStartDay == "") {
throw (new \Exception( '`sch_start_day` can`t be null'));
throw (new \Exception( '\'sch_start_day\' can\'t be null'));
}
if ($nStartDay == 1) {
if ($aData['SCH_START_DAY_OPT_1'] == "") {
throw (new \Exception( '`sch_start_day_opt_1` can`t be null'));
throw (new \Exception( '\'sch_start_day_opt_1\' can\'t be null'));
}
$temp = $aData['SCH_START_DAY_OPT_1'];
$temp = (int)$temp;
if ($temp >= 1 && $temp <= 31) {
$aData['SCH_START_DAY_OPT_1'] = $aData['SCH_START_DAY_OPT_1'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_1`. Must be between 1 and 31'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_1\'. Must be between 1 and 31'));
}
$aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_1'];
} else {
if ($aData['SCH_START_DAY_OPT_2'] == "") {
throw (new \Exception( '`sch_start_day_opt_2` can`t be null'));
throw (new \Exception( '\'sch_start_day_opt_2\' can\'t be null'));
}
$aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_2'];
$optionTwo = $aData['SCH_START_DAY_OPT_2']{0};
if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") {
$aData['SCH_START_DAY_OPT_2'] = $aData['SCH_START_DAY_OPT_2'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_2`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_2\''));
}
$pipelineTwo = $aData['SCH_START_DAY_OPT_2']{1};
if ($pipelineTwo == "|") {
$aData['SCH_START_DAY_OPT_2'] = $aData['SCH_START_DAY_OPT_2'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_2`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_2\''));
}
$dayTwo = $aData['SCH_START_DAY_OPT_2']{2};
if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") {
$aData['SCH_START_DAY_OPT_2'] = $aData['SCH_START_DAY_OPT_2'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_start_day_opt_2`'));
throw (new \Exception( 'Invalid value specified for \'sch_start_day_opt_2\''));
}
}
if ($nStartDay == "") {
throw (new \Exception( '`sch_start_day` can`t be null'));
throw (new \Exception( '\'sch_start_day\' can\'t be null'));
}
$sMonths = '';
if ($aData['SCH_MONTHS'] == "") {
throw (new \Exception( '`sch_months` can`t be null'));
throw (new \Exception( '\'sch_months\' can\'t be null'));
}
if (! empty( $aData['SCH_MONTHS'] )) {
$aMonths = $aData['SCH_MONTHS'];
@@ -740,7 +747,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7"|| $row == "8" || $row == "9" || $row == "10"|| $row == "11" || $row == "12") {
$aData['SCH_MONTHS'] = $aData['SCH_MONTHS'];
} else {
throw (new \Exception( 'Invalid value specified for `sch_months`'));
throw (new \Exception( 'Invalid value specified for \'sch_months\''));
}
}
}
@@ -799,11 +806,11 @@ class CaseScheduler
$aData['SCH_START_TIME'] = time();
$aData['SCH_START_DATE'] = $aData['SCH_START_TIME'];
if ($aData['SCH_REPEAT_EVERY'] == "") {
throw (new \Exception( '`sch_repeat_every` can`t be null'));
throw (new \Exception( '\'sch_repeat_every\' can\'t be null'));
}
$patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/";
if (!preg_match($patternHour, $aData['SCH_REPEAT_EVERY'])) {
throw (new \Exception( 'Invalid value specified for `sch_repeat_every`. Expecting time in HH.MM format'));
throw (new \Exception( 'Invalid value specified for \'sch_repeat_every\'. Expecting time in HH.MM format'));
}
$nextRun = $aData['SCH_REPEAT_EVERY'] * 60 * 60;
$aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY'];

View File

@@ -117,5 +117,276 @@ class Cases
}
return $result;
}
/**
* Get data of a Case
*
* @param string $caseUid Unique id of Case
* @param string $userUid Unique id of User
*
* return array Return an array with data of Case Info
*/
public function getCaseInfo($caseUid, $userUid)
{
try {
$solrEnabled = 0;
if (($solrEnv = \System::solrEnv()) !== false) {
\G::LoadClass("AppSolr");
$appSolr = new \AppSolr(
$solrEnv["solr_enabled"],
$solrEnv["solr_host"],
$solrEnv["solr_instance"]
);
if ($appSolr->isSolrEnabled() && $solrEnv["solr_enabled"] == true) {
//Check if there are missing records to reindex and reindex them
$appSolr->synchronizePendingApplications();
$solrEnabled = 1;
}
}
if ($solrEnabled == 1) {
try {
\G::LoadClass("searchIndex");
$arrayData = array();
$delegationIndexes = array();
$columsToInclude = array("APP_UID");
$solrSearchText = null;
//Todo
$solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:TO_DO AND APP_ASSIGNED_USERS:" . $userUid . ")";
$delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . $userUid . "_txt";
//Draft
$solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:DRAFT AND APP_DRAFT_USER:" . $userUid . ")";
//Index is allways 1
$solrSearchText = "($solrSearchText)";
//Add del_index dynamic fields to list of resulting columns
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
$solrRequestData = \Entity_SolrRequestData::createForRequestPagination(
array(
"workspace" => $solrEnv["solr_instance"],
"startAfter" => 0,
"pageSize" => 1000,
"searchText" => $solrSearchText,
"numSortingCols" => 1,
"sortCols" => array("APP_NUMBER"),
"sortDir" => array(strtolower("DESC")),
"includeCols" => $columsToIncludeFinal,
"resultFormat" => "json"
)
);
//Use search index to return list of cases
$searchIndex = new \BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
//Execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
//Get the missing data from database
$arrayApplicationUid = array();
foreach ($solrQueryResult->aaData as $i => $data) {
$arrayApplicationUid[] = $data["APP_UID"];
}
$aaappsDBData = $appSolr->getListApplicationDelegationData($arrayApplicationUid);
foreach ($solrQueryResult->aaData as $i => $data) {
//Initialize array
$delIndexes = array(); //Store all the delegation indexes
//Complete empty values
$applicationUid = $data["APP_UID"]; //APP_UID
//Get all the indexes returned by Solr as columns
for($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
if (is_array($data[$columsToIncludeFinal[$i]])) {
foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {
$delIndexes[] = $delIndex;
}
}
}
//Verify if the delindex is an array
//if is not check different types of repositories
//the delegation index must always be defined.
if (count($delIndexes) == 0) {
$delIndexes[] = 1; // the first default index
}
//Remove duplicated
$delIndexes = array_unique($delIndexes);
//Get records
foreach ($delIndexes as $delIndex) {
$aRow = array();
//Copy result values to new row from Solr server
$aRow["APP_UID"] = $data["APP_UID"];
//Get delegation data from DB
//Filter data from db
$indexes = $appSolr->aaSearchRecords($aaappsDBData, array(
"APP_UID" => $applicationUid,
"DEL_INDEX" => $delIndex
));
foreach ($indexes as $index) {
$row = $aaappsDBData[$index];
}
if(!isset($row))
{
continue;
}
$aRow["APP_NUMBER"] = $row["APP_NUMBER"];
$aRow["APP_STATUS"] = $row["APP_STATUS"];
$aRow["PRO_UID"] = $row["PRO_UID"];
$aRow["DEL_INDEX"] = $row["DEL_INDEX"];
$arrayData[] = array(
"guid" => $aRow["APP_UID"],
"name" => $aRow["APP_NUMBER"],
"status" => $aRow["APP_STATUS"],
"delIndex" => $aRow["DEL_INDEX"],
"processId" => $aRow["PRO_UID"]
);
}
}
$case = array();
for ($i = 0; $i<=count($arrayData)-1; $i++) {
if ($arrayData[$i]["guid"] == $caseUid) {
$case = $arrayData[$i];
}
}
return $case;
} catch (\InvalidIndexSearchTextException $e) {
$arrayData = array();
$arrayData[] = array (
"guid" => $e->getMessage(),
"name" => $e->getMessage(),
"status" => $e->getMessage(),
"delIndex" => $e->getMessage(),
"processId" => $e->getMessage()
);
return $arrayData;
}
} else {
$arrayData = array();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\AppCacheViewPeer::APP_UID);
$criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX);
$criteria->addSelectColumn(\AppCacheViewPeer::APP_NUMBER);
$criteria->addSelectColumn(\AppCacheViewPeer::APP_STATUS);
$criteria->addSelectColumn(\AppCacheViewPeer::PRO_UID);
$criteria->add(\AppCacheViewPeer::USR_UID, $userUid);
$criteria->add(\AppCacheViewPeer::APP_UID, $caseUid);
$criteria->add(
//ToDo - getToDo()
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "TO_DO", \CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
)->addOr(
//Draft - getDraft()
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "DRAFT", \CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
);
$criteria->addDescendingOrderByColumn(\AppCacheViewPeer::APP_NUMBER);
$rsCriteria = \AppCacheViewPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayData[] = array(
"guid" => $row["APP_UID"],
"name" => $row["APP_NUMBER"],
"status" => $row["APP_STATUS"],
"delIndex" => $row["DEL_INDEX"],
"processId" => $row["PRO_UID"]
);
}
return $arrayData;
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data Task Case
*
* @param string $caseUid Unique id of Case
*
* return array Return an array with Task Case
*/
public function getTaskCase($caseUid)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->taskCase($caseUid);
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Add New Case
*
* @param string $prjUid Unique id of Project
* @param string $actUid Unique id of Activity
* @param string $caseUid Unique id of Case
* @param array $variables
*
* return array Return an array with Task Case
*/
public function addCase($prjUid, $actUid, $userUid, $variables)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
if ($variables) {
$variables = array_shift($variables);
}
$fields = $ws->newCase($prjUid, $userUid, $actUid, $variables);
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Add New Case Impersonate
*
* @param string $prjUid Unique id of Project
* @param string $usrUid Unique id of User
* @param string $caseUid Unique id of Case
* @param array $variables
*
* return array Return an array with Task Case
*/
public function addCaseImpersonate($prjUid, $usrUid, $caseUid, $variables)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->newCaseImpersonate($prjUid, $usrUid, $variables, '1352844695225ff5fe54de2005407079');
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Reassign Case
*
* @param string $caseUid Unique id of Case
* @param string $userUid Unique id of User
* @param string $delIndex
* @param string $userUidSource Unique id of User Source
* @param string $userUid $userUidTarget id of User Target
*
* return array Return an array with Task Case
*/
public function updateReassignCase($caseUid, $userUid, $delIndex, $userUidSource, $userUidTarget)
{
try {
\G::LoadClass('wsBase');
$ws = new \wsBase();
$fields = $ws->reassignCase($userUid, $caseUid, $delIndex, $userUidSource, $userUidTarget);
//Return
return $fields;
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -164,5 +164,121 @@ class Cases extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:cas_uid
*
* @param string $cas_uid {@min 32}{@max 32}
*/
public function doGetCaseInfo($cas_uid)
{
try {
$userUid = $this->getUserId();
$cases = new \BusinessModel\Cases();
$arrayData = $cases->getCaseInfo($cas_uid, $userUid);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:cas_uid/current-task
*
* @param string $cas_uid {@min 32}{@max 32}
*/
public function doGetTaskCase($cas_uid)
{
try {
$cases = new \BusinessModel\Cases();
$arrayData = $cases->getTaskCase($cas_uid);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST
*
* @param string $prj_uid {@from body} {@min 32}{@max 32}
* @param string $act_uid {@from body} {@min 32}{@max 32}
* @param array $variables {@from body}
*
*/
public function doPostCase($prj_uid, $act_uid, $variables=null)
{
try {
$userUid = $this->getUserId();
$cases = new \BusinessModel\Cases();
$arrayData = $cases->addCase($prj_uid, $act_uid, $userUid, $variables);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /impersonate
*
* @param string $prj_uid {@from body} {@min 32}{@max 32}
* @param string $usr_uid {@from body} {@min 32}{@max 32}
* @param string $act_uid {@from body} {@min 32}{@max 32}
* @param array $variables {@from body}
*/
public function doPostCaseImpersonate($prj_uid, $usr_uid, $act_uid, $variables)
{
try {
$cases = new \BusinessModel\Cases();
$arrayData = $cases->addCaseImpersonate($prj_uid, $usr_uid, $act_uid, $variables);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url PUT /:cas_uid/reassign-case
*
* @param string $del_index {@from body}
* @param string $usr_uid_source {@from body} {@min 32}{@max 32}
* @param string $usr_uid_target {@from body} {@min 32}{@max 32}
*/
public function doPutReassignCase($cas_uid, $del_index, $usr_uid_source, $usr_uid_target)
{
try {
$userUid = $this->getUserId();
$cases = new \BusinessModel\Cases();
$arrayData = $cases->updateReassignCase($cas_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url PUT /:cas_uid/route-case
*
* @param string $del_index {@from body}
* @param string $usr_uid_source {@from body} {@min 32}{@max 32}
* @param string $usr_uid_target {@from body} {@min 32}{@max 32}
*/
public function doPutRouteCase($cas_uid, $del_index, $usr_uid_source, $usr_uid_target)
{
try {
$userUid = $this->getUserId();
$cases = new \BusinessModel\Cases();
$arrayData = $cases->updateRouteCase($cas_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -159,7 +159,7 @@ class CaseSchedulerStructure
public $sch_last_run_time;
/**
* @var string {@from body} {@min 0} {@max 15}
* @var string {@from body} {@choice ACTIVE,INACTIVE}
*/
public $sch_state;

View File

@@ -8,6 +8,7 @@
*
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
*/
$config = parse_ini_file(__DIR__ . DIRECTORY_SEPARATOR . "config.ini");
$workspace = $config['workspace'];
@@ -15,131 +16,19 @@ $lang = $config['lang'];
$processMakerHome = $config['pm_home_dir'];
$rootDir = realpath($processMakerHome) . DIRECTORY_SEPARATOR;
define('SYS_LANG', $lang);
define('PATH_SEP', DIRECTORY_SEPARATOR);
require $rootDir . "framework/src/Maveriks/Util/ClassLoader.php";
define('PATH_TRUNK', $rootDir . PATH_SEP);
define('PATH_OUTTRUNK', realpath($rootDir . '/../') . PATH_SEP);
define('PATH_HOME', $rootDir . PATH_SEP . 'workflow' . PATH_SEP);
$loader = Maveriks\Util\ClassLoader::getInstance();
$loader->add($rootDir . 'framework/src/', "Maveriks");
$loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker");
$loader->add($rootDir . 'workflow/engine/src/');
define('PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP);
define('PATH_RBAC_HOME', PATH_TRUNK . 'rbac' . PATH_SEP);
define('PATH_GULLIVER_HOME', PATH_TRUNK . 'gulliver' . PATH_SEP);
define('PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP); //gulliver system classes
define('PATH_GULLIVER_BIN', PATH_GULLIVER_HOME . 'bin' . PATH_SEP); //gulliver bin classes
define('PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP);
define('PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP);
define('PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP); //to enable rbac version 2
define('PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP);
define('PATH_CORE', PATH_HOME . 'engine' . PATH_SEP);
define('PATH_SKINS', PATH_CORE . 'skins' . PATH_SEP);
define('PATH_SKIN_ENGINE', PATH_CORE . 'skinEngine' . PATH_SEP);
define('PATH_METHODS', PATH_CORE . 'methods' . PATH_SEP);
define('PATH_XMLFORM', PATH_CORE . 'xmlform' . PATH_SEP);
define('PATH_CONFIG', PATH_CORE . 'config' . PATH_SEP);
define('PATH_PLUGINS', PATH_CORE . 'plugins' . PATH_SEP);
define('PATH_HTMLMAIL', PATH_CORE . 'html_templates' . PATH_SEP);
define('PATH_TPL', PATH_CORE . 'templates' . PATH_SEP);
define('PATH_TEST', PATH_CORE . 'test' . PATH_SEP);
define('PATH_FIXTURES', PATH_TEST . 'fixtures' . PATH_SEP);
define('PATH_RTFDOCS', PATH_CORE . 'rtf_templates' . PATH_SEP);
define('PATH_DYNACONT', PATH_CORE . 'content' . PATH_SEP . 'dynaform' . PATH_SEP);
define('SYS_UPLOAD_PATH', PATH_HOME . "public_html/files/" );
define('PATH_UPLOAD', PATH_HTML . 'files' . PATH_SEP);
define('PATH_WORKFLOW_MYSQL_DATA', PATH_CORE . 'data' . PATH_SEP . 'mysql' . PATH_SEP);
define('PATH_RBAC_MYSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mysql' . PATH_SEP);
define('FILE_PATHS_INSTALLED', PATH_CORE . 'config' . PATH_SEP . 'paths_installed.php' );
define('PATH_WORKFLOW_MSSQL_DATA', PATH_CORE . 'data' . PATH_SEP . 'mssql' . PATH_SEP);
define('PATH_RBAC_MSSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mssql' . PATH_SEP);
define('PATH_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP);
define('PATH_SERVICES_REST', PATH_CORE . 'services' . PATH_SEP . 'rest' . PATH_SEP);
// add vendors to autoloader
$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php');
require_once PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php';
spl_autoload_register(array("Bootstrap", "autoloadClass"));
Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php");
Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php");
// define autoloading for others
Bootstrap::registerClass("wsBase", PATH_HOME . "engine/classes/class.wsBase.php");
Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . "class.xmlDocument.php");
Bootstrap::registerClass('XmlForm_Field_TextPM', PATH_HOME . "engine/classes/class.XmlForm_Field_TextPM.php");
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class");
Bootstrap::registerSystemClasses();
Bootstrap::registerDir('src', PATH_HOME . 'engine/src/');
Bootstrap::registerDir('model', PATH_CORE . 'classes' . PATH_SEP . 'model');
$config = System::getSystemConfiguration();
define('DEBUG_SQL_LOG', $config['debug_sql']);
define('DEBUG_TIME_LOG', $config['debug_time']);
define('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
define('MEMCACHED_ENABLED', $config['memcached']);
define('MEMCACHED_SERVER', $config['memcached_server']);
define('TIME_ZONE', $config['time_zone']);
// set include path
set_include_path(
PATH_CORE . PATH_SEPARATOR .
PATH_THIRDPARTY . PATH_SEPARATOR .
PATH_THIRDPARTY . 'pear' . PATH_SEPARATOR .
PATH_RBAC_CORE . PATH_SEPARATOR .
get_include_path()
);
/*
* Setting Up Workspace
*/
// include the server installed configuration
require_once FILE_PATHS_INSTALLED;
define('SYS_SYS', $workspace);
// defining system constant when a valid server environment exists
define( 'PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP );
define( 'PATH_CUSTOM_SKINS', PATH_DATA . 'skins' . PATH_SEP );
define( 'PATH_TEMPORAL', PATH_C . 'dynEditor/' );
define( 'PATH_DB', PATH_DATA . 'sites' . PATH_SEP );
$workspaceDir = PATH_DB . $workspace;
// smarty constants
define( 'PATH_SMARTY_C', PATH_C . 'smarty' . PATH_SEP . 'c' );
define( 'PATH_SMARTY_CACHE', PATH_C . 'smarty' . PATH_SEP . 'cache' );
//***************** PM Paths DATA **************************
define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
define('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/');
define('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
if (is_file(PATH_DATA_SITE.PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents(PATH_DATA_SITE.PATH_SEP.'.server_info');
$SERVER_INFO = unserialize($SERVER_INFO);
define('SERVER_NAME', $SERVER_INFO ['SERVER_NAME']);
define('SERVER_PORT', $SERVER_INFO ['SERVER_PORT']);
} else {
echo "WARNING! No server info found!";
}
// create memcached singleton
Bootstrap::LoadClass( 'memcached' );
//$memcache = PMmemcached::getSingleton( SYS_SYS );
Propel::init(PATH_CONFIG . "databases.php");
$loader->addModelClassPath($rootDir . "workflow/engine/classes/model/");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$app->loadEnvironment($workspace);

View File

@@ -38,7 +38,7 @@ try {
//$loader->add($rootDir . "workflow/engine/classes/model/");
$loader->add($rootDir . 'workflow/engine/src/');
// and vendors to autoloader
// add vendors to autoloader
$loader->add($rootDir . 'vendor/luracast/restler/vendor', "Luracast");
$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php');
@@ -67,7 +67,10 @@ try {
break;
case Maveriks\WebApplication::RUNNING_DEFAULT:
$app->run(Maveriks\WebApplication::REDIRECT_DEFAULT);
$response = new Maveriks\Http\Response("", 302);
//TODO compose this def url with configuration data from env.ini
$response->setHeader("location", "/sys/en/neoclassic/login/login");
$response->send();
break;
}