Merge remote branch 'upstream/master' into BUG-5359

This commit is contained in:
Hector Cortez
2012-07-04 17:19:01 -04:00
12 changed files with 3990 additions and 3360 deletions

View File

@@ -4569,11 +4569,16 @@ class xmlformTemplate extends Smarty
$result [$k] = G::replaceDataField ( $form->fields [$k]->label, $form->values );
if (! is_array ( $value )) {
if ($form->type == 'grid') {
$aAux = array ();
// $index = ($therow >count ( $form->owner->values [$form->name] ))? $therow : count($form->owner->values [$form->name] );
for($i = 0; $i < $therow; $i ++) {
$aAux = array();
if ($therow == -1) {
for($i = 0; $i < count($form->values[$form->name]); $i++) {
$aAux [] = '';
}
} else {
for($i = 0; $i < $therow; $i++) {
$aAux [] = '';
}
}
$result ['form'] [$k] = $form->fields [$k]->renderGrid ( $aAux, $form );
} else {
$result ['form'] [$k] = $form->fields [$k]->render ( $value, $form );

View File

@@ -12,22 +12,32 @@ if (!defined('SYS_LANG')) {
}
if (!defined('PATH_HOME')) {
if ( !defined('PATH_SEP') ) {
define('PATH_SEP', ( substr(PHP_OS, 0, 3) == 'WIN' ) ? '\\' : '/');
if (!defined('PATH_SEP')) {
define('PATH_SEP', (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
}
$docuroot = explode(PATH_SEP, str_replace('engine' . PATH_SEP . 'methods' . PATH_SEP . 'services', '', dirname(__FILE__)));
$pathServices = 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'services';
$docuroot = explode(PATH_SEP, str_replace($pathServices, '', dirname(__FILE__)));
array_pop($docuroot);
array_pop($docuroot);
$pathhome = implode(PATH_SEP, $docuroot) . PATH_SEP;
$pathHome = implode(PATH_SEP, $docuroot) . PATH_SEP;
//try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
//in a normal installation you don't need to change it.
array_pop($docuroot);
$pathTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP ;
array_pop($docuroot);
$pathOutTrunk = implode( PATH_SEP, $docuroot) . PATH_SEP ;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define('PATH_HOME', $pathhome);
array_pop($docuroot);
$pathTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP;
array_pop($docuroot);
$pathOutTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP;
//to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define('PATH_HOME', $pathHome);
define('PATH_TRUNK', $pathTrunk);
define('PATH_OUTTRUNK', $pathOutTrunk);
@@ -57,23 +67,27 @@ if (!defined('PATH_HOME')) {
require_once ( "creole/Creole.php" );
}
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Event.php';
require_once 'classes/model/AppEvent.php';
require_once 'classes/model/CaseScheduler.php';
//G::loadClass('pmScript');
require_once ("classes/model/Configuration.php");
require_once ("classes/model/AppCacheView.php");
require_once ("classes/model/AppDelegation.php");
require_once ("classes/model/Event.php");
require_once ("classes/model/AppEvent.php");
require_once ("classes/model/CaseScheduler.php");
//G::loadClass("pmScript");
//default values
$bCronIsRunning = false;
$sLastExecution = '';
if ( file_exists(PATH_DATA . 'cron') ) {
$aAux = unserialize( trim( @file_get_contents(PATH_DATA . 'cron')) );
$bCronIsRunning = (boolean)$aAux['bCronIsRunning'];
$sLastExecution = $aAux['sLastExecution'];
}
else {
if (file_exists(PATH_DATA . 'cron')) {
$arrayAux = unserialize(trim(@file_get_contents(PATH_DATA . 'cron')));
$bCronIsRunning = (boolean)($arrayAux['bCronIsRunning']);
$sLastExecution = $arrayAux['sLastExecution'];
} else {
//if not exists the file, just create a new one with current date
@file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => '1', 'sLastExecution' => date('Y-m-d H:i:s'))));
$arrayAux = array('bCronIsRunning' => '1', 'sLastExecution' => date('Y-m-d H:i:s'));
@file_put_contents(PATH_DATA . 'cron', serialize($arrayAux));
}
if (!defined('SYS_SYS')) {
@@ -81,37 +95,37 @@ if (!defined('SYS_SYS')) {
$sNow = $argv[2];
$sFilter = '';
for($i=3; $i<count($argv); $i++){
$sFilter .= ' '.$argv[$i];
for ($i = 3; $i < count($argv); $i++) {
$sFilter .= ' ' . $argv[$i];
}
$oDirectory = dir(PATH_DB);
if (is_dir(PATH_DB . $sObject)) {
saveLog ( 'main', 'action', "checking folder " . PATH_DB . $sObject );
if (file_exists(PATH_DB . $sObject . PATH_SEP . 'db.php')) {
saveLog('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists(PATH_DB . $sObject . PATH_SEP . 'db.php')) {
define('SYS_SYS', $sObject);
include_once(PATH_HOME.'engine'.PATH_SEP.'config'.PATH_SEP.'paths_installed.php');
include_once(PATH_HOME.'engine'.PATH_SEP.'config'.PATH_SEP.'paths.php');
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
//***************** PM Paths DATA **************************
define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' );
define( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' );
define( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' );
define( 'PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/' );
define( 'PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/' );
define( 'PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles'.PATH_SEP);
define( 'PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies'.PATH_SEP);
define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
define('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/');
define('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
if(is_file(PATH_DATA_SITE.PATH_SEP.'.server_info')){
if (is_file(PATH_DATA_SITE.PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents(PATH_DATA_SITE.PATH_SEP.'.server_info');
$SERVER_INFO = unserialize($SERVER_INFO);
//print_r($SERVER_INFO);
define( 'SERVER_NAME', $SERVER_INFO ['SERVER_NAME']);
define( 'SERVER_PORT', $SERVER_INFO ['SERVER_PORT']);
define('SERVER_NAME', $SERVER_INFO ['SERVER_NAME']);
define('SERVER_PORT', $SERVER_INFO ['SERVER_PORT']);
} else {
eprintln("WARNING! No server info found!", 'red');
}
@@ -127,9 +141,15 @@ if (!defined('SYS_SYS')) {
$sContent = str_replace(");", ';', $sContent);
eval($sContent);
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
$dsnRp = $DB_ADAPTER . '://' . $DB_REPORT_USER . ':' . $DB_REPORT_PASS . '@' . $DB_REPORT_HOST . '/' . $DB_REPORT_NAME;
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/';
$dsnRbac = $dsnRbac . $DB_RBAC_NAME;
$dsnRp = $DB_ADAPTER . '://' . $DB_REPORT_USER . ':' . $DB_REPORT_PASS . '@' . $DB_REPORT_HOST . '/';
$dsnRp = $dsnRp . $DB_REPORT_NAME;
switch ($DB_ADAPTER) {
case 'mysql':
$dsn .= '?encoding=utf8';
@@ -142,6 +162,7 @@ if (!defined('SYS_SYS')) {
default:
break;
}
$pro['datasources']['workflow']['connection'] = $dsn;
$pro['datasources']['workflow']['adapter'] = $DB_ADAPTER;
$pro['datasources']['rbac']['connection'] = $dsnRbac;
@@ -150,34 +171,41 @@ if (!defined('SYS_SYS')) {
$pro['datasources']['rp']['adapter'] = $DB_ADAPTER;
//$pro['datasources']['dbarray']['connection'] = 'dbarray://user:pass@localhost/pm_os';
//$pro['datasources']['dbarray']['adapter'] = 'dbarray';
$oFile = fopen(PATH_CORE . 'config/_databases_.php', 'w');
fwrite($oFile, '<?php global $pro;return $pro; ?>');
fclose($oFile);
Propel::init(PATH_CORE . 'config/_databases_.php');
//Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
eprintln("Processing workspace: " . $sObject, 'green');
try{
eprintln("Processing workspace: " . $sObject, "green");
try {
processWorkspace();
}catch(Exception $e){
} catch (Exception $e) {
echo $e->getMessage();
eprintln("Probelm in workspace: " . $sObject.' it was omitted.', 'red');
eprintln("Probelm in workspace: " . $sObject . " it was omitted.", "red");
}
eprintln();
}
}
unlink(PATH_CORE . 'config/_databases_.php');
}
else {
} else {
processWorkspace();
}
//finally update the file
@file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
$arrayAux = array('bCronIsRunning' => '0', 'sLastExecution' => date('Y-m-d H:i:s'));
@file_put_contents(PATH_DATA . 'cron', serialize($arrayAux));
function processWorkspace() {
function processWorkspace()
{
global $sLastExecution;
try {
resendEmails();
unpauseApplications();
@@ -185,63 +213,80 @@ function processWorkspace() {
executePlugins();
executeEvents($sLastExecution);
executeScheduledCases();
}
catch (Exception $oError) {
saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n" );
executeUpdateAppTitle();
} catch (Exception $oError) {
saveLog("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n");
}
}
function resendEmails() {
function resendEmails()
{
global $sFilter;
if($sFilter!='' && strpos($sFilter, 'emails') === false) return false;
if ($sFilter != '' && strpos($sFilter, 'emails') === false) {
return false;
}
setExecutionMessage("Resending emails");
try {
G::LoadClass('spool');
$oSpool = new spoolRun();
$oSpool->resendEmails();
saveLog('resendEmails', 'action', 'Resending Emails', "c");
$aSpoolWarnings = $oSpool->getWarnings();
if( $aSpoolWarnings !== false ) {
foreach($aSpoolWarnings as $sWarning){
if ( $aSpoolWarnings !== false ) {
foreach ($aSpoolWarnings as $sWarning) {
print('MAIL SPOOL WARNING: ' . $sWarning."\n");
saveLog('resendEmails', 'warning', 'MAIL SPOOL WARNING: ' . $sWarning);
}
}
setExecutionResultMessage('DONE');
}
catch (Exception $oError) {
} catch (Exception $oError) {
setExecutionResultMessage('WITH ERRORS', 'error');
eprintln(" '-".$oError->getMessage(), 'red');
saveLog('resendEmails', 'error', 'Error Resending Emails: ' . $oError->getMessage());
}
}
function unpauseApplications() {
function unpauseApplications()
{
global $sFilter;
global $sNow;
if($sFilter!='' && strpos($sFilter, 'unpause') === false) return false;
if ($sFilter != '' && strpos($sFilter, 'unpause') === false) {
return false;
}
setExecutionMessage("Unpausing applications");
try {
G::LoadClass('case');
$oCases = new Cases();
$oCases->ThrowUnpauseDaemon($sNow);
setExecutionResultMessage('DONE');
saveLog('unpauseApplications', 'action', 'Unpausing Applications');
}
catch (Exception $oError) {
} catch (Exception $oError) {
setExecutionResultMessage('WITH ERRORS', 'error');
eprintln(" '-".$oError->getMessage(), 'red');
saveLog('unpauseApplications', 'error', 'Error Unpausing Applications: ' . $oError->getMessage());
}
}
function executePlugins(){
function executePlugins()
{
global $sFilter;
if($sFilter!='' && strpos($sFilter, 'plugins') === false) return false;
if ($sFilter!='' && strpos($sFilter, 'plugins') === false) {
return false;
}
$pathCronPlugins = PATH_CORE.'bin'.PATH_SEP.'plugins'.PATH_SEP;
@@ -250,14 +295,16 @@ function executePlugins(){
return false;
}
if ($handle = opendir( $pathCronPlugins )) {
while ( false !== ($file = readdir($handle))) {
if ( strpos($file, '.php',1) && is_file($pathCronPlugins . $file) ) {
$filename = str_replace('.php' , '', $file) ;
if ($handle = opendir($pathCronPlugins)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php',1) && is_file($pathCronPlugins . $file)) {
$filename = str_replace('.php' , '', $file);
$className = $filename . 'ClassCron';
include_once ( $pathCronPlugins . $file ); //$filename. ".php"
$oPlugin = new $className();
if (method_exists($oPlugin, 'executeCron')) {
$oPlugin->executeCron();
setExecutionMessage("Executing Plugins");
@@ -267,120 +314,190 @@ function executePlugins(){
}
}
}
function calculateDuration() {
function calculateDuration()
{
global $sFilter;
if($sFilter!='' && strpos($sFilter, 'calculate') === false) return false;
if ($sFilter != '' && strpos($sFilter, 'calculate') === false) {
return false;
}
setExecutionMessage("Calculating Duration");
try {
$oAppDelegation = new AppDelegation();
$oAppDelegation->calculateDuration();
setExecutionResultMessage('DONE');
saveLog('calculateDuration', 'action', 'Calculating Duration');
}
catch (Exception $oError) {
} catch (Exception $oError) {
setExecutionResultMessage('WITH ERRORS', 'error');
eprintln(" '-".$oError->getMessage(), 'red');
saveLog('calculateDuration', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
}
}
function executeEvents($sLastExecution, $sNow=null) {
function executeEvents($sLastExecution, $sNow=null)
{
global $sFilter;
global $sNow;
$log = array();
if($sFilter!='' && strpos($sFilter, 'events') === false) return false;
if ($sFilter != '' && strpos($sFilter, 'events') === false) {
return false;
}
setExecutionMessage("Executing events");
setExecutionResultMessage('PROCESSING');
try {
$oAppEvent = new AppEvent();
saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $sNow ");
$n = $oAppEvent->executeEvents($sNow, false, $log);
foreach ($log as $value) {
saveLog('executeEvents', 'action', "Execute Events : $value, $sNow ");
}
setExecutionMessage("|- End Execution events");
setExecutionResultMessage("Processed $n");
//saveLog('executeEvents', 'action', $res );
}
catch (Exception $oError) {
} catch (Exception $oError) {
setExecutionResultMessage('WITH ERRORS', 'error');
eprintln(" '-".$oError->getMessage(), 'red');
saveLog('calculateAlertsDueDate', 'Error', 'Error Executing Events: ' . $oError->getMessage());
}
}
function executeScheduledCases($sNow=null){
try{
function executeScheduledCases($sNow=null)
{
try {
global $sFilter;
global $sNow;
$log = array();
if($sFilter!='' && strpos($sFilter, 'scheduler') === false) return false;
if ($sFilter != '' && strpos($sFilter, 'scheduler') === false) {
return false;
}
setExecutionMessage("Executing the scheduled starting cases");
setExecutionResultMessage('PROCESSING');
$sNow = isset($sNow)? $sNow: date('Y-m-d H:i:s');
$oCaseScheduler = new CaseScheduler;
$sNow = isset($sNow)? $sNow : date('Y-m-d H:i:s');
$oCaseScheduler = new CaseScheduler();
$oCaseScheduler->caseSchedulerCron($sNow, $log);
foreach ($log as $value) {
saveLog('executeScheduledCases', 'action', "OK Case# $value");
}
setExecutionResultMessage('DONE');
} catch(Exception $oError){
} catch (Exception $oError) {
setExecutionResultMessage('WITH ERRORS', 'error');
eprintln(" '-".$oError->getMessage(), 'red');
}
}
function saveLog($sSource, $sType, $sDescription) {
function executeUpdateAppTitle()
{
try {
$criteriaConf = new Criteria("workflow");
$criteriaConf->addSelectColumn(ConfigurationPeer::OBJ_UID);
$criteriaConf->addSelectColumn(ConfigurationPeer::CFG_VALUE);
$criteriaConf->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
$rsCriteriaConf = ConfigurationPeer::doSelectRS($criteriaConf);
$rsCriteriaConf->setFetchmode(ResultSet::FETCHMODE_ASSOC);
setExecutionMessage("Update case labels");
saveLog("updateCaseLabels", "action", "Update case labels", "c");
while ($rsCriteriaConf->next()) {
$row = $rsCriteriaConf->getRow();
$taskUid = $row["OBJ_UID"];
$lang = $row["CFG_VALUE"];
//Update case labels
$appcv = new AppCacheView();
$appcv->appTitleByTaskCaseLabelUpdate($taskUid, $lang);
//Delete record
$criteria = new Criteria("workflow");
$criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
$criteria->add(ConfigurationPeer::OBJ_UID, $taskUid);
$criteria->add(ConfigurationPeer::CFG_VALUE, $lang);
$numRowDeleted = ConfigurationPeer::doDelete($criteria);
saveLog("updateCaseLabels", "action", "OK Task $taskUid");
}
setExecutionResultMessage("DONE");
} catch (Exception $e) {
setExecutionResultMessage("WITH ERRORS", "error");
eprintln(" '-" . $e->getMessage(), "red");
saveLog("updateCaseLabels", "error", "Error updating case labels: " . $e->getMessage());
}
}
function saveLog($sSource, $sType, $sDescription)
{
try {
global $isDebug;
if ( $isDebug )
print date('H:i:s') ." ($sSource) $sType $sDescription <br>\n";
if ($isDebug) {
print date('H:i:s') ." ($sSource) $sType $sDescription <br />\n";
}
@fwrite($oFile, date('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
G::verifyPath(PATH_DATA . 'log' . PATH_SEP, true);
if ($sType == 'action') {
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
}
else {
} else {
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+');
}
@fwrite($oFile, date('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
@fclose($oFile);
}
catch (Exception $oError) {
} catch (Exception $oError) {
//CONTINUE
}
}
function setExecutionMessage($m){
function setExecutionMessage($m)
{
$len = strlen($m);
$linesize = 60;
$rOffset = $linesize - $len;
eprint("* $m");
for($i=0; $i<$rOffset; $i++) eprint('.');
for ($i = 0; $i < $rOffset; $i++) {
eprint('.');
}
}
function setExecutionResultMessage($m, $t=''){
$c='green';
if($t=='error') $c = 'red';
if($t=='info') $c = 'yellow';
function setExecutionResultMessage($m, $t='')
{
$c = 'green';
if ($t == 'error') {
$c = 'red';
}
if ($t == 'info') {
$c = 'yellow';
}
eprintln("[$m]", $c);
}

View File

@@ -665,7 +665,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
* @param string $sCode
* @return array
*/
function set_javascript($A,$fieldName,$sCode,$meta)
function set_javascript($A,$fieldName,$sCode,$meta='')
{
if ($fieldName == '___pm_boot_strap___') {
return 0;

View File

@@ -33,6 +33,9 @@
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
if (!class_exists('PMScript')) {
G::LoadClass('pmScript');
}
/**
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.

View File

@@ -1,4 +1,5 @@
<?php
/**
* class.pmScript.php
* @package workflow.engine.ProcessMaker
@@ -38,7 +39,6 @@
* last modify comment was added and adapted the catch errors
* @copyright 2007 COLOSA
*/
function __autoload($sClassName)
{
if (defined('SYS_SYS')) {
@@ -57,24 +57,25 @@ if (class_exists('folderData')) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
foreach ($aAvailablePmFunctions as $key => $class ) {
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
if ( file_exists ( $filePlugin ) )
if (file_exists($filePlugin)) {
include_once( $filePlugin);
}
}
}
//end plugin
//Add External Triggers
$dir=G::ExpandPath( "classes" ).'triggers';
$filesArray=array();
if (file_exists($dir)){
$dir = G::ExpandPath("classes") . 'triggers';
$filesArray = array();
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if(($file!=".")&&($file!="..")){
$extFile =explode(".",$file);
if($extFile[sizeof($extFile)-1] == 'php')
include_once( $dir.PATH_SEP.$file);
if (($file != ".") && ($file != "..")) {
$extFile = explode(".", $file);
if ($extFile[sizeof($extFile) - 1] == 'php') {
include_once( $dir . PATH_SEP . $file);
}
}
}
closedir($handle);
@@ -88,36 +89,37 @@ if (file_exists($dir)){
*/
class PMScript
{
/**
* Original fields
*/
var $aOriginalFields = array();
public $aOriginalFields = array();
/**
* Fields to use
*/
var $aFields = array();
public $aFields = array();
/**
* Script
*/
var $sScript = '';
public $sScript = '';
/**
* Error has happened?
*/
var $bError = false;
public $bError = false;
/**
* Affected fields
*/
var $affected_fields;
public $affected_fields;
/**
* Constructor of the class PMScript
* @return void
*/
function PMScript()
public function PMScript()
{
$this->aFields['__ERROR__'] = 'none';
}
@@ -127,7 +129,7 @@ class PMScript
* @param array $aFields
* @return void
*/
function setFields($aFields = array())
public function setFields($aFields=array())
{
if (!is_array($aFields)) {
$aFields = array();
@@ -140,7 +142,7 @@ class PMScript
* @param string $sScript
* @return void
*/
function setScript($sScript = '')
public function setScript($sScript='')
{
$this->sScript = $sScript;
}
@@ -150,13 +152,13 @@ class PMScript
* @param string $sScript
* @return boolean
*/
function validSyntax($sScript)
public function validSyntax($sScript)
{
return true;
}
function executeAndCatchErrors($sScript, $sCode) {
public function executeAndCatchErrors($sScript, $sCode)
{
ob_start('handleFatalErrors');
set_error_handler('handleErrors');
$_SESSION['_CODE_'] = $sCode;
@@ -169,146 +171,170 @@ class PMScript
* Execute the current script
* @return void
*/
function execute()
public function execute()
{
$sScript = "";
$iAux = 0;
$bEqual = false;
$iOcurrences = preg_match_all('/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences){
for($i = 0; $i < $iOcurrences; $i++){
$iOcurrences = preg_match_all( '/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]'
. '*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/',
$this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
for ($i = 0; $i < $iOcurrences; $i++) {
$sAux = substr($this->sScript, $iAux, $aMatch[0][$i][1] - $iAux);
if (!$bEqual){
if (strpos($sAux, '==') !== false){
if (!$bEqual) {
if (strpos($sAux, '==') !== false) {
$bEqual = false;
}
else {
if (strpos($sAux, '=') !== false){
} else {
if (strpos($sAux, '=') !== false) {
$bEqual = true;
}
}
}
if ($bEqual){
if (strpos($sAux, ';') !== false){
if ($bEqual) {
if (strpos($sAux, ';') !== false) {
$bEqual = false;
}
}
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
eval("if (!isset(\$this->aFields['" . $aMatch[2][$i][0] . "'])) { \$this->aFields['" . $aMatch[2][$i][0] . "'] = null; }");
}
else {
eval("if (!isset(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")) { \$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . " = null; }");
eval("if (!isset(\$this->aFields['" . $aMatch[2][$i][0] . "'])) { \$this->aFields['"
. $aMatch[2][$i][0] . "'] = null; }");
} else {
eval( "if (!isset(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")) { \$this->aFields"
. (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0]
. "']" : '') . $aMatch[5][$i][0] . " = null; }");
}
}
$sScript .= $sAux;
$iAux = $aMatch[0][$i][1] + strlen($aMatch[0][$i][0]);
switch ($aMatch[1][$i][0])
{ case '@':
if ($bEqual){
switch ($aMatch[1][$i][0]) {
case '@':
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToString(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToString(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToString(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '%':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToInteger(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToInteger(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToInteger(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '#':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToFloat(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToFloat(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToFloat(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '?':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToUrl(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToUrl(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToUrl(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '$':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmSqlEscape(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmSqlEscape(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmSqlEscape(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '=':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
@@ -317,13 +343,16 @@ class PMScript
}
}
$sScript .= substr($this->sScript, $iAux);
$sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}";
$sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n "
. " \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}";
//echo '<pre>-->'; print_r($this->aFields); echo '<---</pre>';
$this->executeAndCatchErrors($sScript, $this->sScript);
for($i=0; $i<count($this->affected_fields); $i++){
for ($i = 0; $i < count($this->affected_fields); $i++) {
$_SESSION['TRIGGER_DEBUG']['DATA'][] = Array(
'key' => $this->affected_fields[$i],
'value' => isset($this->aFields[$this->affected_fields[$i]]) ? $this->aFields[$this->affected_fields[$i]] : ''
'value' => isset($this->aFields[$this->affected_fields[$i]])
? $this->aFields[$this->affected_fields[$i]]
: ''
);
}
//echo '<pre>-->'; print_r($_SESSION['TRIGGER_DEBUG']['DATA']); echo '<---</pre>';
@@ -333,141 +362,161 @@ class PMScript
* Evaluate the current script
* @return void
*/
function evaluate()
public function evaluate()
{
$bResult = null;
$sScript = '';
$iAux = 0;
$bEqual = false;
$variableIsDefined = true;
$iOcurrences = preg_match_all('/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences){
for($i = 0; $i < $iOcurrences; $i++){
// if the variables for that condition has not been previously defined then $variableIsDefined is set to false
if (!isset($this->aFields[$aMatch[2][$i][0]])){
// $variableIsDefined = false;
$iOcurrences = preg_match_all('/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]'
. '*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/',
$this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
for ($i = 0; $i < $iOcurrences; $i++) {
// if the variables for that condition has not been previously defined then $variableIsDefined
// is set to false
if (!isset($this->aFields[$aMatch[2][$i][0]])) {
// $variableIsDefined = false;
$this->aFields[$aMatch[2][$i][0]] = '';
}
$sAux = substr($this->sScript, $iAux, $aMatch[0][$i][1] - $iAux);
if (!$bEqual){
if (strpos($sAux, '=') !== false){
if (!$bEqual) {
if (strpos($sAux, '=') !== false) {
$bEqual = true;
}
}
if ($bEqual){
if (strpos($sAux, ';') !== false)
{
if ($bEqual) {
if (strpos($sAux, ';') !== false) {
$bEqual = false;
}
}
$sScript .= $sAux;
$iAux = $aMatch[0][$i][1] + strlen($aMatch[0][$i][0]);
switch ($aMatch[1][$i][0]){
switch ($aMatch[1][$i][0]) {
case '@':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToString(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToString(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToString(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '%':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToInteger(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToInteger(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToInteger(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '#':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToFloat(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToFloat(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToFloat(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '?':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmToUrl(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmToUrl(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmToUrl(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '$':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "pmSqlEscape(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
} else {
$sScript .= "pmSqlEscape(\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0] . ")";
}
else {
$sScript .= "pmSqlEscape(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
case '=':
if ($bEqual){
if ($bEqual) {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
}
}
else{
} else {
if (!isset($aMatch[5][$i][0])) {
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
}
else {
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
} else {
$sScript .= "\$this->aFields"
. (isset($aMatch[2][$i][0])
? "['" . $aMatch[2][$i][0] . "']"
: '') . $aMatch[5][$i][0];
}
}
break;
@@ -477,12 +526,11 @@ class PMScript
$sScript .= substr($this->sScript, $iAux);
$sScript = '$bResult = ' . $sScript . ';';
// checks if the syntax is valid or if the variables in that condition has been previously defined
if ($this->validSyntax($sScript)&&$variableIsDefined){
if ($this->validSyntax($sScript) && $variableIsDefined) {
$this->bError = false;
eval($sScript);
}
else{
// echo "<script> alert('".G::loadTranslation('MSG_CONDITION_NOT_DEFINED')."'); </script>";
} else {
// echo "<script> alert('".G::loadTranslation('MSG_CONDITION_NOT_DEFINED')."'); </script>";
G::SendTemporalMessage('MSG_CONDITION_NOT_DEFINED', 'error', 'labels');
$this->bError = true;
}
@@ -499,7 +547,7 @@ class PMScript
*/
function pmToString($vValue)
{
return (string)$vValue;
return (string) $vValue;
}
/**
@@ -509,7 +557,7 @@ function pmToString($vValue)
*/
function pmToInteger($vValue)
{
return (int)$vValue;
return (int) $vValue;
}
/**
@@ -519,7 +567,7 @@ function pmToInteger($vValue)
*/
function pmToFloat($vValue)
{
return (float)$vValue;
return (float) $vValue;
}
/**
@@ -546,11 +594,11 @@ function pmSqlEscape($vValue)
/***************************************************************************
* Error handler
* author: Julio Cesar Laura Avenda<64>o <juliocesar@colosa.com>
* date: 2009-10-01
***************************************************************************/
/* * *************************************************************************
* Error handler
* author: Julio Cesar Laura Avenda<64>o <juliocesar@colosa.com>
* date: 2009-10-01
* ************************************************************************* */
/*
* Convert to data base escaped string
* @param string $errno
@@ -562,7 +610,7 @@ function pmSqlEscape($vValue)
function handleErrors($errno, $errstr, $errfile, $errline)
{
if ($errno != '' && ($errno != 8) && ($errno != 2048)) {
if( isset($_SESSION['_CODE_']) ){
if (isset($_SESSION['_CODE_'])) {
$sCode = $_SESSION['_CODE_'];
unset($_SESSION['_CODE_']);
registerError(1, $errstr, $errline - 1, $sCode);
@@ -575,6 +623,7 @@ function handleErrors($errno, $errstr, $errfile, $errline)
* @param variant $buffer
* @return buffer
*/
function handleFatalErrors($buffer)
{
if (preg_match('/(error<\/b>:)(.+)(<br)/', $buffer, $regs)) {
@@ -587,11 +636,14 @@ function handleFatalErrors($buffer)
if (strpos($_SERVER['REQUEST_URI'], '&ACTION=GENERATE') !== false) {
G::LoadClass('case');
$oCase = new Cases();
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
if($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'],
$_SESSION['APPLICATION'],
$_SESSION['INDEX'],
$_SESSION['STEP_POSITION']);
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$aNextStep['PAGE'] = $aNextStep['PAGE'].'&breakpoint=triggerdebug';
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
G::header('Location: ' . $aNextStep['PAGE']);
die;
@@ -599,15 +651,17 @@ function handleFatalErrors($buffer)
$_SESSION['_NO_EXECUTE_TRIGGERS_'] = 1;
G::header('Location: ' . $_SERVER['REQUEST_URI']);
die;
}
else {
} else {
G::LoadClass('case');
$oCase = new Cases();
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
if($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'],
$_SESSION['APPLICATION'],
$_SESSION['INDEX'],
$_SESSION['STEP_POSITION']);
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$aNextStep['PAGE'] = $aNextStep['PAGE'].'&breakpoint=triggerdebug';
$aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug';
}
if (strpos($aNextStep['PAGE'], 'TYPE=ASSIGN_TASK&UID=-1') !== false) {
G::SendMessageText('Fatal error in trigger', 'error');
@@ -618,6 +672,7 @@ function handleFatalErrors($buffer)
}
return $buffer;
}
/*
* Register Error
* @param string $iType
@@ -626,10 +681,12 @@ function handleFatalErrors($buffer)
* @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;
$_SESSION['TRIGGER_DEBUG']['ERRORS'][][$sType] = $sError . ($iLine > 0 ? ' (line ' . $iLine . ')' : '')
. ':<br /><br />' . $sCode;
}
/**
@@ -650,7 +707,7 @@ function getEngineDataBaseName($connection)
* @param type $sql
* @param type $connection
*/
function executeQueryOci($sql, $connection, $aParameter = array())
function executeQueryOci($sql, $connection, $aParameter=array())
{
$aDNS = $connection->getDSN();
@@ -660,10 +717,10 @@ function executeQueryOci($sql, $connection, $aParameter = array())
$sDatabse = $aDNS["database"];
$sPort = $aDNS["port"];
if ($sPort != "1521") { // if not default port
if ($sPort != "1521") {
// if not default port
$conn = oci_connect($sUsername, $sPassword, $sHostspec . ":" . $sPort . "/" . $sDatabse);
}
else {
} else {
$conn = oci_connect($sUsername, $sPassword, $sHostspec . "/" . $sDatabse);
}
@@ -673,7 +730,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
return $e;
}
switch(true) {
switch (true) {
case preg_match("/^(SELECT|SHOW|DESCRIBE|DESC)\s/i", $sql):
$stid = oci_parse($conn, $sql);
if (count($aParameter) > 0) {
@@ -695,7 +752,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
case preg_match("/^(INSERT|UPDATE|DELETE)\s/i", $sql):
$stid = oci_parse($conn, $sql);
$isValid = true;
if (count($aParameter) > 0){
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name($stid, $key, $val);
}
@@ -703,8 +760,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
$objExecute = oci_execute($stid, OCI_DEFAULT);
if ($objExecute) {
oci_commit($conn);
}
else {
} else {
oci_rollback($conn);
$isValid = false;
}
@@ -712,8 +768,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
oci_close($conn);
if ($isValid) {
return true;
}
else {
} else {
return oci_error();
}
break;
@@ -721,7 +776,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
// Stored procedures
$stid = oci_parse($conn, $sql);
$aParameterRet = array();
if (count($aParameter) > 0){
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
$aParameterRet[$key] = $val;
// The third parameter ($aParameterRet[$key]) returned a value by reference.
@@ -734,5 +789,5 @@ function executeQueryOci($sql, $connection, $aParameter = array())
return $aParameterRet;
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,4 @@
<?php
/**
* Task.php
* @package workflow.engine.classes.model
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/om/BaseTask.php';
require_once 'classes/model/Content.php';
@@ -39,25 +14,30 @@ require_once 'classes/model/Content.php';
*
* @package workflow.engine.classes.model
*/
class Task extends BaseTask {
class Task extends BaseTask
{
/**
* This value goes in the content table
* @var string
*/
protected $tas_title = '';
/**
* Get the tas_title column value.
* @return string
*/
public function getTasTitle()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasTitle, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in getTasTitle, the getTasUid() can't be blank"));
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_title = Content::load ( 'TAS_TITLE', '', $this->getTasUid(), $lang );
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_title = Content::load('TAS_TITLE', '', $this->getTasUid(), $lang);
return $this->tas_title;
}
/**
* Set the tas_title column value.
*
@@ -66,37 +46,46 @@ class Task extends BaseTask {
*/
public function setTasTitle($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasTitle, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in setTasTitle, the getTasUid() can't be blank"));
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_title !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_title !== $v || $v === "") {
$this->tas_title = $v;
$res = Content::addContent( 'TAS_TITLE', '', $this->getTasUid(), $lang, $this->tas_title );
$res = Content::addContent('TAS_TITLE', '', $this->getTasUid(), $lang, $this->tas_title);
return $res;
}
return 0;
}
/**
* This value goes in the content table
* @var string
*/
protected $tas_description = '';
/**
* Get the tas_description column value.
* @return string
*/
public function getTasDescription()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasDescription, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception( "Error in getTasDescription, the getTasUid() can't be blank"));
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_description = Content::load ( 'TAS_DESCRIPTION', '', $this->getTasUid(), $lang );
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_description = Content::load('TAS_DESCRIPTION', '', $this->getTasUid(), $lang);
return $this->tas_description;
}
/**
* Set the tas_description column value.
*
@@ -105,37 +94,46 @@ class Task extends BaseTask {
*/
public function setTasDescription($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasDescription, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in setTasDescription, the getTasUid() can't be blank"));
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_description !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_description !== $v || $v === "") {
$this->tas_description = $v;
$res = Content::addContent( 'TAS_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_description );
$res = Content::addContent('TAS_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_description);
return $res;
}
return 0;
}
/**
* This value goes in the content table
* @var string
*/
protected $tas_def_title = '';
/**
* Get the tas_def_title column value.
* @return string
*/
public function getTasDefTitle()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasDefTitle, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception( "Error in getTasDefTitle, the getTasUid() can't be blank"));
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_def_title = Content::load ( 'TAS_DEF_TITLE', '', $this->getTasUid(), $lang );
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_def_title = Content::load('TAS_DEF_TITLE', '', $this->getTasUid(), $lang);
return $this->tas_def_title;
}
/**
* Set the tas_def_title column value.
*
@@ -144,37 +142,46 @@ class Task extends BaseTask {
*/
public function setTasDefTitle($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasDefTitle, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in setTasDefTitle, the getTasUid() can't be blank"));
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_def_title !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_def_title !== $v || $v === "") {
$this->tas_def_title = $v;
$res = Content::addContent( 'TAS_DEF_TITLE', '', $this->getTasUid(), $lang, $this->tas_def_title );
$res = Content::addContent('TAS_DEF_TITLE', '', $this->getTasUid(), $lang, $this->tas_def_title);
return $res;
}
return 0;
}
/**
* This value goes in the content table
* @var string
*/
protected $tas_def_description = '';
/**
* Get the tas_def_description column value.
* @return string
*/
public function getTasDefDescription()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasDefDescription, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception( "Error in getTasDefDescription, the getTasUid() can't be blank"));
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_def_description = Content::load ( 'TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang );
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_def_description = Content::load('TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang);
return $this->tas_def_description;
}
/**
* Set the tas_def_description column value.
*
@@ -183,37 +190,45 @@ class Task extends BaseTask {
*/
public function setTasDefDescription($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasDefDescription, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in setTasDefDescription, the getTasUid() can't be blank"));
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_def_description !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_def_description !== $v || $v === "") {
$this->tas_def_description = $v;
$res = Content::addContent( 'TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_def_description );
$res = Content::addContent('TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang, $v);
return $res;
}
return 0;
}
/**
* This value goes in the content table
* @var string
*/
protected $tas_def_proc_code = '';
/**
* Get the tas_def_proc_code column value.
* @return string
*/
public function getTasDefProcCode()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasDefProcCode, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception( "Error in getTasDefProcCode, the getTasUid() can't be blank"));
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_def_proc_code = Content::load ( 'TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang );
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_def_proc_code = Content::load('TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang);
return $this->tas_def_proc_code;
}
/**
* Set the tas_def_proc_code column value.
*
@@ -222,35 +237,43 @@ class Task extends BaseTask {
*/
public function setTasDefProcCode($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasDefProcCode, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in setTasDefProcCode, the getTasUid() can't be blank"));
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_def_proc_code !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_def_proc_code !== $v || $v === "") {
$this->tas_def_proc_code = $v;
$res = Content::addContent( 'TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang, $this->tas_def_proc_code );
$res = Content::addContent('TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang, $this->tas_def_proc_code);
return $res;
}
return 0;
}
/**
* This value goes in the content table
* @var string
*/
protected $tas_def_message = '';
/**
* Get the tas_def_message column value.
* @return string
*/
public function getTasDefMessage()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasDefMessage, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception( "Error in getTasDefMessage, the getTasUid() can't be blank"));
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_def_message = Content::load ( 'TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang );
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_def_message = Content::load('TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang);
return $this->tas_def_message;
}
@@ -262,17 +285,20 @@ class Task extends BaseTask {
*/
public function setTasDefMessage($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasDefMessage, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception("Error in setTasDefMessage, the getTasUid() can't be blank"));
}
$v=isset($v)?((string)$v):'';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_def_message !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_def_message !== $v || $v === "") {
$this->tas_def_message = $v;
$res = Content::addContent( 'TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_message );
$res = Content::addContent('TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_message);
return $res;
}
return 0;
}
@@ -288,14 +314,15 @@ class Task extends BaseTask {
*/
public function getTasDefSubjectMessage()
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in getTasDefSubjectMessage, the getTasUid() can't be blank") );
}
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
$this->tas_def_subject_message = Content::load ( 'TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang );
return $this->tas_def_subject_message;
if ($this->getTasUid() == "") {
throw (new Exception("Error in getTasDefSubjectMessage, the getTasUid() can't be blank"));
}
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
$this->tas_def_subject_message = Content::load('TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang);
return $this->tas_def_subject_message;
}
/**
* Set the tas_def_subject_message column value.
@@ -305,19 +332,21 @@ class Task extends BaseTask {
*/
public function setTasDefSubjectMessage($v)
{
if ( $this->getTasUid() == "" ) {
throw ( new Exception( "Error in setTasDefSubjectMessage, the getTasUid() can't be blank") );
if ($this->getTasUid() == "") {
throw (new Exception( "Error in setTasDefSubjectMessage, the getTasUid() can't be blank"));
}
$v = isset($v)? ((string)$v) : '';
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
if ($this->tas_def_subject_message !== $v || $v==="") {
$v = isset($v)? ((string)$v) : '';
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
if ($this->tas_def_subject_message !== $v || $v === "") {
$this->tas_def_subject_message = $v;
$res = Content::addContent( 'TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_subject_message );
$res = Content::addContent('TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang, $v);
return $res;
}
return 0;
}
@@ -327,11 +356,11 @@ class Task extends BaseTask {
* @param array $aData with new values
* @return void
*/
function create($aData)
public function create($aData)
{
$con = Propel::getConnection(TaskPeer::DATABASE_NAME);
try
{
try {
$sTaskUID = G::generateUniqueID();
$con->begin();
$this->setProUid($aData['PRO_UID']);
@@ -369,8 +398,8 @@ class Task extends BaseTask {
$this->setTasPosy("");
$this->setTasColor("");
$this->fromArray($aData,BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
if ($this->validate()) {
$this->setTasTitle((isset($aData['TAS_TITLE']) ? $aData['TAS_TITLE']: ''));
$this->setTasDescription("");
$this->setTasDefTitle("");
@@ -380,25 +409,24 @@ class Task extends BaseTask {
$this->setTasDefSubjectMessage("");
$this->save();
$con->commit();
return $sTaskUID;
}
else
{
} else {
$con->rollback();
$e=new Exception("Failed Validation in class ".get_class($this).".");
$e = new Exception("Failed Validation in class " . get_class($this) . ".");
$e->aValidationFailures=$this->getValidationFailures();
throw($e);
throw ($e);
}
}
catch(Exception $e)
{
} catch (Exception $e) {
$con->rollback();
throw($e);
throw ($e);
}
}
public function kgetassigType($pro_uid, $tas){
public function kgetassigType($pro_uid, $tas)
{
$k = new Criteria();
$k->clearSelectColumns();
$k->addSelectColumn(TaskPeer::TAS_UID);
@@ -418,15 +446,16 @@ public function kgetassigType($pro_uid, $tas){
try {
$oRow = TaskPeer::retrieveByPK($TasUid);
if (!is_null($oRow))
{
if (!is_null($oRow)) {
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); //Populating an object from of the array //Populating attributes
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); //Populating an object from of the array
//Populating attributes
$this->setNew(false);
///////
//Create new records for TASK in CONTENT for the current language, this if is necesary //Populating others attributes
//Create new records for TASK in CONTENT for the current language, this if is necesary
//Populating others attributes
$this->setTasUid($TasUid);
$aFields["TAS_TITLE"] = $this->getTasTitle();
@@ -439,60 +468,157 @@ public function kgetassigType($pro_uid, $tas){
///////
return $aFields;
} else {
throw (new Exception("The row '" . $TasUid . "' in table TASK doesn't exist!"));
}
else {
throw(new Exception("The row '" . $TasUid . "' in table TASK doesn't exist!"));
}
}
catch (Exception $oError) {
throw($oError);
} catch (Exception $oError) {
throw ($oError);
}
}
function update($fields)
public function update($fields)
{
require_once ("classes/model/AppCacheView.php");
require_once ("classes/model/Configuration.php");
$con = Propel::getConnection(TaskPeer::DATABASE_NAME);
try
{
try {
$con->begin();
$this->load($fields['TAS_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$contentResult=0;
if (array_key_exists("TAS_TITLE", $fields)) $contentResult+=$this->setTasTitle($fields["TAS_TITLE"]);
if (array_key_exists("TAS_DESCRIPTION", $fields)) $contentResult+=$this->setTasDescription($fields["TAS_DESCRIPTION"]);
if (array_key_exists("TAS_DEF_TITLE", $fields)) $contentResult+=$this->setTasDefTitle($fields["TAS_DEF_TITLE"]);
if (array_key_exists("TAS_DEF_DESCRIPTION", $fields)) $contentResult+=$this->setTasDefDescription($fields["TAS_DEF_DESCRIPTION"]);
if (array_key_exists("TAS_DEF_PROC_CODE", $fields)) $contentResult+=$this->setTasDefProcCode($fields["TAS_DEF_PROC_CODE"]);
if (array_key_exists("TAS_DEF_MESSAGE", $fields)) $contentResult+=$this->setTasDefMessage(trim($fields["TAS_DEF_MESSAGE"]));
if (array_key_exists("TAS_DEF_SUBJECT_MESSAGE", $fields)) $contentResult+=$this->setTasDefSubjectMessage(trim($fields["TAS_DEF_SUBJECT_MESSAGE"]));
if (array_key_exists("TAS_CALENDAR", $fields)) $contentResult+=$this->setTasCalendar($fields['TAS_UID'],$fields["TAS_CALENDAR"]);
$result=$this->save();
$result=($result==0)?($contentResult>0?1:0):$result;
$this->load($fields["TAS_UID"]);
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
if ($this->validate()) {
$taskDefTitlePrevious = null;
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add(ContentPeer::CON_CATEGORY, "TAS_DEF_TITLE");
$criteria->add(ContentPeer::CON_ID, $fields["TAS_UID"]);
$criteria->add(ContentPeer::CON_LANG, SYS_LANG);
$rsCriteria = ContentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$taskDefTitlePrevious = $row["CON_VALUE"];
}
$contentResult = 0;
if (array_key_exists("TAS_TITLE", $fields)) {
$contentResult += $this->setTasTitle($fields["TAS_TITLE"]);
}
if (array_key_exists("TAS_DESCRIPTION", $fields)) {
$contentResult += $this->setTasDescription($fields["TAS_DESCRIPTION"]);
}
if (array_key_exists("TAS_DEF_TITLE", $fields)) {
$contentResult += $this->setTasDefTitle($fields["TAS_DEF_TITLE"]);
}
if (array_key_exists("TAS_DEF_DESCRIPTION", $fields)) {
$contentResult += $this->setTasDefDescription($fields["TAS_DEF_DESCRIPTION"]);
}
if (array_key_exists("TAS_DEF_PROC_CODE", $fields)) {
$contentResult += $this->setTasDefProcCode($fields["TAS_DEF_PROC_CODE"]);
}
if (array_key_exists("TAS_DEF_MESSAGE", $fields)) {
$contentResult += $this->setTasDefMessage(trim($fields["TAS_DEF_MESSAGE"]));
}
if (array_key_exists("TAS_DEF_SUBJECT_MESSAGE", $fields)) {
$contentResult += $this->setTasDefSubjectMessage(trim($fields["TAS_DEF_SUBJECT_MESSAGE"]));
}
if (array_key_exists("TAS_CALENDAR", $fields)) {
$contentResult += $this->setTasCalendar($fields['TAS_UID'],$fields["TAS_CALENDAR"]);
}
$result = $this->save();
$result = ($result == 0)? (($contentResult > 0)? 1 : 0) : $result;
$con->commit();
if ($result == 1 &&
array_key_exists("TAS_DEF_TITLE", $fields) &&
$fields["TAS_DEF_TITLE"] != $taskDefTitlePrevious
) {
$criteria = new Criteria("workflow");
$criteria->addAsColumn("APPCV_NUM_ROWS", "COUNT(DISTINCT " . AppCacheViewPeer::APP_UID . ")");
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN");
$criteria->add(AppCacheViewPeer::TAS_UID, $fields["TAS_UID"]);
$rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
$appcvNumRows = intval($row["APPCV_NUM_ROWS"]);
if ($appcvNumRows <= 1000) {
$appcv = new AppCacheView();
$appcv->appTitleByTaskCaseLabelUpdate($fields["TAS_UID"], SYS_LANG);
$result = 2;
} else {
//Delete record
$criteria = new Criteria("workflow");
$criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
$criteria->add(ConfigurationPeer::OBJ_UID, $fields["TAS_UID"]);
$criteria->add(ConfigurationPeer::CFG_VALUE, SYS_LANG);
$numRowDeleted = ConfigurationPeer::doDelete($criteria);
//Insert record
$conf = new Configuration();
$conf->create(
array(
"CFG_UID" => "TAS_APP_TITLE_UPDATE",
"OBJ_UID" => $fields["TAS_UID"],
"CFG_VALUE" => SYS_LANG,
"PRO_UID" => "",
"USR_UID" => "",
"APP_UID" => ""
)
);
$result = 3;
}
}
return $result;
}
else
{
} else {
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
throw (new Exception("Failed Validation in class " . get_class($this) . "."));
}
}
catch(Exception $e)
{
} catch (Exception $e) {
$con->rollback();
throw($e);
throw ($e);
}
}
function remove($TasUid)
public function remove($TasUid)
{
$oConnection = Propel::getConnection(TaskPeer::DATABASE_NAME);
try {
$oTask = TaskPeer::retrieveByPK($TasUid);
if (!is_null($oTask))
{
if (!is_null($oTask)) {
$oConnection->begin();
Content::removeContent('TAS_TITLE', '', $oTask->getTasUid());
Content::removeContent('TAS_DESCRIPTION', '', $oTask->getTasUid());
Content::removeContent('TAS_DEF_TITLE', '', $oTask->getTasUid());
@@ -500,17 +626,18 @@ public function kgetassigType($pro_uid, $tas){
Content::removeContent('TAS_DEF_PROC_CODE', '', $oTask->getTasUid());
Content::removeContent('TAS_DEF_MESSAGE', '', $oTask->getTasUid());
Content::removeContent('TAS_DEF_SUBJECT_MESSAGE', '', $oTask->getTasUid());
$iResult = $oTask->delete();
$oConnection->commit();
return $iResult;
} else {
throw (new Exception( "The row '" . $TasUid . "' in table TASK doesn't exist!"));
}
else {
throw( new Exception( "The row '" . $TasUid . "' in table TASK doesn't exist!" ));
}
}
catch (Exception $oError) {
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
throw ($oError);
}
}
@@ -519,20 +646,20 @@ public function kgetassigType($pro_uid, $tas){
*
* @param string $sProUid the uid of the Prolication
*/
function taskExists ( $TasUid ) {
public function taskExists($TasUid)
{
$con = Propel::getConnection(TaskPeer::DATABASE_NAME);
try {
$oPro = TaskPeer::retrieveByPk( $TasUid );
if ( is_object($oPro) && get_class ($oPro) == 'Task' ) {
$oPro = TaskPeer::retrieveByPk($TasUid);
if (is_object($oPro) && get_class($oPro) == 'Task') {
return true;
}
else {
} else {
return false;
}
}
catch (Exception $oError) {
throw($oError);
} catch (Exception $oError) {
throw ($oError);
}
}
@@ -542,52 +669,56 @@ public function kgetassigType($pro_uid, $tas){
* @param array $aData with new values
* @return void
*/
function createRow($aData)
public function createRow($aData)
{
$con = Propel::getConnection(TaskPeer::DATABASE_NAME);
try
{
try {
$con->begin();
$this->fromArray($aData,BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$this->setTasTitle((isset($aData['TAS_TITLE']) ? $aData['TAS_TITLE']: ''));
$this->setTasDescription((isset($aData['TAS_DESCRIPTION']) ? $aData['TAS_DESCRIPTION']: ''));
$this->setTasDefTitle((isset($aData['TAS_DEF_TITLE']) ? $aData['TAS_DEF_TITLE']: ''));
$this->setTasDefDescription((isset($aData['TAS_DEF_DESCRIPTION']) ? $aData['TAS_DEF_DESCRIPTION']: ''));
$this->setTasDefProcCode((isset($aData['TAS_DEF_DESCRIPTION']) ? $aData['TAS_DEF_DESCRIPTION']: ''));
$this->setTasDefMessage((isset($aData['TAS_DEF_MESSAGE']) ? $aData['TAS_DEF_MESSAGE']: ''));
$this->setTasDefSubjectMessage((isset($aData['TAS_DEF_SUBJECT_MESSAGE']) ? $aData['TAS_DEF_SUBJECT_MESSAGE']: ''));
if ($this->validate()) {
$this->setTasTitle((isset($aData['TAS_TITLE'])? $aData['TAS_TITLE'] : ''));
$this->setTasDescription((isset($aData['TAS_DESCRIPTION'])? $aData['TAS_DESCRIPTION'] : ''));
$this->setTasDefTitle((isset($aData['TAS_DEF_TITLE'])? $aData['TAS_DEF_TITLE'] : ''));
$this->setTasDefDescription((isset($aData['TAS_DEF_DESCRIPTION'])? $aData['TAS_DEF_DESCRIPTION'] : ''));
$this->setTasDefProcCode((isset($aData['TAS_DEF_DESCRIPTION'])? $aData['TAS_DEF_DESCRIPTION'] : ''));
$this->setTasDefMessage((isset($aData['TAS_DEF_MESSAGE'])? $aData['TAS_DEF_MESSAGE'] : ''));
$strAux = isset($aData['TAS_DEF_SUBJECT_MESSAGE'])? $aData['TAS_DEF_SUBJECT_MESSAGE'] : '';
$this->setTasDefSubjectMessage($strAux);
$this->save();
$con->commit();
return;
}
else
{
} else {
$con->rollback();
$e=new Exception("Failed Validation in class ".get_class($this).".");
$e = new Exception("Failed Validation in class " . get_class($this) . ".");
$e->aValidationFailures=$this->getValidationFailures();
throw($e);
throw ($e);
}
}
catch(Exception $e)
{
} catch (Exception $e) {
$con->rollback();
throw($e);
throw ($e);
}
}
function setTasCalendar($taskUid,$calendarUid){
//Save Calendar ID for this process
G::LoadClass("calendar");
$calendarObj=new Calendar();
$calendarObj->assignCalendarTo($taskUid,$calendarUid,'TASK');
}
function getDelegatedTaskData($TAS_UID, $APP_UID, $DEL_INDEX)
public function setTasCalendar($taskUid, $calendarUid)
{
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Task.php';
//Save Calendar ID for this process
G::LoadClass("calendar");
$calendarObj = new Calendar();
$calendarObj->assignCalendarTo($taskUid, $calendarUid, 'TASK');
}
public function getDelegatedTaskData($TAS_UID, $APP_UID, $DEL_INDEX)
{
require_once ('classes/model/AppDelegation.php');
require_once ('classes/model/Task.php');
$oTask = new Task();
$aFields = $oTask->load($TAS_UID);
@@ -600,9 +731,22 @@ public function kgetassigType($pro_uid, $tas){
$taskData = $oDataset->getRow();
$iDiff = strtotime($taskData['DEL_FINISH_DATE']) - strtotime($taskData['DEL_INIT_DATE']);
$aFields['INIT_DATE'] = ($taskData['DEL_INIT_DATE'] != null ? $taskData['DEL_INIT_DATE'] : G::LoadTranslation('ID_CASE_NOT_YET_STARTED'));
$aFields['DUE_DATE'] = ($taskData['DEL_TASK_DUE_DATE'] != null ? $taskData['DEL_TASK_DUE_DATE'] : G::LoadTranslation('ID_NOT_FINISHED'));
$aFields['FINISH'] = ($taskData['DEL_FINISH_DATE'] != null ? $taskData['DEL_FINISH_DATE'] : G::LoadTranslation('ID_NOT_FINISHED'));
$aFields['INIT_DATE'] = (
$taskData['DEL_INIT_DATE'] != null ?
$taskData['DEL_INIT_DATE'] : G::LoadTranslation('ID_CASE_NOT_YET_STARTED')
);
$aFields['DUE_DATE'] = (
$taskData['DEL_TASK_DUE_DATE'] != null ?
$taskData['DEL_TASK_DUE_DATE'] : G::LoadTranslation('ID_NOT_FINISHED')
);
$aFields['FINISH'] = (
$taskData['DEL_FINISH_DATE'] != null ?
$taskData['DEL_FINISH_DATE'] : G::LoadTranslation('ID_NOT_FINISHED')
);
$aFields['DURATION'] = ($taskData['DEL_FINISH_DATE'] != null ? (int) ($iDiff / 3600) . ' ' . ((int) ($iDiff / 3600) == 1 ? G::LoadTranslation('ID_HOUR') : G::LoadTranslation('ID_HOURS')) . ' ' . (int) (($iDiff % 3600) / 60) . ' ' . ((int) (($iDiff % 3600) / 60) == 1 ? G::LoadTranslation('ID_MINUTE') : G::LoadTranslation('ID_MINUTES')) . ' ' . (int) (($iDiff % 3600) % 60) . ' ' . ((int) (($iDiff % 3600) % 60) == 1 ? G::LoadTranslation('ID_SECOND') : G::LoadTranslation('ID_SECONDS')) : G::LoadTranslation('ID_NOT_FINISHED'));
return $aFields;
@@ -610,20 +754,26 @@ public function kgetassigType($pro_uid, $tas){
//Added by qennix
//Gets Starting Event of current task
function getStartingEvent(){
require_once 'classes/model/Event.php';
public function getStartingEvent()
{
require_once ('classes/model/Event.php');
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(EventPeer::EVN_UID);
$oCriteria->add(EventPeer::EVN_TAS_UID_TO,$this->tas_uid);
//$oCriteria->add(EventPeer::EVN_TYPE,'bpmnEventMessageStart');
$oCriteria->add(EventPeer::EVN_TAS_UID_TO, $this->tas_uid);
//$oCriteria->add(EventPeer::EVN_TYPE, 'bpmnEventMessageStart');
$oDataset = EventPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()){
if ($oDataset->next()) {
$row = $oDataset->getRow();
$event_uid = $row['EVN_UID'];
}else{
} else {
$event_uid = '';
}
return $event_uid;
}
} // Task
}
//Task

View File

@@ -178,45 +178,73 @@ var saveDataTaskTemporal = function(iForm)
var saveTaskData = function(oForm, iForm, iType)
{
iLastTab = iForm;
if ( !saveDataTaskTemporal(iForm)) {
return false;
}
oTaskData.TAS_UID = getField('TAS_UID').value;
/* while (oTaskData.TAS_TITLE.charAt(0)==' '){
oTaskData.TAS_TITLE = oTaskData.TAS_TITLE.substring(1,oTaskData.TAS_TITLE.length) ;
} */
oTaskData.TAS_TITLE=oTaskData.TAS_TITLE.trim();
if(oTaskData.TAS_TITLE==''){
alert(G_STRINGS.ID_REQ_TITLE );
if (!saveDataTaskTemporal(iForm)) {
return false;
}
var sParameters = 'function=saveTaskData';
var oRPC = new leimnud.module.rpc.xmlhttp({
url : '../tasks/tasks_Ajax',
async : false,
method: 'POST',
args : sParameters + '&oData=' + oTaskData.toJSONString()
});
oRPC.make();
if (oTaskData.TAS_TITLE)
{
Pm.data.db.task[getField('INDEX').value].label = Pm.data.db.task[getField('INDEX').value].object.elements.label.innerHTML = oTaskData.TAS_TITLE.replace(re2, "&amp;");
oTaskData.TAS_UID = getField("TAS_UID").value;
/*
while (oTaskData.TAS_TITLE.charAt(0)==" "){
oTaskData.TAS_TITLE = oTaskData.TAS_TITLE.substring(1,oTaskData.TAS_TITLE.length) ;
}
if (oTaskData.TAS_START)
{
oTaskData.TAS_START = (oTaskData.TAS_START == 'TRUE' ? true : false);
*/
oTaskData.TAS_TITLE = oTaskData.TAS_TITLE.trim();
if (oTaskData.TAS_TITLE == "") {
alert(G_STRINGS.ID_REQ_TITLE );
return false;
}
//Set AJAX
var sParameters = "function=saveTaskData";
var oRPC = new leimnud.module.rpc.xmlhttp({
url: "../tasks/tasks_Ajax",
method: "POST",
args: sParameters + "&oData=" + oTaskData.toJSONString()
});
oRPC.callback = function (rpc) {
var res = rpc.xmlhttp.responseText.parseJSON();
if (oTaskData.TAS_TITLE) {
Pm.data.db.task[getField("INDEX").value].label = Pm.data.db.task[getField("INDEX").value].object.elements.label.innerHTML = oTaskData.TAS_TITLE.replace(re2, "&amp;");
}
if (oTaskData.TAS_START) {
oTaskData.TAS_START = ((oTaskData.TAS_START == "TRUE")? true : false);
Pm.data.render.setTaskINI({task: oTaskData.TAS_UID, value: oTaskData.TAS_START});
}
try {
new leimnud.module.app.info().make( {
var option = {
label: changesSavedLabel
});
}
switch (res.status) {
case "CRONCL":
option = {
label: changesSavedLabel + "<br /><br />" + _("APP_TITLE_CASE_LABEL_UPDATE"),
width: 350,
height: 175
}
break;
}
new leimnud.module.app.info().make(option);
}
catch (e) {
// No show confirmation
//No show confirmation
}
Pm.tmp.propertiesPanel.remove();
}.extend(this);
oRPC.make();
};
var showTriggers = function(sStep, sType)

View File

@@ -29,8 +29,8 @@
G::LoadClass('wsResponse');
G::LoadClass('wsBase');
function login( $params ) {
function login($params)
{
$ws = new wsBase ();
$res = $ws->login( $params->userid, $params->password );
return array(
@@ -39,24 +39,24 @@
'version' => WEB_SERVICE_VERSION,
'timestamp' => $res->timestamp
);
}
function ProcessList( $params ) {
}
function ProcessList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("processes" => $o);
}
if (ifPermission( $params->sessionId, 'PM_CASES') != 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') != 0 ) {
$ws = new wsBase();
$res = $ws->processList();
return array("processes" => $res );
}
if( ifPermission( $params->sessionId, 'PM_FACTORY') == 0 ){
if (ifPermission( $params->sessionId, 'PM_FACTORY') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("processes" => $o);
@@ -78,18 +78,18 @@
$res = $ws->processList();
return array("processes" => $res );
}
function RoleList( $params ) {
}
function RoleList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("roles" => $o);
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("roles" => $o);
@@ -98,17 +98,18 @@
$ws = new wsBase ();
$res = $ws->roleList();
return array("roles" => $res );
}
}
function GroupList( $params ) {
function GroupList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("groups" => $o);
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("groups" => $o);
@@ -117,17 +118,18 @@
$ws = new wsBase ();
$res = $ws->groupList();
return array("groups" => $res );
}
}
function DepartmentList( $params ) {
function DepartmentList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("departments" => $o);
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("departments" => $o);
@@ -136,11 +138,12 @@
$ws = new wsBase ();
$res = $ws->departmentList();
return array("departments" => $res );
}
}
function CaseList( $params ) {
function CaseList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
$o->status = '';
@@ -148,7 +151,7 @@
return array("cases" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
$o->status = '';
@@ -164,18 +167,19 @@
$ws = new wsBase ();
$res = $ws->caseList( $userId );
return array("cases" => $res );
}
}
function UnassignedCaseList( $params ) {
function UnassignedCaseList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
$o->delIndex = '';
return array("cases" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
$o->delIndex = '';
@@ -190,17 +194,18 @@
$ws = new wsBase ();
$res = $ws->unassignedCaseList( $userId );
return array("cases" => $res );
}
}
function UserList( $params ) {
function UserList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("users" => $o);
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("users" => $o);
@@ -209,18 +214,19 @@
$ws = new wsBase ();
$res = $ws->userList();
return array("users" => $res );
}
}
function triggerList( $params ) {
function triggerList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
$o->processId = '';
return array("triggers" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
$o->processId = '';
@@ -230,11 +236,12 @@
$ws = new wsBase ();
$res = $ws->triggerList();
return array("triggers" => $res );
}
}
function outputDocumentList( $params ) {
function outputDocumentList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->filename = '';
$o->docId = '';
@@ -247,7 +254,7 @@
return array("documents" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->filename = '';
$o->docId = '';
@@ -265,15 +272,15 @@
$session = $oSessions->getSessionUser($params->sessionId);
$userId = $session['USR_UID'];
$ws = new wsBase ();
$res = $ws->outputDocumentList( $params->caseId, $userId );
return array("documents" => $res );
}
}
function inputDocumentList( $params ) {
function inputDocumentList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->filename = '';
$o->docId = '';
@@ -286,7 +293,7 @@
return array("documents" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->filename = '';
$o->docId = '';
@@ -307,18 +314,19 @@
$ws = new wsBase ();
$res = $ws->inputDocumentList( $params->caseId, $userId );
return array("documents" => $res );
}
}
function inputDocumentProcessList( $params ) {
function inputDocumentProcessList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
$o->description = '';
return array("documents" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
$o->description = '';
@@ -328,15 +336,16 @@
$ws = new wsBase ();
$res = $ws->inputDocumentProcessList( $params->processId );
return array("documents" => $res);
}
}
function removeDocument( $params ) {
function removeDocument($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "Insufficient privileges to execute this function");
return $result;
}
@@ -344,15 +353,16 @@
$ws = new wsBase ();
$res = $ws->removeDocument( $params->appDocUid );
return $res;
}
}
function SendMessage( $params ) {
function SendMessage($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult->getPayloadArray();
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ) {
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result->getPayloadArray();
}
@@ -368,15 +378,16 @@
$params->template
);
return $res->getPayloadArray() ;
}
}
function getCaseInfo( $params ) {
function getCaseInfo($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ) {
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result;
}
@@ -384,15 +395,16 @@
$ws = new wsBase ();
$res = $ws->getCaseInfo( $params->caseId, $params->delIndex );
return $res;
}
}
function SendVariables( $params ) {
function SendVariables($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ) {
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result;
}
@@ -400,11 +412,11 @@
$ws = new wsBase();
$variables = $params->variables;
$Fields = Array();
if ( is_object($variables) ) {
if (is_object($variables)) {
$Fields[$variables->name] = $variables->value;
} else if ( is_array($variables) ) {
foreach ( $variables as $index=>$obj ) {
if ( is_object($obj) && isset($obj->name) && isset($obj->value)){
} elseif (is_array($variables)) {
foreach ($variables as $index => $obj) {
if (is_object($obj) && isset($obj->name) && isset($obj->value)) {
$Fields[$obj->name] = $obj->value;
}
}
@@ -414,21 +426,21 @@
$res = $ws->sendVariables($params->caseId, $params->variables);
return $res->getPayloadArray();
}
}
function GetVariables( $params ) {
function GetVariables($params)
{
if (!is_array($params->variables)) {
$params->variables = array($params->variables);
}
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
$result = new wsGetVariableResponse (2, "You do not have privileges", NULL );
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsGetVariableResponse (2, "You do not have privileges", null );
return $result;
}
@@ -436,17 +448,18 @@
$res = $ws->getVariables($params->caseId, $params->variables);
return $res;
}
}
function DerivateCase( $params ) {
function DerivateCase($params)
{
$oSession = new Sessions();
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result;
}
@@ -458,17 +471,18 @@
$ws = new wsBase($oStd);
$res = $ws->derivateCase($user['USR_UID'], $params->caseId, $params->delIndex);
return $res;
}
}
function RouteCase( $params ) {
function RouteCase($params)
{
$oSession = new Sessions();
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result;
}
@@ -481,16 +495,16 @@
$res = $ws->derivateCase($user['USR_UID'], $params->caseId, $params->delIndex);
return $res;
//return $res->getPayloadArray ( );
}
}
function executeTrigger ( $params ) {
function executeTrigger ($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result;
}
@@ -498,14 +512,14 @@
$oSession = new Sessions();
$user = $oSession->getSessionUser($params->sessionId);
$ws = new wsBase ();
$delIndex = ( isset ( $params->delIndex ) ) ? $params->delIndex : 1 ;
$res = $ws->executeTrigger( $user['USR_UID'], $params->caseId, $params->triggerIndex, $delIndex);
return $res->getPayloadArray ( );
}
}
function NewCaseImpersonate($params) {
function NewCaseImpersonate($params)
{
$vsResult = isValidSession($params->sessionId);
if ($vsResult->status_code !== 0) {
@@ -524,8 +538,7 @@
if (is_object($variables)) {
$field[$variables->name] = $variables->value;
}
else {
} else {
if (is_array($variables)) {
foreach ($variables as $index => $obj) {
if (is_object($obj) && isset($obj->name) && isset($obj->value)) {
@@ -542,9 +555,10 @@
$res = $ws->newCaseImpersonate($params->processId, $params->userId, $params->variables);
return $res;
}
}
function NewCase($params) {
function NewCase($params)
{
G::LoadClass("sessions");
$vsResult = isValidSession($params->sessionId);
@@ -563,7 +577,7 @@
$userId = $session["USR_UID"];
$variables = $params->variables;
/* this code is for previous version of ws, and apparently this will work for grids inside the variables..
/* this code is for previous version of ws, and apparently this will work for grids inside the variables..
if (!isset($params->variables) ) {
$variables = array();
$field = array();
@@ -600,7 +614,7 @@
}
}
}
*/
*/
$variables = $params->variables;
$field = array();
@@ -620,22 +634,20 @@
$ws = new wsBase();
$res = $ws->newCase($params->processId, $userId, $params->taskId, $params->variables);
######################################################################
# we need to register the case id for a stored session variable. like a normal Session.
######################################################################
// we need to register the case id for a stored session variable. like a normal Session.
$oSession->registerGlobal("APPLICATION", $res->caseId);
######################################################################
return $res;
}
}
function AssignUserToGroup( $params ) {
function AssignUserToGroup($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult->getPayloadArray();
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result->getPayloadArray();
}
@@ -643,7 +655,7 @@
$sessions = new Sessions;
$user=$sessions->getSessionUser($params->sessionId);
if(!is_array($user)){
if (!is_array($user)) {
return new wsResponse (3, 'User not registered in the system');
}
@@ -651,15 +663,16 @@
$ws = new wsBase ();
$res = $ws->assignUserToGroup( $params->userId, $params->groupId);
return $res->getPayloadArray();
}
}
function AssignUserToDepartment( $params ) {
function AssignUserToDepartment($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult->getPayloadArray();
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$result = new wsResponse (2, "You do not have privileges");
return $result->getPayloadArray();
}
@@ -667,40 +680,42 @@
$sessions = new Sessions;
$user=$sessions->getSessionUser($params->sessionId);
if(!is_array($user)){
if (!is_array($user)) {
return new wsResponse (3, 'User not registered in the system');
}
$ws = new wsBase ();
$res = $ws->AssignUserToDepartment( $params->userId, $params->departmentId, $params->manager );
return $res->getPayloadArray();
}
}
function CreateUser( $params ) {
function CreateUser($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$result = new wsCreateUserResponse (2, "You do not have privileges");
return $result;
}
$ws = new wsBase ();
$res = $ws->createUser( $params->userId, $params->firstname, $params->lastname, $params->email, $params->role, $params->password);
$res = $ws->createUser( $params->userId, $params->firstname,
$params->lastname, $params->email, $params->role, $params->password);
return $res;
}
}
function CreateGroup( $params ) {
function CreateGroup($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$result = new wsCreateGroupResponse ($vsResult->status_code , $vsResult->message, '' );
return $result;
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0 ) {
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$result = new wsCreateGroupResponse (2, "You do not have privileges", '');
return $result;
}
@@ -708,33 +723,35 @@
$ws = new wsBase ();
$res = $ws->createGroup( $params->name );
return $res;
}
}
function CreateDepartment( $params ) {
function CreateDepartment($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0 ) {
return $vsResult;
}
if( ifPermission( $params->sessionId, 'PM_USERS') == 0){
if (ifPermission( $params->sessionId, 'PM_USERS') == 0) {
$result = new wsCreateUserResponse (2, "You do not have privileges");
return $result;
}
$ws = new wsBase ();
$res = $ws->CreateDepartment( $params->name, $params->parentUID );
$res = $ws->CreateDepartment($params->name, $params->parentUID);
return $res;
}
}
function TaskList( $params ) {
function TaskList($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("tasks" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission( $params->sessionId, 'PM_CASES') == 0 ) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("tasks" => $o);
@@ -747,17 +764,18 @@
$userId = $session['USR_UID'];
$res = $ws->taskList( $userId );
return array("tasks" => $res );
}
}
function TaskCase( $params ) {
function TaskCase($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
$o->guid = $vsResult->status_code. ' ' . $vsResult->message;
$o->name = '';
return array("taskCases" => $o);
}
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
if (ifPermission($params->sessionId, 'PM_CASES') == 0) {
$o->guid = "2 Insufficient privileges to execute this function";
$o->name = '';
return array("taskCases" => $o);
@@ -766,81 +784,90 @@
$ws = new wsBase ();
$res = $ws->taskCase( $params->caseId );
return array("taskCases" => $res );
}
}
function ReassignCase( $params ) {
function ReassignCase($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
$ws = new wsBase ();
$res = $ws->reassignCase($params->sessionId, $params->caseId, $params->delIndex, $params->userIdSource, $params->userIdTarget );
$res = $ws->reassignCase($params->sessionId, $params->caseId,
$params->delIndex, $params->userIdSource, $params->userIdTarget );
return $res ;
}
}
function systemInformation( $params ) {
function systemInformation($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
$ws = new wsBase ();
$res = $ws->systemInformation( );
return $res;
}
}
function importProcessFromLibrary( $params ) {
function importProcessFromLibrary($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
$ws = new wsBase ();
$res = $ws->importProcessFromLibrary( $params->processId ,$params->version ,$params->importOption ,$params->usernameLibrary ,$params->passwordLibrary );
$res = $ws->importProcessFromLibrary( $params->processId ,
$params->version ,$params->importOption ,$params->usernameLibrary ,$params->passwordLibrary );
return $res;
}
}
function getCaseNotes( $params ) {
function getCaseNotes($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
$ws = new wsBase ();
$res = $ws->getCaseNotes( $params->applicationID ,$params->userUid);
return $res;
}
}
/*************/
#added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
/************
* #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
# modified 12-01-2010 by erik
function isValidSession($sessionId){
*/
function isValidSession($sessionId)
{
G::LoadClass('sessions');
$oSessions = new Sessions();
$session = $oSessions->verifySession($sessionId);
if( is_array($session) ) {
if (is_array($session)) {
return new wsResponse (0, 'Session active');
} else {
return new wsResponse (9, 'Session expired');
}
}
}
//add removeUserFromGroup
function removeUserFromGroup( $params ) {
function removeUserFromGroup($params)
{
$vsResult = isValidSession($params->sessionId);
if( $vsResult->status_code !== 0 ){
if ($vsResult->status_code !== 0) {
return $vsResult;
}
$ws = new wsBase ();
$res = $ws->removeUserFromGroup($params->userId, $params->groupId);
return $res ;
}
//end add
function ifPermission( $sessionId, $permission ){
}
//end add
function ifPermission($sessionId, $permission)
{
global $RBAC;
$RBAC->initRBAC();
G::LoadClass('sessions');
@@ -852,13 +879,12 @@
$aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS'];
$sw=0;
foreach ($aPermissions as $aPermission) {
if ($aPermission['PER_CODE'] == $permission)
{
if ($aPermission['PER_CODE'] == $permission) {
$sw=1;
}
}
return $sw;
}
}
$server = new SoapServer( $wsdl );

View File

@@ -1,29 +1,7 @@
<?php
/**
* tasks_Ajax.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
@@ -39,14 +17,19 @@ try {
$oJSON = new Services_JSON();
$aData = get_object_vars($oJSON->decode($_POST['oData']));
if(isset($_POST['function']))
if (isset($_POST['function'])) {
$sAction = $_POST['function'];
else
} else {
$sAction = $_POST['functions'];
}
switch ($sAction) {
case 'saveTaskData':
require_once 'classes/model/Task.php';
case "saveTaskData":
require_once ("classes/model/Task.php");
$response = array();
$oTask = new Task();
/**
@@ -54,7 +37,8 @@ try {
* that why the char "&" can't be passed by XmlHttpRequest directly
* @autor erik <erik@colosa.com>
*/
foreach($aData as $k=>$v) {
foreach ($aData as $k => $v) {
$aData[$k] = str_replace('@amp@', '&', $v);
}
@@ -64,24 +48,34 @@ try {
$aData['TAS_SEND_LAST_EMAIL'] = 'FALSE';
}
// Additional configuration
//Additional configuration
if (isset($aData['TAS_DEF_MESSAGE_TYPE']) && isset($aData['TAS_DEF_MESSAGE_TEMPLATE'])) {
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->aConfig = Array(
G::LoadClass('configuration');
$oConf = new Configurations();
$oConf->aConfig = array(
'TAS_DEF_MESSAGE_TYPE' => $aData['TAS_DEF_MESSAGE_TYPE'],
'TAS_DEF_MESSAGE_TEMPLATE'=> $aData['TAS_DEF_MESSAGE_TEMPLATE']
'TAS_DEF_MESSAGE_TEMPLATE' => $aData['TAS_DEF_MESSAGE_TEMPLATE']
);
$oConf->saveConfig('TAS_EXTRA_PROPERTIES', $aData['TAS_UID'], '', '');
unset($aData['TAS_DEF_MESSAGE_TYPE']);
unset($aData['TAS_DEF_MESSAGE_TEMPLATE']);
}
$oTask->update($aData);
$result = $oTask->update($aData);
$response["status"] = "OK";
if ($result == 3) {
$response["status"] = "CRONCL";
}
echo G::json_encode($response);
break;
}
}
catch (Exception $oException) {
} catch (Exception $oException) {
die($oException->getMessage());
}
?>

View File

@@ -1,4 +1,5 @@
<?php
/**
* usersGroups.php
*
@@ -22,13 +23,14 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess("PM_LOGIN")) != 1) {
return $RBAC_Response;
}
global $RBAC;
$access = $RBAC->userCanAccess('PM_USERS');
if( $access != 1 ){
switch ($access)
{
if ($access != 1) {
switch ($access) {
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
@@ -69,10 +71,16 @@ $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
switch($_REQUEST['type']){
case 'summary': $ctab = 0; break;
case 'group': $ctab = 1; break;
case 'auth': $ctab = 2; break;
switch ($_REQUEST['type']) {
case 'summary':
$ctab = 0;
break;
case 'group':
$ctab = 1;
break;
case 'auth':
$ctab = 2;
break;
}
$users = Array();
@@ -83,11 +91,12 @@ $users['USR_USERNAME'] = $aRow['USR_USERNAME'];
$users['fullNameFormat'] = $Config['fullNameFormat'];
$users['CURRENT_TAB'] = $ctab;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('users/usersGroups', false); //adding a javascript file .js
// $oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html.
$oHeadPublisher->assign('USERS', $users);
$oHeadPublisher->assign('hasAuthPerm', ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1));
$oHeadPublisher->assign('hasAuthPerm', ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1));
G::RenderPage('publish', 'extJs');

View File

@@ -10,6 +10,7 @@ var infoMode;
var global = {};
var readMode;
var usernameText;
var previousUsername = '';
var canEdit = true;
var flagPoliciesPassword = false;
var flagValidateUsername = false;
@@ -35,7 +36,7 @@ Ext.onReady(function() {
});
if (MODE == 'edit')
if (MODE == 'edit' || MODE == '')
flagPoliciesPassword = true;
//EDIT MODE
@@ -993,18 +994,27 @@ function validateUserName() {
function saveUser()
{
if (flagValidateUsername != true) {
validateUserName();
if ( Ext.getCmp('USR_USERNAME').getValue() == '') {
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME'));
} else {
if (Ext.getCmp('USR_USERNAME').getValue() != '') {
if (previousUsername != '') {
if (Ext.getCmp('USR_USERNAME').getValue() != previousUsername) {
if (!flagValidateUsername) {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
return false;
}
}
} else {
if (!flagValidateUsername) {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
return false;
}
}
} else {
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME'));
return false;
}
if (flagPoliciesPassword != true) {
if ( Ext.getCmp('USR_NEW_PASS').getValue() == '') {
if (!flagPoliciesPassword) {
if (Ext.getCmp('USR_NEW_PASS').getValue() == '') {
Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWD_REQUIRED'));
} else {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('passwordReview').html);
@@ -1131,6 +1141,8 @@ function loadUserData()
comboCalendar.setValue(data.user.USR_CALENDAR);
});
previousUsername = Ext.getCmp('USR_USERNAME').getValue();
},
failure : function(r, o) {
@@ -1237,6 +1249,8 @@ function loadUserView()
//comboDefaultCasesMenuOption.setValue('');
comboDefaultCasesMenuOption.setValue(data.user.PREF_DEFAULT_CASES_MENUSELECTED);
});
previousUsername = Ext.getCmp('USR_USERNAME').getValue();
},
failure:function(r,o) {
//viewport.getEl().unmask();