Merge remote-tracking branch 'origin/feature/HOR-3559' into feature/HOR-3629

This commit is contained in:
Ronald Quenta
2017-08-10 18:33:14 -04:00
68 changed files with 818 additions and 760 deletions

View File

@@ -1503,7 +1503,7 @@ function get_infoOnPM($workspace) {
$dbNetView = new NET(DB_HOST); $dbNetView = new NET(DB_HOST);
$dbNetView->loginDbServer(DB_USER, DB_PASS); $dbNetView->loginDbServer(DB_USER, DB_PASS);
$dbConns = new dbConnections(''); $dbConns = new DbConnections('');
$availdb = ''; $availdb = '';
foreach( $dbConns->getDbServicesAvailables() as $key => $val ) { foreach( $dbConns->getDbServicesAvailables() as $key => $val ) {
if( $availdb != '' ) if( $availdb != '' )

View File

@@ -27,7 +27,6 @@
$xmlfile = '{className}/{className}OnTransitList'; $xmlfile = '{className}/{className}OnTransitList';
/* Render page */ /* Render page */
//require_once ( 'classes/class.extendGulliver.php' );
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( 'propeltable', '{className}/paged-table', '{className}/{className}OnTransitList', $Criteria ); $G_PUBLISH->AddContent( 'propeltable', '{className}/paged-table', '{className}/{className}OnTransitList', $Criteria );
G::RenderPage( "publish" ); G::RenderPage( "publish" );

View File

@@ -14,6 +14,27 @@ class Bootstrap
//below here only approved methods //below here only approved methods
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function autoloadClass($class)
{
}
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function registerClass($className, $includePath)
{
}
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function registerDir($name, $dir)
{
}
/* /*
* these functions still under revision * these functions still under revision
*/ */
@@ -22,6 +43,12 @@ class Bootstrap
{ {
return PmSystem::getSystemConfiguration($globalIniFile, $wsIniFile, $wsName); return PmSystem::getSystemConfiguration($globalIniFile, $wsIniFile, $wsName);
} }
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function registerSystemClasses()
{
}
//below this line, still not approved methods //below this line, still not approved methods
@@ -122,6 +149,13 @@ class Bootstrap
$smarty->display($template); $smarty->display($template);
} }
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function LoadSystem($strClass)
{
}
/** /**
* Get the temporal directory path on differents O.S. * Get the temporal directory path on differents O.S.
* i.e. /temp -> linux, C:/Temp -> win * i.e. /temp -> linux, C:/Temp -> win
@@ -411,6 +445,19 @@ class Bootstrap
return $content; return $content;
} }
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function LoadClass($strClass)
{
}
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function LoadThirdParty($sPath, $sFile)
{
}
/** /**
* Function LoadTranslationObject * Function LoadTranslationObject
@@ -1948,6 +1995,13 @@ class Bootstrap
return $result; return $result;
} }
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public function getModel($model)
{
}
/** /**
* Create an encrypted unique identifier based on $id and the selected scope id. * Create an encrypted unique identifier based on $id and the selected scope id.
* *
@@ -2427,6 +2481,13 @@ class Bootstrap
return strtoupper(PHP_OS) == "LINUX"; return strtoupper(PHP_OS) == "LINUX";
} }
/**
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
*/
public static function initVendors()
{
}
public static function parseIniFile($filename) public static function parseIniFile($filename)
{ {
$data = @parse_ini_file($filename, true); $data = @parse_ini_file($filename, true);
@@ -2516,18 +2577,37 @@ class Bootstrap
return $var; return $var;
} }
public function verifyHashPassword ($pass, $userPass) /**
* Verify Hash password with password entered
*
* @param string $pass password
* @param string $userPass hash of password
* @return bool true or false
*/
public function verifyHashPassword($pass, $userPass)
{ {
global $RBAC;
$passwordHashConfig = Bootstrap::getPasswordHashConfig(); $passwordHashConfig = Bootstrap::getPasswordHashConfig();
$hashTypeCurrent = $passwordHashConfig['current']; $hashTypeCurrent = $passwordHashConfig['current'];
$hashTypePrevious = $passwordHashConfig['previous']; $hashTypePrevious = $passwordHashConfig['previous'];
if ((Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) || ($pass === $hashTypeCurrent . ':' . $userPass)) { $acceptance = false;
return true;
if ($RBAC->loginWithHash()) {
//To enable compatibility with soap login
if ((Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) || ($pass === $hashTypeCurrent . ':' . $userPass)) {
$acceptance = true;
} else if ((Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) || ($pass === $hashTypePrevious . ':' . $userPass)) {
$acceptance = true;
}
} else {
if (Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) {
$acceptance = true;
} else if (Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) {
$acceptance = true;
}
} }
if ((Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) || ($pass === $hashTypePrevious . ':' . $userPass)) {
return true; return $acceptance;
}
return false;
} }
/** /**

View File

@@ -31,7 +31,7 @@
* @description This class is a Dynaform handler for modify directly into file * @description This class is a Dynaform handler for modify directly into file
* @package gulliver.system * @package gulliver.system
*/ */
class dynaFormHandler class DynaformHandler
{ {
private $xmlfile; private $xmlfile;

View File

@@ -46,11 +46,7 @@ class G
public static $httpHost; public static $httpHost;
/** /**
* Load Gulliver Classes * @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
* @access public
* @param string $strClass
* @return void
* @deprecated 08-04-2017
*/ */
public static function LoadSystem($strClass) public static function LoadSystem($strClass)
{ {
@@ -58,11 +54,7 @@ class G
} }
/** /**
* Load System Classes * @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
* @access public
* @param string $strClass
* @return void
* @deprecated 08-04-2017
*/ */
public function LoadSystemExist($strClass) public function LoadSystemExist($strClass)
{ {
@@ -70,11 +62,7 @@ class G
} }
/** /**
* Include javascript files * @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
* @access public
* @param string $strClass
* @return void
* @deprecated 08-04-2017
*/ */
public function LoadInclude($strClass) public function LoadInclude($strClass)
{ {
@@ -82,11 +70,7 @@ class G
} }
/** /**
* public function LoadClassRBAC * @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
* @access public
* @param string $strClass
* @return void
* @deprecated 08-04-2017
*/ */
public function LoadClassRBAC($strClass) public function LoadClassRBAC($strClass)
{ {
@@ -94,12 +78,7 @@ class G
} }
/** /**
* If the class is not defined by the aplication, it * @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
* attempt to load the class from gulliver.system
* @access public
* @param string $strClass
* @return void
* @deprecated 08-04-2017
*/ */
public static function LoadClass($strClass) public static function LoadClass($strClass)
{ {
@@ -107,12 +86,7 @@ class G
} }
/** /**
* public function LoadThirdParty * @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
* @access public
* @param string $sPath
* @param string $sFile
* @return void
* @deprecated 08-04-2017
*/ */
public static function LoadThirdParty($sPath, $sFile) public static function LoadThirdParty($sPath, $sFile)
{ {

View File

@@ -75,6 +75,12 @@ class RBAC
private static $instance = null; private static $instance = null;
public $authorizedActions = array(); public $authorizedActions = array();
/**
* To enable compatibility with soap login.
* @var bool
*/
private $enableLoginHash = false;
public function __construct () public function __construct ()
{ {
$this->authorizedActions = array( $this->authorizedActions = array(
@@ -1572,5 +1578,31 @@ class RBAC
throw new RBACException('ID_ACCESS_DENIED', 403); throw new RBACException('ID_ACCESS_DENIED', 403);
} }
} }
/**
* Enable compatibility with hash login
*/
public function enableLoginWithHash()
{
$this->enableLoginHash = true;
}
/**
* Disable compatibility with hash login
*/
public function disableLoginWithHash()
{
$this->enableLoginHash = false;
}
/**
* Return status login with hash
*
* @return bool
*/
public function loginWithHash()
{
return $this->enableLoginHash;
}
} }

View File

@@ -77,12 +77,13 @@ class RbacUsers extends BaseRbacUsers
try { try {
$c = new Criteria('rbac'); $c = new Criteria('rbac');
$c->add(RbacUsersPeer::USR_USERNAME, $sUsername); $c->add(RbacUsersPeer::USR_USERNAME, $sUsername);
/* @var $rs RbacUsers[] */
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro')); $rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') { if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
$aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME); $aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
//verify password with md5, and md5 format //verify password with md5, and md5 format
if (mb_strtoupper($sUsername, 'utf-8') === mb_strtoupper($aFields['USR_USERNAME'], 'utf-8')) { if (mb_strtoupper($sUsername, 'utf-8') === mb_strtoupper($aFields['USR_USERNAME'], 'utf-8')) {
if( Bootstrap::verifyHashPassword($sPassword, $aFields['USR_PASSWORD']) ) { if( Bootstrap::verifyHashPassword($sPassword, $rs[0]->getUsrPassword()) ) {
if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) { if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) {
return -4; return -4;
} }
@@ -319,6 +320,25 @@ class RbacUsers extends BaseRbacUsers
throw($oError); throw($oError);
} }
} }
/**
* {@inheritdoc} except USR_PASSWORD, for security reasons.
*
* @param string $keyType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$key = RbacUsersPeer::translateFieldName(
RbacUsersPeer::USR_PASSWORD,
BasePeer::TYPE_COLNAME,
$keyType
);
$array = parent::toArray($keyType);
unset($array[$key]);
return $array;
}
} }
// Users // Users

View File

@@ -488,7 +488,7 @@ class Propel {
* @date: 27-05-08 11:48 * * @date: 27-05-08 11:48 *
* @Description: this was added for the additional database connections * * @Description: this was added for the additional database connections *
***********************************************************************/ ***********************************************************************/
$oDbConnections = new dbConnections($_SESSION['PROCESS']); $oDbConnections = new DbConnections($_SESSION['PROCESS']);
$oDbConnections->loadAdditionalConnections(); $oDbConnections->loadAdditionalConnections();
$dsn = isset(self::$configuration['datasources'][$name]['connection']) ? self::$configuration['datasources'][$name]['connection'] : null; $dsn = isset(self::$configuration['datasources'][$name]['connection']) ? self::$configuration['datasources'][$name]['connection'] : null;
} else { } else {

View File

@@ -66,7 +66,6 @@ class PmBootstrap extends Bootstrap
// pm workflow classes (static load) // pm workflow classes (static load)
$this->autoloader->registerClass('System', PATH_CORE . 'classes/class.system'); $this->autoloader->registerClass('System', PATH_CORE . 'classes/class.system');
//$this->autoloader->registerClass('Services_JSON', PATH_THIRDPARTY .'pear/json/class.json');
$this->autoloader->registerClass('Smarty', PATH_THIRDPARTY . 'smarty/libs/Smarty.class'); $this->autoloader->registerClass('Smarty', PATH_THIRDPARTY . 'smarty/libs/Smarty.class');
$this->autoloader->registerClass('Propel', PATH_THIRDPARTY . 'propel/Propel'); $this->autoloader->registerClass('Propel', PATH_THIRDPARTY . 'propel/Propel');

View File

@@ -1,4 +1,5 @@
<?php <?php
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
try { try {
//Set variables //Set variables
$cronName = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_FILENAME); $cronName = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_FILENAME);
@@ -72,7 +73,6 @@ try {
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP, 'ProcessMaker'); $classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP, 'ProcessMaker');
$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);
$classLoader->addClass('Bootstrap', PATH_TRUNK . 'gulliver' . PATH_SEP . 'system' . PATH_SEP . 'class.bootstrap.php'); $classLoader->addClass('Bootstrap', PATH_TRUNK . 'gulliver' . PATH_SEP . 'system' . PATH_SEP . 'class.bootstrap.php');
Bootstrap::initVendors();
$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);
//Load classes //Load classes

View File

@@ -1,4 +1,5 @@
<?php <?php
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
@@ -93,38 +94,6 @@ try {
spl_autoload_register(['Bootstrap', 'autoloadClass']); spl_autoload_register(['Bootstrap', 'autoloadClass']);
//DATABASE propel classes used in 'Cases' Options
Bootstrap::registerClass('AuthenticationSourcePeer', PATH_RBAC . 'model' . PATH_SEP . 'AuthenticationSourcePeer.php');
Bootstrap::registerClass('BaseAuthenticationSource', PATH_RBAC . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseAuthenticationSource.php');
Bootstrap::registerClass('AuthenticationSource', PATH_RBAC . 'model' . PATH_SEP . 'AuthenticationSource.php');
Bootstrap::registerClass('RolesPeer', PATH_RBAC . 'model' . PATH_SEP . 'RolesPeer.php');
Bootstrap::registerClass('BaseRoles', PATH_RBAC . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseRoles.php');
Bootstrap::registerClass('Roles', PATH_RBAC . 'model' . PATH_SEP . 'Roles.php');
require_once(PATH_RBAC . 'model' . PATH_SEP . 'UsersRolesPeer.php');
require_once(PATH_RBAC . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseUsersRoles.php');
require_once(PATH_RBAC . 'model' . PATH_SEP . 'UsersRoles.php');
Bootstrap::registerClass('PMLicensedFeatures', PATH_CLASSES . 'class.licensedFeatures.php');
Bootstrap::registerClass('serverConf', PATH_CLASSES . 'class.serverConfiguration.php');
Bootstrap::registerClass('calendar', PATH_CLASSES . 'class.calendar.php');
Bootstrap::registerClass('groups', PATH_CLASSES . 'class.groups.php');
Bootstrap::registerClass('Entity_Base', PATH_HOME . 'engine/classes/entities/Base.php');
Bootstrap::registerClass('Entity_AppSolrQueue', PATH_HOME . 'engine/classes/entities/AppSolrQueue.php');
Bootstrap::registerClass('XMLDB', PATH_HOME . 'engine/classes/class.xmlDb.php');
Bootstrap::registerClass('dynaFormHandler', PATH_GULLIVER . 'class.dynaformhandler.php');
Bootstrap::registerClass('DynaFormField', PATH_HOME . 'engine/classes/class.dynaFormField.php');
Bootstrap::registerClass('SolrRequestData', PATH_HOME . 'engine/classes/entities/SolrRequestData.php');
Bootstrap::registerClass('SolrUpdateDocument', PATH_HOME . 'engine/classes/entities/SolrUpdateDocument.php');
Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . 'class.xmlDocument.php');
Bootstrap::registerClass('wsResponse', PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.wsResponse.php');
Bootstrap::initVendors();
/*----------------------------------********---------------------------------*/
Bootstrap::registerClass('dashboards', PATH_HOME . 'engine/classes/class.dashboards.php');
/*----------------------------------********---------------------------------*/
//Set variables //Set variables
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$dateInit = null; $dateInit = null;

View File

@@ -115,7 +115,6 @@ if (! defined ('PATH_HOME')) {
define( 'PATH_CLASSES', PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP ); define( 'PATH_CLASSES', PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP );
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
require_once (PATH_GULLIVER . "class.bootstrap.php");
spl_autoload_register(array('Bootstrap', 'autoloadClass')); spl_autoload_register(array('Bootstrap', 'autoloadClass'));
} }

View File

@@ -86,8 +86,6 @@ if (! defined ('PATH_HOME')) {
require_once PATH_TRUNK . "framework/src/Maveriks/Util/ClassLoader.php"; require_once PATH_TRUNK . "framework/src/Maveriks/Util/ClassLoader.php";
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
require_once (PATH_GULLIVER . "class.bootstrap.php");
Bootstrap::registerSystemClasses();
spl_autoload_register(array('Bootstrap', 'autoloadClass')); spl_autoload_register(array('Bootstrap', 'autoloadClass'));

View File

@@ -2365,7 +2365,7 @@ class AppSolr
foreach ($dynaformFileNames as $dynaformFileName) { foreach ($dynaformFileNames as $dynaformFileName) {
if (is_file(PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml') && if (is_file(PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml') &&
filesize(PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml') >0 ) { filesize(PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml') >0 ) {
$dyn = new dynaFormHandler (PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml'); $dyn = new DynaformHandler (PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml');
$dynaformFields [] = $dyn->getFields (); $dynaformFields [] = $dyn->getFields ();
} }
if (is_file(PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml') && if (is_file(PATH_DYNAFORM . $dynaformFileName ['DYN_FILENAME'] . '.xml') &&

View File

@@ -239,14 +239,6 @@ class Applications
$dateFrom = isset($dateFrom)? $dateFrom : ""; $dateFrom = isset($dateFrom)? $dateFrom : "";
$dateTo = isset($dateTo)? $dateTo : ""; $dateTo = isset($dateTo)? $dateTo : "";
//require_once ("classes/model/AppCacheView.php");
//require_once ("classes/model/AppDelegation.php");
//require_once ("classes/model/AdditionalTables.php");
//require_once ("classes/model/AppDelay.php");
//require_once ("classes/model/Fields.php");
//require_once ("classes/model/Users.php");
//require_once ("classes/model/Process.php");
$oAppCache = new AppCacheView(); $oAppCache = new AppCacheView();
if ($configuration == true) { if ($configuration == true) {

View File

@@ -21,7 +21,7 @@ require_once 'model/Content.php';
* @package workflow.engine.classes * @package workflow.engine.classes
* *
*/ */
class dbConnections class DbConnections
{ {
private $PRO_UID; private $PRO_UID;
public $connections; public $connections;

View File

@@ -179,7 +179,7 @@ class DynaFormField extends DBTable
public function saveField($Fields, $attributes = array(), $options = array()) public function saveField($Fields, $attributes = array(), $options = array())
{ {
$dynaform = new dynaFormHandler($this->getFileName()); $dynaform = new DynaformHandler($this->getFileName());
if ($Fields['TYPE'] === 'javascript') { if ($Fields['TYPE'] === 'javascript') {
$Fields['XMLNODE_VALUE'] = $Fields['CODE']; $Fields['XMLNODE_VALUE'] = $Fields['CODE'];
unset($Fields['CODE']); unset($Fields['CODE']);

View File

@@ -664,7 +664,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
$pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path');
$dynaform = new dynaFormHandler($pathFile); $dynaform = new DynaformHandler($pathFile);
$dynaform->replace($fieldName, $fieldName, Array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode $dynaform->replace($fieldName, $fieldName, Array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode
)); ));
@@ -734,7 +734,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
self::_setTmpData($tmp); self::_setTmpData($tmp);
} }
$pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path');
$dynaform = new dynaFormHandler($pathFile); $dynaform = new DynaformHandler($pathFile);
$dbc2 = new DBConnection($pathFile, '', '', '', 'myxml'); $dbc2 = new DBConnection($pathFile, '', '', '', 'myxml');
$ses2 = new DBSession($dbc2); $ses2 = new DBSession($dbc2);
//if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0"; //if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0";
@@ -804,7 +804,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
// $ses2 = new DBSession( $dbc2 ); // $ses2 = new DBSession( $dbc2 );
// $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" ); // $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" );
$pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path'); $pathFile = $filter->xssFilterHard(PATH_DYNAFORM . "{$file}.xml", 'path');
$dynaform = new dynaFormHandler($pathFile); $dynaform = new DynaformHandler($pathFile);
$dynaform->modifyHeaderAttribute('enabletemplate', $value); $dynaform->modifyHeaderAttribute('enabletemplate', $value);
return $value; return $value;

View File

@@ -203,9 +203,6 @@ class PMPluginRegistry
*/ */
public function registerPlugin ($sNamespace, $sFilename = null) public function registerPlugin ($sNamespace, $sFilename = null)
{ {
//require_once ($sFilename);
$sClassName = $sNamespace . "plugin"; $sClassName = $sNamespace . "plugin";
$plugin = new $sClassName( $sNamespace, $sFilename ); $plugin = new $sClassName( $sNamespace, $sFilename );
@@ -278,7 +275,6 @@ class PMPluginRegistry
$pluginSrcDir = PATH_PLUGINS . $detail->sNamespace . PATH_SEP . 'src'; $pluginSrcDir = PATH_PLUGINS . $detail->sNamespace . PATH_SEP . 'src';
if (is_dir($pluginSrcDir)) { if (is_dir($pluginSrcDir)) {
//Bootstrap::registerDir($detail->sNamespace.'/src', $pluginSrcDir);
$loader = \Maveriks\Util\ClassLoader::getInstance(); $loader = \Maveriks\Util\ClassLoader::getInstance();
$loader->add($pluginSrcDir); $loader->add($pluginSrcDir);
} }

View File

@@ -3916,3 +3916,287 @@ function PMFSendMessageToGroup(
//Return //Return
return 1; return 1;
} }
//Start - Private functions
/**
* Convert to string
*
* @param variant $vValue
* @return string
*/
function pmToString($vValue)
{
return (string)$vValue;
}
/**
* Convert to integer
*
* @param variant $vValue
* @return integer
*/
function pmToInteger($vValue)
{
return (int)$vValue;
}
/**
* Convert to float
*
* @param variant $vValue
* @return float
*/
function pmToFloat($vValue)
{
return (float)$vValue;
}
/**
* Convert to Url
*
* @param variant $vValue
* @return url
*/
function pmToUrl($vValue)
{
return urlencode($vValue);
}
/**
* Convert to data base escaped string
*
* @param variant $vValue
* @return string
*/
function pmSqlEscape($vValue)
{
return G::sqlEscape($vValue);
}
//End - Private functions
/* * *************************************************************************
* Error handler
* author: Julio Cesar Laura Avenda<64>o <juliocesar@colosa.com>
* date: 2009-10-01
* ************************************************************************* */
/**
* @param $errno
* @param $errstr
* @param $errfile
* @param $errline
*/
function handleErrors($errno, $errstr, $errfile, $errline)
{
if ($errno != 2048 && isset($_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'])) {
G::logTriggerExecution($_SESSION, $errstr, '', round(microtime(true) -
$_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'], 5));
}
if ($errno != '' && ($errno != 8) && ($errno != 2048)) {
if (isset($_SESSION['_CODE_'])) {
$sCode = $_SESSION['_CODE_'];
unset($_SESSION['_CODE_']);
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oCase = new Cases();
$oPMScript->aFields['__ERROR__'] = $errstr;
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
registerError(1, $errstr, $errline - 1, $sCode);
}
}
}
/*
* Handle Fatal Errors
* @param variant $buffer
* @return buffer
*/
function handleFatalErrors($buffer)
{
if (!empty($buffer)) {
G::logTriggerExecution($_SESSION, $buffer, 'FATAL_ERROR');
}
if (preg_match('/(error<\/b>:)(.+)(<br)/', $buffer, $regs)) {
$oCase = new Cases();
$err = preg_replace('/<.*?>/', '', $regs[2]);
$aAux = explode(' in ', $err);
$sCode = isset($_SESSION['_CODE_']) ? $_SESSION['_CODE_'] : null;
unset($_SESSION['_CODE_']);
registerError(2, $aAux[0], 0, $sCode);
if (strpos($_SERVER['REQUEST_URI'], '/cases/cases_Step') !== false) {
if (strpos($_SERVER['REQUEST_URI'], '&ACTION=GENERATE') !== false) {
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER'));
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oPMScript->aFields['__ERROR__'] = $aAux[0];
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
G::header('Location: ' . $aNextStep['PAGE']);
die();
}
$_SESSION['_NO_EXECUTE_TRIGGERS_'] = 1;
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oPMScript->aFields['__ERROR__'] = $aAux[0];
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
G::header('Location: ' . $_SERVER['REQUEST_URI']);
die();
} else {
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
if (isset($_SESSION['TRIGGER_DEBUG']['ISSET']) && $_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER'));
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
if (strpos($aNextStep['PAGE'], 'TYPE=ASSIGN_TASK&UID=-1') !== false) {
G::SendMessageText('Fatal error in trigger', 'error');
}
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oPMScript->aFields['__ERROR__'] = $aAux[0];
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
G::header('Location: ' . $aNextStep['PAGE']);
die();
}
}
return $buffer;
}
/*
* Register Error
* @param string $iType
* @param string $sError
* @param string $iLine
* @param string $sCode
* @return void
*/
function registerError($iType, $sError, $iLine, $sCode)
{
$sType = ($iType == 1 ? 'ERROR' : 'FATAL');
$_SESSION['TRIGGER_DEBUG']['ERRORS'][][$sType] = $sError . ($iLine > 0 ? ' (line ' . $iLine . ')' : '') . ':<br /><br />' . $sCode;
}
/**
* Obtain engine Data Base name
*
* @param type $connection
* @return type
*/
function getEngineDataBaseName($connection)
{
$aDNS = $connection->getDSN();
return $aDNS["phptype"];
}
/**
* Execute Queries for Oracle Database
*
* @param type $sql
* @param type $connection
*/
function executeQueryOci($sql, $connection, $aParameter = array(), $dbsEncode = "")
{
$aDNS = $connection->getDSN();
$sUsername = $aDNS["username"];
$sPassword = $aDNS["password"];
$sHostspec = $aDNS["hostspec"];
$sDatabse = $aDNS["database"];
$sPort = $aDNS["port"];
if ($sPort != "1521") {
$flagTns = ($sDatabse == "" && ($sPort . "" == "" || $sPort . "" == "0")) ? 1 : 0;
if ($flagTns == 0) {
// if not default port
$conn = oci_connect($sUsername, $sPassword, $sHostspec . ":" . $sPort . "/" . $sDatabse, $dbsEncode);
} else {
$conn = oci_connect($sUsername, $sPassword, $sHostspec, $dbsEncode);
}
} else {
$conn = oci_connect($sUsername, $sPassword, $sHostspec . "/" . $sDatabse, $dbsEncode);
}
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
return $e;
}
switch (true) {
case preg_match("/^(SELECT|SHOW|DESCRIBE|DESC|WITH)\s/i", $sql):
$stid = oci_parse($conn, $sql);
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name($stid, $key, $val);
}
}
oci_execute($stid, OCI_DEFAULT);
$result = Array();
$i = 1;
while ($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
$result[$i++] = $row;
}
oci_free_statement($stid);
oci_close($conn);
return $result;
break;
case preg_match("/^(INSERT|UPDATE|DELETE)\s/i", $sql):
$stid = oci_parse($conn, $sql);
$isValid = true;
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name($stid, $key, $val);
}
}
$objExecute = oci_execute($stid, OCI_DEFAULT);
$result = oci_num_rows($stid);
if ($objExecute) {
oci_commit($conn);
} else {
oci_rollback($conn);
$isValid = false;
}
oci_free_statement($stid);
oci_close($conn);
if ($isValid) {
return $result;
} else {
return oci_error();
}
break;
default:
// Stored procedures
$stid = oci_parse($conn, $sql);
$aParameterRet = array();
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
$aParameterRet[$key] = $val;
// The third parameter ($aParameterRet[$key]) returned a value by reference.
oci_bind_by_name($stid, $key, $aParameterRet[$key]);
}
}
$objExecute = oci_execute($stid, OCI_DEFAULT);
oci_free_statement($stid);
oci_close($conn);
return $aParameterRet;
break;
}
}

View File

@@ -641,287 +641,3 @@ class PMScript
} }
} }
} }
//Start - Private functions
/**
* Convert to string
*
* @param variant $vValue
* @return string
*/
function pmToString ($vValue)
{
return (string) $vValue;
}
/**
* Convert to integer
*
* @param variant $vValue
* @return integer
*/
function pmToInteger ($vValue)
{
return (int) $vValue;
}
/**
* Convert to float
*
* @param variant $vValue
* @return float
*/
function pmToFloat ($vValue)
{
return (float) $vValue;
}
/**
* Convert to Url
*
* @param variant $vValue
* @return url
*/
function pmToUrl ($vValue)
{
return urlencode( $vValue );
}
/**
* Convert to data base escaped string
*
* @param variant $vValue
* @return string
*/
function pmSqlEscape ($vValue)
{
return G::sqlEscape( $vValue );
}
//End - Private functions
/* * *************************************************************************
* Error handler
* author: Julio Cesar Laura Avenda<64>o <juliocesar@colosa.com>
* date: 2009-10-01
* ************************************************************************* */
/**
* @param $errno
* @param $errstr
* @param $errfile
* @param $errline
*/
function handleErrors($errno, $errstr, $errfile, $errline)
{
if ($errno != 2048 && isset($_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'])) {
G::logTriggerExecution($_SESSION, $errstr, '', round(microtime(true) -
$_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'], 5));
}
if ($errno != '' && ($errno != 8) && ($errno != 2048)) {
if (isset( $_SESSION['_CODE_'] )) {
$sCode = $_SESSION['_CODE_'];
unset( $_SESSION['_CODE_'] );
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oCase = new Cases();
$oPMScript->aFields['__ERROR__'] = $errstr;
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
registerError( 1, $errstr, $errline - 1, $sCode );
}
}
}
/*
* Handle Fatal Errors
* @param variant $buffer
* @return buffer
*/
function handleFatalErrors ($buffer)
{
if (!empty($buffer)) {
G::logTriggerExecution($_SESSION, $buffer, 'FATAL_ERROR');
}
if (preg_match( '/(error<\/b>:)(.+)(<br)/', $buffer, $regs )) {
$oCase = new Cases();
$err = preg_replace( '/<.*?>/', '', $regs[2] );
$aAux = explode( ' in ', $err );
$sCode = isset($_SESSION['_CODE_']) ? $_SESSION['_CODE_'] : null;
unset( $_SESSION['_CODE_'] );
registerError( 2, $aAux[0], 0, $sCode );
if (strpos( $_SERVER['REQUEST_URI'], '/cases/cases_Step' ) !== false) {
if (strpos( $_SERVER['REQUEST_URI'], '&ACTION=GENERATE' ) !== false) {
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER'));
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oPMScript->aFields['__ERROR__'] = $aAux[0];
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
G::header( 'Location: ' . $aNextStep['PAGE'] );
die();
}
$_SESSION['_NO_EXECUTE_TRIGGERS_'] = 1;
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oPMScript->aFields['__ERROR__'] = $aAux[0];
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
G::header( 'Location: ' . $_SERVER['REQUEST_URI'] );
die();
} else {
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
if (isset($_SESSION['TRIGGER_DEBUG']['ISSET']) && $_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER'));
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
if (strpos( $aNextStep['PAGE'], 'TYPE=ASSIGN_TASK&UID=-1' ) !== false) {
G::SendMessageText( 'Fatal error in trigger', 'error' );
}
global $oPMScript;
if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) {
$oPMScript->aFields['__ERROR__'] = $aAux[0];
$oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields));
}
G::header( 'Location: ' . $aNextStep['PAGE'] );
die();
}
}
return $buffer;
}
/*
* Register Error
* @param string $iType
* @param string $sError
* @param string $iLine
* @param string $sCode
* @return void
*/
function registerError ($iType, $sError, $iLine, $sCode)
{
$sType = ($iType == 1 ? 'ERROR' : 'FATAL');
$_SESSION['TRIGGER_DEBUG']['ERRORS'][][$sType] = $sError . ($iLine > 0 ? ' (line ' . $iLine . ')' : '') . ':<br /><br />' . $sCode;
}
/**
* Obtain engine Data Base name
*
* @param type $connection
* @return type
*/
function getEngineDataBaseName ($connection)
{
$aDNS = $connection->getDSN();
return $aDNS["phptype"];
}
/**
* Execute Queries for Oracle Database
*
* @param type $sql
* @param type $connection
*/
function executeQueryOci ($sql, $connection, $aParameter = array(), $dbsEncode = "")
{
$aDNS = $connection->getDSN();
$sUsername = $aDNS["username"];
$sPassword = $aDNS["password"];
$sHostspec = $aDNS["hostspec"];
$sDatabse = $aDNS["database"];
$sPort = $aDNS["port"];
if ($sPort != "1521") {
$flagTns = ($sDatabse == "" && ($sPort . "" == "" || $sPort . "" == "0"))? 1 : 0;
if ($flagTns == 0) {
// if not default port
$conn = oci_connect($sUsername, $sPassword, $sHostspec . ":" . $sPort . "/" . $sDatabse, $dbsEncode);
} else {
$conn = oci_connect($sUsername, $sPassword, $sHostspec, $dbsEncode);
}
} else {
$conn = oci_connect( $sUsername, $sPassword, $sHostspec . "/" . $sDatabse, $dbsEncode);
}
if (! $conn) {
$e = oci_error();
trigger_error( htmlentities( $e['message'], ENT_QUOTES ), E_USER_ERROR );
return $e;
}
switch (true) {
case preg_match( "/^(SELECT|SHOW|DESCRIBE|DESC|WITH)\s/i", $sql ):
$stid = oci_parse( $conn, $sql );
if (count( $aParameter ) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name( $stid, $key, $val );
}
}
oci_execute( $stid, OCI_DEFAULT );
$result = Array ();
$i = 1;
while ($row = oci_fetch_array( $stid, OCI_ASSOC + OCI_RETURN_NULLS )) {
$result[$i ++] = $row;
}
oci_free_statement( $stid );
oci_close( $conn );
return $result;
break;
case preg_match( "/^(INSERT|UPDATE|DELETE)\s/i", $sql ):
$stid = oci_parse( $conn, $sql );
$isValid = true;
if (count( $aParameter ) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name( $stid, $key, $val );
}
}
$objExecute = oci_execute( $stid, OCI_DEFAULT );
$result = oci_num_rows ($stid);
if ($objExecute) {
oci_commit( $conn );
} else {
oci_rollback( $conn );
$isValid = false;
}
oci_free_statement( $stid );
oci_close( $conn );
if ($isValid) {
return $result;
} else {
return oci_error();
}
break;
default:
// Stored procedures
$stid = oci_parse( $conn, $sql );
$aParameterRet = array ();
if (count( $aParameter ) > 0) {
foreach ($aParameter as $key => $val) {
$aParameterRet[$key] = $val;
// The third parameter ($aParameterRet[$key]) returned a value by reference.
oci_bind_by_name( $stid, $key, $aParameterRet[$key] );
}
}
$objExecute = oci_execute( $stid, OCI_DEFAULT );
oci_free_statement( $stid );
oci_close( $conn );
return $aParameterRet;
break;
}
}

View File

@@ -349,7 +349,7 @@ class serverConf
$dbNetView = new NET(DB_HOST); $dbNetView = new NET(DB_HOST);
$dbNetView->loginDbServer(DB_USER, DB_PASS); $dbNetView->loginDbServer(DB_USER, DB_PASS);
$dbConns = new dbConnections(''); $dbConns = new DbConnections('');
$availdb = ''; $availdb = '';
foreach ($dbConns->getDbServicesAvailables() as $key => $val) { foreach ($dbConns->getDbServicesAvailables() as $key => $val) {
if ($availdb != '') { if ($availdb != '') {

View File

@@ -65,6 +65,12 @@ class wsBase
global $RBAC; global $RBAC;
try { try {
//To enable compatibility with hash login, method Enable.
//It's necessary to enable the hash start session because there are use cases in both,
//the web entry and in the case planner, where the password is still used in the hash
//format so that is possible to start a session. Thiw way we will mantain the
//compatibility with this type of loggin.
$RBAC->enableLoginWithHash();
$uid = $RBAC->VerifyLogin( $userid, $password ); $uid = $RBAC->VerifyLogin( $userid, $password );
switch ($uid) { switch ($uid) {
@@ -113,14 +119,13 @@ class wsBase
$session->Save(); $session->Save();
//save the session in DataBase //save the session in DataBase
return $wsResponse;
} catch (Exception $e) { } catch (Exception $e) {
$wsResponse = unserialize( $e->getMessage() ); $wsResponse = unserialize( $e->getMessage() );
return $wsResponse;
} }
//To enable compatibility with hash login, method disable.
$RBAC->disableLoginWithHash();
return $wsResponse;
} }
/** /**

View File

@@ -475,7 +475,6 @@ class workspaceTools
foreach ($information as $key => $value) { foreach ($information as $key => $value) {
$arrayLang[] = trim($value['LOCALE']); $arrayLang[] = trim($value['LOCALE']);
} }
//require_once ('classes/model/Content.php');
$regenerateContent = new Content(); $regenerateContent = new Content();
$regenerateContent->regenerateContent($arrayLang, $workSpace); $regenerateContent->regenerateContent($arrayLang, $workSpace);
} }
@@ -670,7 +669,6 @@ class workspaceTools
{ {
$this->initPropel(true); $this->initPropel(true);
//require_once ('classes/model/AppCacheView.php');
//check the language, if no info in config about language, the default is 'en' //check the language, if no info in config about language, the default is 'en'
$oConf = new Configurations(); $oConf = new Configurations();

View File

@@ -531,7 +531,7 @@ function getVarsGrid ($proUid, $dynUid)
$dynaformFields = array (); $dynaformFields = array ();
if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
$dyn = new dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); $dyn = new DynaformHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
$dynaformFields[] = $dyn->getFields(); $dynaformFields[] = $dyn->getFields();
} }

View File

@@ -137,7 +137,7 @@ class FieldCondition extends BaseFieldCondition
$oDynaform = DynaformPeer::retrieveByPk( $DYN_UID ); $oDynaform = DynaformPeer::retrieveByPk( $DYN_UID );
$PRO_UID = $oDynaform->getProUid(); $PRO_UID = $oDynaform->getProUid();
$this->oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . "$PRO_UID/$DYN_UID" . '.xml' ); $this->oDynaformHandler = new DynaformHandler( PATH_DYNAFORM . "$PRO_UID/$DYN_UID" . '.xml' );
$aDynaformFields = $this->oDynaformHandler->getFieldNames(); $aDynaformFields = $this->oDynaformHandler->getFieldNames();
for ($i = 0; $i < count( $aDynaformFields ); $i ++) { for ($i = 0; $i < count( $aDynaformFields ); $i ++) {
$aDynaformFields[$i] = "'$aDynaformFields[$i]'"; $aDynaformFields[$i] = "'$aDynaformFields[$i]'";

View File

@@ -247,7 +247,7 @@ class Language extends BaseLanguage
} }
$dynaform = new dynaFormHandler( PATH_XMLFORM . $xmlForm ); $dynaform = new DynaformHandler( PATH_XMLFORM . $xmlForm );
$fieldName = $match[2]; $fieldName = $match[2];
$codes = explode( '-', $reference ); $codes = explode( '-', $reference );
@@ -460,7 +460,7 @@ class Language extends BaseLanguage
$xmlFormFile = str_replace( chr( 92 ), '/', $xmlFormPath ); $xmlFormFile = str_replace( chr( 92 ), '/', $xmlFormPath );
$xmlFormFile = str_replace( PATH_XMLFORM, '', $xmlFormPath ); $xmlFormFile = str_replace( PATH_XMLFORM, '', $xmlFormPath );
$dynaForm = new dynaFormHandler( $xmlFormPath ); $dynaForm = new DynaformHandler( $xmlFormPath );
$dynaNodes = $dynaForm->getFields(); $dynaNodes = $dynaForm->getFields();
@@ -635,7 +635,7 @@ class Language extends BaseLanguage
} }
$dynaform = new dynaFormHandler( PATH_PLUGINS . $plugin . PATH_SEP . $xmlForm ); $dynaform = new DynaformHandler( PATH_PLUGINS . $plugin . PATH_SEP . $xmlForm );
$fieldName = $match[2]; $fieldName = $match[2];
$codes = explode( '-', $reference ); $codes = explode( '-', $reference );
@@ -753,7 +753,7 @@ class Language extends BaseLanguage
foreach ($aXMLForms as $xmlFormPath) { foreach ($aXMLForms as $xmlFormPath) {
$xmlFormFile = str_replace( chr( 92 ), '/', $xmlFormPath ); $xmlFormFile = str_replace( chr( 92 ), '/', $xmlFormPath );
$xmlFormFile = str_replace( PATH_PLUGINS . $plugin . PATH_SEP , '', $xmlFormPath ); $xmlFormFile = str_replace( PATH_PLUGINS . $plugin . PATH_SEP , '', $xmlFormPath );
$dynaForm = new dynaFormHandler( $xmlFormPath ); $dynaForm = new DynaformHandler( $xmlFormPath );
$dynaNodes = $dynaForm->getFields(); $dynaNodes = $dynaForm->getFields();
//get all fields of each xmlform //get all fields of each xmlform
foreach ($dynaNodes as $oNode) { foreach ($dynaNodes as $oNode) {

View File

@@ -374,7 +374,7 @@ class Step extends BaseStep
while ($oDataset->next()) { while ($oDataset->next()) {
$aRow1 = $oDataset->getRow(); $aRow1 = $oDataset->getRow();
//print_r($aRow1); //print_r($aRow1);
$dynHandler = new dynaFormHandler(PATH_DYNAFORM . $sproUid . PATH_SEP . $aRow1["DYN_UID"] . ".xml"); $dynHandler = new DynaformHandler(PATH_DYNAFORM . $sproUid . PATH_SEP . $aRow1["DYN_UID"] . ".xml");
$dynFields = $dynHandler->getFields(); $dynFields = $dynHandler->getFields();
$sxmlgrid = ''; $sxmlgrid = '';
$sType = ''; $sType = '';
@@ -477,7 +477,7 @@ class Step extends BaseStep
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
if ($aRow['DYN_TYPE'] == 'xmlform') { if ($aRow['DYN_TYPE'] == 'xmlform') {
$dynHandler = new dynaFormHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml" ); $dynHandler = new DynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml" );
$dynFields = $dynHandler->getFields(); $dynFields = $dynHandler->getFields();
$sxmlgrid = ''; $sxmlgrid = '';
$sType = ''; $sType = '';
@@ -547,7 +547,7 @@ class Step extends BaseStep
while ($oDataset->next()) { while ($oDataset->next()) {
$aRow1 = $oDataset->getRow(); $aRow1 = $oDataset->getRow();
$dynHandler = new dynaFormHandler( PATH_DYNAFORM . $sproUid . "/" . $sObjUID . ".xml" ); $dynHandler = new DynaformHandler( PATH_DYNAFORM . $sproUid . "/" . $sObjUID . ".xml" );
$dynFields = $dynHandler->getFields(); $dynFields = $dynHandler->getFields();
$sxmlgrid = ''; $sxmlgrid = '';
$sType = ''; $sType = '';

View File

@@ -490,4 +490,23 @@ class Users extends BaseUsers
$criteria->add(UsersPeer::USR_ID, $id); $criteria->add(UsersPeer::USR_ID, $id);
return UsersPeer::doSelect($criteria)[0]; return UsersPeer::doSelect($criteria)[0];
} }
/**
* {@inheritdoc} except USR_PASSWORD, for security reasons.
*
* @param string $keyType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$key = UsersPeer::translateFieldName(
UsersPeer::USR_PASSWORD,
BasePeer::TYPE_COLNAME,
$keyType
);
$array = parent::toArray($keyType);
unset($array[$key]);
return $array;
}
} }

View File

@@ -69,7 +69,6 @@
// include Gulliver Class // include Gulliver Class
require_once( PATH_GULLIVER . PATH_SEP . 'class.g.php'); require_once( PATH_GULLIVER . PATH_SEP . 'class.g.php');
// include Bootstrap Class // include Bootstrap Class
require_once (PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php');
if(file_exists(FILE_PATHS_INSTALLED)) { if(file_exists(FILE_PATHS_INSTALLED)) {
// backward compatibility; parsing old definitions in the compiled path constant // backward compatibility; parsing old definitions in the compiled path constant

View File

@@ -14000,6 +14000,12 @@ msgstr "Not Required"
msgid "The variable name already exists!" msgid "The variable name already exists!"
msgstr "The variable name already exists!" msgstr "The variable name already exists!"
# TRANSLATION
# LABEL/DYNAFIELD_PHPNAME_ALREADY_EXIST
#: LABEL/DYNAFIELD_PHPNAME_ALREADY_EXIST
msgid "Name error encountered when creating the variable: {0}. Please rename the variable you are creating with a unique name. Avoid differentiating similarly-named variables with only capitalization and '_' characters."
msgstr "Name error encountered when creating the variable: {0}. Please rename the variable you are creating with a unique name. Avoid differentiating similarly-named variables with only capitalization and '_' characters."
# TRANSLATION # TRANSLATION
# LABEL/DYNAFIELD_EMPTY # LABEL/DYNAFIELD_EMPTY
#: LABEL/DYNAFIELD_EMPTY #: LABEL/DYNAFIELD_EMPTY

View File

@@ -233,7 +233,7 @@ class Admin extends Controller
$dbNetView = new NET( DB_HOST ); $dbNetView = new NET( DB_HOST );
$dbNetView->loginDbServer( DB_USER, DB_PASS ); $dbNetView->loginDbServer( DB_USER, DB_PASS );
$dbConns = new dbConnections( '' ); $dbConns = new DbConnections( '' );
$availdb = ''; $availdb = '';
foreach ($dbConns->getDbServicesAvailables() as $key => $val) { foreach ($dbConns->getDbServicesAvailables() as $key => $val) {
if ($availdb != '') { if ($availdb != '') {

View File

@@ -91,8 +91,6 @@ class AppProxy extends HttpProxyController
); );
} }
//require_once ("classes/model/AppNotes.php");
$usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : ""; $usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : "";
$appNotes = new AppNotes(); $appNotes = new AppNotes();
$response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit ); $response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit );
@@ -113,9 +111,6 @@ class AppProxy extends HttpProxyController
*/ */
function postNote ($httpData) function postNote ($httpData)
{ {
//require_once ("classes/model/AppNotes.php");
//extract(getExtJSParams());
if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") { if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
$appUid = $httpData->appUid; $appUid = $httpData->appUid;
} else { } else {

View File

@@ -180,8 +180,6 @@ class Home extends Controller
public function indexSingle ($httpData) public function indexSingle ($httpData)
{ {
require_once 'classes/model/Step.php';
$step = new Step(); $step = new Step();
$solrEnabled = false; $solrEnabled = false;
@@ -377,7 +375,6 @@ class Home extends Controller
$sort = "APP_CACHE_VIEW.APP_NUMBER", $sort = "APP_CACHE_VIEW.APP_NUMBER",
$category = null) $category = null)
{ {
require_once ("classes/model/AppNotes.php");
$appNotes = new AppNotes(); $appNotes = new AppNotes();
@@ -638,7 +635,6 @@ class Home extends Controller
function getCategoryArray () function getCategoryArray ()
{ {
require_once 'classes/model/ProcessCategory.php';
$category = array(); $category = array();
$category[] = array ("",G::LoadTranslation( "ID_ALL_CATEGORIES" )); $category[] = array ("",G::LoadTranslation( "ID_ALL_CATEGORIES" ));

View File

@@ -698,7 +698,7 @@ class Main extends Controller
$dbNetView = new NET( DB_HOST ); $dbNetView = new NET( DB_HOST );
$dbNetView->loginDbServer( DB_USER, DB_PASS ); $dbNetView->loginDbServer( DB_USER, DB_PASS );
$dbConns = new dbConnections( '' ); $dbConns = new DbConnections( '' );
$availdb = ''; $availdb = '';
foreach ($dbConns->getDbServicesAvailables() as $key => $val) { foreach ($dbConns->getDbServicesAvailables() as $key => $val) {
if ($availdb != '') { if ($availdb != '') {

View File

@@ -122,7 +122,6 @@ class pmTables extends Controller
*/ */
public function data ($httpData) public function data ($httpData)
{ {
require_once 'classes/model/AdditionalTables.php';
$additionalTables = new AdditionalTables(); $additionalTables = new AdditionalTables();
$tableDef = $additionalTables->load( $httpData->id, true ); $tableDef = $additionalTables->load( $httpData->id, true );

View File

@@ -451,30 +451,32 @@ class pmTablesProxy extends HttpProxyController
$this->message = $this->success ? G::loadTranslation( 'ID_DELETED_SUCCESSFULLY' ) : G::loadTranslation( 'ID_DELETE_FAILED' ); $this->message = $this->success ? G::loadTranslation( 'ID_DELETED_SUCCESSFULLY' ) : G::loadTranslation( 'ID_DELETE_FAILED' );
} }
public function importCSV ($httpData) /**
* Import pmTable from CSV file
* @param $httpData
*/
public function importCSV($httpData)
{ {
$filter = new InputFilter(); $filter = new InputFilter();
$countRow = 250; $countRow = 250;
$tmpfilename = $_FILES['form']['tmp_name']['CSV_FILE']; $tmpfilename = $_FILES['form']['tmp_name']['CSV_FILE'];
//$tmpfilename = $filter->xssFilterHard($tmpfilename, 'path'); if (preg_match('/[\x00-\x08\x0b-\x0c\x0e\x1f]/', file_get_contents($tmpfilename)) === 0) {
if (preg_match( '/[\x00-\x08\x0b-\x0c\x0e\x1f]/', file_get_contents( $tmpfilename ) ) === 0) {
$filename = $_FILES['form']['name']['CSV_FILE']; $filename = $_FILES['form']['name']['CSV_FILE'];
//$filename = $filter->xssFilterHard($filename, 'path'); if ($oFile = fopen($filter->xssFilterHard($tmpfilename, 'path'), 'r')) {
if ($oFile = fopen( $filter->xssFilterHard($tmpfilename, 'path'), 'r' )) {
require_once 'classes/model/AdditionalTables.php'; require_once 'classes/model/AdditionalTables.php';
$oAdditionalTables = new AdditionalTables(); $oAdditionalTables = new AdditionalTables();
$aAdditionalTables = $oAdditionalTables->load( $_POST['form']['ADD_TAB_UID'], true ); $aAdditionalTables = $oAdditionalTables->load($_POST['form']['ADD_TAB_UID'], true);
$sErrorMessages = ''; $sErrorMessages = '';
$i = 1; $i = 1;
$conData = 0; $conData = 0;
$insert = 'REPLACE INTO ' . $aAdditionalTables['ADD_TAB_NAME'] . ' ('; $insert = 'REPLACE INTO ' . $aAdditionalTables['ADD_TAB_NAME'] . ' (';
$query = ''; $query = '';
$swHead = false; $swHead = false;
while (($aAux = fgetcsv( $oFile, 4096, $_POST['form']['CSV_DELIMITER'] )) !== false) { while (($aAux = fgetcsv($oFile, 4096, $_POST['form']['CSV_DELIMITER'], '"', '"')) !== false) {
if (! is_null( $aAux[0] )) { if (!is_null($aAux[0])) {
if (count( $aAdditionalTables['FIELDS'] ) > count( $aAux )) { if (count($aAdditionalTables['FIELDS']) > count($aAux)) {
$this->success = false; $this->success = false;
$this->message = G::LoadTranslation( 'INVALID_FILE' ); $this->message = G::LoadTranslation('INVALID_FILE');
return 0; return 0;
} }
if ($i == 1) { if ($i == 1) {
@@ -484,7 +486,7 @@ class pmTablesProxy extends HttpProxyController
if ($aField['FLD_NAME'] === $aAux[$j]) { if ($aField['FLD_NAME'] === $aAux[$j]) {
$swHead = true; $swHead = true;
} }
$j ++; $j++;
} }
$insert = substr($insert, 0, -2); $insert = substr($insert, 0, -2);
$insert .= ') VALUES '; $insert .= ') VALUES ';
@@ -495,13 +497,11 @@ class pmTablesProxy extends HttpProxyController
$j = 0; $j = 0;
foreach ($aAdditionalTables['FIELDS'] as $aField) { foreach ($aAdditionalTables['FIELDS'] as $aField) {
$conData++; $conData++;
if (array_key_exists($j, $aAux)) { if (array_key_exists($j, $aAux)) {
$temp = '"' . addslashes(stripslashes(G::is_utf8($aAux[$j]) ? $aAux[$j] : utf8_encode($aAux[$j]))) . '"'; $temp = '"' . addslashes(G::is_utf8($aAux[$j]) ? $aAux[$j] : utf8_encode($aAux[$j])) . '"';
} else { } else {
$temp = '""'; $temp = '""';
} }
if ($temp == '') { if ($temp == '') {
switch ($aField['FLD_TYPE']) { switch ($aField['FLD_TYPE']) {
case 'DATE': case 'DATE':
@@ -510,7 +510,7 @@ class pmTablesProxy extends HttpProxyController
break; break;
} }
} }
$j ++; $j++;
$queryRow .= $temp . ','; $queryRow .= $temp . ',';
} }
$query .= substr($queryRow, 0, -1) . '),'; $query .= substr($queryRow, 0, -1) . '),';
@@ -522,15 +522,15 @@ class pmTablesProxy extends HttpProxyController
$conData = 0; $conData = 0;
} }
} catch (Exception $oError) { } catch (Exception $oError) {
$sErrorMessages .= G::LoadTranslation( 'ID_ERROR_INSERT_LINE' ) . ': ' . G::LoadTranslation( 'ID_LINE' ) . ' ' . $i . '. '; $sErrorMessages .= G::LoadTranslation('ID_ERROR_INSERT_LINE') . ': ' . G::LoadTranslation('ID_LINE') . ' ' . $i . '. ';
} }
} else { } else {
$swHead = false; $swHead = false;
} }
$i ++; $i++;
} }
} }
fclose( $oFile ); fclose($oFile);
if ($conData > 0) { if ($conData > 0) {
$query = substr($query, 0, -1); $query = substr($query, 0, -1);
executeQuery($insert . $query . ';', $aAdditionalTables['DBS_UID']); executeQuery($insert . $query . ';', $aAdditionalTables['DBS_UID']);
@@ -541,12 +541,12 @@ class pmTablesProxy extends HttpProxyController
$this->message = $sErrorMessages; $this->message = $sErrorMessages;
} else { } else {
$this->success = true; $this->success = true;
$this->message = G::loadTranslation( 'ID_FILE_IMPORTED_SUCCESSFULLY', array ($filename $this->message = G::loadTranslation('ID_FILE_IMPORTED_SUCCESSFULLY', array($filename
) ); ));
G::auditLog("ImportTable", $filename); G::auditLog("ImportTable", $filename);
} }
} else { } else {
$sMessage = G::LoadTranslation( 'ID_UPLOAD_VALID_CSV_FILE' ); $sMessage = G::LoadTranslation('ID_UPLOAD_VALID_CSV_FILE');
$this->success = false; $this->success = false;
$this->message = $sMessage; $this->message = $sMessage;
} }
@@ -637,11 +637,11 @@ class pmTablesProxy extends HttpProxyController
} }
/** /**
* export a pm tables record to CSV * Export pmTable to CSV format
* * @param $httpData
* @param string $httpData->id * @return StdClass
*/ */
public function exportCSV ($httpData) public function exportCSV($httpData)
{ {
$result = new StdClass(); $result = new StdClass();
try { try {
@@ -653,50 +653,30 @@ class pmTablesProxy extends HttpProxyController
require_once 'classes/model/AdditionalTables.php'; require_once 'classes/model/AdditionalTables.php';
$oAdditionalTables = new AdditionalTables(); $oAdditionalTables = new AdditionalTables();
$aAdditionalTables = $oAdditionalTables->load( $_POST['ADD_TAB_UID'], true ); $aAdditionalTables = $oAdditionalTables->load($_POST['ADD_TAB_UID'], true);
$sErrorMessages = ''; $sErrorMessages = '';
$sDelimiter = $_POST['CSV_DELIMITER']; $sDelimiter = $_POST['CSV_DELIMITER'];
$resultData = $oAdditionalTables->getAllData( $_POST['ADD_TAB_UID'], null, null, false ); $resultData = $oAdditionalTables->getAllData($_POST['ADD_TAB_UID'], null, null, false);
$rows = $resultData['rows']; $rows = $resultData['rows'];
$count = $resultData['count']; $count = $resultData['count'];
$PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP; $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
$filenameOnly = strtolower( $aAdditionalTables['ADD_TAB_NAME'] . "_" . date( "Y-m-d" ) . '_' . date( "Hi" ) . ".csv" ); $filenameOnly = strtolower($aAdditionalTables['ADD_TAB_NAME'] . "_" . date("Y-m-d") . '_' . date("Hi") . ".csv");
$filename = $PUBLIC_ROOT_PATH . $filenameOnly; $filename = $PUBLIC_ROOT_PATH . $filenameOnly;
$fp = fopen( $filename, "wb" ); $fp = fopen($filename, "wb");
$swColumns = true; $swColumns = true;
foreach ($rows as $keyCol => $cols) { foreach ($rows as $keyCol => $cols) {
$SDATA = ""; if ($swColumns) {
$header = ""; fputcsv($fp, array_keys($cols), $sDelimiter, '"', "\\");
$cnt = $cntC = count( $cols ); $swColumns = false;
foreach ($cols as $key => $val) {
if($swColumns){
$header .= $key;
if (-- $cntC > 0) {
$header .= $sDelimiter;
} else {
$header .= "\n";
$bytesSaved += fwrite( $fp, $header );
$swColumns = false;
}
}
$SDATA .= addslashes($val);
if (-- $cnt > 0) {
$SDATA .= $sDelimiter;
}
} }
$SDATA .= "\n"; fputcsv($fp, $cols, $sDelimiter, '"');
$bytesSaved += fwrite( $fp, $SDATA );
} }
fclose( $fp ); fclose($fp);
// $filenameLink = "pmTables/streamExported?f=$filenameOnly";
$filenameLink = "streamExported?f=$filenameOnly"; $filenameLink = "streamExported?f=$filenameOnly";
$size = round( ($bytesSaved / 1024), 2 ) . " Kb"; $size = filesize($filename);
$filename = $filenameOnly;
$link = $filenameLink; $link = $filenameLink;
$result->success = true; $result->success = true;
@@ -1269,7 +1249,7 @@ class pmTablesProxy extends HttpProxyController
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) { if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) {
$dynaformHandler = new dynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' ); $dynaformHandler = new DynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' );
$nodeFieldsList = $dynaformHandler->getFields(); $nodeFieldsList = $dynaformHandler->getFields();
foreach ($nodeFieldsList as $node) { foreach ($nodeFieldsList as $node) {
@@ -1579,7 +1559,7 @@ class pmTablesProxy extends HttpProxyController
} }
} }
} else { } else {
$dynaformHandler = new dynaformHandler(PATH_DYNAFORM . $record['DYN_FILENAME'] . '.xml'); $dynaformHandler = new DynaformHandler(PATH_DYNAFORM . $record['DYN_FILENAME'] . '.xml');
$nodeFieldsList = $dynaformHandler->getFields(); $nodeFieldsList = $dynaformHandler->getFields();
foreach ($nodeFieldsList as $node) { foreach ($nodeFieldsList as $node) {

View File

@@ -3823,6 +3823,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_INSTRUCTIONS','en','Instructions','2014-01-15') , ( 'LABEL','ID_INSTRUCTIONS','en','Instructions','2014-01-15') ,
( 'LABEL','ID_NOT_REQUIRED','en','Not Required','2014-01-15') , ( 'LABEL','ID_NOT_REQUIRED','en','Not Required','2014-01-15') ,
( 'LABEL','DYNAFIELD_ALREADY_EXIST','en','The variable name already exists!','2015-04-24') , ( 'LABEL','DYNAFIELD_ALREADY_EXIST','en','The variable name already exists!','2015-04-24') ,
( 'LABEL','DYNAFIELD_PHPNAME_ALREADY_EXIST','en','Name error encountered when creating the variable: {0}. Please rename the variable you are creating with a unique name. Avoid differentiating similarly-named variables with only capitalization and ''_'' characters.','2017-08-09') ,
( 'LABEL','DYNAFIELD_EMPTY','en','The Field Name is empty','2014-10-21') , ( 'LABEL','DYNAFIELD_EMPTY','en','The Field Name is empty','2014-10-21') ,
( 'LABEL','DYNAFIELD_NODENAME_NUMBER','en','The field name should not start with a number','2014-01-15') , ( 'LABEL','DYNAFIELD_NODENAME_NUMBER','en','The field name should not start with a number','2014-01-15') ,
( 'LABEL','ID_EMPTY_NODENAME','en','The name field is empty','2014-01-15') , ( 'LABEL','ID_EMPTY_NODENAME','en','The name field is empty','2014-01-15') ,

View File

@@ -162,8 +162,6 @@ function sendJsonResultGeneric($response, $callback)
function expandNode() function expandNode()
{ {
//require_once ("classes/model/AppFolder.php");
extract(getExtJSParams()); extract(getExtJSParams());
$oPMFolder = new AppFolder(); $oPMFolder = new AppFolder();

View File

@@ -303,7 +303,6 @@ try {
} }
//Save files //Save files
//require_once ("classes/model/AppDocument.php");
if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$oInputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument(); $oInputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();

View File

@@ -130,8 +130,6 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
} }
if ($indocUid != null) { if ($indocUid != null) {
//require_once ("classes/model/AppFolder.php");
//require_once ("classes/model/InputDocument.php");
$oInputDocument = new InputDocument(); $oInputDocument = new InputDocument();
$aID = $oInputDocument->load( $indocUid ); $aID = $oInputDocument->load( $indocUid );

View File

@@ -328,7 +328,7 @@ try {
* Added By erik 16-05-08 * Added By erik 16-05-08
* Description: this was added for the additional database connections * Description: this was added for the additional database connections
*/ */
$oDbConnections = new dbConnections( $_SESSION['PROCESS'] ); $oDbConnections = new DbConnections( $_SESSION['PROCESS'] );
$oDbConnections->loadAdditionalConnections(); $oDbConnections->loadAdditionalConnections();
$_SESSION['CURRENT_DYN_UID'] = $_GET['UID']; $_SESSION['CURRENT_DYN_UID'] = $_GET['UID'];
@@ -1137,7 +1137,7 @@ try {
* Description: this was added for the additional database connections * Description: this was added for the additional database connections
*/ */
$oDbConnections = new dbConnections( $_SESSION['PROCESS'] ); $oDbConnections = new DbConnections( $_SESSION['PROCESS'] );
$oDbConnections->loadAdditionalConnections(); $oDbConnections->loadAdditionalConnections();
$stepFilename = "$sNamespace/$sStepName"; $stepFilename = "$sNamespace/$sStepName";
G::evalJScript( " G::evalJScript( "

View File

@@ -139,7 +139,7 @@ if (! isset( $_GET['ex'] )) {
$_GET['ex'] = $_GET['position']; $_GET['ex'] = $_GET['position'];
} }
$oDbConnections = new dbConnections( $_SESSION['PROCESS'] ); $oDbConnections = new DbConnections( $_SESSION['PROCESS'] );
$oDbConnections->loadAdditionalConnections(); $oDbConnections->loadAdditionalConnections();
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();

View File

@@ -75,7 +75,7 @@ try {
} }
if (file_exists( PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml' )) { if (file_exists( PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml' )) {
$_SESSION['PROCESS'] = $applicationFields['PRO_UID']; $_SESSION['PROCESS'] = $applicationFields['PRO_UID'];
$dbConnections = new dbConnections( $_SESSION['PROCESS'] ); $dbConnections = new DbConnections( $_SESSION['PROCESS'] );
$dbConnections->loadAdditionalConnections(); $dbConnections->loadAdditionalConnections();
$_SESSION['CURRENT_DYN_UID'] = $_REQUEST['DYN_UID']; $_SESSION['CURRENT_DYN_UID'] = $_REQUEST['DYN_UID'];

View File

@@ -93,7 +93,7 @@ switch ($action) {
G::RenderPage( 'publish', 'raw' ); G::RenderPage( 'publish', 'raw' );
break; break;
case 'newDdConnection': case 'newDdConnection':
$dbs = new dbConnections( $_SESSION['PROCESS'] ); $dbs = new DbConnections( $_SESSION['PROCESS'] );
$dbServices = $dbs->getDbServicesAvailables(); $dbServices = $dbs->getDbServicesAvailables();
$dbService = $dbs->getEncondeList(); $dbService = $dbs->getEncondeList();
@@ -115,7 +115,7 @@ switch ($action) {
G::RenderPage( 'publish', 'raw' ); G::RenderPage( 'publish', 'raw' );
break; break;
case 'editDdConnection': case 'editDdConnection':
$dbs = new dbConnections( $_SESSION['PROCESS'] ); $dbs = new DbConnections( $_SESSION['PROCESS'] );
$dbServices = $dbs->getDbServicesAvailables(); $dbServices = $dbs->getDbServicesAvailables();
$rows[] = array ('uid' => 'char','name' => 'char' $rows[] = array ('uid' => 'char','name' => 'char'
@@ -343,7 +343,7 @@ switch ($action) {
$engine = $_POST['engine']; $engine = $_POST['engine'];
if ($engine != "0") { if ($engine != "0") {
$dbs = new dbConnections(); $dbs = new DbConnections();
$var = Bootstrap::json_encode($dbs->getEncondeList($filter->xssFilterHard($engine))); $var = Bootstrap::json_encode($dbs->getEncondeList($filter->xssFilterHard($engine)));
G::outRes($var); G::outRes($var);

View File

@@ -9,7 +9,7 @@
if (isset( $_SESSION['PROCESS'] )) { if (isset( $_SESSION['PROCESS'] )) {
$pro = include (PATH_CORE . "config/databases.php"); $pro = include (PATH_CORE . "config/databases.php");
$oDbConnections = new dbConnections( $_SESSION['PROCESS'] ); $oDbConnections = new DbConnections( $_SESSION['PROCESS'] );
foreach ($oDbConnections->connections as $db) { foreach ($oDbConnections->connections as $db) {
$db['DBS_PASSWORD'] = $oDbConnections->getPassWithoutEncrypt( $db ); $db['DBS_PASSWORD'] = $oDbConnections->getPassWithoutEncrypt( $db );

View File

@@ -54,7 +54,7 @@ try {
$sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : ''; $sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : '';
//$oJSON = new Services_JSON(); //$oJSON = new Services_JSON();
$oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' ); $oDynaformHandler = new DynaformHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' );
$aFilter = explode( ',', $sFilter ); $aFilter = explode( ',', $sFilter );
@@ -68,7 +68,7 @@ try {
$_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE']; $_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
$sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : ''; $sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : '';
$oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' ); $oDynaformHandler = new DynaformHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' );
$aFilter = explode( ',', $sFilter ); $aFilter = explode( ',', $sFilter );
$aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter ); $aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter );

View File

@@ -38,7 +38,7 @@ switch ($request) {
$tmpfilename = $filter->xssFilterHard($tmpfilename); $tmpfilename = $filter->xssFilterHard($tmpfilename);
$o = new dynaFormHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" ); $o = new DynaformHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" );
$list_elements = explode( ',', $items ); $list_elements = explode( ',', $items );
@@ -59,7 +59,7 @@ switch ($request) {
$tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE']; $tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
$tmpfilename = $filter->xssFilterHard($tmpfilename); $tmpfilename = $filter->xssFilterHard($tmpfilename);
$o = new dynaFormHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" ); $o = new DynaformHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" );
$hidden_items = Array (); $hidden_items = Array ();
$has_hidden_items = false; $has_hidden_items = false;

View File

@@ -47,8 +47,6 @@ if (isset( $_SESSION['CURRENT_PAGE_INITILIZATION'] )) {
eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] ); eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] );
} }
//require_once (PATH_THIRDPARTY . 'pear/json/class.json.php');
//$json = new Services_JSON();
$G_FORM = new form( G::getUIDName( urlDecode( $_POST['form'] ) ) ); $G_FORM = new form( G::getUIDName( urlDecode( $_POST['form'] ) ) );
$G_FORM->id = urlDecode( $_POST['form'] ); $G_FORM->id = urlDecode( $_POST['form'] );
$G_FORM->values = $_SESSION[$G_FORM->id]; $G_FORM->values = $_SESSION[$G_FORM->id];

View File

@@ -45,9 +45,6 @@ try {
// Bootstrap::mylog("post:".$_POST['function']); // Bootstrap::mylog("post:".$_POST['function']);
switch ($sfunction) { switch ($sfunction) {
case 'lookForNameInput': case 'lookForNameInput':
//require_once ('classes/model/Content.php');
//require_once ("classes/model/InputDocument.php");
$snameInput = urldecode( $_POST['NAMEINPUT'] ); $snameInput = urldecode( $_POST['NAMEINPUT'] );
$sPRO_UID = urldecode( $_POST['proUid'] ); $sPRO_UID = urldecode( $_POST['proUid'] );

View File

@@ -901,7 +901,7 @@ try {
$proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : ''; $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : '';
$dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : ''; $dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : '';
if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
$dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); $dyn = new DynaformHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
$dynaformFields[] = $dyn->getFields(); $dynaformFields[] = $dyn->getFields();
} }
foreach ($dynaformFields as $aDynFormFields) { foreach ($dynaformFields as $aDynFormFields) {

View File

@@ -21,6 +21,18 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
use ProcessMaker\Exception\RBACException;
global $RBAC;
switch ($RBAC->userCanAccess('PM_USERS')) {
case -2:
throw new RBACException('ID_USER_HAVENT_RIGHTS_SYSTEM', -2);
break;
case -1:
case -3:
throw new RBACException('ID_USER_HAVENT_RIGHTS_PAGE', -1);
break;
}
$REQUEST = (isset( $_GET['request'] )) ? $_GET['request'] : $_POST['request']; $REQUEST = (isset( $_GET['request'] )) ? $_GET['request'] : $_POST['request'];

View File

@@ -1,6 +1,7 @@
<?php <?php
ini_set("soap.wsdl_cache_enabled", 0); //disabling WSDL cache use ProcessMaker\Util\ParseSoapVariableName;
ini_set("soap.wsdl_cache_enabled", 0); //disabling WSDL cache
define( 'WEB_SERVICE_VERSION', '2.0' ); define( 'WEB_SERVICE_VERSION', '2.0' );

View File

@@ -318,7 +318,7 @@ switch ($_POST['action']) {
require_once 'classes/model/UsersProperties.php'; require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties(); $oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($aFields['USR_PASSWORD'])))); $aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($oUser->getUsrPassword()))));
$aFields['USR_LOGGED_NEXT_TIME'] = $aUserProperty['USR_LOGGED_NEXT_TIME']; $aFields['USR_LOGGED_NEXT_TIME'] = $aUserProperty['USR_LOGGED_NEXT_TIME'];
if (array_key_exists('USR_PASSWORD', $aFields)) { if (array_key_exists('USR_PASSWORD', $aFields)) {

View File

@@ -1,10 +1,14 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use \G; use G;
use UsersPeer;
use CasesPeer;
use AppDelegation;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
use \UsersPeer; use Exception;
use \CasesPeer; use wsBase;
use RBAC;
/** /**
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -26,7 +30,7 @@ class Cases
{ {
try { try {
$this->formatFieldNameInUppercase = $flag; $this->formatFieldNameInUppercase = $flag;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -42,7 +46,7 @@ class Cases
{ {
try { try {
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -57,7 +61,7 @@ class Cases
*/ */
private function throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException) private function throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException)
{ {
throw new \Exception(\G::LoadTranslation( throw new Exception(\G::LoadTranslation(
'ID_CASE_DOES_NOT_EXIST2', [$fieldNameForException, $applicationUid] 'ID_CASE_DOES_NOT_EXIST2', [$fieldNameForException, $applicationUid]
)); ));
} }
@@ -87,7 +91,7 @@ class Cases
if ($flag) { if ($flag) {
$this->throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException); $this->throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException);
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -122,7 +126,7 @@ class Cases
//Return //Return
return $obj->toArray(\BasePeer::TYPE_FIELDNAME); return $obj->toArray(\BasePeer::TYPE_FIELDNAME);
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -149,7 +153,7 @@ class Cases
if (is_null($obj)) { if (is_null($obj)) {
if ($throwException) { if ($throwException) {
throw new \Exception(\G::LoadTranslation( throw new Exception(\G::LoadTranslation(
'ID_CASE_DEL_INDEX_DOES_NOT_EXIST', 'ID_CASE_DEL_INDEX_DOES_NOT_EXIST',
[ [
$arrayVariableNameForException['$applicationUid'], $arrayVariableNameForException['$applicationUid'],
@@ -165,7 +169,7 @@ class Cases
//Return //Return
return $obj->toArray(\BasePeer::TYPE_FIELDNAME); return $obj->toArray(\BasePeer::TYPE_FIELDNAME);
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -209,7 +213,7 @@ class Cases
//Return //Return
return $arrayListCounter; return $arrayListCounter;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -462,11 +466,11 @@ class Cases
if (!isset($row)) { if (!isset($row)) {
continue; continue;
} }
$ws = new \wsBase(); $ws = new wsBase();
$fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]); $fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"])); throw (new Exception($array ["message"]));
} else { } else {
$array['app_uid'] = $array['caseId']; $array['app_uid'] = $array['caseId'];
$array['app_number'] = $array['caseNumber']; $array['app_number'] = $array['caseNumber'];
@@ -526,15 +530,15 @@ class Cases
"app_name" => $e->getMessage(), "app_name" => $e->getMessage(),
"del_index" => $e->getMessage(), "del_index" => $e->getMessage(),
"pro_uid" => $e->getMessage()); "pro_uid" => $e->getMessage());
throw (new \Exception($arrayData)); throw (new Exception($arrayData));
} }
} else { } else {
$ws = new \wsBase(); $ws = new wsBase();
$fields = $ws->getCaseInfo($applicationUid, 0); $fields = $ws->getCaseInfo($applicationUid, 0);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"])); throw (new Exception($array ["message"]));
} else { } else {
$array['app_uid'] = $array['caseId']; $array['app_uid'] = $array['caseId'];
$array['app_number'] = $array['caseNumber']; $array['app_number'] = $array['caseNumber'];
@@ -592,7 +596,7 @@ class Cases
//Return //Return
return $oResponse; return $oResponse;
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -621,7 +625,7 @@ class Cases
$rsCriteria = \ApplicationPeer::doSelectRS($criteria); $rsCriteria = \ApplicationPeer::doSelectRS($criteria);
if ($rsCriteria->next()) { if ($rsCriteria->next()) {
throw new \Exception(\G::LoadTranslation("ID_CASE_NO_CURRENT_TASKS_BECAUSE_CASE_ITS_COMPLETED", array($this->getFieldNameByFormatFieldName("APP_UID"), $applicationUid))); throw new Exception(\G::LoadTranslation("ID_CASE_NO_CURRENT_TASKS_BECAUSE_CASE_ITS_COMPLETED", array($this->getFieldNameByFormatFieldName("APP_UID"), $applicationUid)));
} }
//Get data //Get data
@@ -629,8 +633,8 @@ class Cases
$oCriteria = new \Criteria( 'workflow' ); $oCriteria = new \Criteria( 'workflow' );
$del = \DBAdapter::getStringDelimiter(); $del = \DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn( \AppDelegationPeer::DEL_INDEX ); $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
$oCriteria->addSelectColumn( \AppDelegationPeer::TAS_UID ); $oCriteria->addSelectColumn(\AppDelegationPeer::TAS_UID);
$oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE); $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE);
$oCriteria->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE); $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE);
$oCriteria->addSelectColumn(\TaskPeer::TAS_TITLE); $oCriteria->addSelectColumn(\TaskPeer::TAS_TITLE);
@@ -652,11 +656,11 @@ class Cases
} }
//Return //Return
if (empty($result)) { if (empty($result)) {
throw new \Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid))); throw new Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid)));
} else { } else {
return $result; return $result;
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -675,19 +679,19 @@ class Cases
{ {
try { try {
$ws = new \wsBase(); $ws = new wsBase();
if ($variables) { if ($variables) {
$variables = array_shift($variables); $variables = array_shift($variables);
} }
Validator::proUid($processUid, '$pro_uid'); Validator::proUid($processUid, '$pro_uid');
$oTask = new \Task(); $oTask = new \Task();
if (! $oTask->taskExists($taskUid)) { if (! $oTask->taskExists($taskUid)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('tas_uid'))); throw new Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('tas_uid')));
} }
$fields = $ws->newCase($processUid, $userUid, $taskUid, $variables); $fields = $ws->newCase($processUid, $userUid, $taskUid, $variables);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"])); throw (new Exception($array ["message"]));
} else { } else {
$array['app_uid'] = $array['caseId']; $array['app_uid'] = $array['caseId'];
$array['app_number'] = $array['caseNumber']; $array['app_number'] = $array['caseNumber'];
@@ -700,7 +704,7 @@ class Cases
$oResponse = json_decode(json_encode($array), false); $oResponse = json_decode(json_encode($array), false);
//Return //Return
return $oResponse; return $oResponse;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -719,7 +723,7 @@ class Cases
{ {
try { try {
$ws = new \wsBase(); $ws = new wsBase();
if ($variables) { if ($variables) {
$variables = array_shift($variables); $variables = array_shift($variables);
} elseif ($variables == null) { } elseif ($variables == null) {
@@ -728,17 +732,17 @@ class Cases
Validator::proUid($processUid, '$pro_uid'); Validator::proUid($processUid, '$pro_uid');
$user = new \Users(); $user = new \Users();
if (! $user->userExists( $userUid )) { if (! $user->userExists( $userUid )) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid'))); throw new Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid')));
} }
$fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid); $fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
if ($array ["status_code"] == 12) { if ($array ["status_code"] == 12) {
throw (new \Exception(\G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.')); throw (new Exception(\G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.'));
} elseif ($array ["status_code"] == 13) { } elseif ($array ["status_code"] == 13) {
throw (new \Exception(\G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.')); throw (new Exception(\G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.'));
} }
throw (new \Exception($array ["message"])); throw (new Exception($array ["message"]));
} else { } else {
$array['app_uid'] = $array['caseId']; $array['app_uid'] = $array['caseId'];
$array['app_number'] = $array['caseNumber']; $array['app_number'] = $array['caseNumber'];
@@ -751,7 +755,7 @@ class Cases
$oResponse = json_decode(json_encode($array), false); $oResponse = json_decode(json_encode($array), false);
//Return //Return
return $oResponse; return $oResponse;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -771,24 +775,24 @@ class Cases
{ {
try { try {
if (!$delIndex) { if (!$delIndex) {
$delIndex = \AppDelegation::getCurrentIndex($applicationUid); $delIndex = AppDelegation::getCurrentIndex($applicationUid);
} }
$ws = new \wsBase(); $ws = new wsBase();
$fields = $ws->reassignCase($userUid, $applicationUid, $delIndex, $userUidSource, $userUidTarget); $fields = $ws->reassignCase($userUid, $applicationUid, $delIndex, $userUidSource, $userUidTarget);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if (array_key_exists("status_code", $array)) { if (array_key_exists("status_code", $array)) {
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"])); throw (new Exception($array ["message"]));
} else { } else {
unset($array['status_code']); unset($array['status_code']);
unset($array['message']); unset($array['message']);
unset($array['timestamp']); unset($array['timestamp']);
} }
} else { } else {
throw new \Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid))); throw new Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid)));
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -814,14 +818,14 @@ class Cases
Validator::usrUid($usr_uid, '$usr_uid'); Validator::usrUid($usr_uid, '$usr_uid');
if ($del_index === false) { if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid); $del_index = AppDelegation::getCurrentIndex($app_uid);
} }
Validator::isInteger($del_index, '$del_index'); Validator::isInteger($del_index, '$del_index');
$case = new \Cases(); $case = new \Cases();
$fields = $case->loadCase($app_uid); $fields = $case->loadCase($app_uid);
if ($fields['APP_STATUS'] == 'CANCELLED') { if ($fields['APP_STATUS'] == 'CANCELLED') {
throw (new \Exception(\G::LoadTranslation("ID_CASE_ALREADY_CANCELED", array($app_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_ALREADY_CANCELED", array($app_uid))));
} }
$appCacheView = new \AppCacheView(); $appCacheView = new \AppCacheView();
@@ -840,7 +844,7 @@ class Cases
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria); $rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
if (!$rsCriteria->next()) { if (!$rsCriteria->next()) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_CANCEL_CASE", array($usr_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_CANCEL_CASE", array($usr_uid))));
} }
$case->cancelCase( $app_uid, $del_index, $usr_uid ); $case->cancelCase( $app_uid, $del_index, $usr_uid );
@@ -868,7 +872,7 @@ class Cases
Validator::usrUid($usr_uid, '$usr_uid'); Validator::usrUid($usr_uid, '$usr_uid');
if ($del_index === false) { if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid); $del_index = AppDelegation::getCurrentIndex($app_uid);
} }
Validator::isInteger($del_index, '$del_index'); Validator::isInteger($del_index, '$del_index');
@@ -876,13 +880,13 @@ class Cases
$case = new \Cases(); $case = new \Cases();
$fields = $case->loadCase($app_uid); $fields = $case->loadCase($app_uid);
if ($fields['APP_STATUS'] == 'CANCELLED') { if ($fields['APP_STATUS'] == 'CANCELLED') {
throw (new \Exception(\G::LoadTranslation("ID_CASE_IS_CANCELED", array($app_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_IS_CANCELED", array($app_uid))));
} }
$oDelay = new \AppDelay(); $oDelay = new \AppDelay();
if ($oDelay->isPaused($app_uid, $del_index)) { if ($oDelay->isPaused($app_uid, $del_index)) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_PAUSED", array($app_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_PAUSED", array($app_uid))));
} }
$appCacheView = new \AppCacheView(); $appCacheView = new \AppCacheView();
@@ -904,7 +908,7 @@ class Cases
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria); $rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
if (!$rsCriteria->next()) { if (!$rsCriteria->next()) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_PAUSED_CASE", array($usr_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_PAUSED_CASE", array($usr_uid))));
} }
if ($unpaused_date != null) { if ($unpaused_date != null) {
@@ -934,14 +938,14 @@ class Cases
Validator::usrUid($usr_uid, '$usr_uid'); Validator::usrUid($usr_uid, '$usr_uid');
if ($del_index === false) { if ($del_index === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid); $del_index = AppDelegation::getCurrentIndex($app_uid);
} }
Validator::isInteger($del_index, '$del_index'); Validator::isInteger($del_index, '$del_index');
$oDelay = new \AppDelay(); $oDelay = new \AppDelay();
if (!$oDelay->isPaused($app_uid, $del_index)) { if (!$oDelay->isPaused($app_uid, $del_index)) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_NOT_PAUSED", array($app_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_NOT_PAUSED", array($app_uid))));
} }
$appCacheView = new \AppCacheView(); $appCacheView = new \AppCacheView();
@@ -960,7 +964,7 @@ class Cases
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria); $rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
if (!$rsCriteria->next()) { if (!$rsCriteria->next()) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_UNPAUSE_CASE", array($usr_uid)))); throw (new Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_UNPAUSE_CASE", array($usr_uid))));
} }
$case = new \Cases(); $case = new \Cases();
@@ -971,39 +975,45 @@ class Cases
* Put execute trigger case * Put execute trigger case
* *
* @access public * @access public
* @param string $app_uid , Uid for case * @param string $appUid, Uid for case
* @param string $usr_uid , Uid for user * @param string $triUid, Uid for trigger
* @param bool|string $del_index , Index for case * @param string $userUid, Uid for user
* @param bool|string $delIndex, Index for case
* *
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @return array
* @copyright Colosa - Bolivia * @throws Exception
*/ */
public function putExecuteTriggerCase($app_uid, $tri_uid, $usr_uid, $del_index = false) public function putExecuteTriggerCase($appUid, $triUid, $userUid, $delIndex = false)
{ {
Validator::isString($app_uid, '$app_uid'); Validator::isString($appUid, '$appUid');
Validator::isString($tri_uid, '$tri_uid'); Validator::isString($triUid, '$triUid');
Validator::isString($usr_uid, '$usr_uid'); Validator::isString($userUid, '$userUid');
Validator::appUid($app_uid, '$app_uid'); Validator::appUid($appUid, '$appUid');
Validator::triUid($tri_uid, '$tri_uid'); Validator::triUid($triUid, '$triUid');
Validator::usrUid($usr_uid, '$usr_uid'); Validator::usrUid($userUid, '$userUid');
if ($del_index === false) { if ($delIndex === false) {
$del_index = \AppDelegation::getCurrentIndex($app_uid); //We need to find the last delIndex open related to the user $usr_uid
$delIndex = (integer)$this->getLastParticipatedByUser($appUid, $userUid, 'OPEN');
//If the is assigned another user the function will be return 0
if ($delIndex === 0) {
throw new Exception(G::loadTranslation('ID_CASE_ASSIGNED_ANOTHER_USER'));
}
} }
Validator::isInteger($del_index, '$del_index'); Validator::isInteger($delIndex, '$del_index');
global $RBAC; global $RBAC;
if (!method_exists($RBAC, 'initRBAC')) { if (!method_exists($RBAC, 'initRBAC')) {
$RBAC = \RBAC::getSingleton( PATH_DATA, session_id() ); $RBAC = RBAC::getSingleton( PATH_DATA, session_id() );
$RBAC->sSystem = 'PROCESSMAKER'; $RBAC->sSystem = 'PROCESSMAKER';
} }
$case = new \wsBase(); $case = new wsBase();
$result = $case->executeTrigger($usr_uid, $app_uid, $tri_uid, $del_index); $result = $case->executeTrigger($userUid, $appUid, $triUid, $delIndex);
if ($result->status_code != 0) { if ($result->status_code != 0) {
throw new \Exception($result->message); throw new Exception($result->message);
} }
} }
@@ -1032,11 +1042,11 @@ class Cases
$dataset->next(); $dataset->next();
$aRow = $dataset->getRow(); $aRow = $dataset->getRow();
if ($aRow['APP_STATUS'] != 'DRAFT') { if ($aRow['APP_STATUS'] != 'DRAFT') {
throw (new \Exception(\G::LoadTranslation("ID_DELETE_CASE_NO_STATUS"))); throw (new Exception(\G::LoadTranslation("ID_DELETE_CASE_NO_STATUS")));
} }
if ($aRow['APP_INIT_USER'] != $usr_uid) { if ($aRow['APP_INIT_USER'] != $usr_uid) {
throw (new \Exception(\G::LoadTranslation("ID_DELETE_CASE_NO_OWNER"))); throw (new Exception(\G::LoadTranslation("ID_DELETE_CASE_NO_OWNER")));
} }
$case = new \Cases(); $case = new \Cases();
@@ -1057,26 +1067,26 @@ class Cases
{ {
try { try {
if (!$delIndex) { if (!$delIndex) {
$delIndex = \AppDelegation::getCurrentIndex($applicationUid); $delIndex = AppDelegation::getCurrentIndex($applicationUid);
//Check if the next task is a subprocess SYNCHRONOUS with a thread Open //Check if the next task is a subprocess SYNCHRONOUS with a thread Open
$subAppData = new \SubApplication(); $subAppData = new \SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($applicationUid, $delIndex); $caseSubprocessPending = $subAppData->isSubProcessWithCasePending($applicationUid, $delIndex);
if ($caseSubprocessPending) { if ($caseSubprocessPending) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_ALREADY_DERIVATED"))); throw (new Exception(\G::LoadTranslation("ID_CASE_ALREADY_DERIVATED")));
} }
} }
$ws = new \wsBase(); $ws = new wsBase();
$fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false); $fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
throw (new \Exception($array ["message"])); throw (new Exception($array ["message"]));
} else { } else {
unset($array['status_code']); unset($array['status_code']);
unset($array['message']); unset($array['message']);
unset($array['timestamp']); unset($array['timestamp']);
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -1545,7 +1555,7 @@ class Cases
try { try {
$aAux1 = $oUser->load($aAux['USR_UID']); $aAux1 = $oUser->load($aAux['USR_UID']);
$sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]);
} catch (\Exception $oException) { } catch (Exception $oException) {
$sUser = '(USER DELETED)'; $sUser = '(USER DELETED)';
} }
//if both documents were generated, we choose the pdf one, only if doc was //if both documents were generated, we choose the pdf one, only if doc was
@@ -1656,7 +1666,7 @@ class Cases
//Return //Return
return $caseVariable; return $caseVariable;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -1755,11 +1765,11 @@ class Cases
$arrayResult = $this->getStatusInfo($app_uid); $arrayResult = $this->getStatusInfo($app_uid);
if ($arrayResult["APP_STATUS"] == "CANCELLED") { if ($arrayResult["APP_STATUS"] == "CANCELLED") {
throw new \Exception(\G::LoadTranslation("ID_CASE_CANCELLED", array($app_uid))); throw new Exception(\G::LoadTranslation("ID_CASE_CANCELLED", array($app_uid)));
} }
if ($arrayResult["APP_STATUS"] == "COMPLETED") { if ($arrayResult["APP_STATUS"] == "COMPLETED") {
throw new \Exception(\G::LoadTranslation("ID_CASE_IS_COMPLETED", array($app_uid))); throw new Exception(\G::LoadTranslation("ID_CASE_IS_COMPLETED", array($app_uid)));
} }
$appCacheView = new \AppCacheView(); $appCacheView = new \AppCacheView();
@@ -1775,7 +1785,7 @@ class Cases
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria); $rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
if (!$rsCriteria->next()) { if (!$rsCriteria->next()) {
throw (new \Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED", array($usr_uid)))); throw (new Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED", array($usr_uid))));
} }
$_SESSION['APPLICATION'] = $app_uid; $_SESSION['APPLICATION'] = $app_uid;
@@ -1856,11 +1866,11 @@ class Cases
$case = new \Cases(); $case = new \Cases();
$caseLoad = $case->loadCase($app_uid); $caseLoad = $case->loadCase($app_uid);
$pro_uid = $caseLoad['PRO_UID']; $pro_uid = $caseLoad['PRO_UID'];
$tas_uid = \AppDelegation::getCurrentTask($app_uid); $tas_uid = AppDelegation::getCurrentTask($app_uid);
$respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' ); $respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' );
$respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' ); $respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' );
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
throw (new \Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); throw (new Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS")));
} }
if ($sort != 'APP_NOTE.NOTE_DATE') { if ($sort != 'APP_NOTE.NOTE_DATE') {
@@ -1944,7 +1954,7 @@ class Cases
Validator::isString($note_content, '$note_content'); Validator::isString($note_content, '$note_content');
if (strlen($note_content) > 500) { if (strlen($note_content) > 500) {
throw (new \Exception(\G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content,'500')))); throw (new Exception(\G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content,'500'))));
} }
Validator::isBoolean($send_mail, '$send_mail'); Validator::isBoolean($send_mail, '$send_mail');
@@ -1952,11 +1962,11 @@ class Cases
$case = new \Cases(); $case = new \Cases();
$caseLoad = $case->loadCase($app_uid); $caseLoad = $case->loadCase($app_uid);
$pro_uid = $caseLoad['PRO_UID']; $pro_uid = $caseLoad['PRO_UID'];
$tas_uid = \AppDelegation::getCurrentTask($app_uid); $tas_uid = AppDelegation::getCurrentTask($app_uid);
$respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' ); $respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' );
$respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' ); $respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' );
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
throw (new \Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); throw (new Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS")));
} }
$note_content = addslashes($note_content); $note_content = addslashes($note_content);
@@ -1987,7 +1997,7 @@ class Cases
$this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $record["USR_FIRSTNAME"] . "", $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $record["USR_FIRSTNAME"] . "",
$this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . "" $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . ""
); );
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -2255,7 +2265,7 @@ class Cases
//Return //Return
return $arrayTask; return $arrayTask;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -2333,7 +2343,7 @@ class Cases
//Return //Return
return $arrayData; return $arrayData;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -2520,7 +2530,7 @@ class Cases
//Return //Return
return array(); return array();
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -2542,7 +2552,7 @@ class Cases
$response = $case->getProcessListStartCase($usrUid, $typeView); $response = $case->getProcessListStartCase($usrUid, $typeView);
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()));
} }
} }
@@ -2624,7 +2634,7 @@ class Cases
} }
return $processList; return $processList;
} catch (\Exception $e) { } catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
} }
@@ -2807,7 +2817,7 @@ class Cases
$filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']))? $arrayFilterData['filter'] : '', $filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']))? $arrayFilterData['filter'] : '',
'data' => $arrayUser 'data' => $arrayUser
]; ];
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -3180,7 +3190,7 @@ class Cases
} }
} }
$arrayApplicationData['APP_DATA'][$key] = G::json_encode($files); $arrayApplicationData['APP_DATA'][$key] = G::json_encode($files);
} catch (\Exception $e) { } catch (Exception $e) {
Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, SYS_SYS, 'processmaker.log'); Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, SYS_SYS, 'processmaker.log');
} }
} }
@@ -3244,7 +3254,7 @@ class Cases
* @param array $appData * @param array $appData
* @param array $dataVariable * @param array $dataVariable
* @return array * @return array
* @throws \Exception * @throws Exception
*/ */
public static function getGlobalVariables($appData = array(), $dataVariable = array()) public static function getGlobalVariables($appData = array(), $dataVariable = array())
{ {

View File

@@ -391,7 +391,6 @@ class Dashboard {
$data['PRO_UID'] = ""; $data['PRO_UID'] = "";
$data['APP_UID'] = ""; $data['APP_UID'] = "";
//require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Configuration.php");
$oConfig = new \Configuration(); $oConfig = new \Configuration();
$response = $oConfig->create($data); $response = $oConfig->create($data);
@@ -409,7 +408,6 @@ class Dashboard {
*/ */
public function getConfig($usr_uid) public function getConfig($usr_uid)
{ {
//require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Configuration.php");
$oConfig = new \Configuration(); $oConfig = new \Configuration();
$response = array(); $response = array();

View File

@@ -1,9 +1,9 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use \G; use G;
use \DbSource; use DbSource;
use \dbConnections; use DbConnections;
class DataBaseConnection class DataBaseConnection
{ {
@@ -61,7 +61,7 @@ class DataBaseConnection
$dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid); $dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid);
} }
$dbs = new dbConnections($pro_uid); $dbs = new DbConnections($pro_uid);
$oDBConnection = new DbSource(); $oDBConnection = new DbSource();
$aFields = $oDBConnection->load($dbs_uid, $pro_uid); $aFields = $oDBConnection->load($dbs_uid, $pro_uid);
if ($aFields['DBS_PORT'] == '0') { if ($aFields['DBS_PORT'] == '0') {
@@ -162,7 +162,7 @@ class DataBaseConnection
if (isset($dataDBConnection['DBS_ENCODE'])) { if (isset($dataDBConnection['DBS_ENCODE'])) {
$encodesExists = array(); $encodesExists = array();
$dbs = new dbConnections(); $dbs = new DbConnections();
$dbEncodes = $dbs->getEncondeList($dataDBConnection['DBS_TYPE']); $dbEncodes = $dbs->getEncondeList($dataDBConnection['DBS_TYPE']);
foreach ($dbEncodes as $value) { foreach ($dbEncodes as $value) {
$encodesExists[] = $value['0']; $encodesExists[] = $value['0'];
@@ -423,7 +423,7 @@ class DataBaseConnection
*/ */
public function getDbEngines () public function getDbEngines ()
{ {
$dbs = new dbConnections(); $dbs = new DbConnections();
$dbServices = $dbs->getDbServicesAvailables(); $dbServices = $dbs->getDbServicesAvailables();
return $dbServices; return $dbServices;
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use DynaformHandler;
class DynaForm class DynaForm
{ {
@@ -155,7 +156,7 @@ class DynaForm
while ($oDataset->next()) { while ($oDataset->next()) {
$dataForms = $oDataset->getRow(); $dataForms = $oDataset->getRow();
$dynHandler = new \dynaFormHandler(PATH_DYNAFORM . $proUid . PATH_SEP . $dataForms["DYN_UID"] . ".xml"); $dynHandler = new DynaformHandler(PATH_DYNAFORM . $proUid . PATH_SEP . $dataForms["DYN_UID"] . ".xml");
$dynFields = $dynHandler->getFields(); $dynFields = $dynHandler->getFields();
foreach ($dynFields as $field) { foreach ($dynFields as $field) {
$sType = \Step::getAttribute( $field, 'type' ); $sType = \Step::getAttribute( $field, 'type' );

View File

@@ -3,6 +3,7 @@ namespace ProcessMaker\BusinessModel;
use G; use G;
use Criteria; use Criteria;
use DynaformHandler;
class Process class Process
{ {
@@ -1676,7 +1677,7 @@ class Process
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) { if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) {
$dyn = new \dynaFormHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml"); $dyn = new DynaformHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml");
if ($dyn->getHeaderAttribute("type") !== "xmlform" && $dyn->getHeaderAttribute("type") !== "") { if ($dyn->getHeaderAttribute("type") !== "xmlform" && $dyn->getHeaderAttribute("type") !== "") {
// skip it, if that is not a xmlform // skip it, if that is not a xmlform
@@ -1729,7 +1730,7 @@ class Process
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) { if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) {
$dyn = new \dynaFormHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml"); $dyn = new DynaformHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml");
if ($dyn->getHeaderAttribute("type") === "xmlform") { if ($dyn->getHeaderAttribute("type") === "xmlform") {
// skip it, if that is not a xmlform // skip it, if that is not a xmlform
@@ -1775,7 +1776,7 @@ class Process
$aMultipleSelectionFields = array("listbox", "checkgroup", "grid"); $aMultipleSelectionFields = array("listbox", "checkgroup", "grid");
if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
$dyn = new \dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); $dyn = new DynaformHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
$dynaformFields[] = $dyn->getFields(); $dynaformFields[] = $dyn->getFields();
$fields = $dyn->getFields(); $fields = $dyn->getFields();

View File

@@ -1,9 +1,10 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use \G; use G;
use \AdditionalTables; use AdditionalTables;
use \Fields; use Fields;
use DynaformHandler;
class Table class Table
{ {
@@ -798,7 +799,7 @@ class Table
while ($oDataset->next()) { while ($oDataset->next()) {
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) { if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) {
$dynaformHandler = new \dynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' ); $dynaformHandler = new DynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' );
$nodeFieldsList = $dynaformHandler->getFields(); $nodeFieldsList = $dynaformHandler->getFields();
foreach ($nodeFieldsList as $node) { foreach ($nodeFieldsList as $node) {
@@ -1052,7 +1053,7 @@ class Table
while ($oDataset->next()) { while ($oDataset->next()) {
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
$dynaformHandler = new \dynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' ); $dynaformHandler = new DynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' );
$nodeFieldsList = $dynaformHandler->getFields(); $nodeFieldsList = $dynaformHandler->getFields();
foreach ($nodeFieldsList as $node) { foreach ($nodeFieldsList as $node) {
$arrayNode = $dynaformHandler->getArray( $node ); $arrayNode = $dynaformHandler->getArray( $node );

View File

@@ -1897,7 +1897,12 @@ class Task
} }
} }
public function getValidateSelfService($data) /**
* This method verify if an activity has cases
* @param $data
* @return \stdclass
*/
public function hasPendingCases($data)
{ {
$paused = false; $paused = false;
$data = array_change_key_case($data, CASE_LOWER); $data = array_change_key_case($data, CASE_LOWER);

View File

@@ -785,7 +785,7 @@ class User
$oUser = new Users(); $oUser = new Users();
$aUser = $oUser->load($userUid); $aUser = $oUser->load($userUid);
$oUserProperty = new UsersProperties(); $oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array($aUser["USR_PASSWORD"])))); $aUserProperty = $oUserProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array($oUser->getUsrPassword()))));
$aUserProperty["USR_LOGGED_NEXT_TIME"] = $arrayData["USR_LOGGED_NEXT_TIME"]; $aUserProperty["USR_LOGGED_NEXT_TIME"] = $arrayData["USR_LOGGED_NEXT_TIME"];
$oUserProperty->update($aUserProperty); $oUserProperty->update($aUserProperty);
} }

View File

@@ -1,7 +1,9 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use \G; use G;
use Exception;
use AdditionalTables;
class Variable class Variable
{ {
@@ -13,25 +15,22 @@ class Variable
* @param string $processUid Unique id of Process * @param string $processUid Unique id of Process
* @param array $arrayData Data * @param array $arrayData Data
* *
* return array Return data of the new Variable created * @return array, return data of the new Variable created
* @throws Exception
*/ */
public function create($processUid, array $arrayData) public function create($processUid, array $arrayData)
{ {
try { try {
//Verify data //Verify data
Validator::proUid($processUid, '$prj_uid'); Validator::proUid($processUid, '$prj_uid');
$arrayData = array_change_key_case($arrayData, CASE_UPPER); $arrayData = array_change_key_case($arrayData, CASE_UPPER);
$this->existsName($processUid, $arrayData["VAR_NAME"], ""); $this->existsName($processUid, $arrayData["VAR_NAME"], "");
$this->throwExceptionFieldDefinition($arrayData); $this->throwExceptionFieldDefinition($arrayData);
//Create //Create
$cnn = \Propel::getConnection("workflow"); $cnn = \Propel::getConnection("workflow");
try { try {
$variable = new \ProcessVariables(); $variable = new \ProcessVariables();
$sPkProcessVariables = \ProcessMaker\Util\Common::generateUID(); $sPkProcessVariables = \ProcessMaker\Util\Common::generateUID();
$variable->setVarUid($sPkProcessVariables); $variable->setVarUid($sPkProcessVariables);
@@ -43,13 +42,13 @@ class Variable
if (isset($arrayData["VAR_NAME"])) { if (isset($arrayData["VAR_NAME"])) {
$variable->setVarName($arrayData["VAR_NAME"]); $variable->setVarName($arrayData["VAR_NAME"]);
} else { } else {
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_name' ))); throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_name' )));
} }
if (isset($arrayData["VAR_FIELD_TYPE"])) { if (isset($arrayData["VAR_FIELD_TYPE"])) {
$arrayData["VAR_FIELD_TYPE"] = $this->validateVarFieldType($arrayData["VAR_FIELD_TYPE"]); $arrayData["VAR_FIELD_TYPE"] = $this->validateVarFieldType($arrayData["VAR_FIELD_TYPE"]);
$variable->setVarFieldType($arrayData["VAR_FIELD_TYPE"]); $variable->setVarFieldType($arrayData["VAR_FIELD_TYPE"]);
} else { } else {
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_field_type' ))); throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_field_type' )));
} }
if (isset($arrayData["VAR_FIELD_SIZE"])) { if (isset($arrayData["VAR_FIELD_SIZE"])) {
$variable->setVarFieldSize($arrayData["VAR_FIELD_SIZE"]); $variable->setVarFieldSize($arrayData["VAR_FIELD_SIZE"]);
@@ -57,7 +56,7 @@ class Variable
if (isset($arrayData["VAR_LABEL"])) { if (isset($arrayData["VAR_LABEL"])) {
$variable->setVarLabel($arrayData["VAR_LABEL"]); $variable->setVarLabel($arrayData["VAR_LABEL"]);
} else { } else {
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_label' ))); throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_label' )));
} }
if (isset($arrayData["VAR_DBCONNECTION"])) { if (isset($arrayData["VAR_DBCONNECTION"])) {
$variable->setVarDbconnection($arrayData["VAR_DBCONNECTION"]); $variable->setVarDbconnection($arrayData["VAR_DBCONNECTION"]);
@@ -78,7 +77,7 @@ class Variable
$variable->setVarDefault($arrayData["VAR_DEFAULT"]); $variable->setVarDefault($arrayData["VAR_DEFAULT"]);
} }
if (isset($arrayData["VAR_ACCEPTED_VALUES"])) { if (isset($arrayData["VAR_ACCEPTED_VALUES"])) {
$encodeAcceptedValues = \G::json_encode($arrayData["VAR_ACCEPTED_VALUES"]); $encodeAcceptedValues = G::json_encode($arrayData["VAR_ACCEPTED_VALUES"]);
$variable->setVarAcceptedValues($encodeAcceptedValues); $variable->setVarAcceptedValues($encodeAcceptedValues);
} }
if (isset($arrayData["INP_DOC_UID"])) { if (isset($arrayData["INP_DOC_UID"])) {
@@ -94,10 +93,10 @@ class Variable
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
} }
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg); throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
} }
} catch (\Exception $e) { } catch (Exception $e) {
$cnn->rollback(); $cnn->rollback();
throw $e; throw $e;
@@ -108,7 +107,7 @@ class Variable
return $variable; return $variable;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -120,7 +119,8 @@ class Variable
* @param string $variableUid Unique id of Variable * @param string $variableUid Unique id of Variable
* @param array $arrayData Data * @param array $arrayData Data
* *
* return array Return data of the Variable updated * @return array,return data of the Variable updated
* @throws Exception
*/ */
public function update($processUid, $variableUid, $arrayData) public function update($processUid, $variableUid, $arrayData)
{ {
@@ -128,7 +128,6 @@ class Variable
//Verify data //Verify data
Validator::proUid($processUid, '$prj_uid'); Validator::proUid($processUid, '$prj_uid');
$arrayData = array_change_key_case($arrayData, CASE_UPPER); $arrayData = array_change_key_case($arrayData, CASE_UPPER);
$this->throwExceptionFieldDefinition($arrayData); $this->throwExceptionFieldDefinition($arrayData);
//Update //Update
@@ -150,7 +149,6 @@ class Variable
$cnn->begin(); $cnn->begin();
if (isset($arrayData["VAR_NAME"])) { if (isset($arrayData["VAR_NAME"])) {
$this->existsName($processUid, $arrayData["VAR_NAME"], $variableUid); $this->existsName($processUid, $arrayData["VAR_NAME"], $variableUid);
$variable->setVarName($arrayData["VAR_NAME"]); $variable->setVarName($arrayData["VAR_NAME"]);
} }
if (isset($arrayData["VAR_FIELD_TYPE"])) { if (isset($arrayData["VAR_FIELD_TYPE"])) {
@@ -176,7 +174,7 @@ class Variable
$variable->setVarDefault($arrayData["VAR_DEFAULT"]); $variable->setVarDefault($arrayData["VAR_DEFAULT"]);
} }
if (isset($arrayData["VAR_ACCEPTED_VALUES"])) { if (isset($arrayData["VAR_ACCEPTED_VALUES"])) {
$encodeAcceptedValues = \G::json_encode($arrayData["VAR_ACCEPTED_VALUES"]); $encodeAcceptedValues = G::json_encode($arrayData["VAR_ACCEPTED_VALUES"]);
$variable->setVarAcceptedValues($encodeAcceptedValues); $variable->setVarAcceptedValues($encodeAcceptedValues);
} }
if (isset($arrayData["INP_DOC_UID"])) { if (isset($arrayData["INP_DOC_UID"])) {
@@ -206,15 +204,15 @@ class Variable
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
} }
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg); throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
} }
} catch (\Exception $e) { } catch (Exception $e) {
$cnn->rollback(); $cnn->rollback();
throw $e; throw $e;
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -225,35 +223,31 @@ class Variable
* @param string $processUid Unique id of Process * @param string $processUid Unique id of Process
* @param string $variableUid Unique id of Variable * @param string $variableUid Unique id of Variable
* *
* return void * @return void
* @throws Exception
*/ */
public function delete($processUid, $variableUid) public function delete($processUid, $variableUid)
{ {
try { try {
//Verify data //Verify data
Validator::proUid($processUid, '$prj_uid'); Validator::proUid($processUid, '$prj_uid');
$this->throwExceptionIfNotExistsVariable($variableUid); $this->throwExceptionIfNotExistsVariable($variableUid);
//Verify variable //Verify variable
$this->throwExceptionIfVariableIsAssociatedAditionalTable($variableUid); $this->throwExceptionIfVariableIsAssociatedAditionalTable($variableUid);
$variable = $this->getVariable($processUid, $variableUid); $variable = $this->getVariable($processUid, $variableUid);
$pmDynaform = new \pmDynaform(); $pmDynaform = new \pmDynaform();
$isUsed = $pmDynaform->isUsed($processUid, $variable); $isUsed = $pmDynaform->isUsed($processUid, $variable);
if ($isUsed !== false) { if ($isUsed !== false) {
$titleDynaform=$pmDynaform->getDynaformTitle($isUsed); $titleDynaform=$pmDynaform->getDynaformTitle($isUsed);
throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($titleDynaform))); throw new Exception(G::LoadTranslation("ID_VARIABLE_IN_USE", array($titleDynaform)));
} }
//Delete //Delete
$criteria = new \Criteria("workflow"); $criteria = new \Criteria("workflow");
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid); $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid);
\ProcessVariablesPeer::doDelete($criteria); \ProcessVariablesPeer::doDelete($criteria);
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -263,19 +257,18 @@ class Variable
* @param string $processUid Unique id of Process * @param string $processUid Unique id of Process
* @param string $variableUid Unique id of Variable * @param string $variableUid Unique id of Variable
* *
* return array Return an array with data of a Variable * @return array, return an array with data of a Variable
* @throws Exception
*/ */
public function getVariable($processUid, $variableUid) public function getVariable($processUid, $variableUid)
{ {
try { try {
//Verify data //Verify data
Validator::proUid($processUid, '$prj_uid'); Validator::proUid($processUid, '$prj_uid');
$this->throwExceptionIfNotExistsVariable($variableUid); $this->throwExceptionIfNotExistsVariable($variableUid);
//Get data //Get data
$criteria = new \Criteria("workflow"); $criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
$criteria->addSelectColumn(\ProcessVariablesPeer::PRJ_UID); $criteria->addSelectColumn(\ProcessVariablesPeer::PRJ_UID);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
@@ -292,23 +285,18 @@ class Variable
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT); $criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME); $criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE); $criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL);
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID, \Criteria::LEFT_JOIN); $criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID, \Criteria::LEFT_JOIN);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next(); $rsCriteria->next();
$arrayVariables = array(); $arrayVariables = array();
while ($aRow = $rsCriteria->getRow()) { while ($aRow = $rsCriteria->getRow()) {
$VAR_ACCEPTED_VALUES = \G::json_decode($aRow['VAR_ACCEPTED_VALUES'], true); $VAR_ACCEPTED_VALUES = G::json_decode($aRow['VAR_ACCEPTED_VALUES'], true);
if(sizeof($VAR_ACCEPTED_VALUES)) { if(sizeof($VAR_ACCEPTED_VALUES)) {
$encodeAcceptedValues = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", \G::json_encode($VAR_ACCEPTED_VALUES)); $encodeAcceptedValues = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", G::json_encode($VAR_ACCEPTED_VALUES));
} else { } else {
$encodeAcceptedValues = $aRow['VAR_ACCEPTED_VALUES']; $encodeAcceptedValues = $aRow['VAR_ACCEPTED_VALUES'];
} }
@@ -331,7 +319,7 @@ class Variable
//Return //Return
return $arrayVariables; return $arrayVariables;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -342,7 +330,8 @@ class Variable
* *
* @param string $processUid Unique id of Process * @param string $processUid Unique id of Process
* *
* return array Return an array with data of a DynaForm * @return array, return an array with data of a DynaForm
* @throws Exception
*/ */
public function getVariables($processUid) public function getVariables($processUid)
{ {
@@ -352,7 +341,6 @@ class Variable
//Get data //Get data
$criteria = new \Criteria("workflow"); $criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
$criteria->addSelectColumn(\ProcessVariablesPeer::PRJ_UID); $criteria->addSelectColumn(\ProcessVariablesPeer::PRJ_UID);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
@@ -369,22 +357,17 @@ class Variable
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT); $criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME); $criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE); $criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID . " AND " . \DbSourcePeer::PRO_UID . " = '" . $processUid . "'", \Criteria::LEFT_JOIN); $criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID . " AND " . \DbSourcePeer::PRO_UID . " = '" . $processUid . "'", \Criteria::LEFT_JOIN);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next(); $rsCriteria->next();
$arrayVariables = array(); $arrayVariables = array();
while ($aRow = $rsCriteria->getRow()) { while ($aRow = $rsCriteria->getRow()) {
$VAR_ACCEPTED_VALUES = \G::json_decode($aRow['VAR_ACCEPTED_VALUES'], true); $VAR_ACCEPTED_VALUES = G::json_decode($aRow['VAR_ACCEPTED_VALUES'], true);
if(sizeof($VAR_ACCEPTED_VALUES)) { if(sizeof($VAR_ACCEPTED_VALUES)) {
$encodeAcceptedValues = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", \G::json_encode($VAR_ACCEPTED_VALUES)); $encodeAcceptedValues = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", G::json_encode($VAR_ACCEPTED_VALUES));
} else { } else {
$encodeAcceptedValues = $aRow['VAR_ACCEPTED_VALUES']; $encodeAcceptedValues = $aRow['VAR_ACCEPTED_VALUES'];
} }
@@ -407,7 +390,7 @@ class Variable
//Return //Return
return $arrayVariables; return $arrayVariables;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -416,7 +399,8 @@ class Variable
* Verify field definition * Verify field definition
* *
* @param array $aData Unique id of Variable to exclude * @param array $aData Unique id of Variable to exclude
* * @return void
* @throws Exception
*/ */
public function throwExceptionFieldDefinition($aData) public function throwExceptionFieldDefinition($aData)
{ {
@@ -428,10 +412,6 @@ class Variable
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');
Validator::isNotEmpty($aData['VAR_FIELD_TYPE'], '$var_field_type'); Validator::isNotEmpty($aData['VAR_FIELD_TYPE'], '$var_field_type');
/*if ($aData["VAR_FIELD_TYPE"] != 'string' && $aData["VAR_FIELD_TYPE"] != 'integer' && $aData["VAR_FIELD_TYPE"] != 'boolean' && $aData["VAR_FIELD_TYPE"] != 'float' &&
$aData["VAR_FIELD_TYPE"] != 'datetime' && $aData["VAR_FIELD_TYPE"] != 'date_of_birth' && $aData["VAR_FIELD_TYPE"] != 'date') {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('$var_field_type')));
}*/
} }
if (isset($aData["VAR_FIELD_SIZE"])) { if (isset($aData["VAR_FIELD_SIZE"])) {
Validator::isInteger($aData["VAR_FIELD_SIZE"], '$var_field_size'); Validator::isInteger($aData["VAR_FIELD_SIZE"], '$var_field_size');
@@ -449,10 +429,10 @@ class Variable
if (isset($aData["VAR_NULL"])) { if (isset($aData["VAR_NULL"])) {
Validator::isInteger($aData['VAR_NULL'], '$var_null'); Validator::isInteger($aData['VAR_NULL'], '$var_null');
if ($aData["VAR_NULL"] != 0 && $aData["VAR_NULL"] !=1 ) { if ($aData["VAR_NULL"] != 0 && $aData["VAR_NULL"] !=1 ) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array('$var_null','0, 1' ))); throw new Exception(G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array('$var_null','0, 1' )));
} }
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -460,8 +440,10 @@ class Variable
/** /**
* Verify if exists the name of a variable * Verify if exists the name of a variable
* *
* @param string $processUid Unique id of Process * @param string $processUid, unique id of Process
* @param string $variableName Name * @param string $variableName, name of variable
* @param string $variableUidToExclude
* @throws Exception
* *
*/ */
public function existsName($processUid, $variableName, $variableUidToExclude = "") public function existsName($processUid, $variableName, $variableUidToExclude = "")
@@ -471,25 +453,23 @@ class Variable
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
if ($variableUidToExclude != "") { if ($variableUidToExclude != "") {
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUidToExclude, \Criteria::NOT_EQUAL); $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUidToExclude, \Criteria::NOT_EQUAL);
} }
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) { while ($rsCriteria->next()) {
$row = $rsCriteria->getRow(); $row = $rsCriteria->getRow();
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"])) {
throw new Exception(G::LoadTranslation("DYNAFIELD_PHPNAME_ALREADY_EXIST", array($row["VAR_NAME"])));
} }
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -499,21 +479,20 @@ class Variable
* *
* @param string $sql SQL * @param string $sql SQL
* *
* return array Return an array with required variables in the SQL * @return array, return an array with required variables in the SQL
* @throws Exception
*/ */
public function sqlGetRequiredVariables($sql) public function sqlGetRequiredVariables($sql)
{ {
try { try {
$arrayVariableRequired = array(); $arrayVariableRequired = array();
preg_match_all("/@[@%#\?\x24\=]([A-Za-z_]\w*)/", $sql, $arrayMatch, PREG_SET_ORDER); preg_match_all("/@[@%#\?\x24\=]([A-Za-z_]\w*)/", $sql, $arrayMatch, PREG_SET_ORDER);
foreach ($arrayMatch as $value) { foreach ($arrayMatch as $value) {
$arrayVariableRequired[] = $value[1]; $arrayVariableRequired[] = $value[1];
} }
return $arrayVariableRequired; return $arrayVariableRequired;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -525,17 +504,17 @@ class Variable
* @param string $variableSql SQL * @param string $variableSql SQL
* @param array $arrayVariable The variables * @param array $arrayVariable The variables
* *
* return void Throw exception if some required variable in the SQL is missing in the variables * @return void Throw exception if some required variable in the SQL is missing in the variables
* @throws Exception
*/ */
public function throwExceptionIfSomeRequiredVariableSqlIsMissingInVariables($variableName, $variableSql, array $arrayVariable) public function throwExceptionIfSomeRequiredVariableSqlIsMissingInVariables($variableName, $variableSql, array $arrayVariable)
{ {
try { try {
$arrayResult = array_diff(array_unique($this->sqlGetRequiredVariables($variableSql)), array_keys($arrayVariable)); $arrayResult = array_diff(array_unique($this->sqlGetRequiredVariables($variableSql)), array_keys($arrayVariable));
if (count($arrayResult) > 0) { if (count($arrayResult) > 0) {
throw new \Exception(\G::LoadTranslation("ID_PROCESS_VARIABLE_REQUIRED_VARIABLES_FOR_QUERY", array($variableName, implode(", ", $arrayResult)))); throw new Exception(G::LoadTranslation("ID_PROCESS_VARIABLE_REQUIRED_VARIABLES_FOR_QUERY", array($variableName, implode(", ", $arrayResult))));
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -547,13 +526,14 @@ class Variable
* @param string $variableName Variable name * @param string $variableName Variable name
* @param array $arrayVariable The variables * @param array $arrayVariable The variables
* *
* return array Return an array with all records * @return array, return an array with all records
* @throws Exception
*/ */
public function executeSql($processUid, $variableName, array $arrayVariable = array()) public function executeSql($processUid, $variableName, array $arrayVariable = array())
{ {
try { try {
return $this->executeSqlControl($processUid, $arrayVariable); return $this->executeSqlControl($processUid, $arrayVariable);
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -563,7 +543,8 @@ class Variable
* *
* @param string $variableUid Unique id of variable * @param string $variableUid Unique id of variable
* *
* return void Throw exception if does not exist the variable in table PROCESS_VARIABLES * @return void
* @throws Exception, throw exception if does not exist the variable in table PROCESS_VARIABLES
*/ */
public function throwExceptionIfNotExistsVariable($variableUid) public function throwExceptionIfNotExistsVariable($variableUid)
{ {
@@ -571,9 +552,9 @@ class Variable
$obj = \ProcessVariablesPeer::retrieveByPK($variableUid); $obj = \ProcessVariablesPeer::retrieveByPK($variableUid);
if (is_null($obj)) { if (is_null($obj)) {
throw new \Exception('var_uid: '.$variableUid. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST")); throw new Exception('var_uid: '.$variableUid. ' '.G::LoadTranslation("ID_DOES_NOT_EXIST"));
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -584,30 +565,25 @@ class Variable
* @param string $variableUid Unique id of variable * @param string $variableUid Unique id of variable
* *
* @return void Throw exception * @return void Throw exception
* @throws Exception
*/ */
public function throwExceptionIfVariableIsAssociatedAditionalTable($variableUid) public function throwExceptionIfVariableIsAssociatedAditionalTable($variableUid)
{ {
try { try {
$criteria = new \Criteria('workflow'); $criteria = new \Criteria('workflow');
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID); $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
$criteria->addJoin(\ProcessVariablesPeer::PRJ_UID, \AdditionalTablesPeer::PRO_UID, \Criteria::INNER_JOIN); $criteria->addJoin(\ProcessVariablesPeer::PRJ_UID, \AdditionalTablesPeer::PRO_UID, \Criteria::INNER_JOIN);
$arrayCondition = []; $arrayCondition = [];
$arrayCondition[] = array(\AdditionalTablesPeer::ADD_TAB_UID, \FieldsPeer::ADD_TAB_UID, \Criteria::EQUAL); $arrayCondition[] = array(\AdditionalTablesPeer::ADD_TAB_UID, \FieldsPeer::ADD_TAB_UID, \Criteria::EQUAL);
$arrayCondition[] = array(\ProcessVariablesPeer::VAR_NAME, \FieldsPeer::FLD_NAME, \Criteria::EQUAL); $arrayCondition[] = array(\ProcessVariablesPeer::VAR_NAME, \FieldsPeer::FLD_NAME, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::INNER_JOIN); $criteria->addJoinMC($arrayCondition, \Criteria::INNER_JOIN);
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) { if ($rsCriteria->next()) {
throw new \Exception(\G::LoadTranslation('ID_VARIABLE_ASSOCIATED_WITH_REPORT_TABLE', array($variableUid))); throw new Exception(G::LoadTranslation('ID_VARIABLE_ASSOCIATED_WITH_REPORT_TABLE', array($variableUid)));
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -615,8 +591,10 @@ class Variable
/** /**
* Verify if the variable is being used in a Dynaform * Verify if the variable is being used in a Dynaform
* *
* @param string $processUid Unique id of Process * @param string $processUid, Unique id of Process
* @param string $variableUid Unique id of Variable * @param string $variableUid, Unique id of Variable
* @return void
* @throws Exception
* *
*/ */
public function verifyUse($processUid, $variableUid) public function verifyUse($processUid, $variableUid)
@@ -631,10 +609,8 @@ class Variable
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) { while ($rsCriteria->next()) {
$row = $rsCriteria->getRow(); $row = $rsCriteria->getRow();
$contentDecode = G::json_decode($row["DYN_CONTENT"], true);
$contentDecode = \G::json_decode($row["DYN_CONTENT"], true);
$content = $contentDecode['items'][0]['items']; $content = $contentDecode['items'][0]['items'];
if (is_array($content)) { if (is_array($content)) {
foreach ($content as $key => $value) { foreach ($content as $key => $value) {
@@ -649,14 +625,14 @@ class Variable
$rsCriteria->next(); $rsCriteria->next();
if ($rsCriteria->getRow()) { if ($rsCriteria->getRow()) {
throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($variableUid, $row["DYN_UID"]))); throw new Exception(G::LoadTranslation("ID_VARIABLE_IN_USE", array($variableUid, $row["DYN_UID"])));
} }
} }
} }
} }
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -668,13 +644,14 @@ class Variable
* @param string $variableName Variable name * @param string $variableName Variable name
* @param array $arrayVariable The variables * @param array $arrayVariable The variables
* *
* return array Return an array with all records * @return array, return an array with all records
* @throws Exception
*/ */
public function executeSqlSuggest($processUid, $variableName, array $arrayVariable = array()) public function executeSqlSuggest($processUid, $variableName, array $arrayVariable = array())
{ {
try { try {
return $this->executeSqlControl($processUid, $arrayVariable); return $this->executeSqlControl($processUid, $arrayVariable);
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -698,7 +675,7 @@ class Variable
return sizeof($row) ? $row : false; return sizeof($row) ? $row : false;
} }
return false; return false;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -712,7 +689,8 @@ class Variable
* @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist
* (TRUE: throw the exception; FALSE: returns FALSE) * (TRUE: throw the exception; FALSE: returns FALSE)
* *
* @return array Returns an array with Variable record, ThrowTheException/FALSE otherwise * @return array, returns an array with Variable record
* @throws Exception, ThrowTheException/FALSE otherwise
*/ */
public function getVariableRecordByName( public function getVariableRecordByName(
$projectUid, $projectUid,
@@ -722,20 +700,17 @@ class Variable
) { ) {
try { try {
$criteria = new \Criteria('workflow'); $criteria = new \Criteria('workflow');
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL); $criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) { if ($rsCriteria->next()) {
$arrayVariableData = $rsCriteria->getRow(); $arrayVariableData = $rsCriteria->getRow();
} else { } else {
if ($throwException) { if ($throwException) {
throw new \Exception( throw new Exception(
$arrayVariableNameForException['$variableName'] . ': ' . $variableName. ' ' . $arrayVariableNameForException['$variableName'] . ': ' . $variableName. ' ' .
\G::LoadTranslation('ID_DOES_NOT_EXIST') G::LoadTranslation('ID_DOES_NOT_EXIST')
); );
} else { } else {
return false; return false;
@@ -744,7 +719,7 @@ class Variable
//Return //Return
return $arrayVariableData; return $arrayVariableData;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -753,7 +728,7 @@ class Variable
{ {
$vType = strtolower($type); $vType = strtolower($type);
if(!in_array($vType, $this->variableTypes)) { if(!in_array($vType, $this->variableTypes)) {
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED")); throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED"));
} }
return $vType; return $vType;
} }
@@ -774,7 +749,7 @@ class Variable
* @param type $proUid * @param type $proUid
* @param array $params * @param array $params
* @return array * @return array
* @throws \Exception * @throws Exception
*/ */
public function executeSqlControl($proUid, array $params = array()) public function executeSqlControl($proUid, array $params = array())
{ {
@@ -829,7 +804,7 @@ class Variable
} }
} }
return $result; return $result;
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }

View File

@@ -382,7 +382,7 @@ class WebEntry
$arrayUserData = $user->load($arrayWebEntryData["USR_UID"]); $arrayUserData = $user->load($arrayWebEntryData["USR_UID"]);
$usrUsername = $arrayUserData["USR_USERNAME"]; $usrUsername = $arrayUserData["USR_USERNAME"];
$usrPassword = $arrayUserData["USR_PASSWORD"]; $usrPassword = $user->getUsrPassword();
$dynaForm = new \Dynaform(); $dynaForm = new \Dynaform();

View File

@@ -5,7 +5,7 @@ use ProcessMaker\Project;
class ProjectNotFound extends \RuntimeException class ProjectNotFound extends \RuntimeException
{ {
const EXCEPTION_CODE = 20; const EXCEPTION_CODE = 400;
public function __construct(Project\Handler $obj, $uid, $message = "", \Exception $previous = null) { public function __construct(Project\Handler $obj, $uid, $message = "", \Exception $previous = null) {
$message = empty($message) ? sprintf("Project \"%s\" with UID: %s, does not exist.", get_class($obj), $uid) : $message; $message = empty($message) ? sprintf("Project \"%s\" with UID: %s, does not exist.", get_class($obj), $uid) : $message;

View File

@@ -1,39 +1,36 @@
<?php <?php
namespace ProcessMaker\Project; namespace ProcessMaker\Project;
use \BpmnProject as Project; use \BasePeer;
use \BpmnProcess as Process;
use \BpmnDiagram as Diagram;
use \BpmnActivity as Activity; use \BpmnActivity as Activity;
use \BpmnBound as Bound;
use \BpmnEvent as Event;
use \BpmnGateway as Gateway;
use \BpmnFlow as Flow;
use \BpmnArtifact as Artifact; use \BpmnArtifact as Artifact;
use \BpmnProjectPeer as ProjectPeer;
use \BpmnProcessPeer as ProcessPeer;
use \BpmnDiagramPeer as DiagramPeer;
use \BpmnActivityPeer as ActivityPeer; use \BpmnActivityPeer as ActivityPeer;
use \BpmnBoundPeer as BoundPeer;
use \BpmnEventPeer as EventPeer;
use \BpmnGatewayPeer as GatewayPeer;
use \BpmnFlowPeer as FlowPeer;
use \BpmnArtifactPeer as ArtifactPeer; use \BpmnArtifactPeer as ArtifactPeer;
use \BpmnParticipant as Participant; use \BpmnBound as Bound;
use \BpmnParticipantPeer as ParticipantPeer; use \BpmnBoundPeer as BoundPeer;
use \BpmnDiagram as Diagram;
use \BpmnDiagramPeer as DiagramPeer;
use \BpmnEvent as Event;
use \BpmnEventPeer as EventPeer;
use \BpmnFlow as Flow;
use \BpmnFlowPeer as FlowPeer;
use \BpmnGateway as Gateway;
use \BpmnGatewayPeer as GatewayPeer;
use \BpmnLaneset as Laneset; use \BpmnLaneset as Laneset;
use \BpmnLanesetPeer as LanesetPeer; use \BpmnLanesetPeer as LanesetPeer;
use \BpmnLane as Lane; use \BpmnLane as Lane;
use \BpmnLanePeer as LanePeer; use \BpmnLanePeer as LanePeer;
use \BpmnParticipant as Participant;
use \BasePeer; use \BpmnParticipantPeer as ParticipantPeer;
use \BpmnProject as Project;
use \BpmnProcess as Process;
use \BpmnProjectPeer as ProjectPeer;
use \BpmnProcessPeer as ProcessPeer;
use \Criteria as Criteria; use \Criteria as Criteria;
use \Exception;
use \G;
use \ResultSet as ResultSet; use \ResultSet as ResultSet;
use \ProcessMaker\Util\Common;
use ProcessMaker\Util\Common;
use ProcessMaker\Exception;
/** /**
* Class Bpmn * Class Bpmn
@@ -428,9 +425,12 @@ class Bpmn extends Handler
self::log("Remove Activity: $actUid"); self::log("Remove Activity: $actUid");
$activity = ActivityPeer::retrieveByPK($actUid); $activity = ActivityPeer::retrieveByPK($actUid);
$activity->delete(); if (isset($activity)) {
//TODO if the activity was removed, the related flows to that activity must be removed $activity->delete();
Flow::removeAllRelated($actUid);
} else {
throw new Exception(G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array("act_uid", $actUid)));
}
self::log("Remove Activity Success!"); self::log("Remove Activity Success!");
} catch (\Exception $e) { } catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString()); self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());

View File

@@ -1,8 +1,11 @@
<?php <?php
namespace ProcessMaker\Services\Api\Project; namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api; use \Exception;
use \Luracast\Restler\RestException; use \Luracast\Restler\RestException;
use \ProcessMaker\BusinessModel\Task;
use \ProcessMaker\Project\Adapter\BpmnWorkflow;
use \ProcessMaker\Services\Api;
/** /**
* Project\Activity Api Controller * Project\Activity Api Controller
@@ -136,22 +139,32 @@ class Activity extends Api
/** /**
* This method remove an activity and all related components
* @param string $prj_uid {@min 32} {@max 32} * @param string $prj_uid {@min 32} {@max 32}
* @param string $act_uid {@min 32} {@max 32} * @param string $act_uid {@min 32} {@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @return array * @return array
* * @access protected
* @class AccessControl {@permission PM_FACTORY}
* @url DELETE /:prj_uid/activity/:act_uid * @url DELETE /:prj_uid/activity/:act_uid
*/ */
public function doDeleteProjectActivity($prj_uid, $act_uid) public function doDeleteProjectActivity($prj_uid, $act_uid)
{ {
try { try {
$task = new \ProcessMaker\BusinessModel\Task(); $task = new Task();
$task->deleteTask($prj_uid, $act_uid); $task->setFormatFieldNameInUppercase(false);
} catch (\Exception $e) { $task->setArrayParamException(array("taskUid" => "act_uid"));
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
$response = $task->hasPendingCases(array("act_uid" => $act_uid, "case_type" => "assigned"));
if ($response->result !== false) {
$project = new BpmnWorkflow();
$prj = $project->load($prj_uid);
$prj->removeActivity($act_uid);
} else {
throw new RestException(403, $response->message);
}
} catch (Exception $e) {
$resCode = $e->getCode() == 0 ? Api::STAT_APP_EXCEPTION : $e->getCode();
throw new RestException($resCode, $e->getMessage());
} }
} }
@@ -215,7 +228,7 @@ class Activity extends Api
$task->setFormatFieldNameInUppercase(false); $task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid")); $task->setArrayParamException(array("taskUid" => "act_uid"));
$response = $task->getValidateSelfService($request_data); $response = $task->hasPendingCases($request_data);
return $response; return $response;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -220,7 +220,6 @@ define( 'PATH_RBAC_MSSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mssql' . P
define( 'PATH_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP ); define( 'PATH_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP );
// include Gulliver Class // include Gulliver Class
require_once (PATH_GULLIVER . "class.bootstrap.php");
if (file_exists( FILE_PATHS_INSTALLED )) { if (file_exists( FILE_PATHS_INSTALLED )) {
@@ -642,8 +641,6 @@ $memcache = & PMmemcached::getSingleton( SYS_SYS );
// setup propel definitions and logging // setup propel definitions and logging
//changed to autoloader //changed to autoloader
//require_once ("propel/Propel.php");
//require_once ("creole/Creole.php");
if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) { if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) {
define( 'PM_PID', mt_rand( 1, 999999 ) ); define( 'PM_PID', mt_rand( 1, 999999 ) );
@@ -795,8 +792,6 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
die(); die();
} }
Bootstrap::initVendors();
$isWebEntry = \ProcessMaker\BusinessModel\WebEntry::isWebEntry(SYS_COLLECTION, $phpFile); $isWebEntry = \ProcessMaker\BusinessModel\WebEntry::isWebEntry(SYS_COLLECTION, $phpFile);
if (\Bootstrap::getDisablePhpUploadExecution() === 1 && !$isWebEntry) { if (\Bootstrap::getDisablePhpUploadExecution() === 1 && !$isWebEntry) {
$message = \G::LoadTranslation('THE_PHP_FILES_EXECUTION_WAS_DISABLED'); $message = \G::LoadTranslation('THE_PHP_FILES_EXECUTION_WAS_DISABLED');