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);
@@ -429,7 +418,7 @@ class AdditionalTables extends BaseAdditionalTables
} }
} }
if ($oClass->validate()) { if ($oClass->validate()) {
$iResult = $oClass->save(); $iResult = $oClass->save();
if ($keysAutoIncrement == 1 && $aFields[$keyUIDAutoIncrement] == '' && isset($_SESSION['APPLICATION']) && $_SESSION['APPLICATION'] != '') { if ($keysAutoIncrement == 1 && $aFields[$keyUIDAutoIncrement] == '' && isset($_SESSION['APPLICATION']) && $_SESSION['APPLICATION'] != '') {
G::LoadClass('case'); G::LoadClass('case');
$oCaseKeyAuto = new Cases(); $oCaseKeyAuto = new Cases();
@@ -437,7 +426,7 @@ class AdditionalTables extends BaseAdditionalTables
$aFields = $oCaseKeyAuto->loadCase($_SESSION['APPLICATION']); $aFields = $oCaseKeyAuto->loadCase($_SESSION['APPLICATION']);
$aFields['APP_DATA'][$keyUIDAutoIncrement] = $newId; $aFields['APP_DATA'][$keyUIDAutoIncrement] = $newId;
if (isset($_POST['form'])) { if (isset($_POST['form'])) {
$_POST['form'][$keyUIDAutoIncrement] = $newId; $_POST['form'][$keyUIDAutoIncrement] = $newId;
} }
$oCaseKeyAuto->updateCase($_SESSION['APPLICATION'], $aFields); $oCaseKeyAuto->updateCase($_SESSION['APPLICATION'], $aFields);
} }
@@ -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

@@ -14,14 +14,15 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'ADDITIONAL_TABLES' table. * Skeleton subclass for performing query and update operations on the 'ADDITIONAL_TABLES' 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 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
@@ -327,34 +328,34 @@ class AppCacheView extends BaseAppCacheView
$rs->next(); $rs->next();
if ($rs->getRecordCount() > 0) { if ($rs->getRecordCount() > 0) {
if (!class_exists('Cases')) { if (!class_exists('Cases')) {
G::loadClass('case'); G::loadClass('case');
} }
$caseInstance = new Cases(); $caseInstance = new Cases();
while ($row = $rs->getRow()) { while ($row = $rs->getRow()) {
$tasGroupVariable = str_replace(array('@', '#'), '', $row['TAS_GROUP_VARIABLE']); $tasGroupVariable = str_replace(array('@', '#'), '', $row['TAS_GROUP_VARIABLE']);
$c2 = new Criteria(); $c2 = new Criteria();
$c2->clearSelectColumns(); $c2->clearSelectColumns();
$c2->addSelectColumn(AppDelegationPeer::APP_UID); $c2->addSelectColumn(AppDelegationPeer::APP_UID);
$c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']); $c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']);
$c2->add(AppDelegationPeer::USR_UID, ''); $c2->add(AppDelegationPeer::USR_UID, '');
$c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); $c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
$rs2 = AppDelegationPeer::doSelectRS($c2); $rs2 = AppDelegationPeer::doSelectRS($c2);
$rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs2->next(); $rs2->next();
while ($row2 = $rs2->getRow()) { while ($row2 = $rs2->getRow()) {
$caseData = $caseInstance->LoadCase($row2['APP_UID']); $caseData = $caseInstance->LoadCase($row2['APP_UID']);
if (isset($caseData['APP_DATA'][$tasGroupVariable])) { if (isset($caseData['APP_DATA'][$tasGroupVariable])) {
if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') { if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') {
if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $aGroups)) { if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $aGroups)) {
$cases[] = $row2['APP_UID']; $cases[] = $row2['APP_UID'];
} }
}
} }
} $rs2->next();
$rs2->next(); }
} $rs->next();
$rs->next(); }
}
} }
return $cases; return $cases;
} }
@@ -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

@@ -14,14 +14,15 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_CACHE_VIEW' table. * Skeleton subclass for performing query and update operations on the 'APP_CACHE_VIEW' 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 AppCacheViewPeer extends BaseAppCacheViewPeer { class AppCacheViewPeer extends BaseAppCacheViewPeer
{
}
} // AppCacheViewPeer

View File

@@ -18,105 +18,105 @@ 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 /**
* @param array $aData * Create the application delay registry
* @return string * @param array $aData
**/ * @return string
public function create($aData) **/
{ public function create($aData)
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' ) try {
unset ( $aData['APP_DELAY_UID'] ); if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' ) {
if ( !isset ( $aData['APP_DELAY_UID'] ) ) unset ( $aData['APP_DELAY_UID'] );
$aData['APP_DELAY_UID'] = G::generateUniqueID(); }
$oAppDelay = new AppDelay(); if ( !isset ( $aData['APP_DELAY_UID'] ) ) {
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME); $aData['APP_DELAY_UID'] = G::generateUniqueID();
if ($oAppDelay->validate()) { }
$oConnection->begin(); $oAppDelay = new AppDelay();
$iResult = $oAppDelay->save(); $oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$oConnection->commit(); if ($oAppDelay->validate()) {
return $aData['APP_DELAY_UID']; $oConnection->begin();
} $iResult = $oAppDelay->save();
else { $oConnection->commit();
$sMessage = ''; return $aData['APP_DELAY_UID'];
$aValidationFailures = $oAppDelay->getValidationFailures(); } else {
foreach($aValidationFailures as $oValidationFailure) { $sMessage = '';
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $aValidationFailures = $oAppDelay->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
} }
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
} }
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/** /**
* Update the application delay registry * Update the application delay registry
* @param array $aData * @param array $aData
* @return string * @return string
**/ **/
public function update($aData) public function update($aData)
{ {
$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 {
$sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
}
} else {
throw(new Exception('This row doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
} }
else { }
$sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures(); public function isPaused($appUid, $delIndex)
foreach($aValidationFailures as $oValidationFailure) { {
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $oCriteria = new Criteria('workflow');
} $oCriteria->add(AppDelayPeer::APP_UID, $appUid);
throw(new Exception('The registry cannot be updated!<br />'.$sMessage)); $oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex);
$oCriteria->add(AppDelayPeer::APP_TYPE, 'PAUSE');
$oCriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, null);
$oCriteria->add(
$oCriteria->getNewCriterion(
AppDelayPeer::APP_DISABLE_ACTION_USER,
null,
Criteria::ISNULL
)->addOr(
$oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)
)
);
$oDataset = AppDelayPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if ( $aRow ) {
return true;
} else {
return false;
} }
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function isPaused($appUid, $delIndex){ }
$oCriteria = new Criteria('workflow'); }
$oCriteria->add(AppDelayPeer::APP_UID, $appUid);
$oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex);
$oCriteria->add(AppDelayPeer::APP_TYPE, 'PAUSE');
$oCriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, null);
$oCriteria->add(
$oCriteria->getNewCriterion(
AppDelayPeer::APP_DISABLE_ACTION_USER,
null,
Criteria::ISNULL
)->addOr(
$oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)
)
);
$oDataset = AppDelayPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if( $aRow )
return true;
else
return false;
}
} // AppDelay

View File

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_DELAY' table. * Skeleton subclass for performing query and update operations on the 'APP_DELAY' 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
@@ -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

@@ -2,10 +2,10 @@
/** /**
* AppDelegationPeer.php * AppDelegationPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_DELEGATION' table. * Skeleton subclass for performing query and update operations on the 'APP_DELEGATION' 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
@@ -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

@@ -2,10 +2,10 @@
/** /**
* AppDocumentPeer.php * AppDocumentPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_DOCUMENT' table. * Skeleton subclass for performing query and update operations on the 'APP_DOCUMENT' 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
@@ -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

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_EVENT' table. * Skeleton subclass for performing query and update operations on the 'APP_EVENT' 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
@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppEventPeer extends BaseAppEventPeer { class AppEventPeer extends BaseAppEventPeer
{
}
} // AppEventPeer

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_FOLDER' table. * Skeleton subclass for performing query and update operations on the 'APP_FOLDER' 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
@@ -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 );
}
} }
function getDynaformHistory($PRO_UID,$TAS_UID,$APP_UID,$DYN_UID=""){ public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
{
G::LoadClass('case'); G::LoadClass('case');
$oCase = new Cases(); $oCase = new Cases();
@@ -62,37 +54,30 @@ class AppHistory extends BaseAppHistory {
$aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']); $aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']);
if (!is_array($aObjectPermissions)) { if (!is_array($aObjectPermissions)) {
$aObjectPermissions = array('DYNAFORMS' => array(-1), 'INPUT_DOCUMENTS' => array(-1), 'OUTPUT_DOCUMENTS' => array(-1)); $aObjectPermissions = array('DYNAFORMS' => array(-1), 'INPUT_DOCUMENTS' => array(-1), 'OUTPUT_DOCUMENTS' => array(-1));
} }
if (!isset($aObjectPermissions['DYNAFORMS'])) { if (!isset($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
}
else {
if (!is_array($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1); $aObjectPermissions['DYNAFORMS'] = array(-1);
} } else {
if (!is_array($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
}
} }
if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) { if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
}
else {
if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1); $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
} } else {
if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
}
} }
if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) { if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
}
else {
if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1); $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
} } else {
if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$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);
@@ -129,38 +112,37 @@ class AppHistory extends BaseAppHistory {
$aDynHistory = array(); $aDynHistory = array();
$aDynHistory[] = array( $aDynHistory[] = array(
'DYN_TITLE' => 'char' 'DYN_TITLE' => 'char'
); );
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

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_HISTORY' table. * Skeleton subclass for performing query and update operations on the 'APP_HISTORY' 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
@@ -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

@@ -2,10 +2,10 @@
/** /**
* AppMessagePeer.php * AppMessagePeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_MESSAGE' table. * Skeleton subclass for performing query and update operations on the 'APP_MESSAGE' 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
@@ -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

@@ -1,251 +1,233 @@
<?php <?php
require_once 'classes/model/om/BaseAppNotes.php'; require_once 'classes/model/om/BaseAppNotes.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_NOTES' table. * Skeleton subclass for representing a row from the 'APP_NOTES' 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 classes.model * @package classes.model
*/ */
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");
G::LoadClass( 'ArrayPeer' );
G::LoadClass( 'ArrayPeer' );
$Criteria = new Criteria( 'workflow' );
$Criteria = new Criteria( 'workflow' ); $Criteria->clearSelectColumns();
$Criteria->clearSelectColumns();
$Criteria->addSelectColumn( AppNotesPeer::APP_UID );
$Criteria->addSelectColumn( AppNotesPeer::APP_UID ); $Criteria->addSelectColumn( AppNotesPeer::USR_UID );
$Criteria->addSelectColumn( AppNotesPeer::USR_UID ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_DATE );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_DATE ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_CONTENT );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_CONTENT ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_TYPE );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_TYPE ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_AVAILABILITY );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AVAILABILITY ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_ORIGIN_OBJ );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_ORIGIN_OBJ ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ1 );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ1 ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ2 );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ2 ); $Criteria->addSelectColumn( AppNotesPeer::NOTE_RECIPIENTS );
$Criteria->addSelectColumn( AppNotesPeer::NOTE_RECIPIENTS ); $Criteria->addSelectColumn( UsersPeer::USR_USERNAME );
$Criteria->addSelectColumn( UsersPeer::USR_USERNAME ); $Criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$Criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME ); $Criteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$Criteria->addSelectColumn( UsersPeer::USR_LASTNAME ); $Criteria->addSelectColumn( UsersPeer::USR_EMAIL );
$Criteria->addSelectColumn( UsersPeer::USR_EMAIL );
$Criteria->addJoin( AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
$Criteria->addJoin( AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN );
$Criteria->add( appNotesPeer::APP_UID, $appUid, CRITERIA::EQUAL );
$Criteria->add( appNotesPeer::APP_UID, $appUid, CRITERIA::EQUAL );
if ($usrUid != '') {
if ($usrUid != '') { $Criteria->add( appNotesPeer::USR_UID, $usrUid, CRITERIA::EQUAL );
$Criteria->add( appNotesPeer::USR_UID, $usrUid, CRITERIA::EQUAL ); }
}
$Criteria->addDescendingOrderByColumn( AppNotesPeer::NOTE_DATE );
$Criteria->addDescendingOrderByColumn( AppNotesPeer::NOTE_DATE );
$response = array ();
$response = array (); $totalCount = AppNotesPeer::doCount( $Criteria );
$totalCount = AppNotesPeer::doCount( $Criteria ); $response['totalCount'] = $totalCount;
$response['totalCount'] = $totalCount; $response['notes'] = array ();
$response['notes'] = array ();
if ($start != '') {
if ($start != '') { $Criteria->setLimit( $limit );
$Criteria->setLimit( $limit ); $Criteria->setOffset( $start );
$Criteria->setOffset( $start ); }
}
$oDataset = appNotesPeer::doSelectRS( $Criteria );
$oDataset = appNotesPeer::doSelectRS( $Criteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next();
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
while ($aRow = $oDataset->getRow()) { $aRow['NOTE_CONTENT'] = stripslashes( $aRow['NOTE_CONTENT'] );
$aRow['NOTE_CONTENT'] = stripslashes( $aRow['NOTE_CONTENT'] ); $response['notes'][] = $aRow;
$response['notes'][] = $aRow; $oDataset->next();
$oDataset->next(); }
}
$result['criteria'] = $Criteria;
$result['criteria'] = $Criteria; $result['array'] = $response;
$result['array'] = $response;
return $result;
return $result; }
}
public function postNewNote ($appUid, $usrUid, $noteContent, $notify = true, $noteAvalibility = "PUBLIC", $noteRecipients = "", $noteType = "USER", $noteDate = "now")
public function postNewNote ($appUid, $usrUid, $noteContent, $notify = true, $noteAvalibility = "PUBLIC", $noteRecipients = "", $noteType = "USER", $noteDate = "now") {
{ $this->setAppUid( $appUid );
$this->setAppUid( $appUid ); $this->setUsrUid( $usrUid );
$this->setUsrUid( $usrUid ); $this->setNoteDate( $noteDate );
$this->setNoteDate( $noteDate ); $this->setNoteContent( $noteContent );
$this->setNoteContent( $noteContent ); $this->setNoteType( $noteType );
$this->setNoteType( $noteType ); $this->setNoteAvailability( $noteAvalibility );
$this->setNoteAvailability( $noteAvalibility ); $this->setNoteOriginObj( '' );
$this->setNoteOriginObj( '' ); $this->setNoteAffectedObj1( '' );
$this->setNoteAffectedObj1( '' ); $this->setNoteAffectedObj2( '' );
$this->setNoteAffectedObj2( '' ); $this->setNoteRecipients( $noteRecipients );
$this->setNoteRecipients( $noteRecipients );
if ($this->validate()) {
if ($this->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 = $this->save(); $res = $this->save();
$msg = ''; $msg = '';
} 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/>";
} }
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
} }
if ($msg != "") { if ($msg != "") {
$response['success'] = 'failure'; $response['success'] = 'failure';
$response['message'] = $msg; $response['message'] = $msg;
} else { } else {
$response['success'] = 'success'; $response['success'] = 'success';
$response['message'] = 'Saved...'; $response['message'] = 'Saved...';
} }
if ($notify) { if ($notify) {
if ($noteRecipients == "") { if ($noteRecipients == "") {
$noteRecipientsA = array (); $noteRecipientsA = array ();
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase( $appUid ); $p = $oCase->getUsersParticipatedInCase( $appUid );
foreach ($p['array'] as $key => $userParticipated) { foreach ($p['array'] as $key => $userParticipated) {
$noteRecipientsA[] = $key; $noteRecipientsA[] = $key;
} }
$noteRecipients = implode( ",", $noteRecipientsA ); $noteRecipients = implode( ",", $noteRecipientsA );
} }
$this->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients ); $this->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
} }
return $response; return $response;
} }
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "") public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
{ {
try { try {
require_once ('classes/model/Configuration.php'); require_once ('classes/model/Configuration.php');
$oConfiguration = new Configuration(); $oConfiguration = new Configuration();
$sDelimiter = DBAdapter::getStringDelimiter(); $sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' ); $oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' ); $oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
$oCriteria->add( ConfigurationPeer::PRO_UID, '' ); $oCriteria->add( ConfigurationPeer::PRO_UID, '' );
$oCriteria->add( ConfigurationPeer::USR_UID, '' ); $oCriteria->add( ConfigurationPeer::USR_UID, '' );
$oCriteria->add( ConfigurationPeer::APP_UID, '' ); $oCriteria->add( ConfigurationPeer::APP_UID, '' );
if (ConfigurationPeer::doCount( $oCriteria ) == 0) { if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => '') ); $oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => '') );
$aConfiguration = array (); $aConfiguration = array ();
} else { } else {
$aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' ); $aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' );
if ($aConfiguration['CFG_VALUE'] != '') { if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] ); $aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] );
$passwd = $aConfiguration['MESS_PASSWORD']; $passwd = $aConfiguration['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' ); $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec ); $auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) { if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) { if (count( $auxPass ) == 2) {
$passwd = $auxPass[1]; $passwd = $auxPass[1];
} else { } else {
array_shift( $auxPass ); array_shift( $auxPass );
$passwd = implode( '', $auxPass ); $passwd = implode( '', $auxPass );
} }
} }
$aConfiguration['MESS_PASSWORD'] = $passwd; $aConfiguration['MESS_PASSWORD'] = $passwd;
} else { } else {
$aConfiguration = array (); $aConfiguration = array ();
} }
} }
if (! isset( $aConfiguration['MESS_ENABLED'] ) || $aConfiguration['MESS_ENABLED'] != '1') { if (! isset( $aConfiguration['MESS_ENABLED'] ) || $aConfiguration['MESS_ENABLED'] != '1') {
return false; return false;
} }
$oUser = new Users(); $oUser = new Users();
$aUser = $oUser->load( $usrUid ); $aUser = $oUser->load( $usrUid );
$authorName = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; $authorName = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases(); $oCase = new Cases();
$aFields = $oCase->loadCase( $appUid ); $aFields = $oCase->loadCase( $appUid );
$configNoteNotification['subject'] = G::LoadTranslation( 'ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION' ) . " @#APP_TITLE "; $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"; $configNoteNotification['body'] = G::LoadTranslation( 'ID_CASE' ) . ": @#APP_TITLE<br />" . G::LoadTranslation( 'ID_AUTHOR' ) . ": $authorName<br /><br />$noteContent";
if ($sFrom == '') { if ($sFrom == '') {
$sFrom = '"ProcessMaker"'; $sFrom = '"ProcessMaker"';
} }
$hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match ); $hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match );
if (! $hasEmailFrom || strpos( $sFrom, $aConfiguration['MESS_ACCOUNT'] ) === false) { if (! $hasEmailFrom || strpos( $sFrom, $aConfiguration['MESS_ACCOUNT'] ) === false) {
if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) { if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) {
$sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>';
} else { } else {
if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) { if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) {
$sFrom .= ' <info@' . gethostbyaddr( '127.0.0.1' ) . '>'; $sFrom .= ' <info@' . gethostbyaddr( '127.0.0.1' ) . '>';
} else { } else {
if ($aConfiguration['MESS_SERVER'] != '') { if ($aConfiguration['MESS_SERVER'] != '') {
if (($sAux = @gethostbyaddr( $aConfiguration['MESS_SERVER'] ))) { if (($sAux = @gethostbyaddr( $aConfiguration['MESS_SERVER'] ))) {
$sFrom .= ' <info@' . $sAux . '>'; $sFrom .= ' <info@' . $sAux . '>';
} else { } else {
$sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>'; $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>';
} }
} else { } else {
$sFrom .= ' <info@processmaker.com>'; $sFrom .= ' <info@processmaker.com>';
} }
} }
} }
} }
$sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields ); $sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields );
//erik: new behaviour for messages $sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) );
//G::loadClass('configuration');
//$oConf = new Configurations; G::LoadClass( 'spool' );
//$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', ''); $oUser = new Users();
//$conf = $oConf->aConfig; $recipientsArray = explode( ",", $noteRecipients );
/*
if( isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TEMPLATE']) foreach ($recipientsArray as $recipientUid) {
&& $conf['TAS_DEF_MESSAGE_TYPE'] == 'template' && $conf['TAS_DEF_MESSAGE_TEMPLATE'] != '') {
$aUser = $oUser->load( $recipientUid );
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP;
$fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE']; $sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
$oSpool = new spoolRun();
if ( ! file_exists ( $fileTemplate ) ) { $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'] : '') );
throw new Exception("Template file '$fileTemplate' does not exist."); $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();
}
} }
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
} 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 //Send derivation notification - End
} catch (Exception $oException) { } catch (Exception $oException) {
throw $oException; throw $oException;
} }
} }
} }

View File

@@ -10,7 +10,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_NOTES' table. * Skeleton subclass for performing query and update operations on the 'APP_NOTES' 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
@@ -18,6 +18,7 @@
* *
* @package classes.model * @package classes.model
*/ */
class AppNotesPeer extends BaseAppNotesPeer { class AppNotesPeer extends BaseAppNotesPeer
{
}
} // AppNotesPeer

View File

@@ -2,10 +2,10 @@
/** /**
* AppOwner.php * AppOwner.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
require_once 'classes/model/om/BaseAppOwner.php'; require_once 'classes/model/om/BaseAppOwner.php';
@@ -30,7 +30,7 @@ require_once 'classes/model/om/BaseAppOwner.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_OWNER' table. * Skeleton subclass for representing a row from the 'APP_OWNER' 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
@@ -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

@@ -2,10 +2,10 @@
/** /**
* AppOwnerPeer.php * AppOwnerPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_OWNER' table. * Skeleton subclass for performing query and update operations on the 'APP_OWNER' 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
@@ -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

@@ -7,7 +7,7 @@ require_once 'classes/entities/AppSolrQueue.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_SOLR_QUEUE' table. * Skeleton subclass for representing a row from the 'APP_SOLR_QUEUE' 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
@@ -15,112 +15,100 @@ 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 {
} return false;
else { }
return false; } catch (Exception $oError) {
} return false;
} }
catch (Exception $oError) {
return false;
}
} }
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 );
//$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);
//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 {
} $con->rollback();
else throw(new Exception("Failed Validation in class ".get_class($this)."."));
{
$con->rollback();
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 {
} $e=new Exception("Failed Validation in class ".get_class($this).".");
else //$e->aValidationFailures=$this->getValidationFailures();
{ throw($e);
$e=new Exception("Failed Validation in class ".get_class($this)."."); }
//$e->aValidationFailures=$this->getValidationFailures(); $con->commit();
throw($e); return $result;
} }
$con->commit(); } catch (Exception $e) {
return $result; $con->rollback();
} throw($e);
} }
catch(Exception $e)
{
$con->rollback();
throw($e);
}
} }
/** /**
* 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);
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED); $c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
//"WHERE //"WHERE
$c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL); $c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL);
$rs = AppSolrQueuePeer::doSelectRS($c); $rs = AppSolrQueuePeer::doSelectRS($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//echo $c->toString(); //echo $c->toString();
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
while (is_array($row)) { while (is_array($row)) {
$appSolrQueue = Entity_AppSolrQueue::createEmpty(); $appSolrQueue = Entity_AppSolrQueue::createEmpty();
$appSolrQueue->appUid = $row['APP_UID']; $appSolrQueue->appUid = $row['APP_UID'];
$appSolrQueue->appUpdated = $row['APP_UPDATED']; $appSolrQueue->appUpdated = $row['APP_UPDATED'];
$updatedApplications[] = $appSolrQueue; $updatedApplications[] = $appSolrQueue;
$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

@@ -10,7 +10,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_SOLR_QUEUE' table. * Skeleton subclass for performing query and update operations on the 'APP_SOLR_QUEUE' 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
@@ -18,6 +18,7 @@
* *
* @package classes.model * @package classes.model
*/ */
class AppSolrQueuePeer extends BaseAppSolrQueuePeer { class AppSolrQueuePeer extends BaseAppSolrQueuePeer
{
}
} // AppSolrQueuePeer

View File

@@ -2,10 +2,10 @@
/** /**
* AppThread.php * AppThread.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
require_once 'classes/model/om/BaseAppThread.php'; require_once 'classes/model/om/BaseAppThread.php';
@@ -30,7 +30,7 @@ require_once 'classes/model/om/BaseAppThread.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_THREAD' table. * Skeleton subclass for representing a row from the 'APP_THREAD' 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
@@ -38,85 +38,81 @@ 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 ) { {
throw ( new Exception ( 'Column "APP_UID" cannot be null.' ) ); if (!isset($sAppUid) || strlen($sAppUid ) == 0 ) {
} throw ( new Exception ( 'Column "APP_UID" cannot be null.' ) );
if (!isset($iDelIndex) || strlen($iDelIndex ) == 0 ) {
throw ( new Exception ( 'Column "DEL_INDEX" cannot be null.' ) );
}
if (!isset($iParent) || strlen($iDelIndex ) == 0 ) {
throw ( new Exception ( 'Column "APP_THREAD_INDEX" cannot be null.' ) );
}
$c = new Criteria ();
$c->clearSelectColumns();
$c->addSelectColumn ( 'MAX(' . AppThreadPeer::APP_THREAD_INDEX . ') ' );
$c->add ( AppThreadPeer::APP_UID, $sAppUid );
$rs = AppThreadPeer::doSelectRS ( $c );
$rs->next();
$row = $rs->getRow();
$iAppThreadIndex = $row[0] + 1;
$this->setAppUid ( $sAppUid );
$this->setAppThreadIndex ( $iAppThreadIndex );
$this->setAppThreadParent ( $iParent );
$this->setAppThreadStatus ( 'OPEN' );
$this->setDelIndex ( $iDelIndex );
if ($this->validate() ) {
try {
$res = $this->save();
}
catch ( PropelException $e ) {
throw ( $e );
}
}
else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $this->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage();
}
throw ( new Exception ( 'Failed Data validation. ' . $msg ) );
}
return $iAppThreadIndex;
}
public function update($aData)
{
$con = Propel::getConnection( AppThreadPeer::DATABASE_NAME );
try {
$con->begin();
$oApp = AppThreadPeer::retrieveByPK( $aData['APP_UID'], $aData['APP_THREAD_INDEX'] );
if (is_object($oApp) && get_class ($oApp) == 'AppThread' ) {
$oApp->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oApp->validate()) {
$res = $oApp->save();
$con->commit();
return $res;
} }
else {
$msg = '';
foreach($this->getValidationFailures() as $objValidationFailure)
$msg .= $objValidationFailure->getMessage() . "<br/>";
throw ( new PropelException ( 'The AppThread row cannot be created!', new PropelException ( $msg ) ) );
}
}
else {
$con->rollback();
throw(new Exception( "This AppThread row doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
} // AppThread if (!isset($iDelIndex) || strlen($iDelIndex ) == 0 ) {
throw ( new Exception ( 'Column "DEL_INDEX" cannot be null.' ) );
}
if (!isset($iParent) || strlen($iDelIndex ) == 0 ) {
throw ( new Exception ( 'Column "APP_THREAD_INDEX" cannot be null.' ) );
}
$c = new Criteria ();
$c->clearSelectColumns();
$c->addSelectColumn ( 'MAX(' . AppThreadPeer::APP_THREAD_INDEX . ') ' );
$c->add ( AppThreadPeer::APP_UID, $sAppUid );
$rs = AppThreadPeer::doSelectRS ( $c );
$rs->next();
$row = $rs->getRow();
$iAppThreadIndex = $row[0] + 1;
$this->setAppUid ( $sAppUid );
$this->setAppThreadIndex ( $iAppThreadIndex );
$this->setAppThreadParent ( $iParent );
$this->setAppThreadStatus ( 'OPEN' );
$this->setDelIndex ( $iDelIndex );
if ($this->validate() ) {
try {
$res = $this->save();
} catch ( PropelException $e ) {
throw ( $e );
}
} else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $this->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage();
}
throw ( new Exception ( 'Failed Data validation. ' . $msg ) );
}
return $iAppThreadIndex;
}
public function update($aData)
{
$con = Propel::getConnection( AppThreadPeer::DATABASE_NAME );
try {
$con->begin();
$oApp = AppThreadPeer::retrieveByPK( $aData['APP_UID'], $aData['APP_THREAD_INDEX'] );
if (is_object($oApp) && get_class ($oApp) == 'AppThread' ) {
$oApp->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oApp->validate()) {
$res = $oApp->save();
$con->commit();
return $res;
} else {
$msg = '';
foreach ($this->getValidationFailures() as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
throw ( new PropelException ( 'The AppThread row cannot be created!', new PropelException ( $msg ) ) );
}
} else {
$con->rollback();
throw(new Exception( "This AppThread row doesn't exist!" ));
}
} catch (Exception $oError) {
throw($oError);
}
}
}

View File

@@ -2,10 +2,10 @@
/** /**
* AppThreadPeer.php * AppThreadPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APP_THREAD' table. * Skeleton subclass for performing query and update operations on the 'APP_THREAD' 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
@@ -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

@@ -2,10 +2,10 @@
/** /**
* ApplicationPeer.php * ApplicationPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'APPLICATION' table. * Skeleton subclass for performing query and update operations on the 'APPLICATION' 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
@@ -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

@@ -10,7 +10,7 @@ require_once 'classes/model/om/BaseCalendarAssignments.php';
/** /**
* Skeleton subclass for representing a row from the 'CALENDAR_ASSIGNMENTS' table. * Skeleton subclass for representing a row from the 'CALENDAR_ASSIGNMENTS' 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
@@ -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

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CALENDAR_ASSIGNMENTS' table. * Skeleton subclass for performing query and update operations on the 'CALENDAR_ASSIGNMENTS' 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
@@ -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

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

View File

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CALENDAR_BUSINESS_HOURS' table. * Skeleton subclass for performing query and update operations on the 'CALENDAR_BUSINESS_HOURS' 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
@@ -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

@@ -1,455 +1,447 @@
<?php <?php
/** /**
* CalendarDefinition.php * CalendarDefinition.php
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
require_once 'classes/model/om/BaseCalendarDefinition.php'; require_once 'classes/model/om/BaseCalendarDefinition.php';
require_once 'classes/model/CalendarBusinessHours.php'; require_once 'classes/model/CalendarBusinessHours.php';
require_once 'classes/model/CalendarHolidays.php'; require_once 'classes/model/CalendarHolidays.php';
require_once 'classes/model/CalendarAssignments.php'; require_once 'classes/model/CalendarAssignments.php';
/** /**
* Skeleton subclass for representing a row from the 'CALENDAR_DEFINITION' table. * Skeleton subclass for representing a row from the 'CALENDAR_DEFINITION' 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 CalendarDefinition extends BaseCalendarDefinition class CalendarDefinition extends BaseCalendarDefinition
{ {
public $calendarLog = ''; public $calendarLog = '';
public function getCalendarList ($onlyActive = false, $arrayMode = false) public function getCalendarList ($onlyActive = false, $arrayMode = false)
{ {
$Criteria = new Criteria( 'workflow' ); $Criteria = new Criteria( 'workflow' );
$Criteria->clearSelectColumns(); $Criteria->clearSelectColumns();
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS );
// $Criteria->addAsColumn('DELETABLE', "IF (CALENDAR_UID <> '00000000000000000000000000000001', '".G::LoadTranslation('ID_DELETE')."','') "); // $Criteria->addAsColumn('DELETABLE', "IF (CALENDAR_UID <> '00000000000000000000000000000001', '".G::LoadTranslation('ID_DELETE')."','') ");
$Criteria->addAsColumn( 'DELETABLE', "CASE WHEN CALENDAR_UID <> '00000000000000000000000000000001' THEN '" . G::LoadTranslation( 'ID_DELETE' ) . "' ELSE '' END " ); $Criteria->addAsColumn( 'DELETABLE', "CASE WHEN CALENDAR_UID <> '00000000000000000000000000000001' THEN '" . G::LoadTranslation( 'ID_DELETE' ) . "' ELSE '' END " );
// Note: This list doesn't show deleted items (STATUS = DELETED) // Note: This list doesn't show deleted items (STATUS = DELETED)
if ($onlyActive) { if ($onlyActive) {
// Show only active. Used on assignment lists // Show only active. Used on assignment lists
$Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, "ACTIVE", CRITERIA::EQUAL ); $Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, "ACTIVE", CRITERIA::EQUAL );
} else { } else {
// Show Active and Inactive calendars. USed in main list // Show Active and Inactive calendars. USed in main list
$Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, array ("ACTIVE","INACTIVE"), CRITERIA::IN ); $Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, array ("ACTIVE","INACTIVE"), CRITERIA::IN );
} }
$Criteria->add( calendarDefinitionPeer::CALENDAR_UID, "xx", CRITERIA::NOT_EQUAL ); $Criteria->add( calendarDefinitionPeer::CALENDAR_UID, "xx", CRITERIA::NOT_EQUAL );
if (! $arrayMode) { if (! $arrayMode) {
return $Criteria; return $Criteria;
} else { } else {
$oDataset = calendarDefinitionPeer::doSelectRS( $Criteria ); $oDataset = calendarDefinitionPeer::doSelectRS( $Criteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$calendarA = array (0 => 'dummy'); $calendarA = array (0 => 'dummy');
$calendarCount = 0; $calendarCount = 0;
while (is_array( $aRow = $oDataset->getRow() )) { while (is_array( $aRow = $oDataset->getRow() )) {
$calendarCount ++; $calendarCount ++;
$calendarA[$calendarCount] = $aRow; $calendarA[$calendarCount] = $aRow;
$oDataset->next(); $oDataset->next();
} }
$return['criteria'] = $Criteria; $return['criteria'] = $Criteria;
$return['array'] = $calendarA; $return['array'] = $calendarA;
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)
{ {
$Criteria = new Criteria( 'workflow' ); $Criteria = new Criteria( 'workflow' );
$Criteria->clearSelectColumns(); $Criteria->clearSelectColumns();
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
if ($filter != '') { if ($filter != '') {
$Criteria->add( $Criteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE ) ) ); $Criteria->add( $Criteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $Criteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE ) ) );
} }
$Criteria->add( CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL ); $Criteria->add( CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL );
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID ); $oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME ); $oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME );
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE ); $oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE );
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE ); $oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE );
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION ); $oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION );
$oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS ); $oCriteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS );
if ($filter != '') { if ($filter != '') {
$oCriteria->add( $oCriteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE ) ) ); $oCriteria->add( $oCriteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE ) ) );
} }
$oCriteria->add( CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL ); $oCriteria->add( CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL );
$oCriteria->setLimit( $limit ); $oCriteria->setLimit( $limit );
$oCriteria->setOffset( $start ); $oCriteria->setOffset( $start );
$criterias = array (); $criterias = array ();
$criterias['COUNTER'] = $Criteria; $criterias['COUNTER'] = $Criteria;
$criterias['LIST'] = $oCriteria; $criterias['LIST'] = $oCriteria;
return $criterias; return $criterias;
} }
public function getCalendarInfo ($CalendarUid) public function getCalendarInfo ($CalendarUid)
{ {
//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 = CalendarDefinitionPeer::retrieveByPK( $CalendarUid ); $tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
$defaultCalendar['CALENDAR_UID'] = "00000000000000000000000000000001"; $defaultCalendar['CALENDAR_UID'] = "00000000000000000000000000000001";
$defaultCalendar['CALENDAR_NAME'] = "Default"; $defaultCalendar['CALENDAR_NAME'] = "Default";
$defaultCalendar['CALENDAR_CREATE_DATE'] = date( "Y-m-d" ); $defaultCalendar['CALENDAR_CREATE_DATE'] = date( "Y-m-d" );
$defaultCalendar['CALENDAR_UPDATE_DATE'] = date( "Y-m-d" ); $defaultCalendar['CALENDAR_UPDATE_DATE'] = date( "Y-m-d" );
$defaultCalendar['CALENDAR_DESCRIPTION'] = "Default"; $defaultCalendar['CALENDAR_DESCRIPTION'] = "Default";
$defaultCalendar['CALENDAR_STATUS'] = "ACTIVE"; $defaultCalendar['CALENDAR_STATUS'] = "ACTIVE";
$defaultCalendar['CALENDAR_WORK_DAYS'] = "1|2|3|4|5"; $defaultCalendar['CALENDAR_WORK_DAYS'] = "1|2|3|4|5";
$defaultCalendar['CALENDAR_WORK_DAYS'] = explode( "|", "1|2|3|4|5" ); $defaultCalendar['CALENDAR_WORK_DAYS'] = explode( "|", "1|2|3|4|5" );
$defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7; $defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
$defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00"; $defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
$defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00"; $defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
$defaultCalendar['HOLIDAY'] = array (); $defaultCalendar['HOLIDAY'] = array ();
if ((is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) { if ((is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) {
$fields['CALENDAR_UID'] = $tr->getCalendarUid(); $fields['CALENDAR_UID'] = $tr->getCalendarUid();
$fields['CALENDAR_NAME'] = $tr->getCalendarName(); $fields['CALENDAR_NAME'] = $tr->getCalendarName();
$fields['CALENDAR_CREATE_DATE'] = $tr->getCalendarCreateDate(); $fields['CALENDAR_CREATE_DATE'] = $tr->getCalendarCreateDate();
$fields['CALENDAR_UPDATE_DATE'] = $tr->getCalendarUpdateDate(); $fields['CALENDAR_UPDATE_DATE'] = $tr->getCalendarUpdateDate();
$fields['CALENDAR_DESCRIPTION'] = $tr->getCalendarDescription(); $fields['CALENDAR_DESCRIPTION'] = $tr->getCalendarDescription();
$fields['CALENDAR_STATUS'] = $tr->getCalendarStatus(); $fields['CALENDAR_STATUS'] = $tr->getCalendarStatus();
$fields['CALENDAR_WORK_DAYS'] = $tr->getCalendarWorkDays(); $fields['CALENDAR_WORK_DAYS'] = $tr->getCalendarWorkDays();
$fields['CALENDAR_WORK_DAYS_A'] = explode( "|", $tr->getCalendarWorkDays() ); $fields['CALENDAR_WORK_DAYS_A'] = explode( "|", $tr->getCalendarWorkDays() );
} else { } else {
$fields = $defaultCalendar; $fields = $defaultCalendar;
$this->saveCalendarInfo( $fields ); $this->saveCalendarInfo( $fields );
$fields['CALENDAR_WORK_DAYS'] = "1|2|3|4|5"; $fields['CALENDAR_WORK_DAYS'] = "1|2|3|4|5";
$fields['CALENDAR_WORK_DAYS_A'] = explode( "|", "1|2|3|4|5" ); $fields['CALENDAR_WORK_DAYS_A'] = explode( "|", "1|2|3|4|5" );
$tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid ); $tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
} }
$CalendarBusinessHoursObj = new CalendarBusinessHours(); $CalendarBusinessHoursObj = new CalendarBusinessHours();
$CalendarBusinessHours = $CalendarBusinessHoursObj->getCalendarBusinessHours( $CalendarUid ); $CalendarBusinessHours = $CalendarBusinessHoursObj->getCalendarBusinessHours( $CalendarUid );
$fields['BUSINESS_DAY'] = $CalendarBusinessHours; $fields['BUSINESS_DAY'] = $CalendarBusinessHours;
$CalendarHolidaysObj = new CalendarHolidays(); $CalendarHolidaysObj = new CalendarHolidays();
$CalendarHolidays = $CalendarHolidaysObj->getCalendarHolidays( $CalendarUid ); $CalendarHolidays = $CalendarHolidaysObj->getCalendarHolidays( $CalendarUid );
$fields['HOLIDAY'] = $CalendarHolidays; $fields['HOLIDAY'] = $CalendarHolidays;
$fields = $this->validateCalendarInfo( $fields, $defaultCalendar ); $fields = $this->validateCalendarInfo( $fields, $defaultCalendar );
//******************** //********************
return $fields; return $fields;
} }
//for edit //for edit
public function getCalendarInfoE ($CalendarUid) public function getCalendarInfoE ($CalendarUid)
{ {
//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 = CalendarDefinitionPeer::retrieveByPK( $CalendarUid ); $tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
$defaultCalendar['CALENDAR_UID'] = "00000000000000000000000000000001"; $defaultCalendar['CALENDAR_UID'] = "00000000000000000000000000000001";
$defaultCalendar['CALENDAR_NAME'] = "Default"; $defaultCalendar['CALENDAR_NAME'] = "Default";
$defaultCalendar['CALENDAR_CREATE_DATE'] = date( "Y-m-d" ); $defaultCalendar['CALENDAR_CREATE_DATE'] = date( "Y-m-d" );
$defaultCalendar['CALENDAR_UPDATE_DATE'] = date( "Y-m-d" ); $defaultCalendar['CALENDAR_UPDATE_DATE'] = date( "Y-m-d" );
$defaultCalendar['CALENDAR_DESCRIPTION'] = "Default"; $defaultCalendar['CALENDAR_DESCRIPTION'] = "Default";
$defaultCalendar['CALENDAR_STATUS'] = "ACTIVE"; $defaultCalendar['CALENDAR_STATUS'] = "ACTIVE";
$defaultCalendar['CALENDAR_WORK_DAYS'] = "1|2|3|4|5"; $defaultCalendar['CALENDAR_WORK_DAYS'] = "1|2|3|4|5";
$defaultCalendar['CALENDAR_WORK_DAYS'] = explode( "|", "1|2|3|4|5" ); $defaultCalendar['CALENDAR_WORK_DAYS'] = explode( "|", "1|2|3|4|5" );
$defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7; $defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
$defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00"; $defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
$defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00"; $defaultCalendar['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
$defaultCalendar['HOLIDAY'] = array (); $defaultCalendar['HOLIDAY'] = array ();
if ((is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) { if ((is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) {
$fields['CALENDAR_UID'] = $tr->getCalendarUid(); $fields['CALENDAR_UID'] = $tr->getCalendarUid();
$fields['CALENDAR_NAME'] = $tr->getCalendarName(); $fields['CALENDAR_NAME'] = $tr->getCalendarName();
$fields['CALENDAR_CREATE_DATE'] = $tr->getCalendarCreateDate(); $fields['CALENDAR_CREATE_DATE'] = $tr->getCalendarCreateDate();
$fields['CALENDAR_UPDATE_DATE'] = $tr->getCalendarUpdateDate(); $fields['CALENDAR_UPDATE_DATE'] = $tr->getCalendarUpdateDate();
$fields['CALENDAR_DESCRIPTION'] = $tr->getCalendarDescription(); $fields['CALENDAR_DESCRIPTION'] = $tr->getCalendarDescription();
$fields['CALENDAR_STATUS'] = $tr->getCalendarStatus(); $fields['CALENDAR_STATUS'] = $tr->getCalendarStatus();
$fields['CALENDAR_WORK_DAYS'] = $tr->getCalendarWorkDays(); $fields['CALENDAR_WORK_DAYS'] = $tr->getCalendarWorkDays();
$fields['CALENDAR_WORK_DAYS_A'] = explode( "|", $tr->getCalendarWorkDays() ); $fields['CALENDAR_WORK_DAYS_A'] = explode( "|", $tr->getCalendarWorkDays() );
} else { } else {
$fields = $defaultCalendar; $fields = $defaultCalendar;
$this->saveCalendarInfo( $fields ); $this->saveCalendarInfo( $fields );
$fields['CALENDAR_WORK_DAYS'] = "1|2|3|4|5"; $fields['CALENDAR_WORK_DAYS'] = "1|2|3|4|5";
$fields['CALENDAR_WORK_DAYS_A'] = explode( "|", "1|2|3|4|5" ); $fields['CALENDAR_WORK_DAYS_A'] = explode( "|", "1|2|3|4|5" );
$tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid ); $tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
} }
$CalendarBusinessHoursObj = new CalendarBusinessHours(); $CalendarBusinessHoursObj = new CalendarBusinessHours();
$CalendarBusinessHours = $CalendarBusinessHoursObj->getCalendarBusinessHours( $CalendarUid ); $CalendarBusinessHours = $CalendarBusinessHoursObj->getCalendarBusinessHours( $CalendarUid );
$fields['BUSINESS_DAY'] = $CalendarBusinessHours; $fields['BUSINESS_DAY'] = $CalendarBusinessHours;
$CalendarHolidaysObj = new CalendarHolidays(); $CalendarHolidaysObj = new CalendarHolidays();
$CalendarHolidays = $CalendarHolidaysObj->getCalendarHolidays( $CalendarUid ); $CalendarHolidays = $CalendarHolidaysObj->getCalendarHolidays( $CalendarUid );
$fields['HOLIDAY'] = $CalendarHolidays; $fields['HOLIDAY'] = $CalendarHolidays;
// $fields=$this->validateCalendarInfo($fields, $defaultCalendar); //******************** // $fields=$this->validateCalendarInfo($fields, $defaultCalendar); //********************
return $fields; return $fields;
} }
//end for edit //end for edit
public function validateCalendarInfo ($fields, $defaultCalendar) public function validateCalendarInfo ($fields, $defaultCalendar)
{ {
try { try {
//Validate if Working days are Correct //Validate if Working days are Correct
//Minimun 3 ? //Minimun 3 ?
$workingDays = explode( "|", $fields['CALENDAR_WORK_DAYS'] ); $workingDays = explode( "|", $fields['CALENDAR_WORK_DAYS'] );
if (count( $workingDays ) < 3) { if (count( $workingDays ) < 3) {
throw (new Exception( "You must define at least 3 Working Days!" )); throw (new Exception( "You must define at least 3 Working Days!" ));
} }
//Validate that all Working Days have Bussines Hours //Validate that all Working Days have Bussines Hours
if (count( $fields['BUSINESS_DAY'] ) < 1) { if (count( $fields['BUSINESS_DAY'] ) < 1) {
throw (new Exception( "You must define at least one Business Day for all days" )); throw (new Exception( "You must define at least one Business Day for all days" ));
} }
$workingDaysOK = array (); $workingDaysOK = array ();
foreach ($workingDays as $key => $day) { foreach ($workingDays as $key => $day) {
$workingDaysOK[$day] = false; $workingDaysOK[$day] = false;
} }
$sw_all = false; $sw_all = false;
foreach ($fields['BUSINESS_DAY'] as $keyB => $businessHours) { foreach ($fields['BUSINESS_DAY'] as $keyB => $businessHours) {
if (($businessHours['CALENDAR_BUSINESS_DAY'] == 7)) { if (($businessHours['CALENDAR_BUSINESS_DAY'] == 7)) {
$sw_all = true; $sw_all = true;
} elseif ((in_array( $businessHours['CALENDAR_BUSINESS_DAY'], $workingDays ))) { } elseif ((in_array( $businessHours['CALENDAR_BUSINESS_DAY'], $workingDays ))) {
$workingDaysOK[$businessHours['CALENDAR_BUSINESS_DAY']] = true; $workingDaysOK[$businessHours['CALENDAR_BUSINESS_DAY']] = true;
} }
} }
$sw_days = true; $sw_days = true;
foreach ($workingDaysOK as $day => $sw_day) { foreach ($workingDaysOK as $day => $sw_day) {
$sw_days = $sw_days && $sw_day; $sw_days = $sw_days && $sw_day;
} }
if (! ($sw_all || $sw_days)) { if (! ($sw_all || $sw_days)) {
throw (new Exception( "Not all working days have their correspondent business day" )); throw (new Exception( "Not all working days have their correspondent business day" ));
} }
//Validate Holidays //Validate Holidays
return $fields; return $fields;
} catch (Exception $e) { } catch (Exception $e) {
//print $e->getMessage(); //print $e->getMessage();
$this->addCalendarLog( "!!!!!!! BAD CALENDAR DEFINITION. " . $e->getMessage() ); $this->addCalendarLog( "!!!!!!! BAD CALENDAR DEFINITION. " . $e->getMessage() );
$defaultCalendar['CALENDAR_WORK_DAYS'] = "1|2|3|4|5"; $defaultCalendar['CALENDAR_WORK_DAYS'] = "1|2|3|4|5";
$defaultCalendar['CALENDAR_WORK_DAYS_A'] = explode( "|", "1|2|3|4|5" ); $defaultCalendar['CALENDAR_WORK_DAYS_A'] = explode( "|", "1|2|3|4|5" );
return $defaultCalendar; return $defaultCalendar;
} }
} }
public function saveCalendarInfo ($aData) public function saveCalendarInfo ($aData)
{ {
$CalendarUid = $aData['CALENDAR_UID']; $CalendarUid = $aData['CALENDAR_UID'];
$CalendarName = $aData['CALENDAR_NAME']; $CalendarName = $aData['CALENDAR_NAME'];
$CalendarDescription = $aData['CALENDAR_DESCRIPTION']; $CalendarDescription = $aData['CALENDAR_DESCRIPTION'];
$CalendarStatus = isset( $aData['CALENDAR_STATUS'] ) ? $aData['CALENDAR_STATUS'] : "INACTIVE"; $CalendarStatus = isset( $aData['CALENDAR_STATUS'] ) ? $aData['CALENDAR_STATUS'] : "INACTIVE";
$defaultCalendars[] = '00000000000000000000000000000001'; $defaultCalendars[] = '00000000000000000000000000000001';
if (in_array( $aData['CALENDAR_UID'], $defaultCalendars )) { if (in_array( $aData['CALENDAR_UID'], $defaultCalendars )) {
$CalendarStatus = 'ACTIVE'; $CalendarStatus = 'ACTIVE';
$CalendarName = 'Default'; $CalendarName = 'Default';
} }
$CalendarWorkDays = isset( $aData['CALENDAR_WORK_DAYS'] ) ? implode( "|", $aData['CALENDAR_WORK_DAYS'] ) : ""; $CalendarWorkDays = isset( $aData['CALENDAR_WORK_DAYS'] ) ? implode( "|", $aData['CALENDAR_WORK_DAYS'] ) : "";
//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 = CalendarDefinitionPeer::retrieveByPK( $CalendarUid ); $tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) { if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) {
$tr = new CalendarDefinition(); $tr = new CalendarDefinition();
$tr->setCalendarCreateDate( 'now' ); $tr->setCalendarCreateDate( 'now' );
} }
$tr->setCalendarUid( $CalendarUid ); $tr->setCalendarUid( $CalendarUid );
$tr->setCalendarName( $CalendarName ); $tr->setCalendarName( $CalendarName );
$tr->setCalendarUpdateDate( 'now' ); $tr->setCalendarUpdateDate( 'now' );
$tr->setCalendarDescription( $CalendarDescription ); $tr->setCalendarDescription( $CalendarDescription );
$tr->setCalendarStatus( $CalendarStatus ); $tr->setCalendarStatus( $CalendarStatus );
$tr->setCalendarWorkDays( $CalendarWorkDays ); $tr->setCalendarWorkDays( $CalendarWorkDays );
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();
//Calendar Business Hours Save code. //Calendar Business Hours Save code.
//First Delete all current records //First Delete all current records
$CalendarBusinessHoursObj = new CalendarBusinessHours(); $CalendarBusinessHoursObj = new CalendarBusinessHours();
$CalendarBusinessHoursObj->deleteAllCalendarBusinessHours( $CalendarUid ); $CalendarBusinessHoursObj->deleteAllCalendarBusinessHours( $CalendarUid );
//Save all the sent records //Save all the sent records
foreach ($aData['BUSINESS_DAY'] as $key => $objData) { foreach ($aData['BUSINESS_DAY'] as $key => $objData) {
$objData['CALENDAR_UID'] = $CalendarUid; $objData['CALENDAR_UID'] = $CalendarUid;
$CalendarBusinessHoursObj->saveCalendarBusinessHours( $objData ); $CalendarBusinessHoursObj->saveCalendarBusinessHours( $objData );
} }
//Holiday Save code. //Holiday Save code.
//First Delete all current records //First Delete all current records
$CalendarHolidayObj = new CalendarHolidays(); $CalendarHolidayObj = new CalendarHolidays();
$CalendarHolidayObj->deleteAllCalendarHolidays( $CalendarUid ); $CalendarHolidayObj->deleteAllCalendarHolidays( $CalendarUid );
//Save all the sent records //Save all the sent records
foreach ($aData['HOLIDAY'] as $key => $objData) { foreach ($aData['HOLIDAY'] as $key => $objData) {
if (($objData['CALENDAR_HOLIDAY_NAME'] != "") && ($objData['CALENDAR_HOLIDAY_START'] != "") && ($objData['CALENDAR_HOLIDAY_END'] != "")) { if (($objData['CALENDAR_HOLIDAY_NAME'] != "") && ($objData['CALENDAR_HOLIDAY_START'] != "") && ($objData['CALENDAR_HOLIDAY_END'] != "")) {
$objData['CALENDAR_UID'] = $CalendarUid; $objData['CALENDAR_UID'] = $CalendarUid;
$CalendarHolidayObj->saveCalendarHolidays( $objData ); $CalendarHolidayObj->saveCalendarHolidays( $objData );
} }
} }
} 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
//if ( $res['codError'] < 0 ) { public function deleteCalendar ($CalendarUid)
// G::SendMessageText ( $res['message'] , 'error' ); {
//}
}
public function deleteCalendar ($CalendarUid)
{
//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 = CalendarDefinitionPeer::retrieveByPK( $CalendarUid ); $tr = CalendarDefinitionPeer::retrieveByPK( $CalendarUid );
if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) { if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) {
// //
return false; return false;
} }
$defaultCalendars[] = '00000000000000000000000000000001'; $defaultCalendars[] = '00000000000000000000000000000001';
if (in_array( $tr->getCalendarUid(), $defaultCalendars )) { if (in_array( $tr->getCalendarUid(), $defaultCalendars )) {
return false; return false;
} }
$tr->setCalendarStatus( 'DELETED' ); $tr->setCalendarStatus( 'DELETED' );
$tr->setCalendarUpdateDate( 'now' ); $tr->setCalendarUpdateDate( 'now' );
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 = ''; $msg = '';
$validationFailuresArray = $tr->getValidationFailures(); $validationFailuresArray = $tr->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) { foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>"; $msg .= $objValidationFailure->getMessage() . "<br/>";
} }
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 ) { public function getCalendarFor ($userUid, $proUid, $tasUid, $sw_validate = true)
// G::SendMessageText ( $res['message'] , 'error' ); {
//} $Criteria = new Criteria( 'workflow' );
}
public function getCalendarFor ($userUid, $proUid, $tasUid, $sw_validate = true)
{
$Criteria = new Criteria( 'workflow' );
//Default Calendar //Default Calendar
$calendarUid = "00000000000000000000000000000001"; $calendarUid = "00000000000000000000000000000001";
$calendarOwner = "DEFAULT"; $calendarOwner = "DEFAULT";
//Load User,Task and Process calendars (if exist) //Load User,Task and Process calendars (if exist)
$Criteria->addSelectColumn( CalendarAssignmentsPeer::CALENDAR_UID ); $Criteria->addSelectColumn( CalendarAssignmentsPeer::CALENDAR_UID );
$Criteria->addSelectColumn( CalendarAssignmentsPeer::OBJECT_UID ); $Criteria->addSelectColumn( CalendarAssignmentsPeer::OBJECT_UID );
$Criteria->addSelectColumn( CalendarAssignmentsPeer::OBJECT_TYPE ); $Criteria->addSelectColumn( CalendarAssignmentsPeer::OBJECT_TYPE );
$Criteria->add( CalendarAssignmentsPeer::OBJECT_UID, array ($userUid,$proUid,$tasUid), CRITERIA::IN ); $Criteria->add( CalendarAssignmentsPeer::OBJECT_UID, array ($userUid,$proUid,$tasUid), CRITERIA::IN );
$oDataset = CalendarAssignmentsPeer::doSelectRS( $Criteria ); $oDataset = CalendarAssignmentsPeer::doSelectRS( $Criteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$calendarArray = array (); $calendarArray = array ();
while (is_array( $aRow = $oDataset->getRow() )) { while (is_array( $aRow = $oDataset->getRow() )) {
if ($aRow['OBJECT_UID'] == $userUid) { if ($aRow['OBJECT_UID'] == $userUid) {
$calendarArray['USER'] = $aRow['CALENDAR_UID']; $calendarArray['USER'] = $aRow['CALENDAR_UID'];
} }
if ($aRow['OBJECT_UID'] == $proUid) { if ($aRow['OBJECT_UID'] == $proUid) {
$calendarArray['PROCESS'] = $aRow['CALENDAR_UID']; $calendarArray['PROCESS'] = $aRow['CALENDAR_UID'];
} }
if ($aRow['OBJECT_UID'] == $tasUid) { if ($aRow['OBJECT_UID'] == $tasUid) {
$calendarArray['TASK'] = $aRow['CALENDAR_UID']; $calendarArray['TASK'] = $aRow['CALENDAR_UID'];
} }
$oDataset->next(); $oDataset->next();
} }
if (isset( $calendarArray['USER'] )) { if (isset( $calendarArray['USER'] )) {
$calendarUid = $calendarArray['USER']; $calendarUid = $calendarArray['USER'];
$calendarOwner = "USER"; $calendarOwner = "USER";
} elseif (isset( $calendarArray['PROCESS'] )) { } elseif (isset( $calendarArray['PROCESS'] )) {
$calendarUid = $calendarArray['PROCESS']; $calendarUid = $calendarArray['PROCESS'];
$calendarOwner = "PROCESS"; $calendarOwner = "PROCESS";
} elseif (isset( $calendarArray['TASK'] )) { } elseif (isset( $calendarArray['TASK'] )) {
$calendarUid = $calendarArray['TASK']; $calendarUid = $calendarArray['TASK'];
$calendarOwner = "TASK"; $calendarOwner = "TASK";
} }
//print "<h1>$calendarUid</h1>"; //print "<h1>$calendarUid</h1>";
if ($sw_validate) { if ($sw_validate) {
$calendarDefinition = $this->getCalendarInfo( $calendarUid ); $calendarDefinition = $this->getCalendarInfo( $calendarUid );
} else { } else {
$calendarDefinition = $this->getCalendarInfoE( $calendarUid ); $calendarDefinition = $this->getCalendarInfoE( $calendarUid );
} }
$calendarDefinition['CALENDAR_APPLIED'] = $calendarOwner; $calendarDefinition['CALENDAR_APPLIED'] = $calendarOwner;
$this->addCalendarLog( "--=== Calendar Applied: " . $calendarDefinition['CALENDAR_NAME'] . " -> $calendarOwner" ); $this->addCalendarLog( "--=== Calendar Applied: " . $calendarDefinition['CALENDAR_NAME'] . " -> $calendarOwner" );
return $calendarDefinition; return $calendarDefinition;
} }
public function assignCalendarTo ($objectUid, $calendarUid, $objectType) public function assignCalendarTo ($objectUid, $calendarUid, $objectType)
{ {
//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 = CalendarAssignmentsPeer::retrieveByPK( $objectUid ); $tr = CalendarAssignmentsPeer::retrieveByPK( $objectUid );
if ($calendarUid != "") { if ($calendarUid != "") {
if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarAssignments')) { if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarAssignments')) {
$tr = new CalendarAssignments(); $tr = new CalendarAssignments();
} }
$tr->setObjectUid( $objectUid ); $tr->setObjectUid( $objectUid );
$tr->setCalendarUid( $calendarUid ); $tr->setCalendarUid( $calendarUid );
$tr->setObjectType( $objectType ); $tr->setObjectType( $objectType );
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 = ''; $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 );
} }
} else { } else {
//Delete record //Delete record
if ((is_object( $tr ) && get_class( $tr ) == 'CalendarAssignments')) { if ((is_object( $tr ) && get_class( $tr ) == 'CalendarAssignments')) {
$tr->delete(); $tr->delete();
} }
} }
} }
//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)
{ {
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( CalendarAssignmentsPeer::CALENDAR_UID ); $oCriteria->addSelectColumn( CalendarAssignmentsPeer::CALENDAR_UID );
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' ); $oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
$oCriteria->addGroupByColumn( CalendarAssignmentsPeer::CALENDAR_UID ); $oCriteria->addGroupByColumn( CalendarAssignmentsPeer::CALENDAR_UID );
$oCriteria->add( CalendarAssignmentsPeer::OBJECT_TYPE, $type ); $oCriteria->add( CalendarAssignmentsPeer::OBJECT_TYPE, $type );
$oDataset = CalendarAssignmentsPeer::doSelectRS( $oCriteria ); $oDataset = CalendarAssignmentsPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aCounter = Array (); $aCounter = Array ();
while ($oDataset->next()) { while ($oDataset->next()) {
$row = $oDataset->getRow(); $row = $oDataset->getRow();
$aCounter[$row['CALENDAR_UID']] = $row['CNT']; $aCounter[$row['CALENDAR_UID']] = $row['CNT'];
} }
return $aCounter; return $aCounter;
} }
public function loadByCalendarName ($calendarName) public function loadByCalendarName ($calendarName)
{ {
$Criteria = new Criteria( 'workflow' ); $Criteria = new Criteria( 'workflow' );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS ); $Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS );
$Criteria->add( calendarDefinitionPeer::CALENDAR_NAME, $calendarName, CRITERIA::EQUAL ); $Criteria->add( calendarDefinitionPeer::CALENDAR_NAME, $calendarName, CRITERIA::EQUAL );
$oDataset = calendarDefinitionPeer::doSelectRS( $Criteria ); $oDataset = calendarDefinitionPeer::doSelectRS( $Criteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
return $oDataset->getRow(); return $oDataset->getRow();
} }
} }
// CalendarDefinition

View File

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CALENDAR_DEFINITION' table. * Skeleton subclass for performing query and update operations on the 'CALENDAR_DEFINITION' 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
@@ -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,11 +6,10 @@
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.
* *
* *
* *
* 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
@@ -18,97 +17,87 @@ 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){ {
$Criteria = new Criteria('workflow'); public function getCalendarHolidays ($CalendarUid)
$Criteria->clearSelectColumns ( ); {
$Criteria = new Criteria('workflow');
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_UID ); $Criteria->clearSelectColumns ( );
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_NAME );
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_START );
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_END );
$Criteria->add ( CalendarHolidaysPeer::CALENDAR_UID, $CalendarUid , CRITERIA::EQUAL );
$rs = CalendarHolidaysPeer::doSelectRS($Criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$fields=array();
$count=0;
while (is_array($row)) { $Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_UID );
$count++; $Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_NAME );
$a=explode(" ",$row['CALENDAR_HOLIDAY_START']); $Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_START );
$row['CALENDAR_HOLIDAY_START']=$a[0]; $Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_HOLIDAY_END );
$a=explode(" ",$row['CALENDAR_HOLIDAY_END']);
$row['CALENDAR_HOLIDAY_END']=$a[0]; $Criteria->add ( CalendarHolidaysPeer::CALENDAR_UID, $CalendarUid , CRITERIA::EQUAL );
$fields[$count] = $row;
$rs = CalendarHolidaysPeer::doSelectRS($Criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();
} $fields=array();
return $fields; $count=0;
} while (is_array($row)) {
function deleteAllCalendarHolidays($CalendarUid){ $count++;
$toDelete=$this->getCalendarHolidays($CalendarUid); $a=explode(" ",$row['CALENDAR_HOLIDAY_START']);
foreach($toDelete as $key => $holidayInfo){ $row['CALENDAR_HOLIDAY_START']=$a[0];
$CalendarUid = $holidayInfo['CALENDAR_UID']; $a=explode(" ",$row['CALENDAR_HOLIDAY_END']);
$CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME']; $row['CALENDAR_HOLIDAY_END']=$a[0];
$CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START']; $fields[$count] = $row;
$CalendarHolidayEnd = $holidayInfo['CALENDAR_HOLIDAY_END']; $rs->next();
//if exists the row in the database propel will update it, otherwise will insert. $row = $rs->getRow();
}
$tr = CalendarHolidaysPeer::retrieveByPK ( $CalendarUid,$CalendarHolidayName ); return $fields;
if ( ( is_object ( $tr ) && get_class ($tr) == 'CalendarHolidays' ) ) {
$tr->delete();
}
} }
}
function saveCalendarHolidays($aData){
$CalendarUid = $aData['CALENDAR_UID'];
$CalendarHolidayName = $aData['CALENDAR_HOLIDAY_NAME'];
$CalendarHolidayStart = $aData['CALENDAR_HOLIDAY_START'];
$CalendarHolidayEnd = $aData['CALENDAR_HOLIDAY_END'];
//if exists the row in the database propel will update it, otherwise will insert.
$tr = CalendarHolidaysPeer::retrieveByPK ( $CalendarUid,$CalendarHolidayName);
if ( ! ( is_object ( $tr ) && get_class ($tr) == 'CalendarHolidays' ) ) {
$tr = new CalendarHolidays();
}
$tr->setCalendarUid( $CalendarUid ); public function deleteAllCalendarHolidays($CalendarUid)
$tr->setCalendarHolidayName( $CalendarHolidayName ); {
$tr->setCalendarHolidayStart( $CalendarHolidayStart ); $toDelete=$this->getCalendarHolidays($CalendarUid);
$tr->setCalendarHolidayEnd( $CalendarHolidayEnd ); foreach ($toDelete as $key => $holidayInfo) {
$CalendarUid = $holidayInfo['CALENDAR_UID'];
$CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME'];
if ($tr->validate() ) { $CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START'];
// we save it, since we get no validation errors, or do whatever else you like. $CalendarHolidayEnd = $holidayInfo['CALENDAR_HOLIDAY_END'];
$res = $tr->save(); //if exists the row in the database propel will update it, otherwise will insert.
}
else { $tr = CalendarHolidaysPeer::retrieveByPK ( $CalendarUid,$CalendarHolidayName );
// Something went wrong. We can now get the validationFailures and handle them. if ( ( is_object ( $tr ) && get_class ($tr) == 'CalendarHolidays' ) ) {
$msg = ''; $tr->delete();
$validationFailuresArray = $tr->getValidationFailures(); }
foreach($validationFailuresArray as $objValidationFailure) { }
$msg .= $objValidationFailure->getMessage() . "<br/>"; }
}
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); public function saveCalendarHolidays($aData)
} {
$CalendarUid = $aData['CALENDAR_UID'];
$CalendarHolidayName = $aData['CALENDAR_HOLIDAY_NAME'];
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => ''); $CalendarHolidayStart = $aData['CALENDAR_HOLIDAY_START'];
$CalendarHolidayEnd = $aData['CALENDAR_HOLIDAY_END'];
//to do: uniform coderror structures for all classes
//if exists the row in the database propel will update it, otherwise will insert.
//if ( $res['codError'] < 0 ) { $tr = CalendarHolidaysPeer::retrieveByPK ( $CalendarUid,$CalendarHolidayName);
// G::SendMessageText ( $res['message'] , 'error' ); if ( ! ( is_object ( $tr ) && get_class ($tr) == 'CalendarHolidays' ) ) {
//} $tr = new CalendarHolidays();
} }
$tr->setCalendarUid( $CalendarUid );
$tr->setCalendarHolidayName( $CalendarHolidayName );
$tr->setCalendarHolidayStart( $CalendarHolidayStart );
$tr->setCalendarHolidayEnd( $CalendarHolidayEnd );
if ($tr->validate() ) {
$res = $tr->save();
} else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $tr->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
}
//to do: uniform coderror structures for all classes
}
}
} // CalendarHolidays

View File

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CALENDAR_HOLIDAYS' table. * Skeleton subclass for performing query and update operations on the 'CALENDAR_HOLIDAYS' 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
@@ -22,6 +22,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class CalendarHolidaysPeer extends BaseCalendarHolidaysPeer { class CalendarHolidaysPeer extends BaseCalendarHolidaysPeer
{
}
} // CalendarHolidaysPeer

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CASE_SCHEDULER' table. * Skeleton subclass for performing query and update operations on the 'CASE_SCHEDULER' 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
@@ -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

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CASE_TRACKER_OBJECT' table. * Skeleton subclass for performing query and update operations on the 'CASE_TRACKER_OBJECT' 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
@@ -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

@@ -14,7 +14,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CASE_TRACKER' table. * Skeleton subclass for performing query and update operations on the 'CASE_TRACKER' 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
@@ -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,108 +39,96 @@ 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);
try
{ {
$con->begin(); $con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
$this->setCfgUid($aData['CFG_UID']); try {
$this->setObjUid($aData['OBJ_UID']); $con->begin();
$this->setCfgValue(isset($aData['CFG_VALUE'])?$aData['CFG_VALUE']:''); $this->setCfgUid($aData['CFG_UID']);
$this->setProUid($aData['PRO_UID']); $this->setObjUid($aData['OBJ_UID']);
$this->setUsrUid($aData['USR_UID']); $this->setCfgValue(isset($aData['CFG_VALUE'])?$aData['CFG_VALUE']:'');
$this->setAppUid($aData['APP_UID']); $this->setProUid($aData['PRO_UID']);
if($this->validate()) $this->setUsrUid($aData['USR_UID']);
{ $this->setAppUid($aData['APP_UID']);
$result=$this->save(); if ($this->validate()) {
$con->commit(); $result=$this->save();
return $result; $con->commit();
} 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) {
$con->rollback();
throw($e);
}
} }
catch(Exception $e)
public function load($CfgUid, $ObjUid = '', $ProUid = '', $UsrUid = '', $AppUid = '')
{ {
$con->rollback(); try {
throw($e); $oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
if (!is_null($oRow)) {
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
} else {
throw(new Exception( "The row '$CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid' in table Configuration doesn't exist!" ));
}
} catch (Exception $oError) {
throw($oError);
}
} }
}
public function load($CfgUid, $ObjUid='', $ProUid='', $UsrUid='', $AppUid='') public function update($fields)
{
try {
$oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception( "The row '$CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid' in table Configuration doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function update($fields)
{
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try
{ {
$con->begin(); $con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
$this->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']); try {
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME); $con->begin();
if($this->validate()) $this->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']);
{ $this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
$contentResult=0; if ($this->validate()) {
$result=$this->save(); $contentResult=0;
$result=($result==0)?($contentResult>0?1:0):$result; $result=$this->save();
$con->commit(); $result=($result==0)?($contentResult>0?1:0):$result;
return $result; $con->commit();
} 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) {
$con->rollback();
throw($e);
}
} }
catch(Exception $e)
public function remove($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
{ {
$con->rollback(); $con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
throw($e); try {
$con->begin();
$this->setCfgUid($CfgUid);
$this->setObjUid($ObjUid);
$this->setProUid($ProUid);
$this->setUsrUid($UsrUid);
$this->setAppUid($AppUid);
$result=$this->delete();
$con->commit();
return $result;
} catch (Exception $e) {
$con->rollback();
throw($e);
}
} }
}
public function remove($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid) public function exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
{
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try
{ {
$con->begin(); $oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
$this->setCfgUid($CfgUid); return (( get_class ($oRow) == 'Configuration' )&&(!is_null($oRow)));
$this->setObjUid($ObjUid);
$this->setProUid($ProUid);
$this->setUsrUid($UsrUid);
$this->setAppUid($AppUid);
$result=$this->delete();
$con->commit();
return $result;
} }
catch(Exception $e) }
{
$con->rollback();
throw($e);
}
}
public function exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
{
$oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
return (( get_class ($oRow) == 'Configuration' )&&(!is_null($oRow)));
}
} // Configuration

View File

@@ -2,10 +2,10 @@
/** /**
* ConfigurationPeer.php * ConfigurationPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CONFIGURATION' table. * Skeleton subclass for performing query and update operations on the 'CONFIGURATION' 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
@@ -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

@@ -1,107 +1,109 @@
<?php <?php
/** /**
* Content.php * Content.php
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
require_once 'classes/model/om/BaseContent.php'; require_once 'classes/model/om/BaseContent.php';
/** /**
* Skeleton subclass for representing a row from the 'CONTENT' table. * Skeleton subclass for representing a row from the 'CONTENT' 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 Content extends BaseContent class Content extends BaseContent
{ {
public $langs; public $langs;
public $rowsProcessed; public $rowsProcessed;
public $rowsInserted; public $rowsInserted;
public $rowsUnchanged; public $rowsUnchanged;
public $rowsClustered; public $rowsClustered;
public $langsAsoc; public $langsAsoc;
/* /*
* Load the content row specified by the parameters: * Load the content row specified by the parameters:
* @param string $sUID * @param string $sUID
* @return variant * @return variant
*/ */
public function load ($ConCategory, $ConParent, $ConId, $ConLang) public function load ($ConCategory, $ConParent, $ConId, $ConLang)
{ {
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang ); $content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang );
if (is_null( $content )) { if (is_null( $content )) {
//we dont find any value for this field and language in CONTENT table; //we dont find any value for this field and language in CONTENT table;
$ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang ); $ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang );
} else { } else {
//krumo($content); //krumo($content);
$ConValue = $content->getConValue(); $ConValue = $content->getConValue();
if ($ConValue == "") { if ($ConValue == "") {
//try to find a valid translation //try to find a valid translation
$ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang ); $ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang );
} }
} }
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
* @param string $ConParent * @param string $ConParent
* @param string $ConId * @param string $ConId
* @return string * @return string
* *
*/ */
public function getDefaultContentLang ($ConCategory, $ConParent, $ConId, $destConLang) public function getDefaultContentLang ($ConCategory, $ConParent, $ConId, $destConLang)
{ {
$Criteria = new Criteria( 'workflow' ); $Criteria = new Criteria( 'workflow' );
$Criteria->clearSelectColumns()->clearOrderByColumns(); $Criteria->clearSelectColumns()->clearOrderByColumns();
$Criteria->addSelectColumn( ContentPeer::CON_CATEGORY ); $Criteria->addSelectColumn( ContentPeer::CON_CATEGORY );
$Criteria->addSelectColumn( ContentPeer::CON_PARENT ); $Criteria->addSelectColumn( ContentPeer::CON_PARENT );
$Criteria->addSelectColumn( ContentPeer::CON_ID ); $Criteria->addSelectColumn( ContentPeer::CON_ID );
$Criteria->addSelectColumn( ContentPeer::CON_LANG ); $Criteria->addSelectColumn( ContentPeer::CON_LANG );
$Criteria->addSelectColumn( ContentPeer::CON_VALUE ); $Criteria->addSelectColumn( ContentPeer::CON_VALUE );
$Criteria->add( ContentPeer::CON_CATEGORY, $ConCategory, CRITERIA::EQUAL ); $Criteria->add( ContentPeer::CON_CATEGORY, $ConCategory, CRITERIA::EQUAL );
$Criteria->add( ContentPeer::CON_PARENT, $ConParent, CRITERIA::EQUAL ); $Criteria->add( ContentPeer::CON_PARENT, $ConParent, CRITERIA::EQUAL );
$Criteria->add( ContentPeer::CON_ID, $ConId, CRITERIA::EQUAL ); $Criteria->add( ContentPeer::CON_ID, $ConId, CRITERIA::EQUAL );
$Criteria->add( ContentPeer::CON_LANG, $destConLang, CRITERIA::NOT_EQUAL ); $Criteria->add( ContentPeer::CON_LANG, $destConLang, CRITERIA::NOT_EQUAL );
$rs = ContentPeer::doSelectRS( $Criteria ); $rs = ContentPeer::doSelectRS( $Criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next(); $rs->next();
if (is_array( $row = $rs->getRow() )) { if (is_array( $row = $rs->getRow() )) {
$defaultLang = $row['CON_LANG']; $defaultLang = $row['CON_LANG'];
} else { } else {
$defaultLang = ""; $defaultLang = "";
} }
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
@@ -110,204 +112,204 @@ class Content extends BaseContent
* @param string $destConLang * @param string $destConLang
* @return string * @return string
* if the row doesn't exist, it will be created automatically, even the default 'en' language * if the row doesn't exist, it will be created automatically, even the default 'en' language
*/ */
public function autoLoadSave ($ConCategory, $ConParent, $ConId, $destConLang) public function autoLoadSave ($ConCategory, $ConParent, $ConId, $destConLang)
{ {
//search in 'en' language, the default language //search in 'en' language, the default language
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, 'en' ); $content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, 'en' );
if ((is_null( $content )) || ($content->getConValue() == "")) { if ((is_null( $content )) || ($content->getConValue() == "")) {
$differentLang = Content::getDefaultContentLang( $ConCategory, $ConParent, $ConId, $destConLang ); $differentLang = Content::getDefaultContentLang( $ConCategory, $ConParent, $ConId, $destConLang );
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $differentLang ); $content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $differentLang );
} }
//to do: review if the $destConLang is a valid language/ //to do: review if the $destConLang is a valid language/
if (is_null( $content )) { if (is_null( $content )) {
$ConValue = ''; $ConValue = '';
//we dont find any value for this field and language in CONTENT table //we dont find any value for this field and language in CONTENT table
} else { } else {
$ConValue = $content->getConValue(); $ConValue = $content->getConValue();
} }
try { try {
$con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $destConLang ); $con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $destConLang );
if (is_null( $con )) { if (is_null( $con )) {
$con = new Content(); $con = new Content();
} }
$con->setConCategory( $ConCategory ); $con->setConCategory( $ConCategory );
$con->setConParent( $ConParent ); $con->setConParent( $ConParent );
$con->setConId( $ConId ); $con->setConId( $ConId );
$con->setConLang( $destConLang ); $con->setConLang( $destConLang );
$con->setConValue( $ConValue ); $con->setConValue( $ConValue );
if ($con->validate()) { if ($con->validate()) {
$res = $con->save(); $res = $con->save();
} }
} catch (Exception $e) { } catch (Exception $e) {
throw ($e); throw ($e);
} }
return $ConValue; return $ConValue;
} }
/* /*
* Insert a content row * Insert a content row
* @param string $ConCategory * @param string $ConCategory
* @param string $ConParent * @param string $ConParent
* @param string $ConId * @param string $ConId
* @param string $ConLang * @param string $ConLang
* @param string $ConValue * @param string $ConValue
* @return variant * @return variant
*/ */
public function addContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) public function addContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
{ {
try { try {
if ($ConLang != 'en') { if ($ConLang != 'en') {
$baseLangContent = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, 'en' ); $baseLangContent = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, 'en' );
if ($baseLangContent === null) { if ($baseLangContent === null) {
Content::addContent( $ConCategory, $ConParent, $ConId, 'en', $ConValue ); Content::addContent( $ConCategory, $ConParent, $ConId, 'en', $ConValue );
} }
} }
$con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang ); $con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang );
if (is_null( $con )) { if (is_null( $con )) {
$con = new Content(); $con = new Content();
} else { } else {
if ($con->getConParent() == $ConParent && $con->getConCategory() == $ConCategory && $con->getConValue() == $ConValue && $con->getConLang() == $ConLang && $con->getConId() == $ConId) { if ($con->getConParent() == $ConParent && $con->getConCategory() == $ConCategory && $con->getConValue() == $ConValue && $con->getConLang() == $ConLang && $con->getConId() == $ConId) {
return true; return true;
} }
} }
$con->setConCategory( $ConCategory ); $con->setConCategory( $ConCategory );
if ($con->getConParent() != $ConParent) { if ($con->getConParent() != $ConParent) {
$con->setConParent( $ConParent ); $con->setConParent( $ConParent );
} }
$con->setConId( $ConId ); $con->setConId( $ConId );
$con->setConLang( $ConLang ); $con->setConLang( $ConLang );
$con->setConValue( $ConValue ); $con->setConValue( $ConValue );
if ($con->validate()) { if ($con->validate()) {
$res = $con->save(); $res = $con->save();
return $res; return $res;
} else { } else {
$e = new Exception( "Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid" ); $e = new Exception( "Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid" );
throw ($e); throw ($e);
} }
} catch (Exception $e) { } catch (Exception $e) {
throw ($e); throw ($e);
} }
} }
/* /*
* Insert a content row * Insert a content row
* @param string $ConCategory * @param string $ConCategory
* @param string $ConParent * @param string $ConParent
* @param string $ConId * @param string $ConId
* @param string $ConLang * @param string $ConLang
* @param string $ConValue * @param string $ConValue
* @return variant * @return variant
*/ */
public function insertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) public function insertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
{ {
try { try {
$con = new Content(); $con = new Content();
$con->setConCategory( $ConCategory ); $con->setConCategory( $ConCategory );
$con->setConParent( $ConParent ); $con->setConParent( $ConParent );
$con->setConId( $ConId ); $con->setConId( $ConId );
$con->setConLang( $ConLang ); $con->setConLang( $ConLang );
$con->setConValue( $ConValue ); $con->setConValue( $ConValue );
if ($con->validate()) { if ($con->validate()) {
$res = $con->save(); $res = $con->save();
return $res; return $res;
} else { } else {
$e = new Exception( "Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid" ); $e = new Exception( "Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid" );
throw ($e); throw ($e);
} }
} catch (Exception $e) { } catch (Exception $e) {
throw ($e); throw ($e);
} }
} }
/* /*
* remove a content row * remove a content row
* @param string $ConCategory * @param string $ConCategory
* @param string $ConParent * @param string $ConParent
* @param string $ConId * @param string $ConId
* @param string $ConLang * @param string $ConLang
* @param string $ConValue * @param string $ConValue
* @return variant * @return variant
*/ */
public function removeContent ($ConCategory, $ConParent, $ConId) public function removeContent ($ConCategory, $ConParent, $ConId)
{ {
try { try {
$c = new Criteria(); $c = new Criteria();
$c->add( ContentPeer::CON_CATEGORY, $ConCategory ); $c->add( ContentPeer::CON_CATEGORY, $ConCategory );
$c->add( ContentPeer::CON_PARENT, $ConParent ); $c->add( ContentPeer::CON_PARENT, $ConParent );
$c->add( ContentPeer::CON_ID, $ConId ); $c->add( ContentPeer::CON_ID, $ConId );
$result = ContentPeer::doSelectRS( $c ); $result = ContentPeer::doSelectRS( $c );
$result->next(); $result->next();
$row = $result->getRow(); $row = $result->getRow();
while (is_array( $row )) { while (is_array( $row )) {
ContentPeer::doDelete( array ($ConCategory,$ConParent,$ConId,$row[3]) ); ContentPeer::doDelete( array ($ConCategory,$ConParent,$ConId,$row[3]) );
$result->next(); $result->next();
$row = $result->getRow(); $row = $result->getRow();
} }
} catch (Exception $e) { } catch (Exception $e) {
throw ($e); throw ($e);
} }
} }
/* /*
* Reasons if the record already exists * Reasons if the record already exists
* *
* @param string $ConCategory * @param string $ConCategory
* @param string $ConParent * @param string $ConParent
* @param string $ConId * @param string $ConId
* @param string $ConLang * @param string $ConLang
* @param string $ConValue * @param string $ConValue
* @return boolean true or false * @return boolean true or false
*/ */
public function Exists ($ConCategory, $ConParent, $ConId, $ConLang) public function Exists ($ConCategory, $ConParent, $ConId, $ConLang)
{ {
try { try {
$oPro = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, $ConLang ); $oPro = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, $ConLang );
if (is_object( $oPro ) && get_class( $oPro ) == 'Content') { if (is_object( $oPro ) && get_class( $oPro ) == 'Content') {
return true; return true;
} else { } else {
return false; return false;
} }
} catch (Exception $oError) { } catch (Exception $oError) {
throw ($oError); throw ($oError);
} }
} }
/* /*
* Regenerate Table Content * Regenerate Table Content
* *
* @param array $langs * @param array $langs
*/ */
public function regenerateContent ($langs, $workSpace = SYS_SYS) public function regenerateContent ($langs, $workSpace = SYS_SYS)
{ {
//Search the language //Search the language
$key = array_search( 'en', $langs ); $key = array_search( 'en', $langs );
if ($key === false) { if ($key === false) {
$key = array_search( SYS_LANG, $langs ); $key = array_search( SYS_LANG, $langs );
if ($key === false) { if ($key === false) {
$key = '0'; $key = '0';
} }
} }
$this->langsAsoc = array (); $this->langsAsoc = array ();
foreach ($langs as $key => $value) { foreach ($langs as $key => $value) {
$this->langsAsoc[$value] = $value; $this->langsAsoc[$value] = $value;
} }
$this->langs = $langs; $this->langs = $langs;
$this->rowsProcessed = 0; $this->rowsProcessed = 0;
$this->rowsInserted = 0; $this->rowsInserted = 0;
$this->rowsUnchanged = 0; $this->rowsUnchanged = 0;
$this->rowsClustered = 0; $this->rowsClustered = 0;
//Creating table CONTENT_BACKUP //Creating table CONTENT_BACKUP
$oConnection = Propel::getConnection( 'workflow' ); $oConnection = Propel::getConnection( 'workflow' );
$oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` ( $oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` (
`CON_CATEGORY` VARCHAR(30) default '' NOT NULL, `CON_CATEGORY` VARCHAR(30) default '' NOT NULL,
`CON_PARENT` VARCHAR(32) default '' NOT NULL, `CON_PARENT` VARCHAR(32) default '' NOT NULL,
@@ -315,171 +317,171 @@ class Content extends BaseContent
`CON_LANG` VARCHAR(10) default '' NOT NULL, `CON_LANG` VARCHAR(10) default '' NOT NULL,
`CON_VALUE` MEDIUMTEXT NOT NULL, `CON_VALUE` MEDIUMTEXT NOT NULL,
CONSTRAINT CONTENT_BACKUP_PK PRIMARY KEY (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG) CONSTRAINT CONTENT_BACKUP_PK PRIMARY KEY (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG)
)Engine=MyISAM DEFAULT CHARSET='utf8' COMMENT='Table for add content';" ); )Engine=MyISAM DEFAULT CHARSET='utf8' COMMENT='Table for add content';" );
$oStatement->executeQuery(); $oStatement->executeQuery();
$con = Propel::getConnection( 'workflow' ); $con = Propel::getConnection( 'workflow' );
$sql = " SELECT DISTINCT CON_LANG $sql = " SELECT DISTINCT CON_LANG
FROM CONTENT "; FROM CONTENT ";
$stmt = $con->createStatement(); $stmt = $con->createStatement();
$rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC ); $rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC );
while ($rs->next()) { while ($rs->next()) {
$row = $rs->getRow(); $row = $rs->getRow();
$language = $row['CON_LANG']; $language = $row['CON_LANG'];
if (array_search( $row['CON_LANG'], $langs ) === false) { if (array_search( $row['CON_LANG'], $langs ) === false) {
Content::removeLanguageContent( $row['CON_LANG'] ); Content::removeLanguageContent( $row['CON_LANG'] );
} }
} }
$sql = " SELECT CON_ID, CON_CATEGORY, CON_LANG, CON_PARENT, CON_VALUE $sql = " SELECT CON_ID, CON_CATEGORY, CON_LANG, CON_PARENT, CON_VALUE
FROM CONTENT FROM CONTENT
ORDER BY CON_ID, CON_CATEGORY, CON_PARENT, CON_LANG"; ORDER BY CON_ID, CON_CATEGORY, CON_PARENT, CON_LANG";
G::LoadClass( "wsTools" ); G::LoadClass( "wsTools" );
$workSpace = new workspaceTools( $workSpace ); $workSpace = new workspaceTools( $workSpace );
$workSpace->getDBInfo(); $workSpace->getDBInfo();
$link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass ) or die( "Could not connect" ); $link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass ) or die( "Could not connect" );
mysql_select_db( $workSpace->dbName, $link ); mysql_select_db( $workSpace->dbName, $link );
mysql_query( "SET NAMES 'utf8';" ); mysql_query( "SET NAMES 'utf8';" );
mysql_query( 'SET OPTION SQL_BIG_SELECTS=1' ); mysql_query( 'SET OPTION SQL_BIG_SELECTS=1' );
$result = mysql_unbuffered_query( $sql, $link ); $result = mysql_unbuffered_query( $sql, $link );
$list = array (); $list = array ();
$default = array (); $default = array ();
$sw = array ('CON_ID' => '','CON_CATEGORY' => '','CON_PARENT' => '' $sw = array ('CON_ID' => '','CON_CATEGORY' => '','CON_PARENT' => ''
); );
while ($row = mysql_fetch_assoc( $result )) { while ($row = mysql_fetch_assoc( $result )) {
if ($sw['CON_ID'] == $row['CON_ID'] && $sw['CON_CATEGORY'] == $row['CON_CATEGORY'] && $sw['CON_PARENT'] == $row['CON_PARENT']) { if ($sw['CON_ID'] == $row['CON_ID'] && $sw['CON_CATEGORY'] == $row['CON_CATEGORY'] && $sw['CON_PARENT'] == $row['CON_PARENT']) {
$list[] = $row; $list[] = $row;
} else { } else {
$this->rowsClustered ++; $this->rowsClustered ++;
if (count( $langs ) != count( $list )) { if (count( $langs ) != count( $list )) {
$this->checkLanguage( $list, $default ); $this->checkLanguage( $list, $default );
} else { } else {
$this->rowsUnchanged = $this->rowsUnchanged + count( $langs ); $this->rowsUnchanged = $this->rowsUnchanged + count( $langs );
} }
$sw = array (); $sw = array ();
$sw['CON_ID'] = $row['CON_ID']; $sw['CON_ID'] = $row['CON_ID'];
$sw['CON_CATEGORY'] = $row['CON_CATEGORY']; $sw['CON_CATEGORY'] = $row['CON_CATEGORY'];
$sw['CON_LANG'] = $row['CON_LANG']; $sw['CON_LANG'] = $row['CON_LANG'];
$sw['CON_PARENT'] = $row['CON_PARENT']; $sw['CON_PARENT'] = $row['CON_PARENT'];
unset( $list ); unset( $list );
unset( $default ); unset( $default );
$list = array (); $list = array ();
$default = array (); $default = array ();
$list[] = $row; $list[] = $row;
} }
if ($sw['CON_LANG'] == $langs[$key]) { if ($sw['CON_LANG'] == $langs[$key]) {
$default = $row; $default = $row;
} }
$this->rowsProcessed ++; $this->rowsProcessed ++;
} }
if (count( $langs ) != count( $list )) { if (count( $langs ) != count( $list )) {
$this->checkLanguage( $list, $default ); $this->checkLanguage( $list, $default );
} else { } else {
$this->rowsUnchanged = $this->rowsUnchanged + count( $langs ); $this->rowsUnchanged = $this->rowsUnchanged + count( $langs );
} }
mysql_free_result( $result ); mysql_free_result( $result );
$total = $this->rowsProcessed + $this->rowsInserted; $total = $this->rowsProcessed + $this->rowsInserted;
$connection = Propel::getConnection( 'workflow' ); $connection = Propel::getConnection( 'workflow' );
$statement = $connection->prepareStatement( "INSERT INTO CONTENT $statement = $connection->prepareStatement( "INSERT INTO CONTENT
SELECT CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE SELECT CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE
FROM CONTENT_BACKUP" ); FROM CONTENT_BACKUP" );
$statement->executeQuery(); $statement->executeQuery();
$statement = $connection->prepareStatement( "DROP TABLE CONTENT_BACKUP" ); $statement = $connection->prepareStatement( "DROP TABLE CONTENT_BACKUP" );
$statement->executeQuery(); $statement->executeQuery();
if (! isset( $_SERVER['SERVER_NAME'] )) { if (! isset( $_SERVER['SERVER_NAME'] )) {
CLI::logging( "Rows Processed ---> $this->rowsProcessed ..... \n" ); CLI::logging( "Rows Processed ---> $this->rowsProcessed ..... \n" );
CLI::logging( "Rows Clustered ---> $this->rowsClustered ..... \n" ); CLI::logging( "Rows Clustered ---> $this->rowsClustered ..... \n" );
CLI::logging( "Rows Unchanged ---> $this->rowsUnchanged ..... \n" ); CLI::logging( "Rows Unchanged ---> $this->rowsUnchanged ..... \n" );
CLI::logging( "Rows Inserted ---> $this->rowsInserted ..... \n" ); CLI::logging( "Rows Inserted ---> $this->rowsInserted ..... \n" );
CLI::logging( "Rows Total ---> $total ..... \n" ); CLI::logging( "Rows Total ---> $total ..... \n" );
} }
} }
public function checkLanguage ($content, $default) public function checkLanguage ($content, $default)
{ {
if (count( $content ) > 0) { if (count( $content ) > 0) {
$langs = $this->langs; $langs = $this->langs;
$langsAsoc = $this->langsAsoc; $langsAsoc = $this->langsAsoc;
//Element default //Element default
$default = (count( $default ) > 0) ? $default : $content[0]; $default = (count( $default ) > 0) ? $default : $content[0];
foreach ($content as $key => $value) { foreach ($content as $key => $value) {
unset( $langsAsoc[$value['CON_LANG']] ); unset( $langsAsoc[$value['CON_LANG']] );
} }
foreach ($langsAsoc as $key => $value) { foreach ($langsAsoc as $key => $value) {
$this->rowsInserted ++; $this->rowsInserted ++;
$this->fastInsertContent( $default['CON_CATEGORY'], $default['CON_PARENT'], $default['CON_ID'], $value, $default['CON_VALUE'] ); $this->fastInsertContent( $default['CON_CATEGORY'], $default['CON_PARENT'], $default['CON_ID'], $value, $default['CON_VALUE'] );
} }
} }
} }
public function fastInsertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) public function fastInsertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
{ {
$ConValue = mysql_real_escape_string( $ConValue ); $ConValue = mysql_real_escape_string( $ConValue );
$connection = Propel::getConnection( 'workflow' ); $connection = Propel::getConnection( 'workflow' );
$statement = $connection->prepareStatement( "INSERT INTO CONTENT_BACKUP ( $statement = $connection->prepareStatement( "INSERT INTO CONTENT_BACKUP (
CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE) CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE)
VALUES ('$ConCategory', '$ConParent', '$ConId', '$ConLang', '$ConValue');" ); VALUES ('$ConCategory', '$ConParent', '$ConId', '$ConLang', '$ConValue');" );
$statement->executeQuery(); $statement->executeQuery();
} }
public function removeLanguageContent ($lanId) public function removeLanguageContent ($lanId)
{ {
try { try {
$c = new Criteria(); $c = new Criteria();
$c->addSelectColumn( ContentPeer::CON_CATEGORY ); $c->addSelectColumn( ContentPeer::CON_CATEGORY );
$c->addSelectColumn( ContentPeer::CON_PARENT ); $c->addSelectColumn( ContentPeer::CON_PARENT );
$c->addSelectColumn( ContentPeer::CON_ID ); $c->addSelectColumn( ContentPeer::CON_ID );
$c->addSelectColumn( ContentPeer::CON_LANG ); $c->addSelectColumn( ContentPeer::CON_LANG );
$c->add( ContentPeer::CON_LANG, $lanId ); $c->add( ContentPeer::CON_LANG, $lanId );
$result = ContentPeer::doSelectRS( $c ); $result = ContentPeer::doSelectRS( $c );
$result->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $result->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$result->next(); $result->next();
$row = $result->getRow(); $row = $result->getRow();
while (is_array( $row )) { while (is_array( $row )) {
$content = ContentPeer::retrieveByPK( $row['CON_CATEGORY'], $row['CON_PARENT'], $row['CON_ID'], $lanId ); $content = ContentPeer::retrieveByPK( $row['CON_CATEGORY'], $row['CON_PARENT'], $row['CON_ID'], $lanId );
if ($content !== null) { if ($content !== null) {
$content->delete(); $content->delete();
} }
$result->next(); $result->next();
$row = $result->getRow(); $row = $result->getRow();
} }
} catch (Exception $e) { } catch (Exception $e) {
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)
{ {
if (! isset( $sys_lang )) { if (! isset( $sys_lang )) {
$sys_lang = 'en'; $sys_lang = 'en';
} }
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
$oCriteria->clearSelectColumns(); $oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn( ContentPeer::CON_ID ); $oCriteria->addSelectColumn( ContentPeer::CON_ID );
$oCriteria->addAsColumn( 'ROL_NAME', ContentPeer::CON_VALUE ); $oCriteria->addAsColumn( 'ROL_NAME', ContentPeer::CON_VALUE );
//$oCriteria->addAsColumn('ROL_UID', ContentPeer::CON_ID); //$oCriteria->addAsColumn('ROL_UID', ContentPeer::CON_ID);
$oCriteria->add( ContentPeer::CON_CATEGORY, 'ROL_NAME' ); $oCriteria->add( ContentPeer::CON_CATEGORY, 'ROL_NAME' );
$oCriteria->add( ContentPeer::CON_LANG, $sys_lang ); $oCriteria->add( ContentPeer::CON_LANG, $sys_lang );
$oDataset = ContentPeer::doSelectRS( $oCriteria ); $oDataset = ContentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aRoles = Array (); $aRoles = Array ();
while ($oDataset->next()) { while ($oDataset->next()) {
$xRow = $oDataset->getRow(); $xRow = $oDataset->getRow();
$aRoles[$xRow['CON_ID']] = $xRow['ROL_NAME']; $aRoles[$xRow['CON_ID']] = $xRow['ROL_NAME'];
} }
return $aRoles; return $aRoles;
} }
} }
// Content

View File

@@ -2,10 +2,10 @@
/** /**
* ContentPeer.php * ContentPeer.php
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
// include base peer class // include base peer class
@@ -34,7 +34,7 @@
/** /**
* Skeleton subclass for performing query and update operations on the 'CONTENT' table. * Skeleton subclass for performing query and update operations on the 'CONTENT' 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
@@ -42,6 +42,7 @@
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ContentPeer extends BaseContentPeer { class ContentPeer extends BaseContentPeer
{
}
} // ContentPeer