CODE STYLE Format
Change format
This commit is contained in:
@@ -1,227 +1,218 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
G::LoadSystem( 'dbMaintenance' );
|
||||||
G::LoadSystem('dbMaintenance');
|
G::LoadClass( "cli" );
|
||||||
G::LoadClass("cli");
|
|
||||||
|
/**
|
||||||
/** Class MultipleFilesBackup
|
* Class MultipleFilesBackup
|
||||||
* create a backup of this workspace
|
* create a backup of this workspace
|
||||||
*
|
*
|
||||||
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
||||||
*
|
*/
|
||||||
*/
|
class multipleFilesBackup
|
||||||
class multipleFilesBackup{
|
{
|
||||||
|
private $dir_to_compress = "";
|
||||||
private $dir_to_compress = "";
|
private $filename = "backUpProcessMaker.tar";
|
||||||
private $filename = "backUpProcessMaker.tar";
|
private $fileSize = "1000";
|
||||||
private $fileSize = "1000"; // 1 GB by default.
|
// 1 GB by default.
|
||||||
private $sizeDescriptor = "m"; //megabytes
|
private $sizeDescriptor = "m";
|
||||||
private $tempDirectories = array();
|
//megabytes
|
||||||
|
private $tempDirectories = array ();
|
||||||
/* Constructor
|
|
||||||
* @filename contains the path and filename of the comppress file(s).
|
/* Constructor
|
||||||
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
* @filename contains the path and filename of the comppress file(s).
|
||||||
*/
|
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
||||||
function multipleFilesBackup($filename,$size)
|
*/
|
||||||
{
|
public function multipleFilesBackup ($filename, $size)
|
||||||
if(!empty($filename)){
|
{
|
||||||
$this->filename = $filename;
|
if (! empty( $filename )) {
|
||||||
}
|
$this->filename = $filename;
|
||||||
if(!empty($size) && (int)$size > 0){
|
}
|
||||||
$this->fileSize = $size;
|
if (! empty( $size ) && (int) $size > 0) {
|
||||||
}
|
$this->fileSize = $size;
|
||||||
}
|
}
|
||||||
/* Gets workspace information enough to make its backup.
|
}
|
||||||
* @workspace contains the workspace to be add to the commpression process.
|
|
||||||
*/
|
/* Gets workspace information enough to make its backup.
|
||||||
public function addToBackup($workspace)
|
* @workspace contains the workspace to be add to the commpression process.
|
||||||
{
|
*/
|
||||||
//verifing if workspace exists.
|
public function addToBackup ($workspace)
|
||||||
if (!$workspace->workspaceExists()) {
|
{
|
||||||
echo "Workspace {$workspace->name} not found\n";
|
//verifing if workspace exists.
|
||||||
return false;
|
if (! $workspace->workspaceExists()) {
|
||||||
}
|
echo "Workspace {$workspace->name} not found\n";
|
||||||
//create destination path
|
return false;
|
||||||
if (!file_exists(PATH_DATA . "upgrade/")){
|
}
|
||||||
mkdir(PATH_DATA . "upgrade/");
|
//create destination path
|
||||||
}
|
if (! file_exists( PATH_DATA . "upgrade/" )) {
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
mkdir( PATH_DATA . "upgrade/" );
|
||||||
mkdir($tempDirectory);
|
}
|
||||||
$metadata = $workspace->getMetadata();
|
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
|
||||||
CLI::logging("Temporing up database...\n");
|
mkdir( $tempDirectory );
|
||||||
$metadata["databases"] = $workspace->exportDatabase($tempDirectory);
|
$metadata = $workspace->getMetadata();
|
||||||
$metadata["directories"] = array("{$workspace->name}.files");
|
CLI::logging( "Temporing up database...\n" );
|
||||||
$metadata["version"] = 1;
|
$metadata["databases"] = $workspace->exportDatabase( $tempDirectory );
|
||||||
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
$metadata["directories"] = array ("{$workspace->name}.files");
|
||||||
if (!file_put_contents($metaFilename,
|
$metadata["version"] = 1;
|
||||||
str_replace(array(",", "{", "}"), array(",\n ", "{\n ", "\n}\n"),
|
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
||||||
G::json_encode($metadata)))) {
|
if (! file_put_contents( $metaFilename, str_replace( array (",","{","}"), array (",\n ","{\n ","\n}\n"), G::json_encode( $metadata ) ) )) {
|
||||||
CLI::logging("Could not create backup metadata");
|
CLI::logging( "Could not create backup metadata" );
|
||||||
}
|
}
|
||||||
CLI::logging("Adding database to backup...\n");
|
CLI::logging( "Adding database to backup...\n" );
|
||||||
$this->addDirToBackup($tempDirectory);
|
$this->addDirToBackup( $tempDirectory );
|
||||||
CLI::logging("Adding files to backup...\n");
|
CLI::logging( "Adding files to backup...\n" );
|
||||||
$this->addDirToBackup($workspace->path);
|
$this->addDirToBackup( $workspace->path );
|
||||||
$this->tempDirectories[] = $tempDirectory;
|
$this->tempDirectories[] = $tempDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a directory containing Db files or info files to be commpressed
|
/* Add a directory containing Db files or info files to be commpressed
|
||||||
* @directory the name and path of the directory to be add to the commpression process.
|
* @directory the name and path of the directory to be add to the commpression process.
|
||||||
*/
|
*/
|
||||||
private function addDirToBackup($directory)
|
private function addDirToBackup ($directory)
|
||||||
{
|
{
|
||||||
if(!empty($directory)){
|
if (! empty( $directory )) {
|
||||||
$this->dir_to_compress .= $directory . " ";
|
$this->dir_to_compress .= $directory . " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Commpress the DB and files into a single or several files with numerical series extentions
|
// Commpress the DB and files into a single or several files with numerical series extentions
|
||||||
*/
|
|
||||||
public function letsBackup()
|
public function letsBackup ()
|
||||||
{
|
{
|
||||||
// creating command
|
// creating command
|
||||||
$CommpressCommand = "tar czv ";
|
$CommpressCommand = "tar czv ";
|
||||||
$CommpressCommand .= $this->dir_to_compress;
|
$CommpressCommand .= $this->dir_to_compress;
|
||||||
$CommpressCommand .= "| split -b ";
|
$CommpressCommand .= "| split -b ";
|
||||||
$CommpressCommand .= $this->fileSize;
|
$CommpressCommand .= $this->fileSize;
|
||||||
$CommpressCommand .= "m -d - ";
|
$CommpressCommand .= "m -d - ";
|
||||||
$CommpressCommand .= $this->filename . ".";
|
$CommpressCommand .= $this->filename . ".";
|
||||||
//executing command to create the files
|
//executing command to create the files
|
||||||
echo exec($CommpressCommand);
|
echo exec( $CommpressCommand );
|
||||||
//Remove leftovers dirs.
|
//Remove leftovers dirs.
|
||||||
foreach($this->tempDirectories as $tempDirectory)
|
foreach ($this->tempDirectories as $tempDirectory) {
|
||||||
{
|
CLI::logging( "Deleting: " . $tempDirectory . "\n" );
|
||||||
CLI::logging("Deleting: ".$tempDirectory."\n");
|
G::rm_dir( $tempDirectory );
|
||||||
G::rm_dir($tempDirectory);
|
}
|
||||||
}
|
}
|
||||||
}
|
/* Restore from file(s) commpressed by letsBackup function, into a temporary directory
|
||||||
/* Restore from file(s) commpressed by letsBackup function, into a temporary directory
|
* @ filename got the name and path of the compressed file(s), if there are many files with file extention as a numerical series, the extention should be discriminated.
|
||||||
* @ filename got the name and path of the compressed file(s), if there are many files with file extention as a numerical series, the extention should be discriminated.
|
* @ srcWorkspace contains the workspace to be restored.
|
||||||
* @ srcWorkspace contains the workspace to be restored.
|
* @ dstWorkspace contains the workspace to be overwriting.
|
||||||
* @ dstWorkspace contains the workspace to be overwriting.
|
* @ overwrite got the option true if the workspace will be overwrite.
|
||||||
* @ overwrite got the option true if the workspace will be overwrite.
|
*/
|
||||||
*/
|
static public function letsRestore ($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
|
||||||
static public function letsRestore($filename, $srcWorkspace, $dstWorkspace = NULL, $overwrite = true)
|
{
|
||||||
{
|
// Needed info:
|
||||||
// Needed info:
|
// TEMPDIR /shared/workflow_data/upgrade/
|
||||||
// TEMPDIR /shared/workflow_data/upgrade/
|
// BACKUPS /shared/workflow_data/backups/
|
||||||
// BACKUPS /shared/workflow_data/backups/
|
// Creating command cat myfiles_split.tgz_* | tar xz
|
||||||
|
$DecommpressCommand = "cat " . $filename . ".* ";
|
||||||
// Creating command cat myfiles_split.tgz_* | tar xz
|
$DecommpressCommand .= " | tar xzv";
|
||||||
$DecommpressCommand = "cat " . $filename . ".* ";
|
|
||||||
$DecommpressCommand .= " | tar xzv";
|
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
|
||||||
|
$parentDirectory = PATH_DATA . "upgrade";
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
if (is_writable( $parentDirectory )) {
|
||||||
$parentDirectory = PATH_DATA . "upgrade";
|
mkdir( $tempDirectory );
|
||||||
if (is_writable($parentDirectory)) {
|
} else {
|
||||||
mkdir($tempDirectory);
|
throw new Exception( "Could not create directory:" . $parentDirectory );
|
||||||
} else {
|
}
|
||||||
throw new Exception("Could not create directory:" . $parentDirectory);
|
//Extract all backup files, including database scripts and workspace files
|
||||||
}
|
CLI::logging( "Restoring into " . $tempDirectory . "\n" );
|
||||||
//Extract all backup files, including database scripts and workspace files
|
chdir( $tempDirectory );
|
||||||
CLI::logging("Restoring into ".$tempDirectory."\n");
|
echo exec( $DecommpressCommand );
|
||||||
chdir($tempDirectory);
|
CLI::logging( "\nUncompressed into: " . $tempDirectory . "\n" );
|
||||||
echo exec($DecommpressCommand);
|
|
||||||
CLI::logging("\nUncompressed into: ".$tempDirectory."\n");
|
//Search for metafiles in the new standard (the old standard would contain meta files.
|
||||||
|
$metaFiles = glob( $tempDirectory . "/*.meta" );
|
||||||
//Search for metafiles in the new standard (the old standard would contain meta files.
|
if (empty( $metaFiles )) {
|
||||||
$metaFiles = glob($tempDirectory . "/*.meta");
|
$metaFiles = glob( $tempDirectory . "/*.txt" );
|
||||||
if (empty($metaFiles)) {
|
if (! empty( $metaFiles )) {
|
||||||
$metaFiles = glob($tempDirectory . "/*.txt");
|
return workspaceTools::restoreLegacy( $tempDirectory );
|
||||||
if (!empty($metaFiles)){
|
} else {
|
||||||
return workspaceTools::restoreLegacy($tempDirectory);
|
throw new Exception( "No metadata found in backup" );
|
||||||
}
|
}
|
||||||
else{
|
} else {
|
||||||
throw new Exception("No metadata found in backup");
|
CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
|
||||||
}
|
foreach ($metaFiles as $metafile) {
|
||||||
}
|
CLI::logging( "-> " . basename( $metafile ) . "\n" );
|
||||||
else {
|
}
|
||||||
CLI::logging("Found " . count($metaFiles) . " workspaces in backup:\n");
|
}
|
||||||
foreach ($metaFiles as $metafile){
|
if (count( $metaFiles ) > 1 && (! isset( $srcWorkspace ))) {
|
||||||
CLI::logging("-> " . basename($metafile) . "\n");
|
throw new Exception( "Multiple workspaces in backup but no workspace specified to restore" );
|
||||||
}
|
}
|
||||||
}
|
if (isset( $srcWorkspace ) && ! in_array( "$srcWorkspace.meta", array_map( basename, $metaFiles ) )) {
|
||||||
if (count($metaFiles) > 1 && (!isset($srcWorkspace))){
|
throw new Exception( "Workspace $srcWorkspace not found in backup" );
|
||||||
throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
|
}
|
||||||
}
|
foreach ($metaFiles as $metaFile) {
|
||||||
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(basename, $metaFiles))){
|
$metadata = G::json_decode( file_get_contents( $metaFile ) );
|
||||||
throw new Exception("Workspace $srcWorkspace not found in backup");
|
if ($metadata->version != 1) {
|
||||||
}
|
throw new Exception( "Backup version {$metadata->version} not supported" );
|
||||||
foreach ($metaFiles as $metaFile) {
|
}
|
||||||
$metadata = G::json_decode(file_get_contents($metaFile));
|
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
||||||
if ($metadata->version != 1){
|
if (isset( $dstWorkspace )) {
|
||||||
throw new Exception("Backup version {$metadata->version} not supported");
|
$workspaceName = $dstWorkspace;
|
||||||
}
|
$createWorkspace = true;
|
||||||
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
} else {
|
||||||
if (isset($dstWorkspace)) {
|
$workspaceName = $metadata->WORKSPACE_NAME;
|
||||||
$workspaceName = $dstWorkspace;
|
$createWorkspace = false;
|
||||||
$createWorkspace = true;
|
}
|
||||||
}
|
if (isset( $srcWorkspace ) && strcmp( $metadata->WORKSPACE_NAME, $srcWorkspace ) != 0) {
|
||||||
else {
|
CLI::logging( CLI::warning( "> Workspace $backupWorkspace found, but not restoring." ) . "\n" );
|
||||||
$workspaceName = $metadata->WORKSPACE_NAME;
|
continue;
|
||||||
$createWorkspace = false;
|
} else {
|
||||||
}
|
CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
|
||||||
if (isset($srcWorkspace) && strcmp($metadata->WORKSPACE_NAME, $srcWorkspace) != 0) {
|
}
|
||||||
CLI::logging(CLI::warning("> Workspace $backupWorkspace found, but not restoring.") . "\n");
|
$workspace = new workspaceTools( $workspaceName );
|
||||||
continue;
|
if ($workspace->workspaceExists()) {
|
||||||
}
|
if ($overwrite) {
|
||||||
else {
|
CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
|
||||||
CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
|
} else {
|
||||||
}
|
throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
|
||||||
$workspace = new workspaceTools($workspaceName);
|
}
|
||||||
if ($workspace->workspaceExists()){
|
}
|
||||||
if ($overwrite){
|
if (file_exists( $workspace->path )) {
|
||||||
CLI::logging(CLI::warning("> Workspace $workspaceName already exist, overwriting!") . "\n");
|
G::rm_dir( $workspace->path );
|
||||||
}
|
}
|
||||||
else{
|
foreach ($metadata->directories as $dir) {
|
||||||
throw new Exception("Destination workspace already exist (use -o to overwrite)");
|
CLI::logging( "+> Restoring directory '$dir'\n" );
|
||||||
}
|
if (! rename( "$tempDirectory/$dir", $workspace->path )) {
|
||||||
}
|
throw new Exception( "There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}." );
|
||||||
if (file_exists($workspace->path)) {
|
}
|
||||||
G::rm_dir($workspace->path);
|
}
|
||||||
}
|
|
||||||
foreach ($metadata->directories as $dir) {
|
CLI::logging( "> Changing file permissions\n" );
|
||||||
CLI::logging("+> Restoring directory '$dir'\n");
|
$shared_stat = stat( PATH_DATA );
|
||||||
if (!rename("$tempDirectory/$dir", $workspace->path)) {
|
if ($shared_stat !== false) {
|
||||||
throw new Exception("There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}.");
|
workspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
|
||||||
}
|
} else {
|
||||||
}
|
CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
|
||||||
|
}
|
||||||
CLI::logging("> Changing file permissions\n");
|
|
||||||
$shared_stat = stat(PATH_DATA);
|
list ($dbHost, $dbUser, $dbPass) = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
|
||||||
if ($shared_stat !== false){
|
|
||||||
workspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
|
CLI::logging( "> Connecting to system database in '$dbHost'\n" );
|
||||||
}
|
$link = mysql_connect( $dbHost, $dbUser, $dbPass );
|
||||||
else{
|
@mysql_query( "SET NAMES 'utf8';" );
|
||||||
CLI::logging(CLI::error ("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
if (! $link) {
|
||||||
}
|
throw new Exception( 'Could not connect to system database: ' . mysql_error() );
|
||||||
|
}
|
||||||
list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
|
||||||
|
$newDBNames = $workspace->resetDBInfo( $dbHost, $createWorkspace );
|
||||||
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
|
||||||
$link = mysql_connect($dbHost, $dbUser, $dbPass);
|
foreach ($metadata->databases as $db) {
|
||||||
@mysql_query("SET NAMES 'utf8';");
|
$dbName = $newDBNames[$db->name];
|
||||||
if (!$link){
|
CLI::logging( "+> Restoring database {$db->name} to $dbName\n" );
|
||||||
throw new Exception('Could not connect to system database: ' . mysql_error());
|
$workspace->executeSQLScript( $dbName, "$tempDirectory/{$db->name}.sql" );
|
||||||
}
|
$workspace->createDBUser( $dbName, $db->pass, "localhost", $dbName );
|
||||||
|
$workspace->createDBUser( $dbName, $db->pass, "%", $dbName );
|
||||||
$newDBNames = $workspace->resetDBInfo($dbHost, $createWorkspace);
|
}
|
||||||
|
$workspace->upgradeCacheView( false );
|
||||||
foreach ($metadata->databases as $db) {
|
mysql_close( $link );
|
||||||
$dbName = $newDBNames[$db->name];
|
|
||||||
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
|
}
|
||||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql");
|
CLI::logging( "Removing temporary files\n" );
|
||||||
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName);
|
G::rm_dir( $tempDirectory );
|
||||||
$workspace->createDBUser($dbName, $db->pass, "%", $dbName);
|
CLI::logging( CLI::info( "Done restoring" ) . "\n" );
|
||||||
}
|
}
|
||||||
$workspace->upgradeCacheView(false);
|
}
|
||||||
mysql_close($link);
|
|
||||||
|
|
||||||
}
|
|
||||||
CLI::logging("Removing temporary files\n");
|
|
||||||
G::rm_dir($tempDirectory);
|
|
||||||
CLI::logging(CLI::info("Done restoring") . "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,277 +1,251 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require_once 'classes/model/om/BaseAppNotes.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'APP_NOTES' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package classes.model
|
||||||
|
*/
|
||||||
|
class AppNotes extends BaseAppNotes
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getNotesList ($appUid, $usrUid = '', $start = '', $limit = '')
|
||||||
|
{
|
||||||
|
require_once ("classes/model/Users.php");
|
||||||
|
|
||||||
|
G::LoadClass( 'ArrayPeer' );
|
||||||
|
|
||||||
|
$Criteria = new Criteria( 'workflow' );
|
||||||
|
$Criteria->clearSelectColumns();
|
||||||
|
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::APP_UID );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::USR_UID );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_DATE );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_CONTENT );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_TYPE );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AVAILABILITY );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_ORIGIN_OBJ );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ1 );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ2 );
|
||||||
|
$Criteria->addSelectColumn( AppNotesPeer::NOTE_RECIPIENTS );
|
||||||
|
$Criteria->addSelectColumn( UsersPeer::USR_USERNAME );
|
||||||
|
$Criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
|
||||||
|
$Criteria->addSelectColumn( UsersPeer::USR_LASTNAME );
|
||||||
|
$Criteria->addSelectColumn( UsersPeer::USR_EMAIL );
|
||||||
|
|
||||||
|
$Criteria->addJoin( AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
|
||||||
|
|
||||||
|
$Criteria->add( appNotesPeer::APP_UID, $appUid, CRITERIA::EQUAL );
|
||||||
|
|
||||||
|
if ($usrUid != '') {
|
||||||
|
$Criteria->add( appNotesPeer::USR_UID, $usrUid, CRITERIA::EQUAL );
|
||||||
|
}
|
||||||
|
|
||||||
|
$Criteria->addDescendingOrderByColumn( AppNotesPeer::NOTE_DATE );
|
||||||
|
|
||||||
|
$response = array ();
|
||||||
|
$totalCount = AppNotesPeer::doCount( $Criteria );
|
||||||
|
$response['totalCount'] = $totalCount;
|
||||||
|
$response['notes'] = array ();
|
||||||
|
|
||||||
|
if ($start != '') {
|
||||||
|
$Criteria->setLimit( $limit );
|
||||||
|
$Criteria->setOffset( $start );
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDataset = appNotesPeer::doSelectRS( $Criteria );
|
||||||
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
$oDataset->next();
|
||||||
|
|
||||||
|
while ($aRow = $oDataset->getRow()) {
|
||||||
|
$aRow['NOTE_CONTENT'] = stripslashes( $aRow['NOTE_CONTENT'] );
|
||||||
|
$response['notes'][] = $aRow;
|
||||||
|
$oDataset->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
$result['criteria'] = $Criteria;
|
||||||
|
$result['array'] = $response;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postNewNote ($appUid, $usrUid, $noteContent, $notify = true, $noteAvalibility = "PUBLIC", $noteRecipients = "", $noteType = "USER", $noteDate = "now")
|
||||||
|
{
|
||||||
|
$this->setAppUid( $appUid );
|
||||||
|
$this->setUsrUid( $usrUid );
|
||||||
|
$this->setNoteDate( $noteDate );
|
||||||
|
$this->setNoteContent( $noteContent );
|
||||||
|
$this->setNoteType( $noteType );
|
||||||
|
$this->setNoteAvailability( $noteAvalibility );
|
||||||
|
$this->setNoteOriginObj( '' );
|
||||||
|
$this->setNoteAffectedObj1( '' );
|
||||||
|
$this->setNoteAffectedObj2( '' );
|
||||||
|
$this->setNoteRecipients( $noteRecipients );
|
||||||
|
|
||||||
|
if ($this->validate()) {
|
||||||
|
// we save it, since we get no validation errors, or do whatever else you like.
|
||||||
|
$res = $this->save();
|
||||||
|
$msg = '';
|
||||||
|
} else {
|
||||||
|
// Something went wrong. We can now get the validationFailures and handle them.
|
||||||
|
$msg = '';
|
||||||
|
$validationFailuresArray = $this->getValidationFailures();
|
||||||
|
foreach ($validationFailuresArray as $objValidationFailure) {
|
||||||
|
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||||
|
}
|
||||||
|
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
|
||||||
|
}
|
||||||
|
if ($msg != "") {
|
||||||
|
$response['success'] = 'failure';
|
||||||
|
$response['message'] = $msg;
|
||||||
|
} else {
|
||||||
|
$response['success'] = 'success';
|
||||||
|
$response['message'] = 'Saved...';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($notify) {
|
||||||
|
if ($noteRecipients == "") {
|
||||||
|
$noteRecipientsA = array ();
|
||||||
|
G::LoadClass( 'case' );
|
||||||
|
$oCase = new Cases();
|
||||||
|
$p = $oCase->getUsersParticipatedInCase( $appUid );
|
||||||
|
foreach ($p['array'] as $key => $userParticipated) {
|
||||||
|
$noteRecipientsA[] = $key;
|
||||||
|
}
|
||||||
|
$noteRecipients = implode( ",", $noteRecipientsA );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
require_once ('classes/model/Configuration.php');
|
||||||
|
$oConfiguration = new Configuration();
|
||||||
|
$sDelimiter = DBAdapter::getStringDelimiter();
|
||||||
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
|
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
|
||||||
|
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
|
||||||
|
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
|
||||||
|
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
|
||||||
|
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
|
||||||
|
if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
|
||||||
|
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => '') );
|
||||||
|
$aConfiguration = array ();
|
||||||
|
} else {
|
||||||
|
$aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' );
|
||||||
|
if ($aConfiguration['CFG_VALUE'] != '') {
|
||||||
|
$aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] );
|
||||||
|
$passwd = $aConfiguration['MESS_PASSWORD'];
|
||||||
|
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
|
||||||
|
$auxPass = explode( 'hash:', $passwdDec );
|
||||||
|
if (count( $auxPass ) > 1) {
|
||||||
|
if (count( $auxPass ) == 2) {
|
||||||
|
$passwd = $auxPass[1];
|
||||||
|
} else {
|
||||||
|
array_shift( $auxPass );
|
||||||
|
$passwd = implode( '', $auxPass );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$aConfiguration['MESS_PASSWORD'] = $passwd;
|
||||||
|
} else {
|
||||||
|
$aConfiguration = array ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset( $aConfiguration['MESS_ENABLED'] ) || $aConfiguration['MESS_ENABLED'] != '1') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oUser = new Users();
|
||||||
|
$aUser = $oUser->load( $usrUid );
|
||||||
|
$authorName = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
|
||||||
|
|
||||||
|
G::LoadClass( 'case' );
|
||||||
|
$oCase = new Cases();
|
||||||
|
$aFields = $oCase->loadCase( $appUid );
|
||||||
|
$configNoteNotification['subject'] = G::LoadTranslation( 'ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION' ) . " @#APP_TITLE ";
|
||||||
|
$configNoteNotification['body'] = G::LoadTranslation( 'ID_CASE' ) . ": @#APP_TITLE<br />" . G::LoadTranslation( 'ID_AUTHOR' ) . ": $authorName<br /><br />$noteContent";
|
||||||
|
|
||||||
|
if ($sFrom == '') {
|
||||||
|
$sFrom = '"ProcessMaker"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match );
|
||||||
|
|
||||||
|
if (! $hasEmailFrom || strpos( $sFrom, $aConfiguration['MESS_ACCOUNT'] ) === false) {
|
||||||
|
if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) {
|
||||||
|
$sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>';
|
||||||
|
} else {
|
||||||
|
if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) {
|
||||||
|
$sFrom .= ' <info@' . gethostbyaddr( '127.0.0.1' ) . '>';
|
||||||
|
} else {
|
||||||
|
if ($aConfiguration['MESS_SERVER'] != '') {
|
||||||
|
if (($sAux = @gethostbyaddr( $aConfiguration['MESS_SERVER'] ))) {
|
||||||
|
$sFrom .= ' <info@' . $sAux . '>';
|
||||||
|
} else {
|
||||||
|
$sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sFrom .= ' <info@processmaker.com>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields );
|
||||||
|
|
||||||
|
//erik: new behaviour for messages
|
||||||
|
//G::loadClass('configuration');
|
||||||
|
//$oConf = new Configurations;
|
||||||
|
//$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
|
||||||
|
//$conf = $oConf->aConfig;
|
||||||
|
/*
|
||||||
|
if( isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TEMPLATE'])
|
||||||
|
&& $conf['TAS_DEF_MESSAGE_TYPE'] == 'template' && $conf['TAS_DEF_MESSAGE_TEMPLATE'] != '') {
|
||||||
|
|
||||||
require_once 'classes/model/om/BaseAppNotes.php';
|
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP;
|
||||||
|
$fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE'];
|
||||||
|
|
||||||
/**
|
if ( ! file_exists ( $fileTemplate ) ) {
|
||||||
* Skeleton subclass for representing a row from the 'APP_NOTES' table.
|
throw new Exception("Template file '$fileTemplate' does not exist.");
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* You should add additional methods to this class to meet the
|
|
||||||
* application requirements. This class will only be generated as
|
|
||||||
* long as it does not already exist in the output directory.
|
|
||||||
*
|
|
||||||
* @package classes.model
|
|
||||||
*/
|
|
||||||
class AppNotes extends BaseAppNotes {
|
|
||||||
|
|
||||||
function getNotesList($appUid, $usrUid='', $start='', $limit='')
|
|
||||||
{
|
|
||||||
require_once ("classes/model/Users.php");
|
|
||||||
|
|
||||||
G::LoadClass('ArrayPeer');
|
|
||||||
|
|
||||||
$Criteria = new Criteria('workflow');
|
|
||||||
$Criteria->clearSelectColumns();
|
|
||||||
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::APP_UID);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::USR_UID);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_DATE);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2);
|
|
||||||
$Criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS);
|
|
||||||
$Criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
|
||||||
$Criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
|
||||||
$Criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
|
||||||
$Criteria->addSelectColumn(UsersPeer::USR_EMAIL);
|
|
||||||
|
|
||||||
$Criteria->addJoin(AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
|
||||||
|
|
||||||
$Criteria->add(appNotesPeer::APP_UID, $appUid, CRITERIA::EQUAL);
|
|
||||||
|
|
||||||
if ($usrUid != '') {
|
|
||||||
$Criteria->add(appNotesPeer::USR_UID, $usrUid, CRITERIA::EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
$Criteria->addDescendingOrderByColumn(AppNotesPeer::NOTE_DATE);
|
|
||||||
|
|
||||||
$response = array();
|
|
||||||
$totalCount = AppNotesPeer::doCount($Criteria);
|
|
||||||
$response['totalCount'] = $totalCount;
|
|
||||||
$response['notes'] = array();
|
|
||||||
|
|
||||||
if ($start != '') {
|
|
||||||
$Criteria->setLimit($limit);
|
|
||||||
$Criteria->setOffset($start);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oDataset = appNotesPeer::doSelectRS($Criteria);
|
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset->next();
|
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
|
||||||
$aRow['NOTE_CONTENT'] = stripslashes($aRow['NOTE_CONTENT']);
|
|
||||||
$response['notes'][] = $aRow;
|
|
||||||
$oDataset->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
$result['criteria'] = $Criteria;
|
|
||||||
$result['array'] = $response;
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function postNewNote($appUid, $usrUid, $noteContent, $notify=true, $noteAvalibility="PUBLIC", $noteRecipients="", $noteType="USER", $noteDate="now") {
|
|
||||||
|
|
||||||
$this->setAppUid($appUid);
|
|
||||||
$this->setUsrUid($usrUid);
|
|
||||||
$this->setNoteDate($noteDate);
|
|
||||||
$this->setNoteContent($noteContent);
|
|
||||||
$this->setNoteType($noteType);
|
|
||||||
$this->setNoteAvailability($noteAvalibility);
|
|
||||||
$this->setNoteOriginObj('');
|
|
||||||
$this->setNoteAffectedObj1('');
|
|
||||||
$this->setNoteAffectedObj2('');
|
|
||||||
$this->setNoteRecipients($noteRecipients);
|
|
||||||
|
|
||||||
if ($this->validate()) {
|
|
||||||
// we save it, since we get no validation errors, or do whatever else you like.
|
|
||||||
$res = $this->save();
|
|
||||||
$msg = '';
|
|
||||||
} else {
|
|
||||||
// Something went wrong. We can now get the validationFailures and handle them.
|
|
||||||
$msg = '';
|
|
||||||
$validationFailuresArray = $this->getValidationFailures();
|
|
||||||
foreach ($validationFailuresArray as $objValidationFailure) {
|
|
||||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
|
||||||
}
|
|
||||||
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
|
|
||||||
}
|
|
||||||
if ($msg != "") {
|
|
||||||
$response['success'] = 'failure';
|
|
||||||
$response['message'] = $msg;
|
|
||||||
} else {
|
|
||||||
$response['success'] = 'success';
|
|
||||||
$response['message'] = 'Saved...';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($notify) {
|
|
||||||
if ($noteRecipients == "") {
|
|
||||||
$noteRecipientsA = array();
|
|
||||||
G::LoadClass('case');
|
|
||||||
$oCase = new Cases ();
|
|
||||||
|
|
||||||
$p = $oCase->getUsersParticipatedInCase($appUid);
|
|
||||||
foreach($p['array'] as $key => $userParticipated){
|
|
||||||
$noteRecipientsA[]=$key;
|
|
||||||
}
|
|
||||||
$noteRecipients = implode(",", $noteRecipientsA);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") {
|
|
||||||
try {
|
|
||||||
require_once ('classes/model/Configuration.php');
|
|
||||||
$oConfiguration = new Configuration();
|
|
||||||
$sDelimiter = DBAdapter::getStringDelimiter();
|
|
||||||
$oCriteria = new Criteria('workflow');
|
|
||||||
$oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails');
|
|
||||||
$oCriteria->add(ConfigurationPeer::OBJ_UID, '');
|
|
||||||
$oCriteria->add(ConfigurationPeer::PRO_UID, '');
|
|
||||||
$oCriteria->add(ConfigurationPeer::USR_UID, '');
|
|
||||||
$oCriteria->add(ConfigurationPeer::APP_UID, '');
|
|
||||||
if (ConfigurationPeer::doCount($oCriteria) == 0) {
|
|
||||||
$oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
|
|
||||||
$aConfiguration = array();
|
|
||||||
} else {
|
|
||||||
$aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
|
|
||||||
if ($aConfiguration['CFG_VALUE'] != '') {
|
|
||||||
$aConfiguration = unserialize($aConfiguration['CFG_VALUE']);
|
|
||||||
$passwd = $aConfiguration['MESS_PASSWORD'];
|
|
||||||
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
|
|
||||||
$auxPass = explode('hash:', $passwdDec);
|
|
||||||
if (count($auxPass) > 1) {
|
|
||||||
if (count($auxPass) == 2) {
|
|
||||||
$passwd = $auxPass[1];
|
|
||||||
} else {
|
|
||||||
array_shift($auxPass);
|
|
||||||
$passwd = implode('', $auxPass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$aConfiguration['MESS_PASSWORD'] = $passwd;
|
|
||||||
} else {
|
|
||||||
$aConfiguration = array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$oUser = new Users();
|
|
||||||
$aUser = $oUser->load($usrUid);
|
|
||||||
$authorName = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
|
|
||||||
|
|
||||||
G::LoadClass('case');
|
|
||||||
$oCase = new Cases ();
|
|
||||||
$aFields = $oCase->loadCase( $appUid );
|
|
||||||
$configNoteNotification['subject']= G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION')." @#APP_TITLE ";
|
|
||||||
$configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR').": $authorName<br /><br />$noteContent";
|
|
||||||
|
|
||||||
if ($sFrom == '') {
|
|
||||||
$sFrom = '"ProcessMaker"';
|
|
||||||
}
|
|
||||||
|
|
||||||
$hasEmailFrom = preg_match('/(.+)@(.+)\.(.+)/', $sFrom, $match);
|
|
||||||
|
|
||||||
if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) {
|
|
||||||
if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) {
|
|
||||||
$sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>';
|
|
||||||
} else {
|
|
||||||
if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) {
|
|
||||||
$sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>';
|
|
||||||
} else {
|
|
||||||
if ($aConfiguration['MESS_SERVER'] != '') {
|
|
||||||
if (($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER']))) {
|
|
||||||
$sFrom .= ' <info@' . $sAux . '>';
|
|
||||||
} else {
|
|
||||||
$sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$sFrom .= ' <info@processmaker.com>';
|
|
||||||
}
|
}
|
||||||
}
|
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
|
||||||
}
|
} else {*/
|
||||||
}
|
$sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) );
|
||||||
|
/*}*/
|
||||||
$sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields);
|
G::LoadClass( 'spool' );
|
||||||
|
$oUser = new Users();
|
||||||
|
$recipientsArray = explode( ",", $noteRecipients );
|
||||||
//erik: new behaviour for messages
|
|
||||||
//G::loadClass('configuration');
|
foreach ($recipientsArray as $recipientUid) {
|
||||||
//$oConf = new Configurations;
|
|
||||||
//$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
|
$aUser = $oUser->load( $recipientUid );
|
||||||
//$conf = $oConf->aConfig;
|
|
||||||
/*
|
$sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
|
||||||
if( isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TEMPLATE'])
|
$oSpool = new spoolRun();
|
||||||
&& $conf['TAS_DEF_MESSAGE_TYPE'] == 'template' && $conf['TAS_DEF_MESSAGE_TEMPLATE'] != '') {
|
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'],'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false,'SMTPSecure' => isset( $aConfiguration['SMTPSecure'] ) ? $aConfiguration['SMTPSecure'] : '') );
|
||||||
|
$oSpool->create( array ('msg_uid' => '','app_uid' => $appUid,'del_index' => 1,'app_msg_type' => 'DERIVATION','app_msg_subject' => $sSubject,'app_msg_from' => $sFrom,'app_msg_to' => $sTo,'app_msg_body' => $sBody,'app_msg_cc' => '','app_msg_bcc' => '','app_msg_attach' => '','app_msg_template' => '','app_msg_status' => 'pending') );
|
||||||
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP;
|
if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
|
||||||
$fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE'];
|
$oSpool->sendMail();
|
||||||
|
}
|
||||||
if ( ! file_exists ( $fileTemplate ) ) {
|
|
||||||
throw new Exception("Template file '$fileTemplate' does not exist.");
|
}
|
||||||
}
|
//Send derivation notification - End
|
||||||
|
} catch (Exception $oException) {
|
||||||
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
|
throw $oException;
|
||||||
} else {*/
|
}
|
||||||
$sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields));
|
}
|
||||||
/*}*/
|
}
|
||||||
|
|
||||||
G::LoadClass('spool');
|
|
||||||
$oUser = new Users();
|
|
||||||
|
|
||||||
$recipientsArray=explode(",",$noteRecipients);
|
|
||||||
|
|
||||||
foreach($recipientsArray as $recipientUid){
|
|
||||||
|
|
||||||
$aUser = $oUser->load($recipientUid);
|
|
||||||
|
|
||||||
$sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
|
|
||||||
|
|
||||||
$oSpool = new spoolRun();
|
|
||||||
$oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],
|
|
||||||
'MESS_SERVER' => $aConfiguration['MESS_SERVER'],
|
|
||||||
'MESS_PORT' => $aConfiguration['MESS_PORT'],
|
|
||||||
'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],
|
|
||||||
'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'],
|
|
||||||
'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false,
|
|
||||||
'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : ''
|
|
||||||
));
|
|
||||||
$oSpool->create(array('msg_uid' => '',
|
|
||||||
'app_uid' => $appUid,
|
|
||||||
'del_index' => 1,
|
|
||||||
'app_msg_type' => 'DERIVATION',
|
|
||||||
'app_msg_subject' => $sSubject,
|
|
||||||
'app_msg_from' => $sFrom,
|
|
||||||
'app_msg_to' => $sTo,
|
|
||||||
'app_msg_body' => $sBody,
|
|
||||||
'app_msg_cc' => '',
|
|
||||||
'app_msg_bcc' => '',
|
|
||||||
'app_msg_attach' => '',
|
|
||||||
'app_msg_template' => '',
|
|
||||||
'app_msg_status' => 'pending'
|
|
||||||
));
|
|
||||||
if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
|
|
||||||
$oSpool->sendMail();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Send derivation notification - End
|
|
||||||
|
|
||||||
} catch (Exception $oException) {
|
|
||||||
throw $oException;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,349 +1,351 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* FieldCondition.php
|
* FieldCondition.php
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*/
|
* @package workflow.engine.classes.model
|
||||||
|
*/
|
||||||
require_once 'classes/model/om/BaseFieldCondition.php';
|
|
||||||
require_once 'classes/model/Dynaform.php';
|
require_once 'classes/model/om/BaseFieldCondition.php';
|
||||||
|
require_once 'classes/model/Dynaform.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'FIELD_CONDITION' table.
|
* Skeleton subclass for representing a row from the 'FIELD_CONDITION' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
* You should add additional methods to this class to meet the
|
||||||
* application requirements. This class will only be generated as
|
* application requirements. This class will only be generated as
|
||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class FieldCondition extends BaseFieldCondition {
|
class FieldCondition extends BaseFieldCondition
|
||||||
|
{
|
||||||
var $oDynaformHandler;
|
|
||||||
/**
|
public $oDynaformHandler;
|
||||||
* Quick get all records into a criteria object
|
|
||||||
*
|
/**
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* Quick get all records into a criteria object
|
||||||
*/
|
*
|
||||||
public function get( $UID ) {
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
|
*/
|
||||||
$obj = FieldConditionPeer::retrieveByPk($UID);
|
public function get ($UID)
|
||||||
if( !isset($obj) ) {
|
{
|
||||||
throw new Exception("the record with UID: $UID doesn't exits!");
|
|
||||||
}
|
$obj = FieldConditionPeer::retrieveByPk( $UID );
|
||||||
|
if (! isset( $obj )) {
|
||||||
|
throw new Exception( "the record with UID: $UID doesn't exits!" );
|
||||||
|
}
|
||||||
//TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
//TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||||
return $obj->toArray(BasePeer::TYPE_FIELDNAME);
|
return $obj->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick get all records into a criteria object
|
* Quick get all records into a criteria object
|
||||||
*
|
*
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function getAllCriteriaByDynUid( $DYN_UID, $filter='all' ) {
|
public function getAllCriteriaByDynUid ($DYN_UID, $filter = 'all')
|
||||||
$oCriteria = new Criteria('workflow');
|
{
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_UID);
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_FUNCTION);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_UID );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_FIELDS);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FUNCTION );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_CONDITION);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FIELDS );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_EVENTS);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_CONDITION );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_EVENT_OWNERS);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_EVENTS );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_STATUS);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_EVENT_OWNERS );
|
||||||
$oCriteria->addSelectColumn(FieldConditionPeer::FCD_DYN_UID);
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_STATUS );
|
||||||
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_DYN_UID );
|
||||||
$oCriteria->add(FieldConditionPeer::FCD_DYN_UID, $DYN_UID);
|
|
||||||
switch( $filter ) {
|
$oCriteria->add( FieldConditionPeer::FCD_DYN_UID, $DYN_UID );
|
||||||
case 'active':
|
switch ($filter) {
|
||||||
$oCriteria->add(FieldConditionPeer::FCD_STATUS, '1', Criteria::EQUAL);
|
case 'active':
|
||||||
break;
|
$oCriteria->add( FieldConditionPeer::FCD_STATUS, '1', Criteria::EQUAL );
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
return $oCriteria;
|
|
||||||
}
|
return $oCriteria;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Quick get all records into a associative array
|
/**
|
||||||
*
|
* Quick get all records into a associative array
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
*
|
||||||
*/
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
public function getAllByDynUid( $DYN_UID, $filter='all' ) {
|
*/
|
||||||
$aRows = Array();
|
public function getAllByDynUid ($DYN_UID, $filter = 'all')
|
||||||
|
{
|
||||||
$oCriteria = $this->getAllCriteriaByDynUid($DYN_UID, $filter);
|
$aRows = Array ();
|
||||||
|
|
||||||
$oDataset = FieldConditionPeer::doSelectRS($oCriteria);
|
$oCriteria = $this->getAllCriteriaByDynUid( $DYN_UID, $filter );
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset->next();
|
$oDataset = FieldConditionPeer::doSelectRS( $oCriteria );
|
||||||
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
while( $aRow = $oDataset->getRow() ) {
|
$oDataset->next();
|
||||||
$aRows[] = $aRow;
|
|
||||||
$oDataset->next();
|
while ($aRow = $oDataset->getRow()) {
|
||||||
}
|
$aRows[] = $aRow;
|
||||||
|
$oDataset->next();
|
||||||
return $aRows;
|
}
|
||||||
}
|
|
||||||
|
return $aRows;
|
||||||
/**
|
}
|
||||||
* Quick save a record
|
|
||||||
*
|
/**
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* Quick save a record
|
||||||
*/
|
*
|
||||||
public function quickSave($aData) {
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
$con = Propel::getConnection(FieldConditionPeer::DATABASE_NAME);
|
*/
|
||||||
try {
|
public function quickSave ($aData)
|
||||||
$obj = null;
|
{
|
||||||
|
$con = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
||||||
if( isset($aData['FCD_UID']) && trim($aData['FCD_UID']) != '' ) {
|
try {
|
||||||
$obj = FieldConditionPeer::retrieveByPk($aData['FCD_UID']);
|
$obj = null;
|
||||||
} else {
|
|
||||||
$aData['FCD_UID'] = G::generateUniqueID();
|
if (isset( $aData['FCD_UID'] ) && trim( $aData['FCD_UID'] ) != '') {
|
||||||
}
|
$obj = FieldConditionPeer::retrieveByPk( $aData['FCD_UID'] );
|
||||||
|
} else {
|
||||||
if (!is_object($obj)) {
|
$aData['FCD_UID'] = G::generateUniqueID();
|
||||||
$obj = new FieldCondition();
|
}
|
||||||
}
|
|
||||||
|
if (! is_object( $obj )) {
|
||||||
$obj->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$obj = new FieldCondition();
|
||||||
|
}
|
||||||
if ($obj->validate()) {
|
|
||||||
$result = $obj->save();
|
$obj->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
$con->commit();
|
|
||||||
return $result;
|
if ($obj->validate()) {
|
||||||
} else {
|
$result = $obj->save();
|
||||||
$e = new Exception("Failed Validation in class " . get_class($this) . ".");
|
$con->commit();
|
||||||
$e->aValidationFailures = $obj->getValidationFailures();
|
return $result;
|
||||||
throw ($e);
|
} else {
|
||||||
}
|
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||||
|
$e->aValidationFailures = $obj->getValidationFailures();
|
||||||
} catch (exception $e) {
|
throw ($e);
|
||||||
$con->rollback();
|
}
|
||||||
throw ($e);
|
|
||||||
}
|
} catch (exception $e) {
|
||||||
}
|
$con->rollback();
|
||||||
|
throw ($e);
|
||||||
function getConditionScript($DYN_UID) {
|
}
|
||||||
require_once 'classes/model/Dynaform.php';
|
}
|
||||||
G::LoadSystem('dynaformhandler');
|
|
||||||
|
public function getConditionScript ($DYN_UID)
|
||||||
$oDynaform = DynaformPeer::retrieveByPk($DYN_UID);
|
{
|
||||||
$PRO_UID = $oDynaform->getProUid();
|
require_once 'classes/model/Dynaform.php';
|
||||||
|
G::LoadSystem( 'dynaformhandler' );
|
||||||
$this->oDynaformHandler = new dynaFormHandler(PATH_DYNAFORM . "$PRO_UID/$DYN_UID" . '.xml');
|
|
||||||
$aDynaformFields = $this->oDynaformHandler->getFieldNames();
|
$oDynaform = DynaformPeer::retrieveByPk( $DYN_UID );
|
||||||
for ( $i = 0; $i < count($aDynaformFields); $i++ ) {
|
$PRO_UID = $oDynaform->getProUid();
|
||||||
$aDynaformFields[$i] = "'$aDynaformFields[$i]'";
|
|
||||||
}
|
$this->oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . "$PRO_UID/$DYN_UID" . '.xml' );
|
||||||
|
$aDynaformFields = $this->oDynaformHandler->getFieldNames();
|
||||||
$sDynaformFieldsAsStrings = implode(',', $aDynaformFields);
|
for ($i = 0; $i < count( $aDynaformFields ); $i ++) {
|
||||||
|
$aDynaformFields[$i] = "'$aDynaformFields[$i]'";
|
||||||
$aRows = $this->getAllByDynUid($DYN_UID, 'active');
|
}
|
||||||
$sCode = '';
|
|
||||||
|
$sDynaformFieldsAsStrings = implode( ',', $aDynaformFields );
|
||||||
if( sizeof($aRows) != 0 ) {
|
|
||||||
|
$aRows = $this->getAllByDynUid( $DYN_UID, 'active' );
|
||||||
foreach ( $aRows as $aRow ) {
|
$sCode = '';
|
||||||
$hashCond = md5($aRow['FCD_UID']);
|
|
||||||
$sCondition = $this->parseCondition($aRow['FCD_CONDITION']);
|
if (sizeof( $aRows ) != 0) {
|
||||||
$sCondition = addslashes($sCondition);
|
foreach ($aRows as $aRow) {
|
||||||
|
$hashCond = md5( $aRow['FCD_UID'] );
|
||||||
$sCode .= "function __condition__$hashCond() { ";
|
$sCondition = $this->parseCondition( $aRow['FCD_CONDITION'] );
|
||||||
$sCode .= "if( eval(\"{$sCondition}\") ) { ";
|
$sCondition = addslashes( $sCondition );
|
||||||
|
|
||||||
$aFields = explode(',', $aRow['FCD_FIELDS']);
|
$sCode .= "function __condition__$hashCond() { ";
|
||||||
|
$sCode .= "if( eval(\"{$sCondition}\") ) { ";
|
||||||
switch( $aRow['FCD_FUNCTION'] ) {
|
|
||||||
case 'show':
|
$aFields = explode( ',', $aRow['FCD_FIELDS'] );
|
||||||
foreach ( $aFields as $aField ) {
|
|
||||||
$sCode .= "showRowById('$aField');";
|
switch ($aRow['FCD_FUNCTION']) {
|
||||||
}
|
case 'show':
|
||||||
break;
|
foreach ($aFields as $aField) {
|
||||||
|
$sCode .= "showRowById('$aField');";
|
||||||
case 'showOnly':
|
}
|
||||||
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
break;
|
||||||
foreach ( $aFields as $aField ) {
|
case 'showOnly':
|
||||||
$sCode .= "showRowById('$aField');";
|
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
}
|
foreach ($aFields as $aField) {
|
||||||
break;
|
$sCode .= "showRowById('$aField');";
|
||||||
|
}
|
||||||
case 'showAll':
|
break;
|
||||||
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
case 'showAll':
|
||||||
break;
|
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
|
break;
|
||||||
case 'hide':
|
case 'hide':
|
||||||
foreach ( $aFields as $aField ) {
|
foreach ($aFields as $aField) {
|
||||||
$sCode .= "hideRowById('$aField');";
|
$sCode .= "hideRowById('$aField');";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'hideOnly':
|
||||||
case 'hideOnly':
|
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
foreach ($aFields as $aField) {
|
||||||
foreach ( $aFields as $aField ) {
|
$sCode .= "hideRowById('$aField');";
|
||||||
$sCode .= "hideRowById('$aField');";
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case 'hideAll':
|
||||||
|
$aDynaFields = array ();
|
||||||
case 'hideAll':
|
$aEventOwner = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
|
||||||
$aDynaFields = array();
|
foreach ($aDynaformFields as $sDynaformFields) {
|
||||||
$aEventOwner = explode(',', $aRow['FCD_EVENT_OWNERS'] );
|
if (! in_array( str_replace( "'", "", $sDynaformFields ), $aEventOwner )) {
|
||||||
foreach($aDynaformFields as $sDynaformFields){
|
$aDynaFields[] = $sDynaformFields;
|
||||||
if(! in_array(str_replace("'", "", $sDynaformFields), $aEventOwner) ) {
|
}
|
||||||
$aDynaFields[] = $sDynaformFields;
|
}
|
||||||
}
|
$sDynaformFieldsAsStrings = implode( ',', $aDynaFields );
|
||||||
}
|
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
$sDynaformFieldsAsStrings = implode(',', $aDynaFields);
|
break;
|
||||||
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
}
|
||||||
|
$sCode .= " } ";
|
||||||
break;
|
$sCode .= "} ";
|
||||||
}
|
$aFieldOwners = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
|
||||||
$sCode .= " } ";
|
$aEvents = explode( ',', $aRow['FCD_EVENTS'] );
|
||||||
$sCode .= "} ";
|
if (in_array( 'onchange', $aEvents )) {
|
||||||
$aFieldOwners = explode(',', $aRow['FCD_EVENT_OWNERS']);
|
foreach ($aFieldOwners as $aField) {
|
||||||
$aEvents = explode(',', $aRow['FCD_EVENTS']);
|
|
||||||
if( in_array('onchange', $aEvents) ) {
|
|
||||||
foreach ( $aFieldOwners as $aField ) {
|
|
||||||
|
|
||||||
//verify the field type
|
//verify the field type
|
||||||
$node = $this->oDynaformHandler->getNode($aField);
|
$node = $this->oDynaformHandler->getNode( $aField );
|
||||||
$nodeType = $node->getAttribute('type');
|
$nodeType = $node->getAttribute( 'type' );
|
||||||
|
|
||||||
switch($nodeType){
|
switch ($nodeType) {
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
$sJSEvent = 'click';
|
$sJSEvent = 'click';
|
||||||
break;
|
break;
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
case 'currency':
|
case 'currency':
|
||||||
case 'percentage':
|
case 'percentage':
|
||||||
$sJSEvent = 'blur';
|
$sJSEvent = 'blur';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
default:
|
$sJSEvent = 'change';
|
||||||
$sJSEvent = 'change';
|
break;
|
||||||
break;
|
}
|
||||||
}
|
$sCode .= "leimnud.event.add(getField('$aField'), '$sJSEvent', function() {";
|
||||||
$sCode .= "leimnud.event.add(getField('$aField'), '$sJSEvent', function() {";
|
$sCode .= " __condition__$hashCond(); ";
|
||||||
$sCode .= " __condition__$hashCond(); ";
|
$sCode .= "}.extend(getField('$aField')));";
|
||||||
$sCode .= "}.extend(getField('$aField')));";
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
if (in_array( 'onload', $aEvents )) {
|
||||||
if( in_array('onload', $aEvents) ) {
|
foreach ($aFieldOwners as $aField) {
|
||||||
foreach ( $aFieldOwners as $aField ) {
|
$sCode .= " __condition__$hashCond(); ";
|
||||||
$sCode .= " __condition__$hashCond(); ";
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return $sCode;
|
||||||
|
} else {
|
||||||
return $sCode;
|
return null;
|
||||||
} else {
|
}
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
}
|
public function parseCondition ($sCondition)
|
||||||
|
{
|
||||||
function parseCondition($sCondition) {
|
preg_match_all( '/@#[a-zA-Z0-9_.]+/', $sCondition, $result );
|
||||||
preg_match_all('/@#[a-zA-Z0-9_.]+/', $sCondition, $result);
|
if (sizeof( $result[0] ) > 0) {
|
||||||
if ( sizeof($result[0]) > 0 ) {
|
foreach ($result[0] as $fname) {
|
||||||
foreach( $result[0] as $fname ) {
|
preg_match_all( '/(@#[a-zA-Z0-9_]+)\.([@#[a-zA-Z0-9_]+)/', $fname, $result2 );
|
||||||
preg_match_all('/(@#[a-zA-Z0-9_]+)\.([@#[a-zA-Z0-9_]+)/', $fname, $result2);
|
if (isset( $result2[2][0] ) && $result2[1][0]) {
|
||||||
if( isset($result2[2][0]) && $result2[1][0]){
|
$sCondition = str_replace( $fname, "getField('" . str_replace( '@#', '', $result2[1][0] ) . "')." . $result2[2][0], $sCondition );
|
||||||
$sCondition = str_replace($fname, "getField('".str_replace('@#', '', $result2[1][0])."').".$result2[2][0], $sCondition);
|
} else {
|
||||||
} else {
|
$field = str_replace( '@#', '', $fname );
|
||||||
$field = str_replace('@#', '', $fname);
|
$node = $this->oDynaformHandler->getNode( $field );
|
||||||
$node = $this->oDynaformHandler->getNode($field);
|
if (isset( $node )) {
|
||||||
if(isset($node)) {
|
$nodeType = $node->getAttribute( 'type' );
|
||||||
$nodeType = $node->getAttribute('type');
|
switch ($nodeType) {
|
||||||
switch($nodeType){
|
case 'checkbox':
|
||||||
case 'checkbox':
|
$sAtt = 'checked';
|
||||||
$sAtt = 'checked';
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
$sAtt = 'value';
|
||||||
$sAtt = 'value';
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
$sAtt = 'value';
|
||||||
$sAtt = 'value';
|
}
|
||||||
}
|
$sCondition = str_replace( $fname, "getField('" . $field . "').$sAtt", $sCondition );
|
||||||
$sCondition = str_replace($fname, "getField('".$field."').$sAtt", $sCondition);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return $sCondition;
|
||||||
return $sCondition;
|
}
|
||||||
}
|
public function create ($aData)
|
||||||
|
{
|
||||||
public function create($aData) {
|
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
||||||
$oConnection = Propel::getConnection(FieldConditionPeer::DATABASE_NAME);
|
try {
|
||||||
try {
|
|
||||||
// $aData['FCD_UID'] = '';
|
// $aData['FCD_UID'] = '';
|
||||||
if ( isset ( $aData['FCD_UID'] ) && $aData['FCD_UID']== '' )
|
if (isset( $aData['FCD_UID'] ) && $aData['FCD_UID'] == '') {
|
||||||
unset ( $aData['FCD_UID'] );
|
unset( $aData['FCD_UID'] );
|
||||||
if ( !isset ( $aData['FCD_UID'] ) )
|
}
|
||||||
$aData['FCD_UID'] = G::generateUniqueID();
|
if (! isset( $aData['FCD_UID'] )) {
|
||||||
|
$aData['FCD_UID'] = G::generateUniqueID();
|
||||||
$oFieldCondition = new FieldCondition();
|
}
|
||||||
$oFieldCondition->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oFieldCondition = new FieldCondition();
|
||||||
if ($oFieldCondition->validate()) {
|
$oFieldCondition->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
$oConnection->begin();
|
if ($oFieldCondition->validate()) {
|
||||||
$iResult = $oFieldCondition->save();
|
$oConnection->begin();
|
||||||
$oConnection->commit();
|
$iResult = $oFieldCondition->save();
|
||||||
return true;
|
$oConnection->commit();
|
||||||
} else {
|
return true;
|
||||||
$sMessage = '';
|
} else {
|
||||||
$aValidationFailures = $oFieldCondition->getValidationFailures();
|
$sMessage = '';
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
$aValidationFailures = $oFieldCondition->getValidationFailures();
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
}
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
|
}
|
||||||
}
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
} catch (Exception $oError) {
|
}
|
||||||
$oConnection->rollback();
|
} catch (Exception $oError) {
|
||||||
throw($oError);
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function remove($sUID) {
|
public function remove ($sUID)
|
||||||
$oConnection = Propel::getConnection(FieldConditionPeer::DATABASE_NAME);
|
{
|
||||||
try {
|
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
||||||
$oConnection->begin();
|
try {
|
||||||
$this->setFcdUid($sUID);
|
$oConnection->begin();
|
||||||
$iResult = $this->delete();
|
$this->setFcdUid( $sUID );
|
||||||
$oConnection->commit();
|
$iResult = $this->delete();
|
||||||
return $iResult;
|
$oConnection->commit();
|
||||||
} catch (Exception $oError) {
|
return $iResult;
|
||||||
$oConnection->rollback();
|
} catch (Exception $oError) {
|
||||||
throw($oError);
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function fieldConditionExists ( $sUid, $aDynaform ) {
|
|
||||||
try {
|
public function fieldConditionExists ($sUid, $aDynaform)
|
||||||
$found = false;
|
{
|
||||||
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
try {
|
||||||
if( isset($obj) ) {
|
$found = false;
|
||||||
$aFields = $obj->toArray(BasePeer::TYPE_FIELDNAME);
|
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
||||||
foreach($aDynaform as $key => $row){
|
if (isset( $obj )) {
|
||||||
if($row['DYN_UID'] == $aFields['FCD_DYN_UID'])
|
$aFields = $obj->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$found = true;
|
foreach ($aDynaform as $key => $row) {
|
||||||
}
|
if ($row['DYN_UID'] == $aFields['FCD_DYN_UID']) {
|
||||||
}
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// return( get_class($obj) == 'FieldCondition') ;
|
// return( get_class($obj) == 'FieldCondition') ;
|
||||||
return($found);
|
return ($found);
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
throw ($oError);
|
||||||
throw($oError);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function Exists ($sUid)
|
||||||
function Exists ( $sUid ) {
|
{
|
||||||
try {
|
try {
|
||||||
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
||||||
return(is_object($obj) && get_class($obj) == 'FieldCondition') ;
|
return (is_object( $obj ) && get_class( $obj ) == 'FieldCondition');
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
throw ($oError);
|
||||||
throw($oError);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// FieldCondition
|
||||||
} // FieldCondition
|
|
||||||
|
|||||||
@@ -1,185 +1,166 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Gateway.php
|
* Gateway.php
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*/
|
* @package workflow.engine.classes.model
|
||||||
|
*/
|
||||||
require_once 'classes/model/om/BaseGateway.php';
|
|
||||||
|
require_once 'classes/model/om/BaseGateway.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'GATEWAY' table.
|
* Skeleton subclass for representing a row from the 'GATEWAY' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
* You should add additional methods to this class to meet the
|
||||||
* application requirements. This class will only be generated as
|
* application requirements. This class will only be generated as
|
||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class Gateway extends BaseGateway {
|
class Gateway extends BaseGateway
|
||||||
|
{
|
||||||
public function create ($aData)
|
|
||||||
{
|
public function create ($aData)
|
||||||
$oConnection = Propel::getConnection(GatewayPeer::DATABASE_NAME);
|
{
|
||||||
try {
|
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
$sGatewayUID = G::generateUniqueID();
|
try {
|
||||||
$aData['GAT_UID'] = $sGatewayUID;
|
$sGatewayUID = G::generateUniqueID();
|
||||||
$oGateway = new Gateway();
|
$aData['GAT_UID'] = $sGatewayUID;
|
||||||
$oGateway->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oGateway = new Gateway();
|
||||||
if ($oGateway->validate()) {
|
$oGateway->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
$oConnection->begin();
|
if ($oGateway->validate()) {
|
||||||
$iResult = $oGateway->save();
|
$oConnection->begin();
|
||||||
$oConnection->commit();
|
$iResult = $oGateway->save();
|
||||||
return $sGatewayUID;
|
$oConnection->commit();
|
||||||
}
|
return $sGatewayUID;
|
||||||
else {
|
} else {
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oGateway->getValidationFailures();
|
$aValidationFailures = $oGateway->getValidationFailures();
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
}
|
}
|
||||||
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
$oConnection->rollback();
|
||||||
$oConnection->rollback();
|
throw ($oError);
|
||||||
throw($oError);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function load ($GatewayUid)
|
||||||
public function load($GatewayUid)
|
{
|
||||||
{
|
try {
|
||||||
try {
|
$oRow = GatewayPeer::retrieveByPK( $GatewayUid );
|
||||||
$oRow = GatewayPeer::retrieveByPK( $GatewayUid );
|
if (! is_null( $oRow )) {
|
||||||
if (!is_null($oRow))
|
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
{
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
|
$this->setNew( false );
|
||||||
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
|
return $aFields;
|
||||||
$this->setNew(false);
|
} else {
|
||||||
return $aFields;
|
throw (new Exception( "The row '" . $GatewayUid . "' in table Gateway doesn't exist!" ));
|
||||||
}
|
}
|
||||||
else {
|
} catch (Exception $oError) {
|
||||||
throw(new Exception( "The row '" . $GatewayUid . "' in table Gateway doesn't exist!" ));
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
|
||||||
throw($oError);
|
public function update ($fields)
|
||||||
}
|
{
|
||||||
}
|
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
|
try {
|
||||||
public function update($fields)
|
$con->begin();
|
||||||
{
|
$this->load( $fields['GAT_UID'] );
|
||||||
$con = Propel::getConnection(GatewayPeer::DATABASE_NAME);
|
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||||
try
|
if ($this->validate()) {
|
||||||
{
|
$result = $this->save();
|
||||||
$con->begin();
|
$con->commit();
|
||||||
$this->load($fields['GAT_UID']);
|
return $result;
|
||||||
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
|
} else {
|
||||||
if($this->validate())
|
$con->rollback();
|
||||||
{
|
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||||
$result=$this->save();
|
}
|
||||||
$con->commit();
|
} catch (Exception $e) {
|
||||||
return $result;
|
$con->rollback();
|
||||||
}
|
throw ($e);
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
$con->rollback();
|
|
||||||
throw(new Exception("Failed Validation in class ".get_class($this)."."));
|
public function remove ($GatewayUid)
|
||||||
}
|
{
|
||||||
}
|
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
catch(Exception $e)
|
try {
|
||||||
{
|
$oGateWay = GatewayPeer::retrieveByPK( $GatewayUid );
|
||||||
$con->rollback();
|
if (! is_null( $oGateWay )) {
|
||||||
throw($e);
|
$oConnection->begin();
|
||||||
}
|
$iResult = $oGateWay->delete();
|
||||||
}
|
$oConnection->commit();
|
||||||
|
//return $iResult;
|
||||||
public function remove($GatewayUid)
|
return true;
|
||||||
{
|
} else {
|
||||||
$oConnection = Propel::getConnection(GatewayPeer::DATABASE_NAME);
|
throw (new Exception( 'This row does not exist!' ));
|
||||||
try {
|
}
|
||||||
$oGateWay = GatewayPeer::retrieveByPK($GatewayUid);
|
} catch (Exception $oError) {
|
||||||
if (!is_null($oGateWay))
|
$oConnection->rollback();
|
||||||
{
|
throw ($oError);
|
||||||
$oConnection->begin();
|
}
|
||||||
$iResult = $oGateWay->delete();
|
}
|
||||||
$oConnection->commit();
|
|
||||||
//return $iResult;
|
/**
|
||||||
return true;
|
* verify if Gateway row specified in [GatUid] exists.
|
||||||
}
|
*
|
||||||
else {
|
* @param string $sProUid the uid of the Prolication
|
||||||
throw(new Exception('This row does not exist!'));
|
*/
|
||||||
}
|
|
||||||
}
|
public function gatewayExists ($GatUid)
|
||||||
catch (Exception $oError) {
|
{
|
||||||
$oConnection->rollback();
|
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
throw($oError);
|
try {
|
||||||
}
|
$oPro = GatewayPeer::retrieveByPk( $GatUid );
|
||||||
}
|
if (is_object( $oPro ) && get_class( $oPro ) == 'Gateway') {
|
||||||
|
return true;
|
||||||
/**
|
} else {
|
||||||
* verify if Gateway row specified in [GatUid] exists.
|
return false;
|
||||||
*
|
}
|
||||||
* @param string $sProUid the uid of the Prolication
|
} catch (Exception $oError) {
|
||||||
*/
|
throw ($oError);
|
||||||
|
}
|
||||||
function gatewayExists ( $GatUid ) {
|
}
|
||||||
$con = Propel::getConnection(GatewayPeer::DATABASE_NAME);
|
|
||||||
try {
|
/**
|
||||||
$oPro = GatewayPeer::retrieveByPk( $GatUid );
|
* create a new Gateway
|
||||||
if ( is_object($oPro) && get_class ($oPro) == 'Gateway' ) {
|
*
|
||||||
return true;
|
* @param array $aData with new values
|
||||||
}
|
* @return void
|
||||||
else {
|
*/
|
||||||
return false;
|
public function createRow ($aData)
|
||||||
}
|
{
|
||||||
}
|
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
catch (Exception $oError) {
|
try {
|
||||||
throw($oError);
|
$con->begin();
|
||||||
}
|
|
||||||
}
|
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
|
if ($this->validate()) {
|
||||||
/**
|
$this->setGatUid( (isset( $aData['GAT_UID'] ) ? $aData['GAT_UID'] : '') );
|
||||||
* create a new Gateway
|
$this->setProUid( (isset( $aData['PRO_UID'] ) ? $aData['PRO_UID'] : '') );
|
||||||
*
|
$this->setTasUid( (isset( $aData['TAS_UID'] ) ? $aData['TAS_UID'] : '') );
|
||||||
* @param array $aData with new values
|
$this->setGatNextTask( (isset( $aData['GAT_NEXT_TASK'] ) ? $aData['GAT_NEXT_TASK'] : '') );
|
||||||
* @return void
|
$this->setGatX( (isset( $aData['GAT_X'] ) ? $aData['GAT_X'] : '') );
|
||||||
*/
|
$this->setGatY( (isset( $aData['GAT_Y'] ) ? $aData['GAT_Y'] : '') );
|
||||||
function createRow($aData)
|
$this->save();
|
||||||
{
|
$con->commit();
|
||||||
$con = Propel::getConnection(GatewayPeer::DATABASE_NAME);
|
return;
|
||||||
try
|
} else {
|
||||||
{
|
$con->rollback();
|
||||||
$con->begin();
|
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||||
|
$e->aValidationFailures = $this->getValidationFailures();
|
||||||
$this->fromArray($aData,BasePeer::TYPE_FIELDNAME);
|
throw ($e);
|
||||||
if($this->validate())
|
}
|
||||||
{
|
} catch (Exception $e) {
|
||||||
$this->setGatUid((isset($aData['GAT_UID']) ? $aData['GAT_UID']: ''));
|
$con->rollback();
|
||||||
$this->setProUid((isset($aData['PRO_UID']) ? $aData['PRO_UID']: ''));
|
throw ($e);
|
||||||
$this->setTasUid((isset($aData['TAS_UID']) ? $aData['TAS_UID']: ''));
|
}
|
||||||
$this->setGatNextTask((isset($aData['GAT_NEXT_TASK']) ? $aData['GAT_NEXT_TASK']: ''));
|
}
|
||||||
$this->setGatX((isset($aData['GAT_X']) ? $aData['GAT_X']: ''));
|
}
|
||||||
$this->setGatY((isset($aData['GAT_Y']) ? $aData['GAT_Y']: ''));
|
// Gateway
|
||||||
$this->save();
|
|
||||||
$con->commit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$con->rollback();
|
|
||||||
$e=new Exception("Failed Validation in class ".get_class($this).".");
|
|
||||||
$e->aValidationFailures=$this->getValidationFailures();
|
|
||||||
throw($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
|
||||||
throw($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Gateway
|
|
||||||
|
|||||||
@@ -1,162 +1,160 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ReportVar.php
|
* ReportVar.php
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*/
|
* @package workflow.engine.classes.model
|
||||||
|
*/
|
||||||
require_once 'classes/model/om/BaseReportVar.php';
|
|
||||||
|
require_once 'classes/model/om/BaseReportVar.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'REPORT_VAR' table.
|
* Skeleton subclass for representing a row from the 'REPORT_VAR' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
* You should add additional methods to this class to meet the
|
||||||
* application requirements. This class will only be generated as
|
* application requirements. This class will only be generated as
|
||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class ReportVar extends BaseReportVar {
|
class ReportVar extends BaseReportVar
|
||||||
/*
|
{
|
||||||
|
/*
|
||||||
* Load the report var registry
|
* Load the report var registry
|
||||||
* @param string $sRepVarUid
|
* @param string $sRepVarUid
|
||||||
* @return variant
|
* @return variant
|
||||||
*/
|
*/
|
||||||
public function load($sRepVarUid)
|
public function load ($sRepVarUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
||||||
if (!is_null($oReportVar))
|
if (! is_null( $oReportVar )) {
|
||||||
{
|
$aFields = $oReportVar->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$aFields = $oReportVar->toArray(BasePeer::TYPE_FIELDNAME);
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
return $aFields;
|
||||||
return $aFields;
|
} else {
|
||||||
}
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
else {
|
}
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
} catch (Exception $oError) {
|
||||||
}
|
throw ($oError);
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
}
|
||||||
throw($oError);
|
|
||||||
}
|
/**
|
||||||
}
|
* Create the report var registry
|
||||||
|
*
|
||||||
/**
|
* @param array $aData
|
||||||
* Create the report var registry
|
* @return string
|
||||||
* @param array $aData
|
*
|
||||||
* @return string
|
*/
|
||||||
**/
|
public function create ($aData)
|
||||||
public function create($aData)
|
{
|
||||||
{
|
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
$oConnection = Propel::getConnection(ReportVarPeer::DATABASE_NAME);
|
try {
|
||||||
try {
|
if (isset( $aData['REP_VAR_UID'] ) && $aData['REP_VAR_UID'] == '') {
|
||||||
if ( isset ( $aData['REP_VAR_UID'] ) && $aData['REP_VAR_UID']== '' )
|
unset( $aData['REP_VAR_UID'] );
|
||||||
unset ( $aData['REP_VAR_UID'] );
|
}
|
||||||
if ( !isset ( $aData['REP_VAR_UID'] ) )
|
if (! isset( $aData['REP_VAR_UID'] )) {
|
||||||
$aData['REP_VAR_UID'] = G::generateUniqueID();
|
$aData['REP_VAR_UID'] = G::generateUniqueID();
|
||||||
$oReportVar = new ReportVar();
|
}
|
||||||
$oReportVar->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oReportVar = new ReportVar();
|
||||||
if ($oReportVar->validate()) {
|
$oReportVar->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
$oConnection->begin();
|
if ($oReportVar->validate()) {
|
||||||
$iResult = $oReportVar->save();
|
$oConnection->begin();
|
||||||
$oConnection->commit();
|
$iResult = $oReportVar->save();
|
||||||
return $aData['REP_VAR_UID'];
|
$oConnection->commit();
|
||||||
}
|
return $aData['REP_VAR_UID'];
|
||||||
else {
|
} else {
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oReportVar->getValidationFailures();
|
$aValidationFailures = $oReportVar->getValidationFailures();
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
}
|
}
|
||||||
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
$oConnection->rollback();
|
||||||
$oConnection->rollback();
|
throw ($oError);
|
||||||
throw($oError);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Update the report var registry
|
||||||
* Update the report var registry
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
public function update($aData)
|
*/
|
||||||
{
|
public function update ($aData)
|
||||||
$oConnection = Propel::getConnection(ReportVarPeer::DATABASE_NAME);
|
{
|
||||||
try {
|
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
$oReportVar = ReportVarPeer::retrieveByPK($aData['REP_VAR_UID']);
|
try {
|
||||||
if (!is_null($oReportVar))
|
$oReportVar = ReportVarPeer::retrieveByPK( $aData['REP_VAR_UID'] );
|
||||||
{
|
if (! is_null( $oReportVar )) {
|
||||||
$oReportVar->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oReportVar->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oReportVar->validate()) {
|
if ($oReportVar->validate()) {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
$iResult = $oReportVar->save();
|
$iResult = $oReportVar->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
$sMessage = '';
|
||||||
$sMessage = '';
|
$aValidationFailures = $oReportVar->getValidationFailures();
|
||||||
$aValidationFailures = $oReportVar->getValidationFailures();
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
}
|
||||||
}
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||||
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
|
}
|
||||||
}
|
} else {
|
||||||
}
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
else {
|
}
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
} catch (Exception $oError) {
|
||||||
}
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
catch (Exception $oError) {
|
}
|
||||||
$oConnection->rollback();
|
}
|
||||||
throw($oError);
|
|
||||||
}
|
/**
|
||||||
}
|
* Remove the report var registry
|
||||||
|
*
|
||||||
/**
|
* @param array $aData
|
||||||
* Remove the report var registry
|
* @return string
|
||||||
* @param array $aData
|
*
|
||||||
* @return string
|
*/
|
||||||
**/
|
public function remove ($sRepVarUid)
|
||||||
public function remove($sRepVarUid)
|
{
|
||||||
{
|
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
$oConnection = Propel::getConnection(ReportVarPeer::DATABASE_NAME);
|
try {
|
||||||
try {
|
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
||||||
$oReportVar = ReportVarPeer::retrieveByPK($sRepVarUid);
|
if (! is_null( $oReportVar )) {
|
||||||
if (!is_null($oReportVar))
|
$oConnection->begin();
|
||||||
{
|
$iResult = $oReportVar->delete();
|
||||||
$oConnection->begin();
|
$oConnection->commit();
|
||||||
$iResult = $oReportVar->delete();
|
return $iResult;
|
||||||
$oConnection->commit();
|
} else {
|
||||||
return $iResult;
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
else {
|
} catch (Exception $oError) {
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
}
|
||||||
$oConnection->rollback();
|
|
||||||
throw($oError);
|
public function reportVarExists ($sRepVarUid)
|
||||||
}
|
{
|
||||||
}
|
$con = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
|
try {
|
||||||
function reportVarExists ( $sRepVarUid ) {
|
$oRepVarUid = ReportVarPeer::retrieveByPk( $sRepVarUid );
|
||||||
$con = Propel::getConnection(ReportVarPeer::DATABASE_NAME);
|
if (is_object( $oRepVarUid ) && get_class( $oRepVarUid ) == 'ReportVar') {
|
||||||
try {
|
return true;
|
||||||
$oRepVarUid = ReportVarPeer::retrieveByPk( $sRepVarUid );
|
} else {
|
||||||
if (is_object($oRepVarUid) && get_class ($oRepVarUid) == 'ReportVar' ) {
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
else {
|
throw ($oError);
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
// ReportVar
|
||||||
throw($oError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // ReportVar
|
|
||||||
|
|||||||
@@ -1,166 +1,153 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* SubProcess.php
|
* SubProcess.php
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*/
|
* @package workflow.engine.classes.model
|
||||||
|
*/
|
||||||
require_once 'classes/model/om/BaseSubProcess.php';
|
|
||||||
|
require_once 'classes/model/om/BaseSubProcess.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'SUB_PROCESS' table.
|
* Skeleton subclass for representing a row from the 'SUB_PROCESS' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
* You should add additional methods to this class to meet the
|
||||||
* application requirements. This class will only be generated as
|
* application requirements. This class will only be generated as
|
||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class SubProcess extends BaseSubProcess {
|
class SubProcess extends BaseSubProcess
|
||||||
|
{
|
||||||
public function load($SP_UID)
|
|
||||||
{
|
public function load ($SP_UID)
|
||||||
try {
|
{
|
||||||
$oRow = SubProcessPeer::retrieveByPK( $SP_UID );
|
try {
|
||||||
if (!is_null($oRow))
|
$oRow = SubProcessPeer::retrieveByPK( $SP_UID );
|
||||||
{
|
if (! is_null( $oRow )) {
|
||||||
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$this->setNew(false);
|
$this->setNew( false );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
throw (new Exception( "The row '$SP_UID' in table SubProcess doesn't exist!" ));
|
||||||
throw( new Exception( "The row '$SP_UID' in table SubProcess doesn't exist!" ));
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
}
|
throw ($oError);
|
||||||
catch (Exception $oError) {
|
}
|
||||||
throw($oError);
|
}
|
||||||
}
|
|
||||||
}
|
public function create ($aData)
|
||||||
|
{
|
||||||
public function create($aData)
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
{
|
try {
|
||||||
$con = Propel::getConnection(SubProcessPeer::DATABASE_NAME);
|
$con->begin();
|
||||||
try
|
if (isset( $aData['SP_UID'] ) && $aData['SP_UID'] == '') {
|
||||||
{
|
unset( $aData['SP_UID'] );
|
||||||
$con->begin();
|
}
|
||||||
if ( isset ( $aData['SP_UID'] ) && $aData['SP_UID']== '' )
|
if (! isset( $aData['SP_UID'] )) {
|
||||||
unset ( $aData['SP_UID'] );
|
$this->setSpUid( G::generateUniqueID() );
|
||||||
if ( !isset ( $aData['SP_UID'] ) )
|
} else {
|
||||||
$this->setSpUid(G::generateUniqueID());
|
$this->setSpUid( $aData['SP_UID'] );
|
||||||
else
|
}
|
||||||
$this->setSpUid($aData['SP_UID'] );
|
|
||||||
|
$this->setProUid( $aData['PRO_UID'] );
|
||||||
$this->setProUid($aData['PRO_UID']);
|
|
||||||
|
$this->setTasUid( $aData['TAS_UID'] );
|
||||||
$this->setTasUid($aData['TAS_UID']);
|
|
||||||
|
$this->setProParent( $aData['PRO_PARENT'] );
|
||||||
$this->setProParent($aData['PRO_PARENT']);
|
|
||||||
|
$this->setTasParent( $aData['TAS_PARENT'] );
|
||||||
$this->setTasParent($aData['TAS_PARENT']);
|
|
||||||
|
$this->setSpType( $aData['SP_TYPE'] );
|
||||||
$this->setSpType($aData['SP_TYPE']);
|
|
||||||
|
$this->setSpSynchronous( $aData['SP_SYNCHRONOUS'] );
|
||||||
$this->setSpSynchronous($aData['SP_SYNCHRONOUS']);
|
|
||||||
|
$this->setSpSynchronousType( $aData['SP_SYNCHRONOUS_TYPE'] );
|
||||||
$this->setSpSynchronousType($aData['SP_SYNCHRONOUS_TYPE']);
|
|
||||||
|
$this->setSpSynchronousWait( $aData['SP_SYNCHRONOUS_WAIT'] );
|
||||||
$this->setSpSynchronousWait($aData['SP_SYNCHRONOUS_WAIT']);
|
|
||||||
|
$this->setSpVariablesOut( $aData['SP_VARIABLES_OUT'] );
|
||||||
$this->setSpVariablesOut($aData['SP_VARIABLES_OUT']);
|
|
||||||
|
$this->setSpVariablesIn( $aData['SP_VARIABLES_IN'] );
|
||||||
$this->setSpVariablesIn($aData['SP_VARIABLES_IN']);
|
|
||||||
|
$this->setSpGridIn( $aData['SP_GRID_IN'] );
|
||||||
$this->setSpGridIn($aData['SP_GRID_IN']);
|
|
||||||
|
if ($this->validate()) {
|
||||||
if($this->validate())
|
$result = $this->save();
|
||||||
{
|
$con->commit();
|
||||||
$result=$this->save();
|
return $result;
|
||||||
$con->commit();
|
} else {
|
||||||
return $result;
|
$con->rollback();
|
||||||
}
|
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||||
else
|
}
|
||||||
{
|
} catch (Exception $e) {
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw(new Exception("Failed Validation in class ".get_class($this)."."));
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
|
||||||
{
|
public function update ($fields)
|
||||||
$con->rollback();
|
{
|
||||||
throw($e);
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
}
|
try {
|
||||||
}
|
$con->begin();
|
||||||
public function update($fields)
|
$this->load( $fields['SP_UID'] );
|
||||||
{
|
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||||
$con = Propel::getConnection(SubProcessPeer::DATABASE_NAME);
|
if ($this->validate()) {
|
||||||
try
|
$result = $this->save();
|
||||||
{
|
$con->commit();
|
||||||
$con->begin();
|
return $result;
|
||||||
$this->load($fields['SP_UID']);
|
} else {
|
||||||
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
|
$con->rollback();
|
||||||
if($this->validate())
|
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||||
{
|
$validationE->aValidationFailures = $this->getValidationFailures();
|
||||||
$result=$this->save();
|
throw ($validationE);
|
||||||
$con->commit();
|
}
|
||||||
return $result;
|
} catch (Exception $e) {
|
||||||
}
|
$con->rollback();
|
||||||
else
|
throw ($e);
|
||||||
{
|
}
|
||||||
$con->rollback();
|
}
|
||||||
$validationE=new Exception("Failed Validation in class ".get_class($this).".");
|
|
||||||
$validationE->aValidationFailures = $this->getValidationFailures();
|
public function remove ($SP_UID)
|
||||||
throw($validationE);
|
{
|
||||||
}
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
}
|
try {
|
||||||
catch(Exception $e)
|
$con->begin();
|
||||||
{
|
$oRepTab = SubProcessPeer::retrieveByPK( $SP_UID );
|
||||||
$con->rollback();
|
if (! is_null( $oRepTab )) {
|
||||||
throw($e);
|
$result = $oRepTab->delete();
|
||||||
}
|
$con->commit();
|
||||||
}
|
}
|
||||||
public function remove($SP_UID)
|
return $result;
|
||||||
{
|
} catch (Exception $e) {
|
||||||
$con = Propel::getConnection(SubProcessPeer::DATABASE_NAME);
|
$con->rollback();
|
||||||
try
|
throw ($e);
|
||||||
{
|
}
|
||||||
$con->begin();
|
}
|
||||||
$oRepTab = SubProcessPeer::retrieveByPK( $SP_UID );
|
|
||||||
if (!is_null($oRepTab)) {
|
/**
|
||||||
$result = $oRepTab->delete();
|
* verify if Trigger row specified in [sUid] exists.
|
||||||
$con->commit();
|
*
|
||||||
}
|
* @param string $sUid the uid of the Prolication
|
||||||
return $result;
|
*/
|
||||||
}
|
|
||||||
catch(Exception $e)
|
public function subProcessExists ($sUid)
|
||||||
{
|
{
|
||||||
$con->rollback();
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
throw($e);
|
try {
|
||||||
}
|
$oObj = SubProcessPeer::retrieveByPk( $sUid );
|
||||||
}
|
if (is_object( $oObj ) && get_class( $oObj ) == 'SubProcess') {
|
||||||
|
return true;
|
||||||
/**
|
} else {
|
||||||
* verify if Trigger row specified in [sUid] exists.
|
return false;
|
||||||
*
|
}
|
||||||
* @param string $sUid the uid of the Prolication
|
} catch (Exception $oError) {
|
||||||
*/
|
throw ($oError);
|
||||||
|
}
|
||||||
function subProcessExists ( $sUid ) {
|
}
|
||||||
$con = Propel::getConnection(SubProcessPeer::DATABASE_NAME);
|
}
|
||||||
try {
|
// SubProcess
|
||||||
$oObj = SubProcessPeer::retrieveByPk( $sUid );
|
|
||||||
if (is_object($oObj) && get_class ($oObj) == 'SubProcess' ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $oError) {
|
|
||||||
throw($oError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // SubProcess
|
|
||||||
|
|||||||
@@ -1,237 +1,232 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* SwimlanesElements.php
|
* SwimlanesElements.php
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*
|
* @package workflow.engine.classes.model
|
||||||
* ProcessMaker Open Source Edition
|
*
|
||||||
* Copyright (C) 2004 - 2011 Colosa Inc.
|
* 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
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* License, or (at your option) any later version.
|
* 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
|
* This program is distributed in the hope that it will be useful,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* GNU Affero General Public License for more details.
|
* 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/>.
|
* 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.
|
* 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/BaseSwimlanesElements.php';
|
|
||||||
require_once 'classes/model/Content.php';
|
require_once 'classes/model/om/BaseSwimlanesElements.php';
|
||||||
|
require_once 'classes/model/Content.php';
|
||||||
/**
|
|
||||||
* Skeleton subclass for representing a row from the 'SWIMLANES_ELEMENTS' table.
|
/**
|
||||||
*
|
* Skeleton subclass for representing a row from the 'SWIMLANES_ELEMENTS' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
*
|
||||||
* application requirements. This class will only be generated as
|
* You should add additional methods to this class to meet the
|
||||||
* long as it does not already exist in the input directory.
|
* application requirements. This class will only be generated as
|
||||||
*
|
* long as it does not already exist in the input directory.
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*/
|
* @package workflow.engine.classes.model
|
||||||
class SwimlanesElements extends BaseSwimlanesElements {
|
*/
|
||||||
|
class SwimlanesElements extends BaseSwimlanesElements
|
||||||
/**
|
{
|
||||||
* This value goes in the content table
|
|
||||||
* @var string
|
/**
|
||||||
*/
|
* This value goes in the content table
|
||||||
protected $swi_text = '';
|
*
|
||||||
|
* @var string
|
||||||
/*
|
*/
|
||||||
|
protected $swi_text = '';
|
||||||
|
|
||||||
|
/*
|
||||||
* Load the application document registry
|
* Load the application document registry
|
||||||
* @param string $sAppDocUid
|
* @param string $sAppDocUid
|
||||||
* @return variant
|
* @return variant
|
||||||
*/
|
*/
|
||||||
public function load($sSwiEleUid)
|
public function load ($sSwiEleUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK($sSwiEleUid);
|
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $sSwiEleUid );
|
||||||
if (!is_null($oSwimlanesElements))
|
if (! is_null( $oSwimlanesElements )) {
|
||||||
{
|
$aFields = $oSwimlanesElements->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$aFields = $oSwimlanesElements->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields['SWI_TEXT'] = $oSwimlanesElements->getSwiEleText();
|
||||||
$aFields['SWI_TEXT'] = $oSwimlanesElements->getSwiEleText();
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
return $aFields;
|
||||||
return $aFields;
|
} else {
|
||||||
}
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
else {
|
}
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
} catch (Exception $oError) {
|
||||||
}
|
throw ($oError);
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
}
|
||||||
throw($oError);
|
|
||||||
}
|
/**
|
||||||
}
|
* Create the application document registry
|
||||||
|
*
|
||||||
/**
|
* @param array $aData
|
||||||
* Create the application document registry
|
* @return string
|
||||||
* @param array $aData
|
*
|
||||||
* @return string
|
*/
|
||||||
**/
|
public function create ($aData)
|
||||||
public function create($aData)
|
{
|
||||||
{
|
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
$oConnection = Propel::getConnection(SwimlanesElementsPeer::DATABASE_NAME);
|
try {
|
||||||
try {
|
$aData['SWI_UID'] = G::generateUniqueID();
|
||||||
$aData['SWI_UID'] = G::generateUniqueID();
|
$oSwimlanesElements = new SwimlanesElements();
|
||||||
$oSwimlanesElements = new SwimlanesElements();
|
$oSwimlanesElements->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
$oSwimlanesElements->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
if ($oSwimlanesElements->validate()) {
|
||||||
if ($oSwimlanesElements->validate()) {
|
$oConnection->begin();
|
||||||
$oConnection->begin();
|
if (isset( $aData['SWI_TEXT'] )) {
|
||||||
if (isset($aData['SWI_TEXT'])) {
|
$oSwimlanesElements->setSwiEleText( $aData['SWI_TEXT'] );
|
||||||
$oSwimlanesElements->setSwiEleText($aData['SWI_TEXT']);
|
}
|
||||||
}
|
$iResult = $oSwimlanesElements->save();
|
||||||
$iResult = $oSwimlanesElements->save();
|
$oConnection->commit();
|
||||||
$oConnection->commit();
|
return $aData['SWI_UID'];
|
||||||
return $aData['SWI_UID'];
|
} else {
|
||||||
}
|
$sMessage = '';
|
||||||
else {
|
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
||||||
$sMessage = '';
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
}
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
|
} catch (Exception $oError) {
|
||||||
}
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
catch (Exception $oError) {
|
}
|
||||||
$oConnection->rollback();
|
}
|
||||||
throw($oError);
|
|
||||||
}
|
/**
|
||||||
}
|
* Update the application document registry
|
||||||
|
*
|
||||||
/**
|
* @param array $aData
|
||||||
* Update the application document registry
|
* @return string
|
||||||
* @param array $aData
|
*
|
||||||
* @return string
|
*/
|
||||||
**/
|
public function update ($aData)
|
||||||
public function update($aData)
|
{
|
||||||
{
|
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
$oConnection = Propel::getConnection(SwimlanesElementsPeer::DATABASE_NAME);
|
try {
|
||||||
try {
|
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $aData['SWI_UID'] );
|
||||||
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK($aData['SWI_UID']);
|
if (! is_null( $oSwimlanesElements )) {
|
||||||
if (!is_null($oSwimlanesElements))
|
$oSwimlanesElements->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
{
|
if ($oSwimlanesElements->validate()) {
|
||||||
$oSwimlanesElements->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oConnection->begin();
|
||||||
if ($oSwimlanesElements->validate()) {
|
if (isset( $aData['SWI_TEXT'] )) {
|
||||||
$oConnection->begin();
|
$oSwimlanesElements->setSwiEleText( $aData['SWI_TEXT'] );
|
||||||
if (isset($aData['SWI_TEXT']))
|
}
|
||||||
{
|
$iResult = $oSwimlanesElements->save();
|
||||||
$oSwimlanesElements->setSwiEleText($aData['SWI_TEXT']);
|
$oConnection->commit();
|
||||||
}
|
return $iResult;
|
||||||
$iResult = $oSwimlanesElements->save();
|
} else {
|
||||||
$oConnection->commit();
|
$sMessage = '';
|
||||||
return $iResult;
|
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
||||||
}
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
else {
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
$sMessage = '';
|
}
|
||||||
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
}
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
} else {
|
||||||
}
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
}
|
$oConnection->rollback();
|
||||||
else {
|
throw ($oError);
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception $oError) {
|
/**
|
||||||
$oConnection->rollback();
|
* Remove the application document registry
|
||||||
throw($oError);
|
*
|
||||||
}
|
* @param array $aData
|
||||||
}
|
* @return string
|
||||||
|
*
|
||||||
/**
|
*/
|
||||||
* Remove the application document registry
|
public function remove ($sSwiEleUid)
|
||||||
* @param array $aData
|
{
|
||||||
* @return string
|
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
**/
|
try {
|
||||||
public function remove($sSwiEleUid)
|
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $sSwiEleUid );
|
||||||
{
|
if (! is_null( $oSwimlanesElements )) {
|
||||||
$oConnection = Propel::getConnection(SwimlanesElementsPeer::DATABASE_NAME);
|
$oConnection->begin();
|
||||||
try {
|
Content::removeContent( 'SWI_TEXT', '', $oSwimlanesElements->getSwiUid() );
|
||||||
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK($sSwiEleUid);
|
$iResult = $oSwimlanesElements->delete();
|
||||||
if (!is_null($oSwimlanesElements))
|
$oConnection->commit();
|
||||||
{
|
return $iResult;
|
||||||
$oConnection->begin();
|
} else {
|
||||||
Content::removeContent('SWI_TEXT', '', $oSwimlanesElements->getSwiUid());
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
$iResult = $oSwimlanesElements->delete();
|
}
|
||||||
$oConnection->commit();
|
} catch (Exception $oError) {
|
||||||
return $iResult;
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
else {
|
}
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
}
|
||||||
}
|
|
||||||
}
|
public function swimlanesElementsExists ($sSwiEleUid)
|
||||||
catch (Exception $oError) {
|
{
|
||||||
$oConnection->rollback();
|
$con = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
throw($oError);
|
try {
|
||||||
}
|
$oSwiEleUid = SwimlanesElementsPeer::retrieveByPk( $sSwiEleUid );
|
||||||
}
|
if (is_object( $oSwiEleUid ) && get_class( $oSwiEleUid ) == 'SwimlanesElements') {
|
||||||
|
return true;
|
||||||
function swimlanesElementsExists ( $sSwiEleUid ) {
|
} else {
|
||||||
$con = Propel::getConnection(SwimlanesElementsPeer::DATABASE_NAME);
|
return false;
|
||||||
try {
|
}
|
||||||
$oSwiEleUid = SwimlanesElementsPeer::retrieveByPk( $sSwiEleUid );
|
} catch (Exception $oError) {
|
||||||
if (is_object($oSwiEleUid) && get_class ($oSwiEleUid) == 'SwimlanesElements' ) {
|
throw ($oError);
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return false;
|
/**
|
||||||
}
|
* Get the [swi_text] column value.
|
||||||
}
|
*
|
||||||
catch (Exception $oError) {
|
* @return string
|
||||||
throw($oError);
|
*/
|
||||||
}
|
public function getSwiEleText ()
|
||||||
}
|
{
|
||||||
|
if ($this->swi_text == '') {
|
||||||
/**
|
try {
|
||||||
* Get the [swi_text] column value.
|
$this->swi_text = Content::load( 'SWI_TEXT', '', $this->getSwiUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en') );
|
||||||
* @return string
|
} catch (Exception $oError) {
|
||||||
*/
|
throw ($oError);
|
||||||
public function getSwiEleText()
|
}
|
||||||
{
|
}
|
||||||
if ($this->swi_text == '') {
|
return $this->swi_text;
|
||||||
try {
|
}
|
||||||
$this->swi_text = Content::load('SWI_TEXT', '', $this->getSwiUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'));
|
|
||||||
}
|
/**
|
||||||
catch (Exception $oError) {
|
* Set the [swi_text] column value.
|
||||||
throw($oError);
|
*
|
||||||
}
|
* @param string $sValue new value
|
||||||
}
|
* @return void
|
||||||
return $this->swi_text;
|
*/
|
||||||
}
|
public function setSwiEleText ($sValue)
|
||||||
|
{
|
||||||
/**
|
if ($sValue !== null && ! is_string( $sValue )) {
|
||||||
* Set the [swi_text] column value.
|
$sValue = (string) $sValue;
|
||||||
*
|
}
|
||||||
* @param string $sValue new value
|
if ($this->swi_text !== $sValue || $sValue === '') {
|
||||||
* @return void
|
try {
|
||||||
*/
|
$this->swi_text = $sValue;
|
||||||
public function setSwiEleText($sValue)
|
|
||||||
{
|
$iResult = Content::addContent( 'SWI_TEXT', '', $this->getSwiUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->swi_text );
|
||||||
if ($sValue !== null && !is_string($sValue)) {
|
} catch (Exception $oError) {
|
||||||
$sValue = (string)$sValue;
|
$this->swi_text = '';
|
||||||
}
|
throw ($oError);
|
||||||
if ($this->swi_text !== $sValue || $sValue === '') {
|
}
|
||||||
try {
|
}
|
||||||
$this->swi_text = $sValue;
|
}
|
||||||
|
}
|
||||||
$iResult = Content::addContent('SWI_TEXT', '', $this->getSwiUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->swi_text);
|
// SwimlanesElements
|
||||||
}
|
|
||||||
catch (Exception $oError) {
|
|
||||||
$this->swi_text = '';
|
|
||||||
throw($oError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // SwimlanesElements
|
|
||||||
|
|||||||
@@ -1,198 +1,198 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* TaskUser.php
|
* TaskUser.php
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*
|
* @package workflow.engine.classes.model
|
||||||
* ProcessMaker Open Source Edition
|
*
|
||||||
* Copyright (C) 2004 - 2011 Colosa Inc.
|
* 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
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* License, or (at your option) any later version.
|
* 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
|
* This program is distributed in the hope that it will be useful,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* GNU Affero General Public License for more details.
|
* 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/>.
|
* 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.
|
* 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/BaseTaskUser.php';
|
|
||||||
require_once 'classes/model/Content.php';
|
require_once 'classes/model/om/BaseTaskUser.php';
|
||||||
|
require_once 'classes/model/Content.php';
|
||||||
/**
|
|
||||||
* Skeleton subclass for representing a row from the 'GROUP_USER' table.
|
/**
|
||||||
*
|
* Skeleton subclass for representing a row from the 'GROUP_USER' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
*
|
||||||
* application requirements. This class will only be generated as
|
* You should add additional methods to this class to meet the
|
||||||
* long as it does not already exist in the input directory.
|
* application requirements. This class will only be generated as
|
||||||
*
|
* long as it does not already exist in the input directory.
|
||||||
* @package workflow.engine.classes.model
|
*
|
||||||
*/
|
* @package workflow.engine.classes.model
|
||||||
class TaskUser extends BaseTaskUser {
|
*/
|
||||||
|
class TaskUser extends BaseTaskUser
|
||||||
/**
|
{
|
||||||
* Create the application document registry
|
|
||||||
* @param array $aData
|
/**
|
||||||
* @return string
|
* Create the application document registry
|
||||||
**/
|
*
|
||||||
public function create($aData)
|
* @param array $aData
|
||||||
{
|
* @return string
|
||||||
$oConnection = Propel::getConnection(TaskUserPeer::DATABASE_NAME);
|
*
|
||||||
try {
|
*/
|
||||||
$taskUser = TaskUserPeer::retrieveByPK($aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION']);
|
public function create ($aData)
|
||||||
|
{
|
||||||
if( is_object($taskUser) )
|
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||||
return -1;
|
try {
|
||||||
|
$taskUser = TaskUserPeer::retrieveByPK( $aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION'] );
|
||||||
$oTaskUser = new TaskUser();
|
|
||||||
$oTaskUser->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
if (is_object( $taskUser )) {
|
||||||
if ($oTaskUser->validate()) {
|
return - 1;
|
||||||
$oConnection->begin();
|
}
|
||||||
$iResult = $oTaskUser->save();
|
$oTaskUser = new TaskUser();
|
||||||
$oConnection->commit();
|
$oTaskUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
return $iResult;
|
if ($oTaskUser->validate()) {
|
||||||
}
|
$oConnection->begin();
|
||||||
else {
|
$iResult = $oTaskUser->save();
|
||||||
$sMessage = '';
|
$oConnection->commit();
|
||||||
$aValidationFailures = $oTaskUser->getValidationFailures();
|
return $iResult;
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
} else {
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
$sMessage = '';
|
||||||
}
|
$aValidationFailures = $oTaskUser->getValidationFailures();
|
||||||
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
}
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
$oConnection->rollback();
|
}
|
||||||
throw($oError);
|
} catch (Exception $oError) {
|
||||||
}
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* Remove the application document registry
|
|
||||||
* @param string $sTasUid
|
/**
|
||||||
* @param string $sUserUid
|
* Remove the application document registry
|
||||||
* @return string
|
*
|
||||||
**/
|
* @param string $sTasUid
|
||||||
public function remove($sTasUid, $sUserUid, $iType, $iRelation)
|
* @param string $sUserUid
|
||||||
{
|
* @return string
|
||||||
$oConnection = Propel::getConnection(TaskUserPeer::DATABASE_NAME);
|
*
|
||||||
try {
|
*/
|
||||||
$oTaskUser = TaskUserPeer::retrieveByPK($sTasUid, $sUserUid, $iType, $iRelation);
|
public function remove ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||||
if (!is_null($oTaskUser))
|
{
|
||||||
{
|
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||||
$oConnection->begin();
|
try {
|
||||||
$iResult = $oTaskUser->delete();
|
$oTaskUser = TaskUserPeer::retrieveByPK( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||||
$oConnection->commit();
|
if (! is_null( $oTaskUser )) {
|
||||||
return $iResult;
|
$oConnection->begin();
|
||||||
}
|
$iResult = $oTaskUser->delete();
|
||||||
else {
|
$oConnection->commit();
|
||||||
throw(new Exception('This row does not exist!'));
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
}
|
throw (new Exception( 'This row does not exist!' ));
|
||||||
catch (Exception $oError) {
|
}
|
||||||
$oConnection->rollback();
|
} catch (Exception $oError) {
|
||||||
throw($oError);
|
$oConnection->rollback();
|
||||||
}
|
throw ($oError);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function TaskUserExists ($sTasUid, $sUserUid, $iType, $iRelation) {
|
|
||||||
$con = Propel::getConnection(TaskUserPeer::DATABASE_NAME);
|
public function TaskUserExists ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||||
try {
|
{
|
||||||
$oTaskUser = TaskUserPeer::retrieveByPk($sTasUid, $sUserUid, $iType, $iRelation);
|
$con = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||||
if ( is_object($oTaskUser) && get_class ($oTaskUser) == 'TaskUser' ) {
|
try {
|
||||||
return true;
|
$oTaskUser = TaskUserPeer::retrieveByPk( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||||
}
|
if (is_object( $oTaskUser ) && get_class( $oTaskUser ) == 'TaskUser') {
|
||||||
else {
|
return true;
|
||||||
return false;
|
} else {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
} catch (Exception $oError) {
|
||||||
throw($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCountAllTaksByGroups(){
|
public function getCountAllTaksByGroups ()
|
||||||
$oCriteria = new Criteria('workflow');
|
{
|
||||||
$oCriteria->addAsColumn('GRP_UID', TaskUserPeer::USR_UID);
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
|
$oCriteria->addAsColumn( 'GRP_UID', TaskUserPeer::USR_UID );
|
||||||
$oCriteria->add(TaskUserPeer::TU_TYPE,1);
|
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||||
$oCriteria->add(TaskUserPeer::TU_RELATION,2);
|
$oCriteria->add( TaskUserPeer::TU_TYPE, 1 );
|
||||||
$oCriteria->addGroupByColumn(TaskUserPeer::USR_UID);
|
$oCriteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||||
$oDataset = TaskUserPeer::doSelectRS($oCriteria);
|
$oCriteria->addGroupByColumn( TaskUserPeer::USR_UID );
|
||||||
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
$oDataset = TaskUserPeer::doSelectRS( $oCriteria );
|
||||||
$aRows = Array();
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
while ($oDataset->next()){
|
$aRows = Array ();
|
||||||
$row = $oDataset->getRow();
|
while ($oDataset->next()) {
|
||||||
$aRows[$row['GRP_UID']] = $row['CNT'];
|
$row = $oDataset->getRow();
|
||||||
}
|
$aRows[$row['GRP_UID']] = $row['CNT'];
|
||||||
return $aRows;
|
}
|
||||||
}
|
return $aRows;
|
||||||
|
}
|
||||||
//erik: new functions
|
//erik: new functions
|
||||||
function getUsersTask($TAS_UID, $TU_TYPE=1){
|
public function getUsersTask ($TAS_UID, $TU_TYPE = 1)
|
||||||
|
{
|
||||||
require_once 'classes/model/Users.php';
|
require_once 'classes/model/Users.php';
|
||||||
|
|
||||||
$groupsTask = array();
|
$groupsTask = array ();
|
||||||
$usersTask = array();
|
$usersTask = array ();
|
||||||
|
|
||||||
//getting task's users
|
//getting task's users
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria( 'workflow' );
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
$criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
$criteria->addSelectColumn( UsersPeer::USR_LASTNAME );
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
$criteria->addSelectColumn( UsersPeer::USR_USERNAME );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
|
$criteria->addSelectColumn( TaskUserPeer::TAS_UID );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
|
$criteria->addSelectColumn( TaskUserPeer::USR_UID );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::TU_TYPE);
|
$criteria->addSelectColumn( TaskUserPeer::TU_TYPE );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
|
$criteria->addSelectColumn( TaskUserPeer::TU_RELATION );
|
||||||
$criteria->addJoin(TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
$criteria->addJoin( TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
|
||||||
$criteria->add(TaskUserPeer::TAS_UID, $TAS_UID);
|
$criteria->add( TaskUserPeer::TAS_UID, $TAS_UID );
|
||||||
$criteria->add(TaskUserPeer::TU_TYPE, $TU_TYPE);
|
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||||
$criteria->add(TaskUserPeer::TU_RELATION, 1);
|
$criteria->add( TaskUserPeer::TU_RELATION, 1 );
|
||||||
|
|
||||||
$dataset = TaskUserPeer::doSelectRS($criteria);
|
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
while ($dataset->next())
|
while ($dataset->next()) {
|
||||||
$usersTask[] = $dataset->getRow();
|
$usersTask[] = $dataset->getRow();
|
||||||
|
}
|
||||||
//getting task's groups
|
//getting task's groups
|
||||||
$delimiter = DBAdapter::getStringDelimiter ();
|
$delimiter = DBAdapter::getStringDelimiter();
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria( 'workflow' );
|
||||||
$criteria->addAsColumn('GRP_TITLE', 'CONTENT.CON_VALUE');
|
$criteria->addAsColumn( 'GRP_TITLE', 'CONTENT.CON_VALUE' );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
|
$criteria->addSelectColumn( TaskUserPeer::TAS_UID );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
|
$criteria->addSelectColumn( TaskUserPeer::USR_UID );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::TU_TYPE);
|
$criteria->addSelectColumn( TaskUserPeer::TU_TYPE );
|
||||||
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
|
$criteria->addSelectColumn( TaskUserPeer::TU_RELATION );
|
||||||
$aConditions[] = array(TaskUserPeer::USR_UID, 'CONTENT.CON_ID');
|
$aConditions[] = array (TaskUserPeer::USR_UID,'CONTENT.CON_ID');
|
||||||
$aConditions[] = array('CONTENT.CON_CATEGORY', $delimiter . 'GRP_TITLE' . $delimiter);
|
$aConditions[] = array ('CONTENT.CON_CATEGORY',$delimiter . 'GRP_TITLE' . $delimiter);
|
||||||
$aConditions[] = array('CONTENT.CON_LANG', $delimiter . SYS_LANG . $delimiter);
|
$aConditions[] = array ('CONTENT.CON_LANG',$delimiter . SYS_LANG . $delimiter);
|
||||||
$criteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
$criteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
|
||||||
$criteria->add(TaskUserPeer::TAS_UID, $TAS_UID);
|
$criteria->add( TaskUserPeer::TAS_UID, $TAS_UID );
|
||||||
$criteria->add(TaskUserPeer::TU_TYPE, $TU_TYPE);
|
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||||
$criteria->add(TaskUserPeer::TU_RELATION, 2);
|
$criteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||||
$dataset = TaskUserPeer::doSelectRS($criteria);
|
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||||
|
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||||
$dataset = TaskUserPeer::doSelectRS($criteria);
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
while ($dataset->next()) {
|
||||||
while( $dataset->next() )
|
$usersTask[] = $dataset->getRow();
|
||||||
$usersTask[] = $dataset->getRow();
|
}
|
||||||
|
$result->data = $usersTask;
|
||||||
$result->data = $usersTask;
|
$result->totalCount = sizeof( $usersTask );
|
||||||
$result->totalCount = sizeof($usersTask);
|
|
||||||
|
return $result;
|
||||||
return $result;
|
}
|
||||||
}
|
}
|
||||||
|
// TaskUser
|
||||||
} // TaskUser
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user