Merge pull request #849 from ferOnti/master

CODE STYLE class/model/ files
This commit is contained in:
ferOnti
2012-10-22 03:01:25 -07:00
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
{
public $fields = array();
public $primaryKeys = array();
@@ -28,7 +27,7 @@ class AdditionalTables extends BaseAdditionalTables
* Function load
* access public
*/
public function load($sUID, $bFields=false)
public function load($sUID, $bFields = false)
{
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($sUID);
@@ -82,7 +81,7 @@ class AdditionalTables extends BaseAdditionalTables
return $this->fields;
}
public function getPrimaryKeys($type='complete')
public function getPrimaryKeys($type = 'complete')
{
$this->primaryKeys = array();
foreach ($this->fields as $field) {
@@ -136,7 +135,7 @@ class AdditionalTables extends BaseAdditionalTables
/**
* 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'] == '')) {
$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);
try {
@@ -188,16 +187,6 @@ class AdditionalTables extends BaseAdditionalTables
$oConnection->begin();
$iResult = $oAdditionalTables->save();
$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 {
$sMessage = '';
$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();
$aData = $addTab->load($sUID, true);
@@ -429,7 +418,7 @@ class AdditionalTables extends BaseAdditionalTables
}
}
if ($oClass->validate()) {
$iResult = $oClass->save();
$iResult = $oClass->save();
if ($keysAutoIncrement == 1 && $aFields[$keyUIDAutoIncrement] == '' && isset($_SESSION['APPLICATION']) && $_SESSION['APPLICATION'] != '') {
G::LoadClass('case');
$oCaseKeyAuto = new Cases();
@@ -437,7 +426,7 @@ class AdditionalTables extends BaseAdditionalTables
$aFields = $oCaseKeyAuto->loadCase($_SESSION['APPLICATION']);
$aFields['APP_DATA'][$keyUIDAutoIncrement] = $newId;
if (isset($_POST['form'])) {
$_POST['form'][$keyUIDAutoIncrement] = $newId;
$_POST['form'][$keyUIDAutoIncrement] = $newId;
}
$oCaseKeyAuto->updateCase($_SESSION['APPLICATION'], $aFields);
}
@@ -568,7 +557,7 @@ class AdditionalTables extends BaseAdditionalTables
* @param string $sGrid
* @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";
@@ -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';
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->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);
}
@@ -856,7 +837,7 @@ class AdditionalTables extends BaseAdditionalTables
* Don't use this method, it was left only for backward compatibility
* 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 {
/* $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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*
* @package 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 $pathToAppCacheFiles;
public function getAllCounters($aTypes, $userUid, $processSummary=false)
public function getAllCounters($aTypes, $userUid, $processSummary = false)
{
$aResult = array();
@@ -248,7 +248,7 @@ class AppCacheView extends BaseAppCacheView
* @param string $sUIDUser
* @return $rows
*/
public function getSelfServiceTasks($userUid='')
public function getSelfServiceTasks($userUid = '')
{
$rows[] = array();
$tasks = array();
@@ -304,7 +304,8 @@ class AppCacheView extends BaseAppCacheView
return $tasks;
}
public function getSelfServiceCasesByEvaluate($userUid) {
public function getSelfServiceCasesByEvaluate($userUid)
{
$cases = array();
//check groups assigned to SelfService task
@@ -327,34 +328,34 @@ class AppCacheView extends BaseAppCacheView
$rs->next();
if ($rs->getRecordCount() > 0) {
if (!class_exists('Cases')) {
G::loadClass('case');
}
$caseInstance = new Cases();
while ($row = $rs->getRow()) {
$tasGroupVariable = str_replace(array('@', '#'), '', $row['TAS_GROUP_VARIABLE']);
$c2 = new Criteria();
$c2->clearSelectColumns();
$c2->addSelectColumn(AppDelegationPeer::APP_UID);
$c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']);
$c2->add(AppDelegationPeer::USR_UID, '');
$c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
$rs2 = AppDelegationPeer::doSelectRS($c2);
$rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs2->next();
while ($row2 = $rs2->getRow()) {
$caseData = $caseInstance->LoadCase($row2['APP_UID']);
if (isset($caseData['APP_DATA'][$tasGroupVariable])) {
if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') {
if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $aGroups)) {
$cases[] = $row2['APP_UID'];
}
if (!class_exists('Cases')) {
G::loadClass('case');
}
$caseInstance = new Cases();
while ($row = $rs->getRow()) {
$tasGroupVariable = str_replace(array('@', '#'), '', $row['TAS_GROUP_VARIABLE']);
$c2 = new Criteria();
$c2->clearSelectColumns();
$c2->addSelectColumn(AppDelegationPeer::APP_UID);
$c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']);
$c2->add(AppDelegationPeer::USR_UID, '');
$c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
$rs2 = AppDelegationPeer::doSelectRS($c2);
$rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs2->next();
while ($row2 = $rs2->getRow()) {
$caseData = $caseInstance->LoadCase($row2['APP_UID']);
if (isset($caseData['APP_DATA'][$tasGroupVariable])) {
if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') {
if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $aGroups)) {
$cases[] = $row2['APP_UID'];
}
}
}
}
$rs2->next();
}
$rs->next();
}
$rs2->next();
}
$rs->next();
}
}
return $cases;
}
@@ -853,7 +854,7 @@ class AppCacheView extends BaseAppCacheView
* @param Boolean $doCount
* @return Criteria
*/
public function getGeneralCases($doCount='false')
public function getGeneralCases($doCount = 'false')
{
if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
$oCriteria = new Criteria('workflow');
@@ -1021,7 +1022,7 @@ class AppCacheView extends BaseAppCacheView
return $row[0];
}
public function checkGrantsForUser($root=false)
public function checkGrantsForUser($root = false)
{
try {
if ($root) {
@@ -1144,7 +1145,7 @@ class AppCacheView extends BaseAppCacheView
* Insert an app delegatiojn trigger
* @return void
*/
public function triggerAppDelegationInsert($lang, $recreate=false)
public function triggerAppDelegationInsert($lang, $recreate = false)
{
$con = Propel::getConnection("workflow");
$stmt = $con->createStatement();
@@ -1191,7 +1192,7 @@ class AppCacheView extends BaseAppCacheView
* update the App Delegation triggers
* @return void
*/
public function triggerAppDelegationUpdate($lang, $recreate=false)
public function triggerAppDelegationUpdate($lang, $recreate = false)
{
$con = Propel::getConnection("workflow");
$stmt = $con->createStatement();
@@ -1238,7 +1239,7 @@ class AppCacheView extends BaseAppCacheView
* update the Application triggers
* @return void
*/
public function triggerApplicationUpdate($lang, $recreate=false)
public function triggerApplicationUpdate($lang, $recreate = false)
{
$con = Propel::getConnection("workflow");
$stmt = $con->createStatement();
@@ -1283,7 +1284,7 @@ class AppCacheView extends BaseAppCacheView
* update the Application triggers
* @return void
*/
public function triggerApplicationDelete($lang, $recreate=false)
public function triggerApplicationDelete($lang, $recreate = false)
{
$con = Propel::getConnection("workflow");
$stmt = $con->createStatement();
@@ -1324,7 +1325,7 @@ class AppCacheView extends BaseAppCacheView
return 'exists';
}
public function triggerContentUpdate($lang, $recreate=false)
public function triggerContentUpdate($lang, $recreate = false)
{
$cnn = Propel::getConnection("workflow");
$stmt = $cnn->createStatement();
@@ -1456,7 +1457,7 @@ class AppCacheView extends BaseAppCacheView
return $aRows;
}
public function appTitleByTaskCaseLabelUpdate($taskUid, $lang, $cron=0)
public function appTitleByTaskCaseLabelUpdate($taskUid, $lang, $cron = 0)
{
$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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*
* @package 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
*/
class AppDelay extends BaseAppDelay {
/**
* Create the application delay registry
* @param array $aData
* @return string
**/
public function create($aData)
{
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try {
if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' )
unset ( $aData['APP_DELAY_UID'] );
if ( !isset ( $aData['APP_DELAY_UID'] ) )
$aData['APP_DELAY_UID'] = G::generateUniqueID();
$oAppDelay = new AppDelay();
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) {
$oConnection->begin();
$iResult = $oAppDelay->save();
$oConnection->commit();
return $aData['APP_DELAY_UID'];
}
else {
$sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
class AppDelay extends BaseAppDelay
{
/**
* Create the application delay registry
* @param array $aData
* @return string
**/
public function create($aData)
{
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try {
if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' ) {
unset ( $aData['APP_DELAY_UID'] );
}
if ( !isset ( $aData['APP_DELAY_UID'] ) ) {
$aData['APP_DELAY_UID'] = G::generateUniqueID();
}
$oAppDelay = new AppDelay();
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) {
$oConnection->begin();
$iResult = $oAppDelay->save();
$oConnection->commit();
return $aData['APP_DELAY_UID'];
} else {
$sMessage = '';
$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
* @param array $aData
* @return string
**/
public function update($aData)
{
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try {
$oAppDelay = AppDelayPeer::retrieveByPK($aData['APP_DELAY_UID']);
if (!is_null($oAppDelay))
{
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) {
$oConnection->begin();
$iResult = $oAppDelay->save();
$oConnection->commit();
return $iResult;
/**
* Update the application delay registry
* @param array $aData
* @return string
**/
public function update($aData)
{
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try {
$oAppDelay = AppDelayPeer::retrieveByPK($aData['APP_DELAY_UID']);
if (!is_null($oAppDelay)) {
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) {
$oConnection->begin();
$iResult = $oAppDelay->save();
$oConnection->commit();
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();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
}
public 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;
}
}
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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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?
* @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) {
throw (new Exception( 'Column "PRO_UID" cannot be null.' ));
}
@@ -159,7 +158,7 @@ class AppDelegation extends BaseAppDelegation
* @return array $Fields the fields
*/
function Load ($AppUid, $sDelIndex)
public function Load ($AppUid, $sDelIndex)
{
$con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME );
try {
@@ -213,7 +212,7 @@ class AppDelegation extends BaseAppDelegation
}
}
function remove ($sApplicationUID, $iDelegationIndex)
public function remove ($sApplicationUID, $iDelegationIndex)
{
$oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME );
try {
@@ -232,7 +231,7 @@ class AppDelegation extends BaseAppDelegation
// TasTypeDay = 1 => working days
// TasTypeDay = 2 => calendar days
function calculateDueDate ($sNextTasParam)
public function calculateDueDate ($sNextTasParam)
{
//Get Task properties
$task = TaskPeer::retrieveByPK( $this->getTasUid() );
@@ -272,7 +271,7 @@ class AppDelegation extends BaseAppDelegation
return $iDueDate;
}
function getDiffDate ($date1, $date2)
public function getDiffDate ($date1, $date2)
{
return ($date1 - $date2) / (24 * 60 * 60); //days
return ($date1 - $date2) / 3600;
@@ -445,23 +444,15 @@ class AppDelegation extends BaseAppDelegation
//and finally save the record
$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();
$row = $rs->getRow();
}
} catch (Exception $oError) {
error_log( $oError->getMessage() );
}
}
function getLastDeleration ($APP_UID)
public function getLastDeleration ($APP_UID)
{
$c = new Criteria( 'workflow' );
$c->addSelectColumn( AppDelegationPeer::APP_UID );
@@ -486,5 +477,4 @@ class AppDelegation extends BaseAppDelegation
return $rs->getRow();
}
}
// AppDelegation

View File

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

View File

@@ -2,10 +2,10 @@
/**
* AppDocumentPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'APP_DOCUMENT' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @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 );
try {
@@ -62,7 +62,7 @@ class AppEvent extends BaseAppEvent
}
}
function update ($aData)
public function update ($aData)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
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 );
try {
@@ -110,7 +110,7 @@ class AppEvent extends BaseAppEvent
}
}
function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '')
public function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '')
{
try {
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['APP_EVN_STATUS'] = 'CLOSE';
$this->update( $aRow );
}
}
// AppEvent

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'APP_EVENT' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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
*/
class AppHistory extends BaseAppHistory {
function insertHistory($aData){
class AppHistory extends BaseAppHistory
{
public function insertHistory($aData)
{
$this->setAppUid($aData['APP_UID']);
$this->setDelIndex($aData['DEL_INDEX']);
$this->setProUid($aData['PRO_UID']);
@@ -32,28 +32,20 @@ class AppHistory extends BaseAppHistory {
$this->setHistoryDate($aData['APP_UPDATE_DATE']);
$this->setHistoryData($aData['APP_DATA']);
if ($this->validate() ) {
$res = $this->save();
}
else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $this->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
krumo($msg);
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
}
$res = $this->save();
} else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $this->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
}
}
function getDynaformHistory($PRO_UID,$TAS_UID,$APP_UID,$DYN_UID=""){
public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
{
G::LoadClass('case');
$oCase = new Cases();
@@ -62,37 +54,30 @@ class AppHistory extends BaseAppHistory {
$aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']);
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'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
}
else {
if (!is_array($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
}
} else {
if (!is_array($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
}
}
if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
}
else {
if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
}
} else {
if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
}
}
if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
}
else {
if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
}
} else {
if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
}
}
$c = new Criteria('workflow');
$c->addSelectColumn(AppHistoryPeer::APP_UID);
$c->addSelectColumn(AppHistoryPeer::DEL_INDEX);
@@ -108,12 +93,11 @@ class AppHistory extends BaseAppHistory {
$c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
$c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
//WHERE
$c->add(AppHistoryPeer::DYN_UID, $aObjectPermissions['DYNAFORMS'], Criteria::IN);
$c->add(AppHistoryPeer::PRO_UID, $PRO_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);
}
@@ -121,7 +105,6 @@ class AppHistory extends BaseAppHistory {
$c->clearOrderByColumns();
$c->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
//Execute
$oDataset = AppHistoryPeer::doSelectRS($c);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
@@ -129,38 +112,37 @@ class AppHistory extends BaseAppHistory {
$aDynHistory = array();
$aDynHistory[] = array(
'DYN_TITLE' => 'char'
'DYN_TITLE' => 'char'
);
while ($aRow = $oDataset->getRow()) {
$o = new Dynaform();
$o->setDynUid($aRow['DYN_UID']);
$aRow['DYN_TITLE'] = $o->getDynTitle();
$changedValues=unserialize($aRow['HISTORY_DATA']);
$html="<table border='0' cellpadding='0' cellspacing='0'>";
$sw_add=false;
foreach($changedValues as $key =>$value){
if(($value!=NULL)&&(!is_array($value))){
foreach ($changedValues as $key => $value) {
if (($value!=null) && (!is_array($value))) {
$sw_add=true;
$html.="<tr>";
$html.="<td><b>$key:</b> </td>";
$html.="<td>$value</td>";
$html.="</tr>";
}
if(is_array($value)){
if (is_array($value)) {
$html.="<tr>";
$html.="<td><b>$key (grid):</b> </td>";
$html.="<td>";
$html.="<table>";
foreach($value as $key1 =>$value1){
foreach ($value as $key1 => $value1) {
$html.="<tr>";
$html.="<td><b>$key1</b></td>";
$html.="<td>";
if(is_array($value1)){
if (is_array($value1)) {
$sw_add=true;
$html.="<table>";
foreach($value1 as $key2 =>$value2){
foreach ($value1 as $key2 => $value2) {
$html.="<tr>";
$html.="<td><b>$key2</b></td>";
$html.="<td>$value2</td>";
@@ -170,7 +152,6 @@ class AppHistory extends BaseAppHistory {
}
$html.="</td>";
$html.="</tr>";
}
$html.="</table>";
$html.="</td>";
@@ -182,7 +163,7 @@ class AppHistory extends BaseAppHistory {
$aRow['FIELDS'] = $html;
if($sw_add){
if ($sw_add) {
$aDynHistory[] = $aRow;
}
$oDataset->next();
@@ -196,7 +177,6 @@ class AppHistory extends BaseAppHistory {
$oCriteria->setDBArrayTable('DynaformsHistory');
$oCriteria->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
return $oCriteria;
}
}
} // AppHistory

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'APP_NOTES' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -18,6 +18,7 @@
*
* @package classes.model
*/
class AppNotesPeer extends BaseAppNotesPeer {
class AppNotesPeer extends BaseAppNotesPeer
{
}
} // AppNotesPeer

View File

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

View File

@@ -2,10 +2,10 @@
/**
* AppOwnerPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'APP_OWNER' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -15,112 +15,100 @@ require_once 'classes/entities/AppSolrQueue.php';
*
* @package classes.model
*/
class AppSolrQueue extends BaseAppSolrQueue {
public function exists($sAppUid)
{
try {
$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
if (!is_null($oRow))
{
return true;
}
else {
return false;
}
}
catch (Exception $oError) {
return false;
}
class AppSolrQueue extends BaseAppSolrQueue
{
public function exists($sAppUid)
{
try {
$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
if (!is_null($oRow)) {
return true;
} else {
return false;
}
} catch (Exception $oError) {
return false;
}
}
public function createUpdate($sAppUid, $iUpdated)
{
$con = Propel::getConnection(AppSolrQueuePeer::DATABASE_NAME);
try
{
if($this->exists($sAppUid)){
public function createUpdate($sAppUid, $iUpdated)
{
$con = Propel::getConnection(AppSolrQueuePeer::DATABASE_NAME);
try {
if ($this->exists($sAppUid)) {
$con->begin();
//update record
//$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
//$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
//$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
//$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
//$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
//set field
$this->setAppUid($sAppUid);
$this->setAppUpdated($iUpdated);
if($this->validate())
{
$result=$this->save();
}
else
{
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
if ($this->validate()) {
$result=$this->save();
} else {
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
}
$con->commit();
return $result;
}else{
$con->commit();
return $result;
} else {
//create record
//set values
$this->setAppUid($sAppUid);
$this->setAppUpdated($iUpdated);
if($this->validate())
{
$result=$this->save();
}
else
{
$e=new Exception("Failed Validation in class ".get_class($this).".");
//$e->aValidationFailures=$this->getValidationFailures();
throw($e);
}
$con->commit();
return $result;
}
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
if ($this->validate()) {
$result=$this->save();
} else {
$e=new Exception("Failed Validation in class ".get_class($this).".");
//$e->aValidationFailures=$this->getValidationFailures();
throw($e);
}
$con->commit();
return $result;
}
} catch (Exception $e) {
$con->rollback();
throw($e);
}
}
/**
* Returns the list of updated applications
* array of Entity_AppSolrQueue
*/
public function getListUpdatedApplications(){
$updatedApplications = array();
try
{
$c = new Criteria();
$c->addSelectColumn(AppSolrQueuePeer::APP_UID);
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
//"WHERE
public function getListUpdatedApplications()
{
$updatedApplications = array();
try {
$c = new Criteria();
$c->addSelectColumn(AppSolrQueuePeer::APP_UID);
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
//"WHERE
$c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL);
$rs = AppSolrQueuePeer::doSelectRS($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//echo $c->toString();
$rs->next();
$row = $rs->getRow();
$rs = AppSolrQueuePeer::doSelectRS($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//echo $c->toString();
$rs->next();
$row = $rs->getRow();
while (is_array($row)) {
$appSolrQueue = Entity_AppSolrQueue::createEmpty();
$appSolrQueue->appUid = $row['APP_UID'];
$appSolrQueue->appUpdated = $row['APP_UPDATED'];
$updatedApplications[] = $appSolrQueue;
$rs->next();
$row = $rs->getRow();
$updatedApplications[] = $appSolrQueue;
$rs->next();
$row = $rs->getRow();
}
return $updatedApplications;
}catch(Exception $e){
$con->rollback();
} catch (Exception $e) {
$con->rollback();
throw($e);
}
}
} // AppSolrQueue
}

View File

@@ -10,7 +10,7 @@
/**
* 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
* application requirements. This class will only be generated as
@@ -18,6 +18,7 @@
*
* @package classes.model
*/
class AppSolrQueuePeer extends BaseAppSolrQueuePeer {
class AppSolrQueuePeer extends BaseAppSolrQueuePeer
{
}
} // AppSolrQueuePeer

View File

@@ -2,10 +2,10 @@
/**
* AppThread.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
require_once 'classes/model/om/BaseAppThread.php';
@@ -30,7 +30,7 @@ require_once 'classes/model/om/BaseAppThread.php';
/**
* Skeleton subclass for representing a row from the 'APP_THREAD' table.
*
*
*
*
* You should add additional methods to this class to meet the
* 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
*/
class AppThread extends BaseAppThread {
function createAppThread ( $sAppUid, $iDelIndex, $iParent ) {
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;
class AppThread extends BaseAppThread
{
public function createAppThread ($sAppUid, $iDelIndex, $iParent)
{
if (!isset($sAppUid) || strlen($sAppUid ) == 0 ) {
throw ( new Exception ( 'Column "APP_UID" cannot be null.' ) );
}
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
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'APP_THREAD' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class AppThreadPeer extends BaseAppThreadPeer {
class AppThreadPeer extends BaseAppThreadPeer
{
}
} // AppThreadPeer

View File

@@ -2,10 +2,10 @@
/**
* ApplicationPeer.php
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'APPLICATION' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @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.
*
*
*
*
* You should add additional methods to this class to meet the
* 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
*/
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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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.
*
*
*
*
* You should add additional methods to this class to meet the
* 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
*/
class CalendarBusinessHours extends BaseCalendarBusinessHours {
function getCalendarBusinessHours($CalendarUid){
$Criteria = new Criteria('workflow');
$Criteria->clearSelectColumns ( );
$Criteria->addSelectColumn ( CalendarBusinessHoursPeer::CALENDAR_UID );
$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;
class CalendarBusinessHours extends BaseCalendarBusinessHours
{
public function getCalendarBusinessHours($CalendarUid)
{
$Criteria = new Criteria('workflow');
$Criteria->clearSelectColumns ( );
while (is_array($row)) {
$count++;
$fields[$count] = $row;
$Criteria->addSelectColumn ( CalendarBusinessHoursPeer::CALENDAR_UID );
$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 );
$rs = CalendarBusinessHoursPeer::doSelectRS($Criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
}
return $fields;
}
function deleteAllCalendarBusinessHours($CalendarUid){
$toDelete=$this->getCalendarBusinessHours($CalendarUid);
foreach($toDelete as $key => $businessHoursInfo){
$CalendarUid = $businessHoursInfo['CALENDAR_UID'];
$CalendarBusinessDay = $businessHoursInfo['CALENDAR_BUSINESS_DAY'];
$CalendarBusinessStart = $businessHoursInfo['CALENDAR_BUSINESS_START'];
$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();
}
$fields=array();
$count=0;
while (is_array($row)) {
$count++;
$fields[$count] = $row;
$rs->next();
$row = $rs->getRow();
}
return $fields;
}
}
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 );
$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);
}
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
}
public function deleteAllCalendarBusinessHours($CalendarUid)
{
$toDelete = $this->getCalendarBusinessHours($CalendarUid);
foreach ($toDelete as $key => $businessHoursInfo) {
$CalendarUid = $businessHoursInfo['CALENDAR_UID'];
$CalendarBusinessDay = $businessHoursInfo['CALENDAR_BUSINESS_DAY'];
$CalendarBusinessStart = $businessHoursInfo['CALENDAR_BUSINESS_START'];
$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();
}
}
}
public 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 );
$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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @package workflow.engine.classes.model
*/
class CalendarBusinessHoursPeer extends BaseCalendarBusinessHoursPeer {
class CalendarBusinessHoursPeer extends BaseCalendarBusinessHoursPeer
{
}
} // CalendarBusinessHoursPeer

View File

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

View File

@@ -14,7 +14,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'CALENDAR_DEFINITION' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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';
/**
* Skeleton subclass for representing a row from the 'CALENDAR_HOLIDAYS' table.
*
*
*
*
* You should add additional methods to this class to meet the
* 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
*/
class CalendarHolidays extends BaseCalendarHolidays {
function getCalendarHolidays($CalendarUid){
$Criteria = new Criteria('workflow');
$Criteria->clearSelectColumns ( );
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_UID );
$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;
class CalendarHolidays extends BaseCalendarHolidays
{
public function getCalendarHolidays ($CalendarUid)
{
$Criteria = new Criteria('workflow');
$Criteria->clearSelectColumns ( );
while (is_array($row)) {
$count++;
$a=explode(" ",$row['CALENDAR_HOLIDAY_START']);
$row['CALENDAR_HOLIDAY_START']=$a[0];
$a=explode(" ",$row['CALENDAR_HOLIDAY_END']);
$row['CALENDAR_HOLIDAY_END']=$a[0];
$fields[$count] = $row;
$Criteria->addSelectColumn ( CalendarHolidaysPeer::CALENDAR_UID );
$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();
}
return $fields;
}
function deleteAllCalendarHolidays($CalendarUid){
$toDelete=$this->getCalendarHolidays($CalendarUid);
foreach($toDelete as $key => $holidayInfo){
$CalendarUid = $holidayInfo['CALENDAR_UID'];
$CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME'];
$CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START'];
$CalendarHolidayEnd = $holidayInfo['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->delete();
}
$fields=array();
$count=0;
while (is_array($row)) {
$count++;
$a=explode(" ",$row['CALENDAR_HOLIDAY_START']);
$row['CALENDAR_HOLIDAY_START']=$a[0];
$a=explode(" ",$row['CALENDAR_HOLIDAY_END']);
$row['CALENDAR_HOLIDAY_END']=$a[0];
$fields[$count] = $row;
$rs->next();
$row = $rs->getRow();
}
return $fields;
}
}
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 );
$tr->setCalendarHolidayName( $CalendarHolidayName );
$tr->setCalendarHolidayStart( $CalendarHolidayStart );
$tr->setCalendarHolidayEnd( $CalendarHolidayEnd );
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 = '';
$validationFailuresArray = $tr->getValidationFailures();
foreach($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
}
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' );
//}
}
public function deleteAllCalendarHolidays($CalendarUid)
{
$toDelete=$this->getCalendarHolidays($CalendarUid);
foreach ($toDelete as $key => $holidayInfo) {
$CalendarUid = $holidayInfo['CALENDAR_UID'];
$CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME'];
$CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START'];
$CalendarHolidayEnd = $holidayInfo['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->delete();
}
}
}
public 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 );
$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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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
{
public function load ($sProcessUID)
{
try {
@@ -110,7 +109,7 @@ class CaseTracker extends BaseCaseTracker
}
}
function caseTrackerExists ($sUid)
public function caseTrackerExists ($sUid)
{
try {
$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 {
$oCriteria = new Criteria( 'workflow' );
@@ -135,7 +135,7 @@ class CaseTrackerObject extends BaseCaseTrackerObject
}
}
function caseTrackerObjectExists ($Uid)
public function caseTrackerObjectExists ($Uid)
{
try {
$oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid );
@@ -149,7 +149,7 @@ class CaseTrackerObject extends BaseCaseTrackerObject
}
}
function removeByObject ($sType, $sObjUid)
public function removeByObject ($sType, $sObjUid)
{
try {
$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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -22,6 +22,7 @@
*
* @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
*/
class Configuration extends BaseConfiguration {
public function create($aData)
{
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try
class Configuration extends BaseConfiguration
{
public function create($aData)
{
$con->begin();
$this->setCfgUid($aData['CFG_UID']);
$this->setObjUid($aData['OBJ_UID']);
$this->setCfgValue(isset($aData['CFG_VALUE'])?$aData['CFG_VALUE']:'');
$this->setProUid($aData['PRO_UID']);
$this->setUsrUid($aData['USR_UID']);
$this->setAppUid($aData['APP_UID']);
if($this->validate())
{
$result=$this->save();
$con->commit();
return $result;
}
else
{
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
}
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try {
$con->begin();
$this->setCfgUid($aData['CFG_UID']);
$this->setObjUid($aData['OBJ_UID']);
$this->setCfgValue(isset($aData['CFG_VALUE'])?$aData['CFG_VALUE']:'');
$this->setProUid($aData['PRO_UID']);
$this->setUsrUid($aData['USR_UID']);
$this->setAppUid($aData['APP_UID']);
if ($this->validate()) {
$result=$this->save();
$con->commit();
return $result;
} else {
$con->rollback();
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();
throw($e);
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 load($CfgUid, $ObjUid='', $ProUid='', $UsrUid='', $AppUid='')
{
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
public function update($fields)
{
$con->begin();
$this->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$contentResult=0;
$result=$this->save();
$result=($result==0)?($contentResult>0?1:0):$result;
$con->commit();
return $result;
}
else
{
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
}
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try {
$con->begin();
$this->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
if ($this->validate()) {
$contentResult=0;
$result=$this->save();
$result=($result==0)?($contentResult>0?1:0):$result;
$con->commit();
return $result;
} else {
$con->rollback();
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();
throw($e);
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
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)
{
$con = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
try
public function exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
{
$con->begin();
$this->setCfgUid($CfgUid);
$this->setObjUid($ObjUid);
$this->setProUid($ProUid);
$this->setUsrUid($UsrUid);
$this->setAppUid($AppUid);
$result=$this->delete();
$con->commit();
return $result;
$oRow = ConfigurationPeer::retrieveByPK( $CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid );
return (( get_class ($oRow) == 'Configuration' )&&(!is_null($oRow)));
}
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
* @package workflow.engine.classes.model
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,13 +15,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
// include base peer class
@@ -34,7 +34,7 @@
/**
* Skeleton subclass for performing query and update operations on the 'CONFIGURATION' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
@@ -42,6 +42,7 @@
*
* @package workflow.engine.classes.model
*/
class ConfigurationPeer extends BaseConfigurationPeer {
class ConfigurationPeer extends BaseConfigurationPeer
{
}
} // ConfigurationPeer

View File

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

View File

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