CODE STYLE class/model/ files

This commit is contained in:
Fernando Ontiveros
2012-10-22 05:57:53 -04:00
parent ea98460f99
commit 14c64af8c5
45 changed files with 3066 additions and 3250 deletions

View File

@@ -20,7 +20,6 @@ require_once 'classes/model/om/BaseAdditionalTables.php';
*/ */
class AdditionalTables extends BaseAdditionalTables class AdditionalTables extends BaseAdditionalTables
{ {
public $fields = array(); public $fields = array();
public $primaryKeys = array(); public $primaryKeys = array();
@@ -28,7 +27,7 @@ class AdditionalTables extends BaseAdditionalTables
* Function load * Function load
* access public * access public
*/ */
public function load($sUID, $bFields=false) public function load($sUID, $bFields = false)
{ {
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID); $oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
@@ -82,7 +81,7 @@ class AdditionalTables extends BaseAdditionalTables
return $this->fields; return $this->fields;
} }
public function getPrimaryKeys($type='complete') public function getPrimaryKeys($type = 'complete')
{ {
$this->primaryKeys = array(); $this->primaryKeys = array();
foreach ($this->fields as $field) { foreach ($this->fields as $field) {
@@ -136,7 +135,7 @@ class AdditionalTables extends BaseAdditionalTables
/** /**
* Create & Update function * Create & Update function
*/ */
public function create($aData, $aFields=array()) public function create($aData, $aFields = array())
{ {
if (!isset($aData['ADD_TAB_UID']) || (isset($aData['ADD_TAB_UID']) && $aData['ADD_TAB_UID'] == '')) { if (!isset($aData['ADD_TAB_UID']) || (isset($aData['ADD_TAB_UID']) && $aData['ADD_TAB_UID'] == '')) {
$aData['ADD_TAB_UID'] = G::generateUniqueID(); $aData['ADD_TAB_UID'] = G::generateUniqueID();
@@ -177,7 +176,7 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
public function update($aData, $aFields=array()) public function update($aData, $aFields = array())
{ {
$oConnection = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME); $oConnection = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME);
try { try {
@@ -188,16 +187,6 @@ class AdditionalTables extends BaseAdditionalTables
$oConnection->begin(); $oConnection->begin();
$iResult = $oAdditionalTables->save(); $iResult = $oAdditionalTables->save();
$oConnection->commit(); $oConnection->commit();
/* * * DEPRECATED
require_once 'classes/model/ShadowTable.php';
$oShadowTable = new ShadowTable();
$oShadowTable->create(array('ADD_TAB_UID' => $aData['ADD_TAB_UID'],
'SHD_ACTION' => 'ALTER',
'SHD_DETAILS' => serialize($aFields),
'USR_UID' => (isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''),
'APP_UID' => '',
'SHD_DATE' => date('Y-m-d H:i:s')));
return $iResult; */
} else { } else {
$sMessage = ''; $sMessage = '';
$aValidationFailures = $oAdditionalTables->getValidationFailures(); $aValidationFailures = $oAdditionalTables->getValidationFailures();
@@ -320,7 +309,7 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
public function getAllData($sUID, $start=null, $limit=null, $keyOrderUppercase=true) public function getAllData($sUID, $start = null, $limit = null, $keyOrderUppercase = true)
{ {
$addTab = new AdditionalTables(); $addTab = new AdditionalTables();
$aData = $addTab->load($sUID, true); $aData = $addTab->load($sUID, true);
@@ -568,7 +557,7 @@ class AdditionalTables extends BaseAdditionalTables
* @param string $sGrid * @param string $sGrid
* @return number * @return number
*/ */
public function populateReportTable($tableName, $sConnection='rp', $type='NORMAL', $processUid='', $gridKey='') public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '')
{ {
require_once "classes/model/Application.php"; require_once "classes/model/Application.php";
@@ -727,7 +716,7 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
public function getTableVars($uid, $bWhitType=false) public function getTableVars($uid, $bWhitType = false)
{ {
require_once 'classes/model/Fields.php'; require_once 'classes/model/Fields.php';
try { try {
@@ -761,7 +750,7 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
public function getAll($start=0, $limit=20, $filter='', $process=null) public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
{ {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID); $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
@@ -839,14 +828,6 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
// // fltering by proces title
// if(isset($filter['process'])) {
// foreach ($addTables as $i => $addTable) {
// if (strpos($addTable['PRO_TITLE'], $filter['process']) === false)
// unset($addTables[$i]);
// }
// }
return array('rows' => $addTables, 'count' => $count); return array('rows' => $addTables, 'count' => $count);
} }
@@ -856,7 +837,7 @@ class AdditionalTables extends BaseAdditionalTables
* Don't use this method, it was left only for backward compatibility * Don't use this method, it was left only for backward compatibility
* for some external plugins that still is using it * for some external plugins that still is using it
*/ */
public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection='workflow') public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection = 'workflow')
{ {
try { try {
/* $aUID = array('FLD_NAME' => 'PM_UNIQUE_ID', /* $aUID = array('FLD_NAME' => 'PM_UNIQUE_ID',
@@ -1257,5 +1238,4 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
} }
// AdditionalTables

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AdditionalTablesPeer extends BaseAdditionalTablesPeer { class AdditionalTablesPeer extends BaseAdditionalTablesPeer
{
}
} // AdditionalTablesPeer

View File

@@ -34,7 +34,7 @@ class AppCacheView extends BaseAppCacheView
public $confCasesList; public $confCasesList;
public $pathToAppCacheFiles; public $pathToAppCacheFiles;
public function getAllCounters($aTypes, $userUid, $processSummary=false) public function getAllCounters($aTypes, $userUid, $processSummary = false)
{ {
$aResult = array(); $aResult = array();
@@ -248,7 +248,7 @@ class AppCacheView extends BaseAppCacheView
* @param string $sUIDUser * @param string $sUIDUser
* @return $rows * @return $rows
*/ */
public function getSelfServiceTasks($userUid='') public function getSelfServiceTasks($userUid = '')
{ {
$rows[] = array(); $rows[] = array();
$tasks = array(); $tasks = array();
@@ -304,7 +304,8 @@ class AppCacheView extends BaseAppCacheView
return $tasks; return $tasks;
} }
public function getSelfServiceCasesByEvaluate($userUid) { public function getSelfServiceCasesByEvaluate($userUid)
{
$cases = array(); $cases = array();
//check groups assigned to SelfService task //check groups assigned to SelfService task
@@ -853,7 +854,7 @@ class AppCacheView extends BaseAppCacheView
* @param Boolean $doCount * @param Boolean $doCount
* @return Criteria * @return Criteria
*/ */
public function getGeneralCases($doCount='false') public function getGeneralCases($doCount = 'false')
{ {
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) { if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
@@ -1021,7 +1022,7 @@ class AppCacheView extends BaseAppCacheView
return $row[0]; return $row[0];
} }
public function checkGrantsForUser($root=false) public function checkGrantsForUser($root = false)
{ {
try { try {
if ($root) { if ($root) {
@@ -1144,7 +1145,7 @@ class AppCacheView extends BaseAppCacheView
* Insert an app delegatiojn trigger * Insert an app delegatiojn trigger
* @return void * @return void
*/ */
public function triggerAppDelegationInsert($lang, $recreate=false) public function triggerAppDelegationInsert($lang, $recreate = false)
{ {
$con = Propel::getConnection("workflow"); $con = Propel::getConnection("workflow");
$stmt = $con->createStatement(); $stmt = $con->createStatement();
@@ -1191,7 +1192,7 @@ class AppCacheView extends BaseAppCacheView
* update the App Delegation triggers * update the App Delegation triggers
* @return void * @return void
*/ */
public function triggerAppDelegationUpdate($lang, $recreate=false) public function triggerAppDelegationUpdate($lang, $recreate = false)
{ {
$con = Propel::getConnection("workflow"); $con = Propel::getConnection("workflow");
$stmt = $con->createStatement(); $stmt = $con->createStatement();
@@ -1238,7 +1239,7 @@ class AppCacheView extends BaseAppCacheView
* update the Application triggers * update the Application triggers
* @return void * @return void
*/ */
public function triggerApplicationUpdate($lang, $recreate=false) public function triggerApplicationUpdate($lang, $recreate = false)
{ {
$con = Propel::getConnection("workflow"); $con = Propel::getConnection("workflow");
$stmt = $con->createStatement(); $stmt = $con->createStatement();
@@ -1283,7 +1284,7 @@ class AppCacheView extends BaseAppCacheView
* update the Application triggers * update the Application triggers
* @return void * @return void
*/ */
public function triggerApplicationDelete($lang, $recreate=false) public function triggerApplicationDelete($lang, $recreate = false)
{ {
$con = Propel::getConnection("workflow"); $con = Propel::getConnection("workflow");
$stmt = $con->createStatement(); $stmt = $con->createStatement();
@@ -1324,7 +1325,7 @@ class AppCacheView extends BaseAppCacheView
return 'exists'; return 'exists';
} }
public function triggerContentUpdate($lang, $recreate=false) public function triggerContentUpdate($lang, $recreate = false)
{ {
$cnn = Propel::getConnection("workflow"); $cnn = Propel::getConnection("workflow");
$stmt = $cnn->createStatement(); $stmt = $cnn->createStatement();
@@ -1456,7 +1457,7 @@ class AppCacheView extends BaseAppCacheView
return $aRows; return $aRows;
} }
public function appTitleByTaskCaseLabelUpdate($taskUid, $lang, $cron=0) public function appTitleByTaskCaseLabelUpdate($taskUid, $lang, $cron = 0)
{ {
$taskDefTitle = null; $taskDefTitle = null;
@@ -1537,5 +1538,4 @@ class AppCacheView extends BaseAppCacheView
} }
} }
} }
//AppCacheView

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppCacheViewPeer extends BaseAppCacheViewPeer { class AppCacheViewPeer extends BaseAppCacheViewPeer
{
}
} // AppCacheViewPeer

View File

@@ -18,7 +18,8 @@ require_once 'classes/model/om/BaseAppDelay.php';
* /** * /**
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppDelay extends BaseAppDelay { class AppDelay extends BaseAppDelay
{
/** /**
* Create the application delay registry * Create the application delay registry
* @param array $aData * @param array $aData
@@ -28,10 +29,12 @@ class AppDelay extends BaseAppDelay {
{ {
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME); $oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try { try {
if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' ) if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' ) {
unset ( $aData['APP_DELAY_UID'] ); unset ( $aData['APP_DELAY_UID'] );
if ( !isset ( $aData['APP_DELAY_UID'] ) ) }
if ( !isset ( $aData['APP_DELAY_UID'] ) ) {
$aData['APP_DELAY_UID'] = G::generateUniqueID(); $aData['APP_DELAY_UID'] = G::generateUniqueID();
}
$oAppDelay = new AppDelay(); $oAppDelay = new AppDelay();
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME); $oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) { if ($oAppDelay->validate()) {
@@ -39,17 +42,15 @@ class AppDelay extends BaseAppDelay {
$iResult = $oAppDelay->save(); $iResult = $oAppDelay->save();
$oConnection->commit(); $oConnection->commit();
return $aData['APP_DELAY_UID']; return $aData['APP_DELAY_UID'];
} } else {
else {
$sMessage = ''; $sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures(); $aValidationFailures = $oAppDelay->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);
} }
@@ -65,35 +66,32 @@ class AppDelay extends BaseAppDelay {
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME); $oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try { try {
$oAppDelay = AppDelayPeer::retrieveByPK($aData['APP_DELAY_UID']); $oAppDelay = AppDelayPeer::retrieveByPK($aData['APP_DELAY_UID']);
if (!is_null($oAppDelay)) if (!is_null($oAppDelay)) {
{
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME); $oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) { if ($oAppDelay->validate()) {
$oConnection->begin(); $oConnection->begin();
$iResult = $oAppDelay->save(); $iResult = $oAppDelay->save();
$oConnection->commit(); $oConnection->commit();
return $iResult; return $iResult;
} } else {
else {
$sMessage = ''; $sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures(); $aValidationFailures = $oAppDelay->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 {
else {
throw(new Exception('This row doesn\'t exist!')); throw(new Exception('This row doesn\'t exist!'));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
$oConnection->rollback(); $oConnection->rollback();
throw($oError); throw($oError);
} }
} }
function isPaused($appUid, $delIndex){ public function isPaused($appUid, $delIndex)
{
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->add(AppDelayPeer::APP_UID, $appUid); $oCriteria->add(AppDelayPeer::APP_UID, $appUid);
$oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex); $oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex);
@@ -113,10 +111,12 @@ class AppDelay extends BaseAppDelay {
$oDataset->next(); $oDataset->next();
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
if( $aRow ) if ( $aRow ) {
return true; return true;
else } else {
return false; return false;
}
} }
} // AppDelay }

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppDelayPeer extends BaseAppDelayPeer { class AppDelayPeer extends BaseAppDelayPeer
{
}
} // AppDelayPeer

View File

@@ -56,9 +56,8 @@ class AppDelegation extends BaseAppDelegation
* @param $isSubprocess is a subprocess inside a process? * @param $isSubprocess is a subprocess inside a process?
* @return delegation index of the application delegation. * @return delegation index of the application delegation.
*/ */
function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null) public function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null)
{ {
if (! isset( $sProUid ) || strlen( $sProUid ) == 0) { if (! isset( $sProUid ) || strlen( $sProUid ) == 0) {
throw (new Exception( 'Column "PRO_UID" cannot be null.' )); throw (new Exception( 'Column "PRO_UID" cannot be null.' ));
} }
@@ -159,7 +158,7 @@ class AppDelegation extends BaseAppDelegation
* @return array $Fields the fields * @return array $Fields the fields
*/ */
function Load ($AppUid, $sDelIndex) public function Load ($AppUid, $sDelIndex)
{ {
$con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME ); $con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME );
try { try {
@@ -213,7 +212,7 @@ class AppDelegation extends BaseAppDelegation
} }
} }
function remove ($sApplicationUID, $iDelegationIndex) public function remove ($sApplicationUID, $iDelegationIndex)
{ {
$oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME );
try { try {
@@ -232,7 +231,7 @@ class AppDelegation extends BaseAppDelegation
// TasTypeDay = 1 => working days // TasTypeDay = 1 => working days
// TasTypeDay = 2 => calendar days // TasTypeDay = 2 => calendar days
function calculateDueDate ($sNextTasParam) public function calculateDueDate ($sNextTasParam)
{ {
//Get Task properties //Get Task properties
$task = TaskPeer::retrieveByPK( $this->getTasUid() ); $task = TaskPeer::retrieveByPK( $this->getTasUid() );
@@ -272,7 +271,7 @@ class AppDelegation extends BaseAppDelegation
return $iDueDate; return $iDueDate;
} }
function getDiffDate ($date1, $date2) public function getDiffDate ($date1, $date2)
{ {
return ($date1 - $date2) / (24 * 60 * 60); //days return ($date1 - $date2) / (24 * 60 * 60); //days
return ($date1 - $date2) / 3600; return ($date1 - $date2) / 3600;
@@ -445,23 +444,15 @@ class AppDelegation extends BaseAppDelegation
//and finally save the record //and finally save the record
$RES = $oAppDel->save(); $RES = $oAppDel->save();
//print "<tr><td>$iDelegateDate </td><td>$iInitDate </td><td>$iDueDate </td><td>$iFinishDate </td><td>$isStarted </td><td>$isFinished </td><td>$isDelayed</td><td>$queueDuration </td><td>$delDuration </td>" .
// "<td>$delayDuration</td><td>$overduePercentage</td><td>" . $row['DEL_INDEX'] . " $RES </td></tr>";
//UPDATE APP_DELEGATION SET DEL_DELAYED = 0
//where
// APP_OVERDUE_PERCENTAGE < 0
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
} }
} catch (Exception $oError) { } catch (Exception $oError) {
error_log( $oError->getMessage() ); error_log( $oError->getMessage() );
} }
} }
function getLastDeleration ($APP_UID) public function getLastDeleration ($APP_UID)
{ {
$c = new Criteria( 'workflow' ); $c = new Criteria( 'workflow' );
$c->addSelectColumn( AppDelegationPeer::APP_UID ); $c->addSelectColumn( AppDelegationPeer::APP_UID );
@@ -486,5 +477,4 @@ class AppDelegation extends BaseAppDelegation
return $rs->getRow(); return $rs->getRow();
} }
} }
// AppDelegation

View File

@@ -42,6 +42,7 @@
* /** * /**
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppDelegationPeer extends BaseAppDelegationPeer { class AppDelegationPeer extends BaseAppDelegationPeer
{
}
} // AppDelegationPeer

View File

@@ -578,7 +578,7 @@ class AppDocument extends BaseAppDocument
return $res; return $res;
} }
function getObject ($APP_UID, $DEL_INDEX, $STEP_UID_OBJ, $APP_DOC_TYPE) public function getObject ($APP_UID, $DEL_INDEX, $STEP_UID_OBJ, $APP_DOC_TYPE)
{ {
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppDocumentPeer::APP_UID, $APP_UID ); $oCriteria->add( AppDocumentPeer::APP_UID, $APP_UID );
@@ -617,5 +617,4 @@ class AppDocument extends BaseAppDocument
return $documents; return $documents;
} }
} }
// AppDocument

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppDocumentPeer extends BaseAppDocumentPeer { class AppDocumentPeer extends BaseAppDocumentPeer
{
}
} // AppDocumentPeer

View File

@@ -37,7 +37,7 @@ class AppEvent extends BaseAppEvent
} }
} }
function create ($aData) public function create ($aData)
{ {
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try { try {
@@ -62,7 +62,7 @@ class AppEvent extends BaseAppEvent
} }
} }
function update ($aData) public function update ($aData)
{ {
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try { try {
@@ -91,7 +91,7 @@ class AppEvent extends BaseAppEvent
} }
} }
function remove ($sApplicationUID, $iDelegation, $sEvnUid) public function remove ($sApplicationUID, $iDelegation, $sEvnUid)
{ {
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try { try {
@@ -110,7 +110,7 @@ class AppEvent extends BaseAppEvent
} }
} }
function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '') public function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '')
{ {
try { try {
require_once 'classes/model/Event.php'; require_once 'classes/model/Event.php';
@@ -347,12 +347,11 @@ class AppEvent extends BaseAppEvent
} }
} }
function close ($APP_UID, $DEL_INDEX) public function close ($APP_UID, $DEL_INDEX)
{ {
$aRow = $this->load( $APP_UID, $DEL_INDEX ); $aRow = $this->load( $APP_UID, $DEL_INDEX );
$aRow['APP_EVN_STATUS'] = 'CLOSE'; $aRow['APP_EVN_STATUS'] = 'CLOSE';
$this->update( $aRow ); $this->update( $aRow );
} }
} }
// AppEvent

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppEventPeer extends BaseAppEventPeer { class AppEventPeer extends BaseAppEventPeer
{
}
} // AppEventPeer

View File

@@ -31,10 +31,9 @@ class AppFolder extends BaseAppFolder
* @param strin(32) $folderParent * @param strin(32) $folderParent
* @return Ambigous <>|number * @return Ambigous <>|number
*/ */
function createFolder ($folderName, $folderParent = "/", $action = "createifnotexists") public function createFolder ($folderName, $folderParent = "/", $action = "createifnotexists")
{ {
$validActions = array ("createifnotexists","create","update" $validActions = array ("createifnotexists","create","update");
);
if (! in_array( $action, $validActions )) { if (! in_array( $action, $validActions )) {
$action = "createifnotexists"; $action = "createifnotexists";
} }
@@ -93,7 +92,7 @@ class AppFolder extends BaseAppFolder
* @param strin(32) $sessionID * @param strin(32) $sessionID
* @return string Last Folder ID generated * @return string Last Folder ID generated
*/ */
function createFromPath ($folderPath, $sessionID = "") public function createFromPath ($folderPath, $sessionID = "")
{ {
if ($sessionID == "") { if ($sessionID == "") {
$sessionID = $_SESSION['APPLICATION']; $sessionID = $_SESSION['APPLICATION'];
@@ -121,7 +120,7 @@ class AppFolder extends BaseAppFolder
* @param string(32) $sessionID Application ID * @param string(32) $sessionID Application ID
* @return string * @return string
*/ */
function parseTags ($fileTags, $sessionID = "") public function parseTags ($fileTags, $sessionID = "")
{ {
if ($sessionID == "") { if ($sessionID == "") {
@@ -141,7 +140,7 @@ class AppFolder extends BaseAppFolder
* @param string(32) $folderID * @param string(32) $folderID
* @return multitype: * @return multitype:
*/ */
function getFolderList ($folderID, $limit = 0, $start = 0) public function getFolderList ($folderID, $limit = 0, $start = 0)
{ {
$Criteria = new Criteria( 'workflow' ); $Criteria = new Criteria( 'workflow' );
$Criteria->clearSelectColumns()->clearOrderByColumns(); $Criteria->clearSelectColumns()->clearOrderByColumns();
@@ -177,7 +176,7 @@ class AppFolder extends BaseAppFolder
* @param string(32) $folderUid * @param string(32) $folderUid
* @return array <multitype:, mixed> * @return array <multitype:, mixed>
*/ */
function load ($folderUid) public function load ($folderUid)
{ {
$tr = AppFolderPeer::retrieveByPK( $folderUid ); $tr = AppFolderPeer::retrieveByPK( $folderUid );
if ((is_object( $tr ) && get_class( $tr ) == 'AppFolder')) { if ((is_object( $tr ) && get_class( $tr ) == 'AppFolder')) {
@@ -203,7 +202,7 @@ class AppFolder extends BaseAppFolder
return $fields; return $fields;
} }
function getFolderStructure ($folderId) public function getFolderStructure ($folderId)
{ {
$folderObj = $this->load( $folderId ); $folderObj = $this->load( $folderId );
$folderArray[$folderObj['FOLDER_UID']] = array ("NAME" => $folderObj['FOLDER_NAME'],"PARENT" => $folderObj['FOLDER_PARENT_UID'] $folderArray[$folderObj['FOLDER_UID']] = array ("NAME" => $folderObj['FOLDER_NAME'],"PARENT" => $folderObj['FOLDER_PARENT_UID']
@@ -220,7 +219,7 @@ class AppFolder extends BaseAppFolder
return $folderArray; return $folderArray;
} }
function getFolderContent ($folderID, $docIdFilter = array(), $keyword = null, $searchType = null, $limit = 0, $start = 0, $user = '', $onlyActive = false) public function getFolderContent ($folderID, $docIdFilter = array(), $keyword = null, $searchType = null, $limit = 0, $start = 0, $user = '', $onlyActive = false)
{ {
require_once ("classes/model/AppDocument.php"); require_once ("classes/model/AppDocument.php");
require_once ("classes/model/InputDocument.php"); require_once ("classes/model/InputDocument.php");
@@ -308,7 +307,8 @@ class AppFolder extends BaseAppFolder
} }
} elseif ($lastVersion == $row['DOC_VERSION']) { } elseif ($lastVersion == $row['DOC_VERSION']) {
//Only Last Document version //Only Last Document version
if ($searchType == "ALL") { // If search in name of docs is active then filter if ($searchType == "ALL") {
// If search in name of docs is active then filter
if ((stripos( $completeInfo['APP_DOC_FILENAME'], $keyword ) !== false) || (stripos( $completeInfo['APP_DOC_TAGS'], $keyword ) !== false)) { if ((stripos( $completeInfo['APP_DOC_FILENAME'], $keyword ) !== false) || (stripos( $completeInfo['APP_DOC_TAGS'], $keyword ) !== false)) {
$response['documents'][] = $completeInfo; $response['documents'][] = $completeInfo;
} }
@@ -325,7 +325,7 @@ class AppFolder extends BaseAppFolder
return ($response); return ($response);
} }
function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId) public function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId)
{ {
require_once ("classes/model/AppDocument.php"); require_once ("classes/model/AppDocument.php");
require_once ("classes/model/InputDocument.php"); require_once ("classes/model/InputDocument.php");
@@ -339,7 +339,8 @@ class AppFolder extends BaseAppFolder
G::LoadClass( 'process' ); G::LoadClass( 'process' );
$oProcess = new Process(); $oProcess = new Process();
if (($oApp->exists( $appUid )) || ($appUid == "00000000000000000000000000000000")) { if (($oApp->exists( $appUid )) || ($appUid == "00000000000000000000000000000000")) {
if ($appUid == "00000000000000000000000000000000") { //External Files if ($appUid == "00000000000000000000000000000000") {
//External Files
$row1 = $oAppDocument->load( $appDocUid, $docVersion ); $row1 = $oAppDocument->load( $appDocUid, $docVersion );
$row2 = array ('PRO_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' )); $row2 = array ('PRO_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
$row3 = array ('APP_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' )); $row3 = array ('APP_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
@@ -400,7 +401,6 @@ class AppFolder extends BaseAppFolder
$downloadLabel1 = ""; $downloadLabel1 = "";
} }
///////
if (! empty( $row1["APP_DOC_PLUGIN"] )) { if (! empty( $row1["APP_DOC_PLUGIN"] )) {
$pluginRegistry = &PMPluginRegistry::getSingleton(); $pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginName = $row1["APP_DOC_PLUGIN"]; $pluginName = $row1["APP_DOC_PLUGIN"];
@@ -434,7 +434,6 @@ class AppFolder extends BaseAppFolder
$row1["APP_DOC_PLUGIN"] = $fieldValue; $row1["APP_DOC_PLUGIN"] = $fieldValue;
} }
break; break;
default: default:
$row4 = array (); $row4 = array ();
$versioningEnabled = false; $versioningEnabled = false;
@@ -473,8 +472,7 @@ class AppFolder extends BaseAppFolder
} }
//**** End get docinfo //**** End get docinfo
$infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 ); $infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 );
//krumo($infoMerged);
//****************************************************************************************************
$sUserUID = $_SESSION['USER_LOGGED']; $sUserUID = $_SESSION['USER_LOGGED'];
$aObjectPermissions = array (); $aObjectPermissions = array ();
if (isset( $infoMerged['PRO_UID'] )) { if (isset( $infoMerged['PRO_UID'] )) {
@@ -508,12 +506,11 @@ class AppFolder extends BaseAppFolder
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1); $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
} }
} }
//****************************************************************************************************
return array_merge( $infoMerged, $aObjectPermissions ); return array_merge( $infoMerged, $aObjectPermissions );
} }
} }
function getFolderChilds ($folderID, $folderArray) public function getFolderChilds ($folderID, $folderArray)
{ {
$folderList = $this->getFolderList( $folderID ); $folderList = $this->getFolderList( $folderID );
$foldersList = array (); $foldersList = array ();
@@ -524,7 +521,7 @@ class AppFolder extends BaseAppFolder
return (array_merge( $folderArray, $foldersList )); return (array_merge( $folderArray, $foldersList ));
} }
function getFolderTags ($rootFolder) public function getFolderTags ($rootFolder)
{ {
$folderArray[$rootFolder] = $rootFolder; $folderArray[$rootFolder] = $rootFolder;
$foldersToProcess = $this->getFolderChilds( $rootFolder, $folderArray ); $foldersToProcess = $this->getFolderChilds( $rootFolder, $folderArray );
@@ -536,22 +533,21 @@ class AppFolder extends BaseAppFolder
foreach ($filesList as $key => $fileInfo) { foreach ($filesList as $key => $fileInfo) {
$fileTags = explode( ",", $fileInfo['APP_DOC_TAGS'] ); $fileTags = explode( ",", $fileInfo['APP_DOC_TAGS'] );
foreach ($fileTags as $key1 => $tag) { foreach ($fileTags as $key1 => $tag) {
if (! (isset( $tagsInfo[$tag] ))) if (! (isset( $tagsInfo[$tag] ))) {
$tagsInfo[$tag] = 0; $tagsInfo[$tag] = 0;
}
$tagsInfo[$tag] ++; $tagsInfo[$tag] ++;
} }
} }
} }
return $tagsInfo; return $tagsInfo;
} }
function remove ($FolderUid, $rootfolder) public function remove ($FolderUid, $rootfolder)
{ {
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( AppFolderPeer::FOLDER_UID, $FolderUid ); $oCriteria->add( AppFolderPeer::FOLDER_UID, $FolderUid );
AppFolderPeer::doDelete( $oCriteria ); AppFolderPeer::doDelete( $oCriteria );
} }
} }
// AppFolder

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppFolderPeer extends BaseAppFolderPeer { class AppFolderPeer extends BaseAppFolderPeer
{
}
} // AppFolderPeer

View File

@@ -18,10 +18,10 @@ require_once 'classes/model/om/BaseAppHistory.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppHistory extends BaseAppHistory { class AppHistory extends BaseAppHistory
{
function insertHistory($aData){ public function insertHistory($aData)
{
$this->setAppUid($aData['APP_UID']); $this->setAppUid($aData['APP_UID']);
$this->setDelIndex($aData['DEL_INDEX']); $this->setDelIndex($aData['DEL_INDEX']);
$this->setProUid($aData['PRO_UID']); $this->setProUid($aData['PRO_UID']);
@@ -32,28 +32,20 @@ class AppHistory extends BaseAppHistory {
$this->setHistoryDate($aData['APP_UPDATE_DATE']); $this->setHistoryDate($aData['APP_UPDATE_DATE']);
$this->setHistoryData($aData['APP_DATA']); $this->setHistoryData($aData['APP_DATA']);
if ($this->validate() ) { if ($this->validate() ) {
$res = $this->save(); $res = $this->save();
} } else {
else {
// Something went wrong. We can now get the validationFailures and handle them. // Something went wrong. We can now get the validationFailures and handle them.
$msg = ''; $msg = '';
$validationFailuresArray = $this->getValidationFailures(); $validationFailuresArray = $this->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) { foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>"; $msg .= $objValidationFailure->getMessage() . "<br/>";
} }
krumo($msg); }
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
} }
public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
{
}
function getDynaformHistory($PRO_UID,$TAS_UID,$APP_UID,$DYN_UID=""){
G::LoadClass('case'); G::LoadClass('case');
$oCase = new Cases(); $oCase = new Cases();
@@ -66,33 +58,26 @@ class AppHistory extends BaseAppHistory {
} }
if (!isset($aObjectPermissions['DYNAFORMS'])) { if (!isset($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1); $aObjectPermissions['DYNAFORMS'] = array(-1);
} } else {
else {
if (!is_array($aObjectPermissions['DYNAFORMS'])) { if (!is_array($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1); $aObjectPermissions['DYNAFORMS'] = array(-1);
} }
} }
if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) { if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1); $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
} } else {
else {
if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) { if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1); $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
} }
} }
if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) { if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1); $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
} } else {
else {
if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) { if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1); $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
} }
} }
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->addSelectColumn(AppHistoryPeer::APP_UID); $c->addSelectColumn(AppHistoryPeer::APP_UID);
$c->addSelectColumn(AppHistoryPeer::DEL_INDEX); $c->addSelectColumn(AppHistoryPeer::DEL_INDEX);
@@ -108,12 +93,11 @@ class AppHistory extends BaseAppHistory {
$c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)"); $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
$c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); $c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
//WHERE //WHERE
$c->add(AppHistoryPeer::DYN_UID, $aObjectPermissions['DYNAFORMS'], Criteria::IN); $c->add(AppHistoryPeer::DYN_UID, $aObjectPermissions['DYNAFORMS'], Criteria::IN);
$c->add(AppHistoryPeer::PRO_UID, $PRO_UID); $c->add(AppHistoryPeer::PRO_UID, $PRO_UID);
$c->add(AppHistoryPeer::APP_UID, $APP_UID); $c->add(AppHistoryPeer::APP_UID, $APP_UID);
if((isset($DYN_UID))&&($DYN_UID!="")){ if ((isset($DYN_UID))&&($DYN_UID!="")) {
$c->add(AppHistoryPeer::DYN_UID, $DYN_UID); $c->add(AppHistoryPeer::DYN_UID, $DYN_UID);
} }
@@ -121,7 +105,6 @@ class AppHistory extends BaseAppHistory {
$c->clearOrderByColumns(); $c->clearOrderByColumns();
$c->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE); $c->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
//Execute //Execute
$oDataset = AppHistoryPeer::doSelectRS($c); $oDataset = AppHistoryPeer::doSelectRS($c);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
@@ -133,34 +116,33 @@ class AppHistory extends BaseAppHistory {
); );
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$o = new Dynaform(); $o = new Dynaform();
$o->setDynUid($aRow['DYN_UID']); $o->setDynUid($aRow['DYN_UID']);
$aRow['DYN_TITLE'] = $o->getDynTitle(); $aRow['DYN_TITLE'] = $o->getDynTitle();
$changedValues=unserialize($aRow['HISTORY_DATA']); $changedValues=unserialize($aRow['HISTORY_DATA']);
$html="<table border='0' cellpadding='0' cellspacing='0'>"; $html="<table border='0' cellpadding='0' cellspacing='0'>";
$sw_add=false; $sw_add=false;
foreach($changedValues as $key =>$value){ foreach ($changedValues as $key => $value) {
if(($value!=NULL)&&(!is_array($value))){ if (($value!=null) && (!is_array($value))) {
$sw_add=true; $sw_add=true;
$html.="<tr>"; $html.="<tr>";
$html.="<td><b>$key:</b> </td>"; $html.="<td><b>$key:</b> </td>";
$html.="<td>$value</td>"; $html.="<td>$value</td>";
$html.="</tr>"; $html.="</tr>";
} }
if(is_array($value)){ if (is_array($value)) {
$html.="<tr>"; $html.="<tr>";
$html.="<td><b>$key (grid):</b> </td>"; $html.="<td><b>$key (grid):</b> </td>";
$html.="<td>"; $html.="<td>";
$html.="<table>"; $html.="<table>";
foreach($value as $key1 =>$value1){ foreach ($value as $key1 => $value1) {
$html.="<tr>"; $html.="<tr>";
$html.="<td><b>$key1</b></td>"; $html.="<td><b>$key1</b></td>";
$html.="<td>"; $html.="<td>";
if(is_array($value1)){ if (is_array($value1)) {
$sw_add=true; $sw_add=true;
$html.="<table>"; $html.="<table>";
foreach($value1 as $key2 =>$value2){ foreach ($value1 as $key2 => $value2) {
$html.="<tr>"; $html.="<tr>";
$html.="<td><b>$key2</b></td>"; $html.="<td><b>$key2</b></td>";
$html.="<td>$value2</td>"; $html.="<td>$value2</td>";
@@ -170,7 +152,6 @@ class AppHistory extends BaseAppHistory {
} }
$html.="</td>"; $html.="</td>";
$html.="</tr>"; $html.="</tr>";
} }
$html.="</table>"; $html.="</table>";
$html.="</td>"; $html.="</td>";
@@ -182,7 +163,7 @@ class AppHistory extends BaseAppHistory {
$aRow['FIELDS'] = $html; $aRow['FIELDS'] = $html;
if($sw_add){ if ($sw_add) {
$aDynHistory[] = $aRow; $aDynHistory[] = $aRow;
} }
$oDataset->next(); $oDataset->next();
@@ -196,7 +177,6 @@ class AppHistory extends BaseAppHistory {
$oCriteria->setDBArrayTable('DynaformsHistory'); $oCriteria->setDBArrayTable('DynaformsHistory');
$oCriteria->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE); $oCriteria->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
return $oCriteria; return $oCriteria;
} }
}
} // AppHistory

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppHistoryPeer extends BaseAppHistoryPeer { class AppHistoryPeer extends BaseAppHistoryPeer
{
}
} // AppHistoryPeer

View File

@@ -121,5 +121,4 @@ class AppMessage extends BaseAppMessage
} }
} }
} }
// AppMessage

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppMessagePeer extends BaseAppMessagePeer { class AppMessagePeer extends BaseAppMessagePeer
{
}
} // AppMessagePeer

View File

@@ -15,7 +15,6 @@ require_once 'classes/model/om/BaseAppNotes.php';
*/ */
class AppNotes extends BaseAppNotes class AppNotes extends BaseAppNotes
{ {
public function getNotesList ($appUid, $usrUid = '', $start = '', $limit = '') public function getNotesList ($appUid, $usrUid = '', $start = '', $limit = '')
{ {
require_once ("classes/model/Users.php"); require_once ("classes/model/Users.php");
@@ -206,25 +205,8 @@ class AppNotes extends BaseAppNotes
$sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields ); $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'] != '') {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP;
$fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE'];
if ( ! file_exists ( $fileTemplate ) ) {
throw new Exception("Template file '$fileTemplate' does not exist.");
}
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
} else {*/
$sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) ); $sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) );
/*}*/
G::LoadClass( 'spool' ); G::LoadClass( 'spool' );
$oUser = new Users(); $oUser = new Users();
$recipientsArray = explode( ",", $noteRecipients ); $recipientsArray = explode( ",", $noteRecipients );

View File

@@ -18,6 +18,7 @@
* *
* @package classes.model * @package classes.model
*/ */
class AppNotesPeer extends BaseAppNotesPeer { class AppNotesPeer extends BaseAppNotesPeer
{
}
} // AppNotesPeer

View File

@@ -38,6 +38,7 @@ require_once 'classes/model/om/BaseAppOwner.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppOwner extends BaseAppOwner { class AppOwner extends BaseAppOwner
{
}
} // AppOwner

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppOwnerPeer extends BaseAppOwnerPeer { class AppOwnerPeer extends BaseAppOwnerPeer
{
}
} // AppOwnerPeer

View File

@@ -15,21 +15,18 @@ require_once 'classes/entities/AppSolrQueue.php';
* *
* @package classes.model * @package classes.model
*/ */
class AppSolrQueue extends BaseAppSolrQueue { class AppSolrQueue extends BaseAppSolrQueue
{
public function exists($sAppUid) public function exists($sAppUid)
{ {
try { try {
$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid ); $oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
if (!is_null($oRow)) if (!is_null($oRow)) {
{
return true; return true;
} } else {
else {
return false; return false;
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
return false; return false;
} }
} }
@@ -37,9 +34,8 @@ class AppSolrQueue extends BaseAppSolrQueue {
public function createUpdate($sAppUid, $iUpdated) public function createUpdate($sAppUid, $iUpdated)
{ {
$con = Propel::getConnection(AppSolrQueuePeer::DATABASE_NAME); $con = Propel::getConnection(AppSolrQueuePeer::DATABASE_NAME);
try try {
{ if ($this->exists($sAppUid)) {
if($this->exists($sAppUid)){
$con->begin(); $con->begin();
//update record //update record
//$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid ); //$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
@@ -49,28 +45,22 @@ class AppSolrQueue extends BaseAppSolrQueue {
//set field //set field
$this->setAppUid($sAppUid); $this->setAppUid($sAppUid);
$this->setAppUpdated($iUpdated); $this->setAppUpdated($iUpdated);
if($this->validate()) if ($this->validate()) {
{
$result=$this->save(); $result=$this->save();
} } else {
else
{
$con->rollback(); $con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this).".")); throw(new Exception("Failed Validation in class ".get_class($this)."."));
} }
$con->commit(); $con->commit();
return $result; return $result;
}else{ } else {
//create record //create record
//set values //set values
$this->setAppUid($sAppUid); $this->setAppUid($sAppUid);
$this->setAppUpdated($iUpdated); $this->setAppUpdated($iUpdated);
if($this->validate()) if ($this->validate()) {
{
$result=$this->save(); $result=$this->save();
} } else {
else
{
$e=new Exception("Failed Validation in class ".get_class($this)."."); $e=new Exception("Failed Validation in class ".get_class($this).".");
//$e->aValidationFailures=$this->getValidationFailures(); //$e->aValidationFailures=$this->getValidationFailures();
throw($e); throw($e);
@@ -78,9 +68,7 @@ class AppSolrQueue extends BaseAppSolrQueue {
$con->commit(); $con->commit();
return $result; return $result;
} }
} } catch (Exception $e) {
catch(Exception $e)
{
$con->rollback(); $con->rollback();
throw($e); throw($e);
} }
@@ -90,10 +78,10 @@ class AppSolrQueue extends BaseAppSolrQueue {
* Returns the list of updated applications * Returns the list of updated applications
* array of Entity_AppSolrQueue * array of Entity_AppSolrQueue
*/ */
public function getListUpdatedApplications(){ public function getListUpdatedApplications()
$updatedApplications = array();
try
{ {
$updatedApplications = array();
try {
$c = new Criteria(); $c = new Criteria();
$c->addSelectColumn(AppSolrQueuePeer::APP_UID); $c->addSelectColumn(AppSolrQueuePeer::APP_UID);
@@ -116,11 +104,11 @@ class AppSolrQueue extends BaseAppSolrQueue {
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
} }
return $updatedApplications; return $updatedApplications;
}catch(Exception $e){ } catch (Exception $e) {
$con->rollback(); $con->rollback();
throw($e); throw($e);
} }
} }
} // AppSolrQueue }

View File

@@ -18,6 +18,7 @@
* *
* @package classes.model * @package classes.model
*/ */
class AppSolrQueuePeer extends BaseAppSolrQueuePeer { class AppSolrQueuePeer extends BaseAppSolrQueuePeer
{
}
} // AppSolrQueuePeer

View File

@@ -38,9 +38,10 @@ require_once 'classes/model/om/BaseAppThread.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppThread extends BaseAppThread { class AppThread extends BaseAppThread
{
function createAppThread ( $sAppUid, $iDelIndex, $iParent ) { public function createAppThread ($sAppUid, $iDelIndex, $iParent)
{
if (!isset($sAppUid) || strlen($sAppUid ) == 0 ) { if (!isset($sAppUid) || strlen($sAppUid ) == 0 ) {
throw ( new Exception ( 'Column "APP_UID" cannot be null.' ) ); throw ( new Exception ( 'Column "APP_UID" cannot be null.' ) );
} }
@@ -71,16 +72,14 @@ class AppThread extends BaseAppThread {
if ($this->validate() ) { if ($this->validate() ) {
try { try {
$res = $this->save(); $res = $this->save();
} } catch ( PropelException $e ) {
catch ( PropelException $e ) {
throw ( $e ); throw ( $e );
} }
} } else {
else {
// Something went wrong. We can now get the validationFailures and handle them. // Something went wrong. We can now get the validationFailures and handle them.
$msg = ''; $msg = '';
$validationFailuresArray = $this->getValidationFailures(); $validationFailuresArray = $this->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) { foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage(); $msg .= $objValidationFailure->getMessage();
} }
throw ( new Exception ( 'Failed Data validation. ' . $msg ) ); throw ( new Exception ( 'Failed Data validation. ' . $msg ) );
@@ -100,23 +99,20 @@ class AppThread extends BaseAppThread {
$res = $oApp->save(); $res = $oApp->save();
$con->commit(); $con->commit();
return $res; return $res;
} } else {
else {
$msg = ''; $msg = '';
foreach($this->getValidationFailures() as $objValidationFailure) foreach ($this->getValidationFailures() as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>"; $msg .= $objValidationFailure->getMessage() . "<br/>";
}
throw ( new PropelException ( 'The AppThread row cannot be created!', new PropelException ( $msg ) ) ); throw ( new PropelException ( 'The AppThread row cannot be created!', new PropelException ( $msg ) ) );
} }
} } else {
else {
$con->rollback(); $con->rollback();
throw(new Exception( "This AppThread row doesn't exist!" )); throw(new Exception( "This AppThread row doesn't exist!" ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
throw($oError); throw($oError);
} }
} }
}
} // AppThread

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppThreadPeer extends BaseAppThreadPeer { class AppThreadPeer extends BaseAppThreadPeer
{
}
} // AppThreadPeer

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ApplicationPeer extends BaseApplicationPeer { class ApplicationPeer extends BaseApplicationPeer
{
}
} // ApplicationPeer

View File

@@ -18,6 +18,7 @@ require_once 'classes/model/om/BaseCalendarAssignments.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarAssignments extends BaseCalendarAssignments { class CalendarAssignments extends BaseCalendarAssignments
{
}
} // CalendarAssignments

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarAssignmentsPeer extends BaseCalendarAssignmentsPeer { class CalendarAssignmentsPeer extends BaseCalendarAssignmentsPeer
{
}
} // CalendarAssignmentsPeer

View File

@@ -18,8 +18,10 @@ require_once 'classes/model/om/BaseCalendarBusinessHours.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarBusinessHours extends BaseCalendarBusinessHours { class CalendarBusinessHours extends BaseCalendarBusinessHours
function getCalendarBusinessHours($CalendarUid){ {
public function getCalendarBusinessHours($CalendarUid)
{
$Criteria = new Criteria('workflow'); $Criteria = new Criteria('workflow');
$Criteria->clearSelectColumns ( ); $Criteria->clearSelectColumns ( );
@@ -28,21 +30,16 @@ class CalendarBusinessHours extends BaseCalendarBusinessHours {
$Criteria->addSelectColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START ); $Criteria->addSelectColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START );
$Criteria->addSelectColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_END ); $Criteria->addSelectColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_END );
$Criteria->add ( CalendarBusinessHoursPeer::CALENDAR_UID, $CalendarUid , CRITERIA::EQUAL ); $Criteria->add ( CalendarBusinessHoursPeer::CALENDAR_UID, $CalendarUid , CRITERIA::EQUAL );
$Criteria->addDescendingOrderByColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_DAY ); $Criteria->addDescendingOrderByColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_DAY );
$Criteria->addAscendingOrderByColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START ); $Criteria->addAscendingOrderByColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START );
//$Criteria->addDescendingOrderByColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START );
$rs = CalendarBusinessHoursPeer::doSelectRS($Criteria); $rs = CalendarBusinessHoursPeer::doSelectRS($Criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
$fields=array(); $fields=array();
$count=0; $count=0;
while (is_array($row)) { while (is_array($row)) {
$count++; $count++;
$fields[$count] = $row; $fields[$count] = $row;
@@ -51,22 +48,25 @@ class CalendarBusinessHours extends BaseCalendarBusinessHours {
} }
return $fields; return $fields;
} }
function deleteAllCalendarBusinessHours($CalendarUid){
$toDelete=$this->getCalendarBusinessHours($CalendarUid); public function deleteAllCalendarBusinessHours($CalendarUid)
foreach($toDelete as $key => $businessHoursInfo){ {
$toDelete = $this->getCalendarBusinessHours($CalendarUid);
foreach ($toDelete as $key => $businessHoursInfo) {
$CalendarUid = $businessHoursInfo['CALENDAR_UID']; $CalendarUid = $businessHoursInfo['CALENDAR_UID'];
$CalendarBusinessDay = $businessHoursInfo['CALENDAR_BUSINESS_DAY']; $CalendarBusinessDay = $businessHoursInfo['CALENDAR_BUSINESS_DAY'];
$CalendarBusinessStart = $businessHoursInfo['CALENDAR_BUSINESS_START']; $CalendarBusinessStart = $businessHoursInfo['CALENDAR_BUSINESS_START'];
$CalendarBusinessEnd = $businessHoursInfo['CALENDAR_BUSINESS_END']; $CalendarBusinessEnd = $businessHoursInfo['CALENDAR_BUSINESS_END'];
//if exists the row in the database propel will update it, otherwise will insert. //if exists the row in the database propel will update it, otherwise will insert.
$tr = CalendarBusinessHoursPeer::retrieveByPK ( $CalendarUid,$CalendarBusinessDay, $CalendarBusinessStart,$CalendarBusinessEnd ); $tr = CalendarBusinessHoursPeer::retrieveByPK ( $CalendarUid,$CalendarBusinessDay, $CalendarBusinessStart,$CalendarBusinessEnd );
if ( ( is_object ( $tr ) && get_class ($tr) == 'CalendarBusinessHours' ) ) { if (( is_object ( $tr ) && get_class ($tr) == 'CalendarBusinessHours' ) ) {
$tr->delete(); $tr->delete();
} }
} }
} }
function saveCalendarBusinessHours($aData){
public function saveCalendarBusinessHours($aData)
{
$CalendarUid = $aData['CALENDAR_UID']; $CalendarUid = $aData['CALENDAR_UID'];
$CalendarBusinessDay = $aData['CALENDAR_BUSINESS_DAY']; $CalendarBusinessDay = $aData['CALENDAR_BUSINESS_DAY'];
$CalendarBusinessStart = $aData['CALENDAR_BUSINESS_START']; $CalendarBusinessStart = $aData['CALENDAR_BUSINESS_START'];
@@ -83,29 +83,19 @@ class CalendarBusinessHours extends BaseCalendarBusinessHours {
$tr->setCalendarBusinessStart( $CalendarBusinessStart ); $tr->setCalendarBusinessStart( $CalendarBusinessStart );
$tr->setCalendarBusinessEnd( $CalendarBusinessEnd ); $tr->setCalendarBusinessEnd( $CalendarBusinessEnd );
if ($tr->validate() ) { if ($tr->validate() ) {
// we save it, since we get no validation errors, or do whatever else you like. // we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save(); $res = $tr->save();
} } else {
else {
// Something went wrong. We can now get the validationFailures and handle them. // Something went wrong. We can now get the validationFailures and handle them.
$msg = $CalendarBusinessDay.'<hr/>'; $msg = $CalendarBusinessDay.'<hr/>';
$validationFailuresArray = $tr->getValidationFailures(); $validationFailuresArray = $tr->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) { foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>"; $msg .= $objValidationFailure->getMessage() . "<br/>";
} }
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
G::SendTemporalMessage($msg); G::SendTemporalMessage($msg);
} }
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
} }
}
} // CalendarBusinessHours

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarBusinessHoursPeer extends BaseCalendarBusinessHoursPeer { class CalendarBusinessHoursPeer extends BaseCalendarBusinessHoursPeer
{
}
} // CalendarBusinessHoursPeer

View File

@@ -67,6 +67,7 @@ class CalendarDefinition extends BaseCalendarDefinition
return $return; return $return;
} }
} }
//Added by qennix //Added by qennix
//Gets criteria for listing //Gets criteria for listing
public function getCalendarCriterias ($filter, $start, $limit) public function getCalendarCriterias ($filter, $start, $limit)
@@ -143,6 +144,7 @@ class CalendarDefinition extends BaseCalendarDefinition
//******************** //********************
return $fields; return $fields;
} }
//for edit //for edit
public function getCalendarInfoE ($CalendarUid) public function getCalendarInfoE ($CalendarUid)
{ {
@@ -291,11 +293,6 @@ class CalendarDefinition extends BaseCalendarDefinition
} }
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
} }
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
} }
public function deleteCalendar ($CalendarUid) public function deleteCalendar ($CalendarUid)
@@ -328,11 +325,6 @@ class CalendarDefinition extends BaseCalendarDefinition
G::SendMessage( "ERROR", $msg ); G::SendMessage( "ERROR", $msg );
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
} }
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
} }
public function getCalendarFor ($userUid, $proUid, $tasUid, $sw_validate = true) public function getCalendarFor ($userUid, $proUid, $tasUid, $sw_validate = true)
@@ -416,6 +408,7 @@ class CalendarDefinition extends BaseCalendarDefinition
} }
} }
} }
//Added by Qennix //Added by Qennix
//Counts all users,task,process by calendar //Counts all users,task,process by calendar
public function getAllCounterByCalendar ($type) public function getAllCounterByCalendar ($type)
@@ -451,5 +444,4 @@ class CalendarDefinition extends BaseCalendarDefinition
return $oDataset->getRow(); return $oDataset->getRow();
} }
} }
// CalendarDefinition

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarDefinitionPeer extends BaseCalendarDefinitionPeer { class CalendarDefinitionPeer extends BaseCalendarDefinitionPeer
{
}
} // CalendarDefinitionPeer

View File

@@ -6,7 +6,6 @@
require_once 'classes/model/om/BaseCalendarHolidays.php'; require_once 'classes/model/om/BaseCalendarHolidays.php';
/** /**
* Skeleton subclass for representing a row from the 'CALENDAR_HOLIDAYS' table. * Skeleton subclass for representing a row from the 'CALENDAR_HOLIDAYS' table.
* *
@@ -18,8 +17,10 @@ require_once 'classes/model/om/BaseCalendarHolidays.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarHolidays extends BaseCalendarHolidays { class CalendarHolidays extends BaseCalendarHolidays
function getCalendarHolidays($CalendarUid){ {
public function getCalendarHolidays ($CalendarUid)
{
$Criteria = new Criteria('workflow'); $Criteria = new Criteria('workflow');
$Criteria->clearSelectColumns ( ); $Criteria->clearSelectColumns ( );
@@ -28,8 +29,6 @@ class CalendarHolidays extends BaseCalendarHolidays {
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_START ); $Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_START );
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_END ); $Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_END );
$Criteria->add ( CalendarHolidaysPeer::CALENDAR_UID, $CalendarUid , CRITERIA::EQUAL ); $Criteria->add ( CalendarHolidaysPeer::CALENDAR_UID, $CalendarUid , CRITERIA::EQUAL );
$rs = CalendarHolidaysPeer::doSelectRS($Criteria); $rs = CalendarHolidaysPeer::doSelectRS($Criteria);
@@ -37,9 +36,7 @@ class CalendarHolidays extends BaseCalendarHolidays {
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
$fields=array(); $fields=array();
$count=0; $count=0;
while (is_array($row)) { while (is_array($row)) {
$count++; $count++;
$a=explode(" ",$row['CALENDAR_HOLIDAY_START']); $a=explode(" ",$row['CALENDAR_HOLIDAY_START']);
@@ -52,9 +49,11 @@ class CalendarHolidays extends BaseCalendarHolidays {
} }
return $fields; return $fields;
} }
function deleteAllCalendarHolidays($CalendarUid){
public function deleteAllCalendarHolidays($CalendarUid)
{
$toDelete=$this->getCalendarHolidays($CalendarUid); $toDelete=$this->getCalendarHolidays($CalendarUid);
foreach($toDelete as $key => $holidayInfo){ foreach ($toDelete as $key => $holidayInfo) {
$CalendarUid = $holidayInfo['CALENDAR_UID']; $CalendarUid = $holidayInfo['CALENDAR_UID'];
$CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME']; $CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME'];
$CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START']; $CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START'];
@@ -66,10 +65,10 @@ function deleteAllCalendarHolidays($CalendarUid){
$tr->delete(); $tr->delete();
} }
} }
} }
function saveCalendarHolidays($aData){
public function saveCalendarHolidays($aData)
{
$CalendarUid = $aData['CALENDAR_UID']; $CalendarUid = $aData['CALENDAR_UID'];
$CalendarHolidayName = $aData['CALENDAR_HOLIDAY_NAME']; $CalendarHolidayName = $aData['CALENDAR_HOLIDAY_NAME'];
$CalendarHolidayStart = $aData['CALENDAR_HOLIDAY_START']; $CalendarHolidayStart = $aData['CALENDAR_HOLIDAY_START'];
@@ -86,29 +85,19 @@ function deleteAllCalendarHolidays($CalendarUid){
$tr->setCalendarHolidayStart( $CalendarHolidayStart ); $tr->setCalendarHolidayStart( $CalendarHolidayStart );
$tr->setCalendarHolidayEnd( $CalendarHolidayEnd ); $tr->setCalendarHolidayEnd( $CalendarHolidayEnd );
if ($tr->validate() ) { if ($tr->validate() ) {
// we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save(); $res = $tr->save();
} } else {
else {
// Something went wrong. We can now get the validationFailures and handle them. // Something went wrong. We can now get the validationFailures and handle them.
$msg = ''; $msg = '';
$validationFailuresArray = $tr->getValidationFailures(); $validationFailuresArray = $tr->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) { foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>"; $msg .= $objValidationFailure->getMessage() . "<br/>";
} }
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
} }
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes //to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
} }
}
} // CalendarHolidays

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarHolidaysPeer extends BaseCalendarHolidaysPeer { class CalendarHolidaysPeer extends BaseCalendarHolidaysPeer
{
}
} // CalendarHolidaysPeer

View File

@@ -23,28 +23,6 @@ require_once 'classes/model/Task.php';
*/ */
class CaseScheduler extends BaseCaseScheduler class CaseScheduler extends BaseCaseScheduler
{ {
/*
private $SchTimeNextRun = null;
private $SchLastRunTime = null;
public function getSchTimeNextRun() {
if($this->SchTimeNextRun === null)
$this->SchTimeNextRun = time();
return $this->SchTimeNextRun;
}
public function setSchTimeNextRun($value) {
$this->SchTimeNextRun = $value;
}
public function getSchLastRunTime(){
if($this->SchTimeNextRun === null)
$this->SchTimeNextRun = time();
return $this->SchLastRunTime;
}
public function setSchLastRunTime($value){
$this->SchLastRunTime = $value;
}
*/
public function load ($SchUid) public function load ($SchUid)
{ {
try { try {
@@ -115,13 +93,6 @@ class CaseScheduler extends BaseCaseScheduler
} else { } else {
throw (new Exception( 'This row doesn\'t exist!' )); throw (new Exception( 'This row doesn\'t exist!' ));
} }
/*
$con->begin();
$this->setSchUid ( $SchUid );
$result = $this->delete();
$con->commit();
return $result;
*/
} catch (Exception $e) { } catch (Exception $e) {
$con->rollback(); $con->rollback();
throw ($e); throw ($e);
@@ -145,14 +116,6 @@ class CaseScheduler extends BaseCaseScheduler
$this->Update( $Fields ); $this->Update( $Fields );
} }
// SELECT A.SCH_UID, A.SCH_NAME, A.PRO_UID, B.CON_VALUE AS PROCESS,
// A.TAS_UID, B.CON_VALUE AS TASK, A.SCH_TIME_NEXT_RUN, A.SCH_LAST_RUN_TIME, A.SCH_STATE, A.SCH_LAST_STATE,
// A.USR_UID, A.SCH_OPTION
// SCH_START_TIME, SCH_START_DATE, SCH_DAYS_PERFORM_TASK, SCH_EVERY_DAYS, SCH_WEEK_DAYS
// SCH_START_DAY, SCH_MONTHS, SCH_END_DATE, SCH_REPEAT_EVERY, SCH_REPEAT_UNTIL, SCH_REPEAT_STOP_IF_RUNNING
// FROM CASE_SCHEDULER A LEFT JOIN CONTENT B ON A.PRO_UID= B.CON_ID AND B.CON_CATEGORY='PRO_TITLE' AND B.CON_LANG='en'
// LEFT JOIN CONTENT C ON A.TAS_UID= C.CON_ID AND C.CON_CATEGORY='TAS_TITLE' AND C.CON_LANG='en'
//
public function getAllCriteria () public function getAllCriteria ()
{ {
$c = new Criteria( 'workflow' ); $c = new Criteria( 'workflow' );
@@ -184,7 +147,6 @@ class CaseScheduler extends BaseCaseScheduler
$c->addSelectColumn( CaseSchedulerPeer::CASE_SH_PLUGIN_UID ); $c->addSelectColumn( CaseSchedulerPeer::CASE_SH_PLUGIN_UID );
return $c; return $c;
} }
public function getAll () public function getAll ()
@@ -293,12 +255,7 @@ class CaseScheduler extends BaseCaseScheduler
), array ('PRO_UID' => $aTaskRow['PRO_UID'] ), array ('PRO_UID' => $aTaskRow['PRO_UID']
) ); ) );
} }
// g::pr($aRows); die;
return $aRows; return $aRows;
} }
public function caseSchedulerCron ($date, &$log = array(), $cron = 0) public function caseSchedulerCron ($date, &$log = array(), $cron = 0)
@@ -358,7 +315,6 @@ class CaseScheduler extends BaseCaseScheduler
break; break;
case '5': case '5':
break; break;
} }
$sActualTime = $aRow['SCH_TIME_NEXT_RUN']; $sActualTime = $aRow['SCH_TIME_NEXT_RUN'];
@@ -368,6 +324,7 @@ class CaseScheduler extends BaseCaseScheduler
$dActualSysMinutes = date( 'i', $nTime ); $dActualSysMinutes = date( 'i', $nTime );
$sActualDataTime = strtotime( $aRow['SCH_TIME_NEXT_RUN'] ); $sActualDataTime = strtotime( $aRow['SCH_TIME_NEXT_RUN'] );
$sActualSysTime = strtotime( $nTime ); $sActualSysTime = strtotime( $nTime );
// note added consider the posibility to encapsulate some in functionality in a class method or some funtions // note added consider the posibility to encapsulate some in functionality in a class method or some funtions
if ($sActualDataHour < $dActualSysHour) { if ($sActualDataHour < $dActualSysHour) {
$_PORT = (SERVER_PORT != '80') ? ':' . SERVER_PORT : ''; $_PORT = (SERVER_PORT != '80') ? ':' . SERVER_PORT : '';
@@ -419,12 +376,10 @@ class CaseScheduler extends BaseCaseScheduler
} }
} }
//If there is a trigger that is registered to do this then transfer control //If there is a trigger that is registered to do this then transfer control
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) { if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
eprintln( " - Transfering control to a Plugin: " . $caseSchedulerSelected->sNamespace . "/" . $caseSchedulerSelected->sActionId, 'green' ); eprintln( " - Transfering control to a Plugin: " . $caseSchedulerSelected->sNamespace . "/" . $caseSchedulerSelected->sActionId, 'green' );
$oData['OBJ_SOAP'] = $client; $oData['OBJ_SOAP'] = $client;
$oData['SCH_UID'] = $aRow['SCH_UID']; $oData['SCH_UID'] = $aRow['SCH_UID'];
$oData['params'] = $params; $oData['params'] = $params;
@@ -506,7 +461,7 @@ class CaseScheduler extends BaseCaseScheduler
} else { } else {
} }
} else if ($sActualDataHour == $dActualSysHour && $sActualDataMinutes <= $dActualSysMinutes) { } elseif ($sActualDataHour == $dActualSysHour && $sActualDataMinutes <= $dActualSysMinutes) {
$_PORT = (isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] != '80') ? ':' . $_SERVER['SERVER_PORT'] : ''; $_PORT = (isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] != '80') ? ':' . $_SERVER['SERVER_PORT'] : '';
//$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_PORT . '/sys' . SYS_SYS .'/'.SYS_LANG.'/classic/green/services/wsdl2'; //$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_PORT . '/sys' . SYS_SYS .'/'.SYS_LANG.'/classic/green/services/wsdl2';
$defaultEndpoint = 'http://' . SERVER_NAME . $_PORT . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2'; $defaultEndpoint = 'http://' . SERVER_NAME . $_PORT . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
@@ -563,7 +518,6 @@ class CaseScheduler extends BaseCaseScheduler
$paramsLog['WS_CREATE_CASE_STATUS'] = strip_tags( $result->message ); $paramsLog['WS_CREATE_CASE_STATUS'] = strip_tags( $result->message );
eprintln( "FAILED->{$paramsLog ['WS_CREATE_CASE_STATUS']}", 'red' ); eprintln( "FAILED->{$paramsLog ['WS_CREATE_CASE_STATUS']}", 'red' );
$paramsLogResult = 'FAILED'; $paramsLogResult = 'FAILED';
} }
} else { } else {
// invalid user or bad password // invalid user or bad password
@@ -611,10 +565,8 @@ class CaseScheduler extends BaseCaseScheduler
$this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime ); $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
} }
} }
$oDataset->next(); $oDataset->next();
} }
} }
public function updateDate ($sSchedulerUid = '', $sSchTimeNextRun = '', $sSchLastRunTime = '') public function updateDate ($sSchedulerUid = '', $sSchTimeNextRun = '', $sSchLastRunTime = '')
@@ -628,8 +580,6 @@ class CaseScheduler extends BaseCaseScheduler
public function updateNextRun ($sOption, $sValue = '', $sActualTime = '', $sDaysPerformTask = '', $sWeeks = '', $sStartDay = '', $sMonths = '', $currentDate = '') public function updateNextRun ($sOption, $sValue = '', $sActualTime = '', $sDaysPerformTask = '', $sWeeks = '', $sStartDay = '', $sMonths = '', $currentDate = '')
{ {
$nActualDate = $currentDate . " " . $sActualTime; $nActualDate = $currentDate . " " . $sActualTime;
// date("Y-m-d H:i:s", $sActualTime);
// date("Y-m-d H:i:s", $sActualTime);
$dEstimatedDate = ''; $dEstimatedDate = '';
switch ($sOption) { switch ($sOption) {
case '1': case '1':
@@ -652,7 +602,6 @@ class CaseScheduler extends BaseCaseScheduler
break; break;
} }
break; break;
case '2': case '2':
if (strlen( $sWeeks ) > 0) { if (strlen( $sWeeks ) > 0) {
//die($sActualTime); //die($sActualTime);
@@ -675,12 +624,8 @@ class CaseScheduler extends BaseCaseScheduler
break; break;
} }
} }
//die;
if ($nSW == 1) { if ($nSW == 1) {
$dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate next " . $aDaysWeek[$nNextDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) ); $dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate next " . $aDaysWeek[$nNextDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
//print_r($dEstimatedDate);
// die("03");
} else { } else {
$nEveryDays = $sDaysPerformTask; $nEveryDays = $sDaysPerformTask;
// $nEveryDays = '1'; // $nEveryDays = '1';
@@ -699,31 +644,14 @@ class CaseScheduler extends BaseCaseScheduler
$nEveryDays = 1; $nEveryDays = 1;
//$nActualDate = date('Y-m-d').' '.$sActualTime; //$nActualDate = date('Y-m-d').' '.$sActualTime;
$nDataTmp = date( 'Y-m-d', strtotime( "$nActualDate + " . $nEveryDays . " Week" ) ); $nDataTmp = date( 'Y-m-d', strtotime( "$nActualDate + " . $nEveryDays . " Week" ) );
//echo "$nActualDate + " . $nEveryDays . " Week ";
//echo "++";
//echo strtotime( "+".$nEveryDays . " week"), "\n";
//echo strtotime("$nActualDate +" . $nEveryDays . " Week ");
//echo "++";
//echo $nDataTmp;
//echo "--";
//echo $sTypeOperation;
//echo $nFirstDay;
//print_r ($aDaysWeek);
//$sTypeOperation = "next";
$dEstimatedDate = date( 'Y-m-d', strtotime( "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) ); $dEstimatedDate = date( 'Y-m-d', strtotime( "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
//echo (strtotime ("$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay]));
//echo "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay];
//echo $dEstimatedDate;
//echo "--";
//echo date('Y-m-d', strtotime ("$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay])) . ' ' . date('H:i:s', strtotime($sActualTime));
//die("02");
} }
//die("03");
} }
} }
break; break;
case '3': case '3':
if (strlen( $sMonths ) > 0) { // Must have at least one selected month if (strlen( $sMonths ) > 0) {
// Must have at least one selected month
// Calculamos para la siguiente ejecucion, acorde a lo seleccionado // Calculamos para la siguiente ejecucion, acorde a lo seleccionado
$aStartDay = explode( '|', $sStartDay ); $aStartDay = explode( '|', $sStartDay );
$nYear = date( "Y", strtotime( $sActualTime ) ); $nYear = date( "Y", strtotime( $sActualTime ) );
@@ -741,7 +669,7 @@ class CaseScheduler extends BaseCaseScheduler
} }
} }
if ($nSW == 1) { // Mes encontrado if ($nSW == 1) {
$nExecNextMonth = $nNextMonth; $nExecNextMonth = $nNextMonth;
} else { } else {
$nExecNextMonth = $aMonths[0] - 1; $nExecNextMonth = $aMonths[0] - 1;
@@ -782,11 +710,8 @@ class CaseScheduler extends BaseCaseScheduler
break; break;
} }
$dEstimatedDate = date( 'Y-m-d', strtotime( $sDaysWeekOpt . ' week ' . $aWeeksShort[$sDayWeek - 1] . ' ' . $aMontsShort[$nExecNextMonth] . ' ' . $nYear ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) ); $dEstimatedDate = date( 'Y-m-d', strtotime( $sDaysWeekOpt . ' week ' . $aWeeksShort[$sDayWeek - 1] . ' ' . $aMontsShort[$nExecNextMonth] . ' ' . $nYear ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
// krumo($nExecNextMonth, $sDayWeek);
// krumo($sDaysWeekOpt . ' week ' . $aWeeksShort[$sDayWeek-1] . ' ' . $aMontsShort[$nExecNextMonth] . ' ' . $nYear);
break; break;
} }
} }
break; break;
} }
@@ -803,5 +728,4 @@ class CaseScheduler extends BaseCaseScheduler
} }
} }
} }
// CaseScheduler

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CaseSchedulerPeer extends BaseCaseSchedulerPeer { class CaseSchedulerPeer extends BaseCaseSchedulerPeer
{
}
} // CaseSchedulerPeer

View File

@@ -20,7 +20,6 @@ require_once 'classes/model/om/BaseCaseTracker.php';
*/ */
class CaseTracker extends BaseCaseTracker class CaseTracker extends BaseCaseTracker
{ {
public function load ($sProcessUID) public function load ($sProcessUID)
{ {
try { try {
@@ -110,7 +109,7 @@ class CaseTracker extends BaseCaseTracker
} }
} }
function caseTrackerExists ($sUid) public function caseTrackerExists ($sUid)
{ {
try { try {
$oObj = CaseTrackerPeer::retrieveByPk( $sUid ); $oObj = CaseTrackerPeer::retrieveByPk( $sUid );
@@ -120,5 +119,4 @@ class CaseTracker extends BaseCaseTracker
} }
} }
} }
// CaseTracker

View File

@@ -116,7 +116,7 @@ class CaseTrackerObject extends BaseCaseTrackerObject
} }
} }
function reorderPositions ($sProcessUID, $iPosition) public function reorderPositions ($sProcessUID, $iPosition)
{ {
try { try {
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
@@ -135,7 +135,7 @@ class CaseTrackerObject extends BaseCaseTrackerObject
} }
} }
function caseTrackerObjectExists ($Uid) public function caseTrackerObjectExists ($Uid)
{ {
try { try {
$oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid ); $oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid );
@@ -149,7 +149,7 @@ class CaseTrackerObject extends BaseCaseTrackerObject
} }
} }
function removeByObject ($sType, $sObjUid) public function removeByObject ($sType, $sObjUid)
{ {
try { try {
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
@@ -161,5 +161,4 @@ class CaseTrackerObject extends BaseCaseTrackerObject
} }
} }
} }
// CaseTrackerObject

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CaseTrackerObjectPeer extends BaseCaseTrackerObjectPeer { class CaseTrackerObjectPeer extends BaseCaseTrackerObjectPeer
{
}
} // CaseTrackerObjectPeer

View File

@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CaseTrackerPeer extends BaseCaseTrackerPeer { class CaseTrackerPeer extends BaseCaseTrackerPeer
{
}
} // CaseTrackerPeer

View File

@@ -39,12 +39,12 @@ require_once 'classes/model/Content.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class Configuration extends BaseConfiguration { class Configuration extends BaseConfiguration
{
public function create($aData) public function create($aData)
{ {
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME); $con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try try {
{
$con->begin(); $con->begin();
$this->setCfgUid($aData['CFG_UID']); $this->setCfgUid($aData['CFG_UID']);
$this->setObjUid($aData['OBJ_UID']); $this->setObjUid($aData['OBJ_UID']);
@@ -52,76 +52,64 @@ class Configuration extends BaseConfiguration {
$this->setProUid($aData['PRO_UID']); $this->setProUid($aData['PRO_UID']);
$this->setUsrUid($aData['USR_UID']); $this->setUsrUid($aData['USR_UID']);
$this->setAppUid($aData['APP_UID']); $this->setAppUid($aData['APP_UID']);
if($this->validate()) if ($this->validate()) {
{
$result=$this->save(); $result=$this->save();
$con->commit(); $con->commit();
return $result; return $result;
} } else {
else
{
$con->rollback(); $con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this).".")); throw(new Exception("Failed Validation in class ".get_class($this)."."));
} }
} } catch (Exception $e) {
catch(Exception $e)
{
$con->rollback(); $con->rollback();
throw($e); throw($e);
} }
} }
public function load($CfgUid, $ObjUid='', $ProUid='', $UsrUid='', $AppUid='')
public function load($CfgUid, $ObjUid = '', $ProUid = '', $UsrUid = '', $AppUid = '')
{ {
try { try {
$oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid ); $oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
if (!is_null($oRow)) 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 '$CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid' in table Configuration doesn't exist!" )); throw(new Exception( "The row '$CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid' in table Configuration doesn't exist!" ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
throw($oError); throw($oError);
} }
} }
public function update($fields) public function update($fields)
{ {
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME); $con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try try {
{
$con->begin(); $con->begin();
$this->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']); $this->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME); $this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
if($this->validate()) if ($this->validate()) {
{
$contentResult=0; $contentResult=0;
$result=$this->save(); $result=$this->save();
$result=($result==0)?($contentResult>0?1:0):$result; $result=($result==0)?($contentResult>0?1:0):$result;
$con->commit(); $con->commit();
return $result; return $result;
} } else {
else
{
$con->rollback(); $con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this).".")); throw(new Exception("Failed Validation in class ".get_class($this)."."));
} }
} } catch (Exception $e) {
catch(Exception $e)
{
$con->rollback(); $con->rollback();
throw($e); throw($e);
} }
} }
public function remove($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid) public function remove($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
{ {
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME); $con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try try {
{
$con->begin(); $con->begin();
$this->setCfgUid($CfgUid); $this->setCfgUid($CfgUid);
$this->setObjUid($ObjUid); $this->setObjUid($ObjUid);
@@ -131,16 +119,16 @@ class Configuration extends BaseConfiguration {
$result=$this->delete(); $result=$this->delete();
$con->commit(); $con->commit();
return $result; return $result;
} } catch (Exception $e) {
catch(Exception $e)
{
$con->rollback(); $con->rollback();
throw($e); throw($e);
} }
} }
public function exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid) public function exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
{ {
$oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid ); $oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
return (( get_class ($oRow) == 'Configuration' )&&(!is_null($oRow))); return (( get_class ($oRow) == 'Configuration' )&&(!is_null($oRow)));
} }
} // Configuration }

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ConfigurationPeer extends BaseConfigurationPeer { class ConfigurationPeer extends BaseConfigurationPeer
{
}
} // ConfigurationPeer

View File

@@ -67,6 +67,7 @@ class Content extends BaseContent
} }
return $ConValue; return $ConValue;
} }
/* /*
* Find a valid Lang for current Content. The most recent * Find a valid Lang for current Content. The most recent
* @param string $ConCategory * @param string $ConCategory
@@ -102,6 +103,7 @@ class Content extends BaseContent
} }
return ($defaultLang); return ($defaultLang);
} }
/* /*
* Load the content row and the Save automatically the row for the destination language * Load the content row and the Save automatically the row for the destination language
* @param string $ConCategory * @param string $ConCategory
@@ -457,6 +459,7 @@ class Content extends BaseContent
throw ($e); throw ($e);
} }
} }
//Added by Enrique at Feb 9th,2011 //Added by Enrique at Feb 9th,2011
//Gets all Role Names by Role //Gets all Role Names by Role
public function getAllContentsByRole ($sys_lang = SYS_LANG) public function getAllContentsByRole ($sys_lang = SYS_LANG)
@@ -481,5 +484,4 @@ class Content extends BaseContent
return $aRoles; return $aRoles;
} }
} }
// Content

View File

@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ContentPeer extends BaseContentPeer { class ContentPeer extends BaseContentPeer
{
}
} // ContentPeer