Merge remote branch 'upstream/master'

This commit is contained in:
Fernando Ontiveros
2012-07-04 17:15:19 -04:00
10 changed files with 4662 additions and 3990 deletions

View File

@@ -15,19 +15,29 @@ if (!defined('PATH_HOME')) {
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);
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 {
$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')) {
@@ -89,8 +103,8 @@ if (!defined('SYS_SYS')) {
if (is_dir(PATH_DB . $sObject)) {
saveLog('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists(PATH_DB . $sObject . PATH_SEP . 'db.php')) {
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');
@@ -109,7 +123,7 @@ if (!defined('SYS_SYS')) {
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']);
} else {
@@ -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');
eprintln("Processing workspace: " . $sObject, "green");
try {
processWorkspace();
} 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) {
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) {
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;
@@ -257,7 +302,9 @@ function executePlugins(){
$className = $filename . 'ClassCron';
include_once ( $pathCronPlugins . $file ); //$filename. ".php"
$oPlugin = new $className();
if (method_exists($oPlugin, 'executeCron')) {
$oPlugin->executeCron();
setExecutionMessage("Executing Plugins");
@@ -267,71 +314,87 @@ 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){
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;
$oCaseScheduler = new CaseScheduler();
$oCaseScheduler->caseSchedulerCron($sNow, $log);
foreach ($log as $value) {
saveLog('executeScheduledCases', 'action', "OK Case# $value");
}
setExecutionResultMessage('DONE');
} catch (Exception $oError) {
setExecutionResultMessage('WITH ERRORS', 'error');
@@ -339,48 +402,102 @@ function executeScheduledCases($sNow=null){
}
}
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=''){
function setExecutionResultMessage($m, $t='')
{
$c = 'green';
if($t=='error') $c = 'red';
if($t=='info') $c = 'yellow';
if ($t == 'error') {
$c = 'red';
}
if ($t == 'info') {
$c = 'yellow';
}
eprintln("[$m]", $c);
}

View File

@@ -61,7 +61,8 @@ if (!class_exists('PMScript')) {
* @return date | $date | Current Date (Y-m-d) | It returns the current date as a string value.
*
*/
function getCurrentDate() {
function getCurrentDate()
{
return G::CurDate('Y-m-d');
}
/**
@@ -77,7 +78,8 @@ function getCurrentDate() {
* @return time | $time | Current Time (H:i:s)| The function returns the current time as a string.
*
*/
function getCurrentTime() {
function getCurrentTime()
{
return G::CurDate('H:i:s');
}
/**
@@ -93,13 +95,13 @@ function getCurrentTime() {
* @return array | $userInfo | User Info | An associative array with Information
*
*/
function userInfo($user_uid) {
function userInfo($user_uid)
{
try {
require_once 'classes/model/Users.php';
$oUser = new Users();
return $oUser->getAllInformation($user_uid);
}
catch (Exception $oException) {
} catch (Exception $oException) {
throw $oException;
}
}
@@ -116,7 +118,8 @@ function userInfo($user_uid) {
* @return string | $TextC | Text Converted | Returns a string with the text converted into upper case letters.
*
*/
function upperCase($sText) {
function upperCase($sText)
{
return G::toUpper($sText);
}
/**
@@ -132,7 +135,8 @@ function upperCase($sText) {
* @return string | $TextC | Text Converted | Returns a string with the text converted into lower case letters.
*
*/
function lowerCase($sText) {
function lowerCase($sText)
{
return G::toLower($sText);
}
/**
@@ -149,7 +153,8 @@ function lowerCase($sText) {
* @return string | $TextC | Text Converted | It returns the introduced text with the first letter capitalized in each word and the subsequent letters into lowercase letters
*
*/
function capitalize($sText) {
function capitalize($sText)
{
return G::capitalizeWords($sText);
}
/**
@@ -167,7 +172,8 @@ function capitalize($sText) {
* @return string | $formatDate | Date whit format | It returns the passed date according to the given date format.
*
*/
function formatDate($date, $format='', $lang='en') {
function formatDate($date, $format='', $lang='en')
{
if ( !isset($date) or $date == '') {
throw new Exception('function:formatDate::Bad param');
}
@@ -191,15 +197,18 @@ function formatDate($date, $format='', $lang='en') {
* @return string | $literaDate | Literal date | It returns the literal date as a string value.
*
*/
function literalDate($date, $lang = 'en') {
function literalDate($date, $lang='en')
{
if ( !isset($date) or $date == '' ) {
throw new Exception('function:formatDate::Bad param');
}
try {
switch ($lang) {
case 'en': $ret = G::getformatedDate($date, 'M d,yyyy', $lang);
case 'en':
$ret = G::getformatedDate($date, 'M d,yyyy', $lang);
break;
case 'es': $ret = G::getformatedDate($date, 'd de M de yyyy', $lang);
case 'es':
$ret = G::getformatedDate($date, 'd de M de yyyy', $lang);
break;
}
return $ret;
@@ -223,7 +232,9 @@ function literalDate($date, $lang = 'en') {
* @return None | $none | None | None
*
*/
function pauseCase($sApplicationUID = '', $iDelegation = 0, $sUserUID = '', $sUnpauseDate = null) {//var_dump($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate);die(':|');
function pauseCase($sApplicationUID='', $iDelegation=0, $sUserUID='', $sUnpauseDate=null)
{
//var_dump($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate);die(':|');
try {
if ($sApplicationUID == '') {
throw new Exception('The application UID cannot be empty!');
@@ -237,8 +248,7 @@ function pauseCase($sApplicationUID = '', $iDelegation = 0, $sUserUID = '', $sUn
G::LoadClass('case');
$oCase = new Cases();
$oCase->pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate);
}
catch (Exception $oException) {
} catch (Exception $oException) {
throw $oException;
}
}
@@ -257,7 +267,8 @@ function pauseCase($sApplicationUID = '', $iDelegation = 0, $sUserUID = '', $sUn
* @return array or string | $Resultquery | Result | Result of the query | If executing a SELECT statement, it returns an array of associative arrays
*
*/
function executeQuery($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array()) {
function executeQuery($SqlStatement, $DBConnectionUID='workflow', $aParameter=array())
{
$con = Propel::getConnection($DBConnectionUID);
$con->begin();
try {
@@ -294,8 +305,7 @@ function executeQuery($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
$result = $con->getUpdateCount();
break;
}
}
else {
} else {
$result = executeQueryOci($SqlStatement, $con, $aParameter);
}
@@ -320,7 +330,8 @@ function executeQuery($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
* @return array | $dataM | Grid Sorted | Grid sorted
*
*/
function orderGrid($dataM, $field, $ord = 'ASC') {
function orderGrid($dataM, $field, $ord='ASC')
{
if (!is_array($dataM) or !isset($field) or $field=='') {
throw new Exception('function:orderGrid Error!, bad parameters found!');
}
@@ -357,7 +368,8 @@ function orderGrid($dataM, $field, $ord = 'ASC') {
* @return array | $aGrid | Grid | Grid with executed operation
*
*/
function evaluateFunction($aGrid, $sExpresion) {
function evaluateFunction($aGrid, $sExpresion)
{
$sExpresion = str_replace('Array','$this->aFields', $sExpresion);
$sExpresion .= ';';
G::LoadClass('pmScript');
@@ -392,7 +404,8 @@ function evaluateFunction($aGrid, $sExpresion) {
* @return string | $unique ID | Unique Id |The unique ID for the initiated session.
*
*/
function WSLogin($user, $pass, $endpoint = "") {
function WSLogin($user, $pass, $endpoint="")
{
$client = WSOpen(true);
$params = array("userid" => $user, "password" => $pass);
@@ -415,8 +428,7 @@ function WSLogin($user, $pass, $endpoint = "") {
$_SESSION["WS_SESSION_ID"] = $result->message;
return $result->message;
}
else {
} else {
if (isset($_SESSION["WS_SESSION_ID"])) {
unset($_SESSION["WS_SESSION_ID"]);
}
@@ -440,10 +452,12 @@ function WSLogin($user, $pass, $endpoint = "") {
* @return Object Client | $client | SoapClient object | A SoapClient object. If unable to establish a connection, returns NULL.
*
*/
function WSOpen($force = false) {
function WSOpen($force=false)
{
if (isset($_SESSION["WS_SESSION_ID"]) || $force) {
if (!isset($_SESSION["WS_END_POINT"])) {
$defaultEndpoint = "http://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . SYS_SYS . "/en/classic/services/wsdl2";
$defaultEndpoint = "http://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"]
. "/sys" . SYS_SYS . "/en/classic/services/wsdl2";
}
$endpoint = isset($_SESSION["WS_END_POINT"])? $_SESSION["WS_END_POINT"] : $defaultEndpoint;
@@ -451,8 +465,7 @@ function WSOpen($force = false) {
$client = new SoapClient($endpoint);
return $client;
}
else {
} else {
throw new Exception("WS session is not open");
}
}
@@ -469,7 +482,8 @@ function WSOpen($force = false) {
* @return array | $rows | Array of tasks open | An array of tasks in the indicated case which have open delegations.
*
*/
function WSTaskCase($caseId) {
function WSTaskCase($caseId)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -487,8 +501,7 @@ function WSTaskCase($caseId) {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->taskCases)) {
$rows[$i] = array("guid" => $result->taskCases->guid, "name" => $result->taskCases->name);
@@ -512,7 +525,8 @@ function WSTaskCase($caseId) {
* @return array | $rows |List of tasks | This function returns a list of tasks
*
*/
function WSTaskList() {
function WSTaskList()
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -530,8 +544,7 @@ function WSTaskList() {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->tasks)) {
$rows[$i] = array("guid" => $result->tasks->guid, "name" => $result->tasks->name);
@@ -554,7 +567,8 @@ function WSTaskList() {
* @return array | $rows | List | List of Active users in the workspace
*
*/
function WSUserList() {
function WSUserList()
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -572,8 +586,7 @@ function WSUserList() {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->users)) {
$rows[$i] = array("guid" => $result->users->guid, "name" => $result->users->name);
@@ -596,7 +609,8 @@ function WSUserList() {
* @return array | $rows | List | List of active groups in the workspace
*
*/
function WSGroupList() {
function WSGroupList()
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -614,8 +628,7 @@ function WSGroupList() {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->groups)) {
$rows[$i] = array("guid" => $result->groups->guid, "name" => $result->groups->name);
@@ -639,7 +652,8 @@ function WSGroupList() {
* @return array | $rows | List | List of roles in the workspace
*
*/
function WSRoleList() {
function WSRoleList()
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -657,8 +671,7 @@ function WSRoleList() {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->roles)) {
$rows[$i] = array("guid" => $result->roles->guid, "name" => $result->roles->name);
@@ -682,7 +695,8 @@ function WSRoleList() {
* @return array | $rows | List of the cases |It returns a list of cases
*
*/
function WSCaseList() {
function WSCaseList()
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -700,8 +714,7 @@ function WSCaseList() {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->cases)) {
$rows[$i] = array("guid" => $result->cases->guid, "name" => $result->cases->name);
@@ -724,7 +737,8 @@ function WSCaseList() {
* @return array | $rows | List of processes | A list of processes
*
*/
function WSProcessList() {
function WSProcessList()
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -742,8 +756,7 @@ function WSProcessList() {
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
$i = $i + 1;
}
}
else {
} else {
//Processing when it is an object //1 row
if (is_object($result->processes)) {
$rows[$i] = array("guid" => $result->processes->guid, "name" => $result->processes->name);
@@ -795,7 +808,8 @@ function getEmailConfiguration()
*
*/
//@param array | $aFields=array() | An associative array optional | Optional parameter. An associative array where the keys are the variable name and the values are the variable's value.
function PMFSendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $aFields = array(), $aAttachment = array()) {
function PMFSendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $aFields=array(), $aAttachment=array())
{
G::LoadClass('wsBase');
$ws = new wsBase ();
@@ -803,8 +817,7 @@ function PMFSendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplat
if ( $result->status_code == 0) {
return 1;
}
else {
} else {
return 0;
}
}
@@ -826,7 +839,8 @@ function PMFSendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplat
* @return array | $fields | WS Response Associative Array: | The function returns a WS Response associative array.
*
*/
function WSSendVariables($caseId, $name1, $value1, $name2, $value2) {
function WSSendVariables($caseId, $name1, $value1, $name2, $value2)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -866,7 +880,8 @@ function WSSendVariables($caseId, $name1, $value1, $name2, $value2) {
* @return array | $fields | WS Response Associative Array | A WS Response associative array.
*
*/
function WSDerivateCase($caseId, $delIndex) {
function WSDerivateCase($caseId, $delIndex)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -899,7 +914,8 @@ function WSDerivateCase($caseId, $delIndex) {
* @return array | $fields | WS Response Associative Array | A WS Response associative array.
*
*/
function WSNewCaseImpersonate($processId, $userId, $name1, $value1, $name2, $value2) {
function WSNewCaseImpersonate($processId, $userId, $name1, $value1, $name2, $value2)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -914,7 +930,10 @@ function WSNewCaseImpersonate($processId, $userId, $name1, $value1, $name2, $val
$variables = array($v1, $v2);
$params = array("sessionId" => $sessionId, "processId" => $processId, "userId" => $userId, "variables" => $variables);
$params = array("sessionId" => $sessionId,
"processId" => $processId,
"userId" => $userId,
"variables" => $variables);
$result = $client->__soapCall("NewCaseImpersonate", array($params));
@@ -945,7 +964,8 @@ function WSNewCaseImpersonate($processId, $userId, $name1, $value1, $name2, $val
* @return array | $fields | WS array | A WS Response associative array.
*
*/
function WSNewCase($processId, $taskId, $name1, $value1, $name2, $value2) {
function WSNewCase($processId, $taskId, $name1, $value1, $name2, $value2)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -959,7 +979,10 @@ function WSNewCase($processId, $taskId, $name1, $value1, $name2, $value2) {
$variables = array($v1, $v2);
$params = array("sessionId" => $sessionId, "processId" => $processId, "taskId" => $taskId, "variables" => $variables);
$params = array("sessionId" => $sessionId,
"processId" => $processId,
"taskId" => $taskId,
"variables" => $variables);
$result = $client->__soapCall("NewCase", array($params));
@@ -986,7 +1009,8 @@ function WSNewCase($processId, $taskId, $name1, $value1, $name2, $value2) {
* @return array | $fields | WS array |A WS Response associative array.
*
*/
function WSAssignUserToGroup($userId, $groupId) {
function WSAssignUserToGroup($userId, $groupId)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
@@ -1019,11 +1043,18 @@ function WSAssignUserToGroup($userId, $groupId) {
* @return array | $fields | WS array | A WS Response associative array.
*
*/
function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role) {
function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role)
{
$client = WSOpen();
$sessionId = $_SESSION["WS_SESSION_ID"];
$params = array("sessionId" => $sessionId, "userId" => $userId, "firstname" => $firstname, "lastname" => $lastname, "email" => $email, "role" => $role, "password" => $password);
$params = array("sessionId" => $sessionId,
"userId" => $userId,
"firstname" => $firstname,
"lastname" => $lastname,
"email" => $email,
"role" => $role,
"password" => $password);
$result = $client->__soapCall("CreateUser", array($params));
@@ -1045,16 +1076,16 @@ function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role)
* @return string | $userId | Sesion ID | The unique ID for the current active session.
*
*/
function WSGetSession() {
function WSGetSession()
{
if (isset($_SESSION["WS_SESSION_ID"])) {
return $_SESSION["WS_SESSION_ID"];
}
else {
} else {
throw new Exception("SW session is not open!");
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** Local Services Functions **/
@@ -1150,7 +1181,8 @@ function PMFUserList() #its test was successfull
* @return none | $none | None | None
*
*/
function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = null, $sUserLogged = null) {
function PMFGenerateOutputDocument($outputID, $sApplication=null, $index=null, $sUserLogged=null)
{
if (!$sApplication) {
$sApplication = $_SESSION['APPLICATION'];
}
@@ -1178,7 +1210,8 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
//Get the Custom Folder ID (create if necessary)
$oFolder=new AppFolder();
//$aOD['OUT_DOC_DESTINATION_PATH'] = ($aOD['OUT_DOC_DESTINATION_PATH']=='')?PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP:$aOD['OUT_DOC_DESTINATION_PATH'];
//$aOD['OUT_DOC_DESTINATION_PATH'] = ($aOD['OUT_DOC_DESTINATION_PATH']=='')?PATH_DOCUMENT
// . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP:$aOD['OUT_DOC_DESTINATION_PATH'];
$folderId=$oFolder->createFromPath($aOD['OUT_DOC_DESTINATION_PATH'], $sApplication);
//Tags
$fileTags=$oFolder->parseTags($aOD['OUT_DOC_TAGS'], $sApplication);
@@ -1197,7 +1230,8 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
if(($aOD['OUT_DOC_VERSIONING'])&&($lastDocVersion!=0)){//Create new Version of current output
if (($aOD['OUT_DOC_VERSIONING'])&&($lastDocVersion!=0)) {
//Create new Version of current output
$lastDocVersion++;
if ($aRow = $oDataset->getRow()) {
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'],
@@ -1215,8 +1249,10 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$oAppDocument->create($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
}
}else{//No versioning so Update a current Output or Create new if no exist
if ($aRow = $oDataset->getRow()) { //Update
} else {
////No versioning so Update a current Output or Create new if no exist
if ($aRow = $oDataset->getRow()) {
//Update
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'],
'APP_UID' => $sApplication,
'DEL_INDEX' => $index,
@@ -1234,7 +1270,9 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
} else {
//we are creating the appdocument row
//create
if($lastDocVersion==0) $lastDocVersion++;
if ($lastDocVersion==0) {
$lastDocVersion++;
}
$aFields = array('APP_UID' => $sApplication,
'DEL_INDEX' => $index,
'DOC_UID' => $outputID,
@@ -1256,20 +1294,30 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$aProperties = array();
if(!isset($aOD['OUT_DOC_MEDIA']))
if (!isset($aOD['OUT_DOC_MEDIA'])) {
$aOD['OUT_DOC_MEDIA'] = 'Letter';
if(!isset($aOD['OUT_DOC_LEFT_MARGIN']))
}
if (!isset($aOD['OUT_DOC_LEFT_MARGIN'])) {
$aOD['OUT_DOC_LEFT_MARGIN'] = '15';
if(!isset($aOD['OUT_DOC_RIGHT_MARGIN']))
}
if (!isset($aOD['OUT_DOC_RIGHT_MARGIN'])) {
$aOD['OUT_DOC_RIGHT_MARGIN'] = '15';
if(!isset($aOD['OUT_DOC_TOP_MARGIN']))
}
if (!isset($aOD['OUT_DOC_TOP_MARGIN'])) {
$aOD['OUT_DOC_TOP_MARGIN'] = '15';
if(!isset($aOD['OUT_DOC_BOTTOM_MARGIN']))
}
if (!isset($aOD['OUT_DOC_BOTTOM_MARGIN'])) {
$aOD['OUT_DOC_BOTTOM_MARGIN'] = '15';
}
$aProperties['media'] = $aOD['OUT_DOC_MEDIA'];
$aProperties['margins']=array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN'],);
$oOutputDocument->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] );
$aProperties['margins'] = array('left' => $aOD['OUT_DOC_LEFT_MARGIN'],
'right' => $aOD['OUT_DOC_RIGHT_MARGIN'],
'top' => $aOD['OUT_DOC_TOP_MARGIN'],
'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']);
$oOutputDocument->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'],
(boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
//G::LoadClass('plugin');
@@ -1299,7 +1347,8 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
if($uploadReturn){//Only delete if the file was saved correctly
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink ( $pathOutput . $sFilename. '.pdf' );
}
@@ -1317,7 +1366,8 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
if($uploadReturn){//Only delete if the file was saved correctly
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink ( $pathOutput . $sFilename. '.doc' );
}
@@ -1336,7 +1386,8 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
if($uploadReturn){//Only delete if the file was saved correctly
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink ( $pathOutput . $sFilename. '.pdf' );
}
break;
@@ -1353,7 +1404,8 @@ function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = nul
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
if($uploadReturn){//Only delete if the file was saved correctly
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink ( $pathOutput . $sFilename. '.doc' );
}
break;
@@ -1481,7 +1533,8 @@ function PMFProcessList() #its test was successfull
* @return int | $result | Result of send variables | Returns 1 if the variables were sent successfully to the case; otherwise, returns 0 if an error occurred.
*
*/
function PMFSendVariables($caseId, $variables) {
function PMFSendVariables($caseId, $variables)
{
G::LoadClass('wsBase');
$ws = new wsBase ();
@@ -1508,17 +1561,17 @@ function PMFSendVariables($caseId, $variables) {
* @return int | $result | Result of Derivate case | Returns 1 if new case was derivated (routed) successfully; otherwise, returns 0 if an error occurred.
*
*/
function PMFDerivateCase($caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $sUserLogged = null) {
function PMFDerivateCase($caseId, $delIndex, $bExecuteTriggersBeforeAssignment=false, $sUserLogged=null)
{
if (!$sUserLogged) {
$sUserLogged = $_SESSION['USER_LOGGED'];
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$result = $ws->derivateCase($sUserLogged, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment);//var_dump($result);die;
$result = $ws->derivateCase($sUserLogged, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment);
if (isset($result->status_code)) {
return $result->status_code;
}
else {
} else {
return 0;
}
if ($result->status_code == 0) {
@@ -1543,7 +1596,8 @@ function PMFDerivateCase($caseId, $delIndex, $bExecuteTriggersBeforeAssignment =
* @return int | $result | Result | Returns 1 if new case was created successfully; otherwise, returns 0 if an error occurred.
*
*/
function PMFNewCaseImpersonate($processId, $userId, $variables) {
function PMFNewCaseImpersonate($processId, $userId, $variables)
{
G::LoadClass("wsBase");
$ws = new wsBase();
@@ -1551,8 +1605,7 @@ function PMFNewCaseImpersonate($processId, $userId, $variables) {
if ($result->status_code == 0) {
return $result->caseId;
}
else {
} else {
return 0;
}
}
@@ -1572,7 +1625,8 @@ function PMFNewCaseImpersonate($processId, $userId, $variables) {
* @return string | $idNewCase | Case ID | If an error occured, it returns the integer zero. Otherwise, it returns a string with the case UID of the new case.
*
*/
function PMFNewCase($processId, $userId, $taskId, $variables) {
function PMFNewCase($processId, $userId, $taskId, $variables)
{
G::LoadClass('wsBase');
$ws = new wsBase ();
@@ -1598,7 +1652,8 @@ function PMFNewCase($processId, $userId, $taskId, $variables) {
* @return int | $result | Result of the assignment | Returns 1 if the user was successfully assigned to the group; otherwise, returns 0.
*
*/
function PMFAssignUserToGroup($userId, $groupId) {
function PMFAssignUserToGroup($userId, $groupId)
{
G::LoadClass('wsBase');
$ws = new wsBase ();
$result = $ws->assignUserToGroup($userId, $groupId);
@@ -1627,7 +1682,8 @@ function PMFAssignUserToGroup($userId, $groupId) {
* @return int | $result | Result of the creation | Returns 1 if the new user was created successfully; otherwise, returns 0 if an error occurred.
*
*/
function PMFCreateUser($userId, $password, $firstname, $lastname, $email, $role) {
function PMFCreateUser($userId, $password, $firstname, $lastname, $email, $role)
{
G::LoadClass('wsBase');
$ws = new wsBase ();
$result = $ws->createUser($userId, $firstname, $lastname, $email, $role, $password);
@@ -1653,7 +1709,8 @@ function PMFCreateUser($userId, $password, $firstname, $lastname, $email, $role)
* @return string | $generateString | Generated string | The generated string of random characters.
*
*/
function generateCode ( $iDigits = 4, $sType = 'NUMERIC' ) {
function generateCode($iDigits=4, $sType='NUMERIC')
{
return G::generateCode ($iDigits, $sType );
}
@@ -1672,7 +1729,8 @@ function generateCode ( $iDigits = 4, $sType = 'NUMERIC' ) {
* @return int | $result | Result | If successful, returns zero, otherwise a non-zero error number.
*
*/
function setCaseTrackerCode($sApplicationUID, $sCode, $sPIN = '') {
function setCaseTrackerCode($sApplicationUID, $sCode, $sPIN='')
{
if ($sCode != '') {
G::LoadClass('case');
$oCase = new Cases();
@@ -1684,8 +1742,7 @@ function setCaseTrackerCode($sApplicationUID, $sCode, $sPIN = '') {
}
$oCase->updateCase($sApplicationUID, $aFields);
return 1;
}
else {
} else {
return 0;
}
}
@@ -1703,11 +1760,13 @@ function setCaseTrackerCode($sApplicationUID, $sCode, $sPIN = '') {
* @return none | $none | None | None
*
*/
function jumping ( $caseId, $delIndex ) {
function jumping ($caseId, $delIndex)
{
try {
$x = PMFDerivateCase($caseId, $delIndex);
if($x==0)
if ($x == 0) {
G::SendTemporalMessage('ID_NOT_DERIVATED', 'error', 'labels');
}
} catch (Exception $oException) {
G::SendTemporalMessage('ID_NOT_DERIVATED', 'error', 'labels');
}
@@ -1730,7 +1789,8 @@ function jumping ( $caseId, $delIndex ) {
* @return string | $label | Label of the specified option | A string holding the label of the specified option or NULL if the specified option does not exist.
*
*/
function PMFgetLabelOption($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTED_ID) {
function PMFgetLabelOption($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTED_ID)
{
$G_FORM = new Form ("{$PROCESS}/{$DYNAFORM_UID}", PATH_DYNAFORM, SYS_LANG, false);
if ( isset($G_FORM->fields[$FIELD_NAME]->option[$FIELD_SELECTED_ID]) ) {
return $G_FORM->fields[$FIELD_NAME]->option[$FIELD_SELECTED_ID];
@@ -1756,7 +1816,8 @@ function PMFgetLabelOption($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTED
* @return none | $none | None | None
*
*/
function PMFRedirectToStep($sApplicationUID, $iDelegation, $sStepType, $sStepUid) {
function PMFRedirectToStep($sApplicationUID, $iDelegation, $sStepType, $sStepUid)
{
$iDelegation = intval($iDelegation);
require_once 'classes/model/AppDelegation.php';
$oCriteria = new Criteria('workflow');
@@ -1806,7 +1867,8 @@ function PMFRedirectToStep($sApplicationUID, $iDelegation, $sStepType, $sStepUid
$aFields['APP_DATA'] = $oPMScript->aFields;
$oCase->updateCase($sApplicationUID,$aFields);
}
G::header('Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid . '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction);
G::header('Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid
. '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction);
die;
}
}
@@ -1825,7 +1887,8 @@ function PMFRedirectToStep($sApplicationUID, $iDelegation, $sStepType, $sStepUid
* @return array | $array | List of users | Return a list of users
*
*/
function PMFGetNextAssignedUser ($application, $task) {
function PMFGetNextAssignedUser ($application, $task)
{
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Task.php';
@@ -1838,8 +1901,7 @@ function PMFGetNextAssignedUser ($application, $task) {
$TaskFields = $oTask->load ($task);
$typeTask = $TaskFields ['TAS_ASSIGN_TYPE'];
if($typeTask == 'BALANCED')
{
if ($typeTask == 'BALANCED') {
G::LoadClass('derivation');
$oDerivation = new Derivation();
@@ -1861,13 +1923,13 @@ function PMFGetNextAssignedUser ($application, $task) {
$aUsers[] = $aUser;
}
if(count($aUsers) == 1)
if (count($aUsers) == 1) {
return $aUser;
else
} else {
return $aUsers;
}
} else
{
} else {
return false;
}
}
@@ -1900,7 +1962,6 @@ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix='usr')
return false;
}
//recipient to store the email addresses
$aRecipient = Array();
$aItems = Array();
@@ -1930,7 +1991,8 @@ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix='usr')
//cleaning for blank spaces into each array item
$sItem = trim($sItem);
if ( strpos($sItem, "|") !== false ) {
//explode the parameter because always will be compose with pipe separator to indicate the type (user or group) and the target mai
// explode the parameter because always will be compose with pipe separator to indicate
// the type (user or group) and the target mai
list($sType, $sID) = explode('|', $sItem);
$sType = trim($sType);
$sID = trim($sID);
@@ -1946,7 +2008,8 @@ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix='usr')
}
break;
case 'usr':
if ($sID == '-1') { // -1: Cuurent user, load from user record
if ($sID == '-1') {
// -1: Curent user, load from user record
if ( isset($APP_UID) ) {
$oAppDelegation = new AppDelegation;
$aAppDel = $oAppDelegation->getLastDeleration($APP_UID);
@@ -1971,7 +2034,6 @@ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix='usr')
}
break;
case 'grp':
G::LoadClass('groups');
$oGroups = new Groups();
@@ -1987,7 +2049,6 @@ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix='usr')
}
break;
case 'dyn':
$oCase = new Cases();
$aFields = $oCase->loadCase($APP_UID);
@@ -2004,10 +2065,10 @@ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix='usr')
switch ($retType) {
case 'array':
return $aRecipient;
break;
case 'string':
return implode(',', $aRecipient);
break;
default:
return $aRecipient;
}

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')) {
@@ -59,12 +59,12 @@ if (class_exists('folderData')) {
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
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();
@@ -73,10 +73,11 @@ if (file_exists($dir)){
while (false !== ($file = readdir($handle))) {
if (($file != ".") && ($file != "..")) {
$extFile = explode(".", $file);
if($extFile[sizeof($extFile)-1] == 'php')
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,20 +171,21 @@ 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);
$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) {
$bEqual = false;
}
else {
} else {
if (strpos($sAux, '=') !== false) {
$bEqual = true;
}
@@ -195,30 +198,38 @@ class PMScript
}
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 '@':
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;
@@ -226,17 +237,20 @@ class PMScript
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;
@@ -244,17 +258,20 @@ class PMScript
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;
@@ -262,17 +279,20 @@ class PMScript
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;
@@ -280,17 +300,20 @@ class PMScript
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;
@@ -298,17 +321,20 @@ class PMScript
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++) {
$_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,17 +362,20 @@ 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);
$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 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]] = '';
@@ -355,8 +387,7 @@ class PMScript
}
}
if ($bEqual) {
if (strpos($sAux, ';') !== false)
{
if (strpos($sAux, ';') !== false) {
$bEqual = false;
}
}
@@ -367,17 +398,20 @@ class PMScript
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;
@@ -385,17 +419,20 @@ class PMScript
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;
@@ -403,17 +440,20 @@ class PMScript
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;
@@ -421,17 +461,20 @@ class PMScript
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;
@@ -439,17 +482,20 @@ class PMScript
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;
@@ -457,17 +503,20 @@ class PMScript
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;
@@ -480,8 +529,7 @@ class PMScript
if ($this->validSyntax($sScript) && $variableIsDefined) {
$this->bError = false;
eval($sScript);
}
else{
} else {
// echo "<script> alert('".G::loadTranslation('MSG_CONDITION_NOT_DEFINED')."'); </script>";
G::SendTemporalMessage('MSG_CONDITION_NOT_DEFINED', 'error', 'labels');
$this->bError = true;
@@ -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,7 +636,10 @@ 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']);
$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'];
@@ -599,11 +651,13 @@ 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']);
$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'];
@@ -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;
}
/**
@@ -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);
}
@@ -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;
@@ -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,12 +14,14 @@ 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
@@ -54,10 +31,13 @@ class Task extends BaseTask {
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);
return $this->tas_title;
}
/**
* Set the tas_title column value.
*
@@ -69,21 +49,27 @@ class Task extends BaseTask {
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 === "") {
$this->tas_title = $v;
$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
@@ -93,10 +79,13 @@ class Task extends BaseTask {
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);
return $this->tas_description;
}
/**
* Set the tas_description column value.
*
@@ -108,21 +97,27 @@ class Task extends BaseTask {
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 === "") {
$this->tas_description = $v;
$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
@@ -132,10 +127,13 @@ class Task extends BaseTask {
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);
return $this->tas_def_title;
}
/**
* Set the tas_def_title column value.
*
@@ -147,21 +145,27 @@ class Task extends BaseTask {
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 === "") {
$this->tas_def_title = $v;
$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
@@ -171,10 +175,13 @@ class Task extends BaseTask {
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);
return $this->tas_def_description;
}
/**
* Set the tas_def_description column value.
*
@@ -186,21 +193,26 @@ class Task extends BaseTask {
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 === "") {
$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
@@ -210,10 +222,13 @@ class Task extends BaseTask {
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);
return $this->tas_def_proc_code;
}
/**
* Set the tas_def_proc_code column value.
*
@@ -225,21 +240,27 @@ class Task extends BaseTask {
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 === "") {
$this->tas_def_proc_code = $v;
$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
@@ -249,8 +270,10 @@ class Task extends BaseTask {
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);
return $this->tas_def_message;
}
@@ -267,12 +290,15 @@ class Task extends BaseTask {
}
$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);
return $res;
}
return 0;
}
@@ -291,12 +317,13 @@ class Task extends BaseTask {
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.
*
@@ -308,16 +335,18 @@ class Task extends BaseTask {
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 === "") {
$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->aValidationFailures=$this->getValidationFailures();
throw ($e);
}
}
catch(Exception $e)
{
} catch (Exception $e) {
$con->rollback();
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 {
} else {
throw (new Exception("The row '" . $TasUid . "' in table TASK doesn't exist!"));
}
}
catch (Exception $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->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;
$con->commit();
return $result;
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"];
}
else
{
$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 {
$con->rollback();
throw (new Exception("Failed Validation in class " . get_class($this) . "."));
}
}
catch(Exception $e)
{
} catch (Exception $e) {
$con->rollback();
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,16 +626,17 @@ 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 {
} else {
throw (new Exception( "The row '" . $TasUid . "' in table TASK doesn't exist!"));
}
}
catch (Exception $oError) {
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
@@ -519,19 +646,19 @@ 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') {
return true;
}
else {
} else {
return false;
}
}
catch (Exception $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())
{
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']: ''));
$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->aValidationFailures=$this->getValidationFailures();
throw ($e);
}
}
catch(Exception $e)
{
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
function setTasCalendar($taskUid,$calendarUid){
public 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 getDelegatedTaskData($TAS_UID, $APP_UID, $DEL_INDEX)
{
require_once 'classes/model/AppDelegation.php';
require_once 'classes/model/Task.php';
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');
$oDataset = EventPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) {
$row = $oDataset->getRow();
$event_uid = $row['EVN_UID'];
} 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_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==''){
if (oTaskData.TAS_TITLE == "") {
alert(G_STRINGS.ID_REQ_TITLE );
return false;
}
var sParameters = 'function=saveTaskData';
//Set AJAX
var sParameters = "function=saveTaskData";
var oRPC = new leimnud.module.rpc.xmlhttp({
url : '../tasks/tasks_Ajax',
async : false,
method: 'POST',
args : sParameters + '&oData=' + oTaskData.toJSONString()
url: "../tasks/tasks_Ajax",
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;");
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);
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
}
Pm.tmp.propertiesPanel.remove();
}.extend(this);
oRPC.make();
};
var showTriggers = function(sStep, sType)

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,6 +37,7 @@ try {
* that why the char "&" can't be passed by XmlHttpRequest directly
* @autor erik <erik@colosa.com>
*/
foreach ($aData as $k => $v) {
$aData[$k] = str_replace('@amp@', '&', $v);
}
@@ -66,22 +50,32 @@ try {
//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']
);
$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)
{
switch ($access) {
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
@@ -70,9 +72,15 @@ $oDataset->next();
$aRow = $oDataset->getRow();
switch ($_REQUEST['type']) {
case 'summary': $ctab = 0; break;
case 'group': $ctab = 1; break;
case 'auth': $ctab = 2; break;
case 'summary':
$ctab = 0;
break;
case 'group':
$ctab = 1;
break;
case 'auth':
$ctab = 2;
break;
}
$users = Array();
@@ -91,3 +99,4 @@ $oHeadPublisher->assign('USERS', $users);
$oHeadPublisher->assign('hasAuthPerm', ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1));
G::RenderPage('publish', 'extJs');

View File

@@ -34,7 +34,8 @@ try {
$libraryName = $libraryO->info ['name'];
$libraryDescription = trim ( str_replace ( "*", "", implode ( " ", $libraryO->info ['description'] ) ) );
$libraryIcon = isset ( $libraryO->info ['icon'] ) && ($libraryO->info ['icon'] != "") ? $libraryO->info ['icon'] : "/images/browse.gif";
$libraryIcon = isset ( $libraryO->info ['icon'] ) && ($libraryO->info ['icon'] != "")
? $libraryO->info ['icon'] : "/images/browse.gif";
$aDataTrigger = $_GET;
$sProUid = $aDataTrigger ['PRO_UID'];
@@ -47,18 +48,22 @@ try {
$methodDescription = trim ( str_replace ( "*", "", implode ( " ", $methodObject->info ['description'] ) ) );
$methodReturn = $methodObject->info ['return'];
$methodParameters = array_keys ( $methodObject->params );
$methodLink = isset ( $methodObject->info ['link'] ) && ($methodObject->info ['link'] != "") ? $methodObject->info ['link'] : "";
$methodLink = isset ( $methodObject->info ['link'] ) && ($methodObject->info ['link'] != "")
? $methodObject->info ['link'] : "";
$methodreturnA = explode ( "|", $methodReturn );
$bReturnValue = true;
$displayMode = 'display:block';
$methodreturnDescription = (trim(strtoupper($methodreturnA [3])) == strtoupper(G::LoadTranslation ( 'ID_NONE')) )? G::LoadTranslation ( 'ID_NOT_REQUIRED') : $methodreturnA [3];
$methodreturnDescription = (trim(strtoupper($methodreturnA [3])) == strtoupper(G::LoadTranslation ( 'ID_NONE')) )
? G::LoadTranslation ( 'ID_NOT_REQUIRED') : $methodreturnA [3];
$methodReturnLabel = isset ( $methodreturnA [3] ) ? $methodreturnDescription : $methodReturn;
if ( (isset($methodreturnA[0]) && isset($methodreturnA[1])) && (trim(strtoupper($methodreturnA[0]) ) != strtoupper(G::LoadTranslation ( 'ID_NONE')) ) ) {
$methodReturnLabelRequired = (trim( $methodreturnA[1] ) != "" )? G::LoadTranslation ( "ID_REQUIRED_FIELD" ) : $methodreturnA[1];
if ( (isset($methodreturnA[0]) && isset($methodreturnA[1]))
&& (trim(strtoupper($methodreturnA[0]) ) != strtoupper(G::LoadTranslation ( 'ID_NONE')) ) ) {
$methodReturnLabelRequired = (trim( $methodreturnA[1] ) != "" )
? G::LoadTranslation ( "ID_REQUIRED_FIELD" ) : $methodreturnA[1];
$methodReturnLabel .= "<br>" . trim( $methodReturnLabelRequired ) . " | " . trim($methodreturnA[0]);
}
else {
} else {
$bReturnValue = false;
$displayMode = 'display:none';
}
@@ -118,18 +123,28 @@ try {
$paramDefaultValue = isset ( $paramDefinitionA [1] ) ? $paramDefinitionA [1] : "";
$paramLabel = isset ( $aParametersFunA [2] ) ? $aParametersFunA [2] : $paramName;
$paramDescription = isset ( $aParametersFunA [3] ) ? $aParametersFunA [3] : "";
$sPMfunction .= ($nrows != 2) ? ', "' . trim ( str_replace ( "$", "", $paramName ) ) . '"' : '"' . trim ( str_replace ( "$", "", $paramName ) . '"' );
$sPMfunction .= ($nrows != 2)
? ', "' . trim ( str_replace ( "$", "", $paramName ) ) . '"'
: '"' . trim ( str_replace ( "$", "", $paramName ) . '"' );
$template->newBlock ( 'paremetersTriggers' );
$template->assign ( 'LABEL_PARAMETER', $paramLabel );
$template->assign ( 'OPT_PARAMETER', trim ( str_replace ( "$", "", $paramName ) ) );
$sNameTag = 'form.' . trim ( str_replace ( "$", "", $paramName ) ) . '.name';
$sNameTag = trim ( $sNameTag );
$template->assign ( 'SNAMETAG', $sNameTag );
$tri_Button = "<input type='button' name='INSERT_VARIABLE' value='@@' onclick='showDynaformsFormVars($sNameTag , \"../controls/varsAjax\" , \"$sProUid\" , \"@@\");return;' >";
$tri_Button = "<input type='button' name='INSERT_VARIABLE' value='@@' "
. "onclick='showDynaformsFormVars($sNameTag , \"../controls/varsAjax\" , "
. " \"$sProUid\" , \"@@\");return;' >";
$template->assign ( 'ADD_TRI_VARIABLE', $tri_Button );
$template->assign ( 'ADD_TRI_VALUE', str_replace ( "'", "", str_replace ( '"', '', $paramDefaultValue ) ) );
$template->assign ( 'ADD_TRI_VALUE',
str_replace ( "'", "", str_replace ( '"', '', $paramDefaultValue ) ) );
$fieldDescription = ($paramDescription!="")?$paramDescription . "<br>":"";
$fieldDescription .= $paramDefaultValue != "" ? $paramDefaultValue . " | " . $paramType : G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
$fieldDescription .= $paramDefaultValue != ""
? $paramDefaultValue . " | " . $paramType
: G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
$template->assign ( 'ADD_TRI_DESCRIPTION', $fieldDescription );
$nrows ++;
}
@@ -146,4 +161,4 @@ try {
die ( $oException->getMessage () );
}
unset ($_SESSION ['PROCESS']);
?>

View File

@@ -33,7 +33,8 @@ try {
$libraryName = $libraryO->info ['name'];
$libraryDescription = trim ( str_replace ( "*", "", implode ( " ", $libraryO->info ['description'] ) ) );
$libraryIcon = isset ( $libraryO->info ['icon'] ) && ($libraryO->info ['icon'] != "") ? $libraryO->info ['icon'] : "/images/browse.gif";
$libraryIcon = isset ( $libraryO->info ['icon'] ) && ($libraryO->info ['icon'] != "")
? $libraryO->info ['icon'] : "/images/browse.gif";
$aDataTrigger = $_GET;
$sProUid = $aDataTrigger ['PRO_UID'];
@@ -46,18 +47,21 @@ try {
$methodDescription = trim ( str_replace ( "*", "", implode ( " ", $methodObject->info ['description'] ) ) );
$methodReturn = $methodObject->info ['return'];
$methodParameters = array_keys ( $methodObject->params );
$methodLink = isset ( $methodObject->info ['link'] ) && ($methodObject->info ['link'] != "") ? $methodObject->info ['link'] : "";
$methodLink = isset ( $methodObject->info ['link'] ) && ($methodObject->info ['link'] != "")
? $methodObject->info ['link'] : "";
$methodreturnA = explode ( "|", $methodReturn );
$bReturnValue = true;
$displayMode = 'display:block';
$methodreturnDescription = (trim(strtoupper($methodreturnA [3])) == strtoupper(G::LoadTranslation ( 'ID_NONE')) )? G::LoadTranslation ( 'ID_NOT_REQUIRED') : $methodreturnA [3];
$methodreturnDescription = (trim(strtoupper($methodreturnA [3])) == strtoupper(G::LoadTranslation ( 'ID_NONE')) )
? G::LoadTranslation ( 'ID_NOT_REQUIRED') : $methodreturnA [3];
$methodReturnLabel = isset ( $methodreturnA [3] ) ? $methodreturnDescription : $methodReturn;
if ( (isset($methodreturnA[0]) && isset($methodreturnA[1])) && (trim(strtoupper($methodreturnA[0]) ) != strtoupper(G::LoadTranslation ( 'ID_NONE')) ) ) {
$methodReturnLabelRequired = (trim( $methodreturnA[1] ) != "" )? G::LoadTranslation ( "ID_REQUIRED_FIELD" ) : $methodreturnA[1];
if ( (isset($methodreturnA[0]) && isset($methodreturnA[1]))
&& (trim(strtoupper($methodreturnA[0]) ) != strtoupper(G::LoadTranslation ( 'ID_NONE')) ) ) {
$methodReturnLabelRequired = (trim( $methodreturnA[1] ) != "" )
? G::LoadTranslation ( "ID_REQUIRED_FIELD" ) : $methodreturnA[1];
$methodReturnLabel .= "<br>" . trim( $methodReturnLabelRequired ) . " | " . trim($methodreturnA[0]);
}
else {
} else {
$bReturnValue = false;
$displayMode = 'display:none';
}
@@ -121,20 +125,30 @@ try {
$paramDefaultValue = isset ( $paramDefinitionA [1] ) ? $paramDefinitionA [1] : "";
$paramLabel = isset ( $aParametersFunA [2] ) ? $aParametersFunA [2] : $paramName;
$paramDescription = isset ( $aParametersFunA [3] ) ? $aParametersFunA [3] : "";
$sPMfunction .= ($nrows != 2) ? ', "' . trim ( str_replace ( "$", "", $paramName ) ) . '"' : '"' . trim ( str_replace ( "$", "", $paramName ) . '"' );
$sPMfunction .= ($nrows != 2)
? ', "' . trim ( str_replace ( "$", "", $paramName ) ) . '"'
: '"' . trim ( str_replace ( "$", "", $paramName ) . '"' );
$template->newBlock ( 'paremetersTriggers' );
$template->assign ( 'LABEL_PARAMETER', $paramLabel );
$template->assign ( 'OPT_PARAMETER', trim ( str_replace ( "$", "", $paramName ) ) );
$sNameTag = 'form.' . trim ( str_replace ( "$", "", $paramName ) ) . '.name';
$sNameTag = trim ( $sNameTag );
$template->assign ( 'SNAMETAG', $sNameTag );
$tri_Button = "<input type='button' name='INSERT_VARIABLE' value='@@' onclick='showDynaformsFormVars($sNameTag , \"../controls/varsAjax\" , \"$sProUid\" , \"@@\");return;' >";
$tri_Button = "<input type='button' name='INSERT_VARIABLE' value='@@' "
. "onclick='showDynaformsFormVars($sNameTag , \"../controls/varsAjax\" , "
. " \"$sProUid\" , \"@@\");return;' >";
$template->assign ( 'ADD_TRI_VARIABLE', $tri_Button );
// $template->assign ( 'ADD_TRI_VALUE', str_replace ( "'", "", str_replace ( '"', '', $paramDefaultValue ) ) );
// $template->assign ( 'ADD_TRI_VALUE', str_replace ( "'", "",
// str_replace ( '"', '', $paramDefaultValue ) ) );
$paramValue = $_GET[trim( str_replace( "$", "", $paramName ) )];
$template->assign ( 'ADD_TRI_VALUE', str_replace("\'", "&apos;", $paramValue) );
$fieldDescription = ($paramDescription!="")?$paramDescription . "<br>":"";
$fieldDescription .= $paramDefaultValue != "" ? $paramDefaultValue . " | " . $paramType : G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
$fieldDescription .= $paramDefaultValue != ""
? $paramDefaultValue . " | " . $paramType
: G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
$template->assign ( 'ADD_TRI_DESCRIPTION', $fieldDescription );
$nrows ++;
}
@@ -151,4 +165,4 @@ try {
die ( $oException->getMessage () );
}
unset ( $_SESSION ['PROCESS'] );
?>