";
$html.="| $key (grid): | ";
$html.="";
$html.="";
- foreach($value as $key1 =>$value1){
+ foreach ($value as $key1 => $value1) {
$html.="";
$html.="| $key1 | ";
$html.="";
- if(is_array($value1)){
+ if (is_array($value1)) {
$sw_add=true;
$html.="";
- foreach($value1 as $key2 =>$value2){
+ foreach ($value1 as $key2 => $value2) {
$html.="";
$html.="| $key2 | ";
$html.="$value2 | ";
@@ -170,7 +152,6 @@ class AppHistory extends BaseAppHistory {
}
$html.="";
$html.=" ";
-
}
$html.=" ";
$html.=" | ";
@@ -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
diff --git a/workflow/engine/classes/model/AppHistoryPeer.php b/workflow/engine/classes/model/AppHistoryPeer.php
index a72252fb0..f20ec1597 100755
--- a/workflow/engine/classes/model/AppHistoryPeer.php
+++ b/workflow/engine/classes/model/AppHistoryPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/AppMessage.php b/workflow/engine/classes/model/AppMessage.php
index a1a31a3ea..03b88fcf0 100755
--- a/workflow/engine/classes/model/AppMessage.php
+++ b/workflow/engine/classes/model/AppMessage.php
@@ -121,5 +121,4 @@ class AppMessage extends BaseAppMessage
}
}
}
-// AppMessage
diff --git a/workflow/engine/classes/model/AppMessagePeer.php b/workflow/engine/classes/model/AppMessagePeer.php
index 848a68aec..a113f98b1 100755
--- a/workflow/engine/classes/model/AppMessagePeer.php
+++ b/workflow/engine/classes/model/AppMessagePeer.php
@@ -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 .
- *
- * 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
diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php
index 2edfbf31b..182e2e54a 100755
--- a/workflow/engine/classes/model/AppNotes.php
+++ b/workflow/engine/classes/model/AppNotes.php
@@ -1,251 +1,233 @@
-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()) {
+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() . " ";
- }
- //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 " . G::LoadTranslation( 'ID_AUTHOR' ) . ": $authorName
$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 .= ' ';
- } else {
- if ($aConfiguration['MESS_SERVER'] != '') {
- if (($sAux = @gethostbyaddr( $aConfiguration['MESS_SERVER'] ))) {
- $sFrom .= ' ';
- } else {
- $sFrom .= ' ';
- }
- } else {
- $sFrom .= ' ';
- }
- }
- }
- }
-
- $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() . " ";
+ }
+ //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 " . G::LoadTranslation( 'ID_AUTHOR' ) . ": $authorName
$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 .= ' ';
+ } else {
+ if ($aConfiguration['MESS_SERVER'] != '') {
+ if (($sAux = @gethostbyaddr( $aConfiguration['MESS_SERVER'] ))) {
+ $sFrom .= ' ';
+ } else {
+ $sFrom .= ' ';
+ }
+ } else {
+ $sFrom .= ' ';
+ }
+ }
+ }
+ }
+
+ $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;
+ }
+ }
+}
+
diff --git a/workflow/engine/classes/model/AppNotesPeer.php b/workflow/engine/classes/model/AppNotesPeer.php
index 66af0ff2a..5641493a3 100755
--- a/workflow/engine/classes/model/AppNotesPeer.php
+++ b/workflow/engine/classes/model/AppNotesPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/AppOwner.php b/workflow/engine/classes/model/AppOwner.php
index ae4d4c5d4..afb1b3c5d 100755
--- a/workflow/engine/classes/model/AppOwner.php
+++ b/workflow/engine/classes/model/AppOwner.php
@@ -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 .
- *
- * 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
diff --git a/workflow/engine/classes/model/AppOwnerPeer.php b/workflow/engine/classes/model/AppOwnerPeer.php
index 6b46cbd73..3724aead0 100755
--- a/workflow/engine/classes/model/AppOwnerPeer.php
+++ b/workflow/engine/classes/model/AppOwnerPeer.php
@@ -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 .
- *
- * 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
diff --git a/workflow/engine/classes/model/AppSolrQueue.php b/workflow/engine/classes/model/AppSolrQueue.php
index f8d0445fd..834adf91c 100644
--- a/workflow/engine/classes/model/AppSolrQueue.php
+++ b/workflow/engine/classes/model/AppSolrQueue.php
@@ -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
+}
+
diff --git a/workflow/engine/classes/model/AppSolrQueuePeer.php b/workflow/engine/classes/model/AppSolrQueuePeer.php
index cf47a3f95..389e764ad 100644
--- a/workflow/engine/classes/model/AppSolrQueuePeer.php
+++ b/workflow/engine/classes/model/AppSolrQueuePeer.php
@@ -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
diff --git a/workflow/engine/classes/model/AppThread.php b/workflow/engine/classes/model/AppThread.php
index 5ce05ebb8..beb7946bc 100755
--- a/workflow/engine/classes/model/AppThread.php
+++ b/workflow/engine/classes/model/AppThread.php
@@ -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 .
- *
- * 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() . " ";
-
- 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() . " ";
+ }
+ 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);
+ }
+ }
+}
+
diff --git a/workflow/engine/classes/model/AppThreadPeer.php b/workflow/engine/classes/model/AppThreadPeer.php
index 6820a1e65..bb5483c79 100755
--- a/workflow/engine/classes/model/AppThreadPeer.php
+++ b/workflow/engine/classes/model/AppThreadPeer.php
@@ -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 .
- *
- * 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
diff --git a/workflow/engine/classes/model/ApplicationPeer.php b/workflow/engine/classes/model/ApplicationPeer.php
index 44f602f02..c4d029fa4 100755
--- a/workflow/engine/classes/model/ApplicationPeer.php
+++ b/workflow/engine/classes/model/ApplicationPeer.php
@@ -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 .
- *
- * 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
diff --git a/workflow/engine/classes/model/CalendarAssignments.php b/workflow/engine/classes/model/CalendarAssignments.php
index 05d416d14..47479d3ec 100755
--- a/workflow/engine/classes/model/CalendarAssignments.php
+++ b/workflow/engine/classes/model/CalendarAssignments.php
@@ -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
diff --git a/workflow/engine/classes/model/CalendarAssignmentsPeer.php b/workflow/engine/classes/model/CalendarAssignmentsPeer.php
index e0da33600..a0126bc7a 100755
--- a/workflow/engine/classes/model/CalendarAssignmentsPeer.php
+++ b/workflow/engine/classes/model/CalendarAssignmentsPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/CalendarBusinessHours.php b/workflow/engine/classes/model/CalendarBusinessHours.php
index ab66fec4d..44ea4b247 100755
--- a/workflow/engine/classes/model/CalendarBusinessHours.php
+++ b/workflow/engine/classes/model/CalendarBusinessHours.php
@@ -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.' ';
- $validationFailuresArray = $tr->getValidationFailures();
- foreach($validationFailuresArray as $objValidationFailure) {
- $msg .= $objValidationFailure->getMessage() . " ";
- }
- //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.' ';
+ $validationFailuresArray = $tr->getValidationFailures();
+ foreach ($validationFailuresArray as $objValidationFailure) {
+ $msg .= $objValidationFailure->getMessage() . " ";
+ }
+ //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
+ G::SendTemporalMessage($msg);
+ }
+ }
+}
-} // CalendarBusinessHours
diff --git a/workflow/engine/classes/model/CalendarBusinessHoursPeer.php b/workflow/engine/classes/model/CalendarBusinessHoursPeer.php
index 039489174..ef9f678d0 100755
--- a/workflow/engine/classes/model/CalendarBusinessHoursPeer.php
+++ b/workflow/engine/classes/model/CalendarBusinessHoursPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/CalendarDefinition.php b/workflow/engine/classes/model/CalendarDefinition.php
index a64308a18..cea5801dc 100755
--- a/workflow/engine/classes/model/CalendarDefinition.php
+++ b/workflow/engine/classes/model/CalendarDefinition.php
@@ -1,455 +1,447 @@
-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 {
+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() . " ";
- }
+ $msg = '';
+ $validationFailuresArray = $tr->getValidationFailures();
+ foreach ($validationFailuresArray as $objValidationFailure) {
+ $msg .= $objValidationFailure->getMessage() . " ";
+ }
//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() . " ";
- }
- G::SendMessage( "ERROR", $msg );
+ $msg = '';
+ $validationFailuresArray = $tr->getValidationFailures();
+ foreach ($validationFailuresArray as $objValidationFailure) {
+ $msg .= $objValidationFailure->getMessage() . " ";
+ }
+ 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 "$calendarUid";
- 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() . " ";
- }
+ $msg = '';
+ $validationFailuresArray = $tr->getValidationFailures();
+ foreach ($validationFailuresArray as $objValidationFailure) {
+ $msg .= $objValidationFailure->getMessage() . " ";
+ }
//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();
+ }
+}
+
diff --git a/workflow/engine/classes/model/CalendarDefinitionPeer.php b/workflow/engine/classes/model/CalendarDefinitionPeer.php
index 1de336a21..4a1121313 100755
--- a/workflow/engine/classes/model/CalendarDefinitionPeer.php
+++ b/workflow/engine/classes/model/CalendarDefinitionPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/CalendarHolidays.php b/workflow/engine/classes/model/CalendarHolidays.php
index fdf5a4390..b55740de3 100755
--- a/workflow/engine/classes/model/CalendarHolidays.php
+++ b/workflow/engine/classes/model/CalendarHolidays.php
@@ -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() . " ";
- }
- //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() . " ";
+ }
+ //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
+ }
+
+ //to do: uniform coderror structures for all classes
+ }
+}
-} // CalendarHolidays
diff --git a/workflow/engine/classes/model/CalendarHolidaysPeer.php b/workflow/engine/classes/model/CalendarHolidaysPeer.php
index 5203a8897..4a4a18f1a 100755
--- a/workflow/engine/classes/model/CalendarHolidaysPeer.php
+++ b/workflow/engine/classes/model/CalendarHolidaysPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/CaseScheduler.php b/workflow/engine/classes/model/CaseScheduler.php
index 2843b9545..5f60e661d 100755
--- a/workflow/engine/classes/model/CaseScheduler.php
+++ b/workflow/engine/classes/model/CaseScheduler.php
@@ -1,807 +1,731 @@
-SchTimeNextRun === null)
- $this->SchTimeNextRun = time();
- return $this->SchTimeNextRun;
+require_once 'classes/model/om/BaseCaseScheduler.php';
+
+require_once 'classes/model/Process.php';
+require_once 'classes/model/Task.php';
+
+/**
+ * Skeleton subclass for representing a row from the 'CASE_SCHEDULER' 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 CaseScheduler extends BaseCaseScheduler
+{
+ public function load ($SchUid)
+ {
+ try {
+ $oRow = CaseSchedulerPeer::retrieveByPK( $SchUid );
+ 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 '" . $SchUid . "' in table CASE_SCHEDULER doesn't exist!" ));
+ }
+ } catch (Exception $oError) {
+ throw ($oError);
+ }
}
- public function setSchTimeNextRun($value) {
- $this->SchTimeNextRun = $value;
- }
- public function getSchLastRunTime(){
- if($this->SchTimeNextRun === null)
- $this->SchTimeNextRun = time();
- return $this->SchLastRunTime;
- }
- public function setSchLastRunTime($value){
- $this->SchLastRunTime = $value;
- }
- */
-
- public function load ($SchUid)
- {
- try {
- $oRow = CaseSchedulerPeer::retrieveByPK( $SchUid );
- 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 '" . $SchUid . "' in table CASE_SCHEDULER doesn't exist!" ));
- }
- } catch (Exception $oError) {
- throw ($oError);
- }
- }
-
- public function create ($aData)
- {
- $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
- try {
- $this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
- 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);
- }
- }
-
- public function update ($fields)
- {
- $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
- try {
- $con->begin();
- $this->load( $fields['SCH_UID'] );
- $this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
- 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);
- }
- }
-
- public function remove ($SchUid)
- {
- $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
- try {
- $oCaseScheduler = CaseSchedulerPeer::retrieveByPK( $SchUid );
- if (! is_null( $oCaseScheduler )) {
- $iResult = $oCaseScheduler->delete();
- $con->commit();
- return $iResult;
- } else {
- throw (new Exception( 'This row doesn\'t exist!' ));
- }
- /*
- $con->begin();
- $this->setSchUid ( $SchUid );
- $result = $this->delete();
+
+ public function create ($aData)
+ {
+ $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
+ try {
+ $this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
+ 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);
- }
- }
-
+ } catch (Exception $e) {
+ $con->rollback();
+ throw ($e);
+ }
+ }
+
+ public function update ($fields)
+ {
+ $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
+ try {
+ $con->begin();
+ $this->load( $fields['SCH_UID'] );
+ $this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
+ 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);
+ }
+ }
+
+ public function remove ($SchUid)
+ {
+ $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
+ try {
+ $oCaseScheduler = CaseSchedulerPeer::retrieveByPK( $SchUid );
+ if (! is_null( $oCaseScheduler )) {
+ $iResult = $oCaseScheduler->delete();
+ $con->commit();
+ return $iResult;
+ } else {
+ throw (new Exception( 'This row doesn\'t exist!' ));
+ }
+ } catch (Exception $e) {
+ $con->rollback();
+ throw ($e);
+ }
+ }
+
/*
- * change Status of any Process
- * @param string $sSchedulerUid
- * @return boolean
- */
- public function changeStatus ($sSchedulerUid = '')
- {
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_LAST_STATE'] = $Fields['SCH_STATE'];
- if ($Fields['SCH_STATE'] == 'ACTIVE') {
- $Fields['SCH_STATE'] = 'INACTIVE';
- } else {
- $Fields['SCH_STATE'] = 'ACTIVE';
- }
- $this->Update( $Fields );
- }
-
- // SELECT A.SCH_UID, A.SCH_NAME, A.PRO_UID, B.CON_VALUE AS PROCESS,
- // A.TAS_UID, B.CON_VALUE AS TASK, A.SCH_TIME_NEXT_RUN, A.SCH_LAST_RUN_TIME, A.SCH_STATE, A.SCH_LAST_STATE,
- // A.USR_UID, A.SCH_OPTION
- // SCH_START_TIME, SCH_START_DATE, SCH_DAYS_PERFORM_TASK, SCH_EVERY_DAYS, SCH_WEEK_DAYS
- // SCH_START_DAY, SCH_MONTHS, SCH_END_DATE, SCH_REPEAT_EVERY, SCH_REPEAT_UNTIL, SCH_REPEAT_STOP_IF_RUNNING
- // FROM CASE_SCHEDULER A LEFT JOIN CONTENT B ON A.PRO_UID= B.CON_ID AND B.CON_CATEGORY='PRO_TITLE' AND B.CON_LANG='en'
- // LEFT JOIN CONTENT C ON A.TAS_UID= C.CON_ID AND C.CON_CATEGORY='TAS_TITLE' AND C.CON_LANG='en'
- //
- public function getAllCriteria ()
- {
- $c = new Criteria( 'workflow' );
- $c->clearSelectColumns();
- $c->addSelectColumn( CaseSchedulerPeer::SCH_UID );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_NAME );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_DEL_USER_NAME );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_DEL_USER_PASS );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_DEL_USER_UID );
- $c->addSelectColumn( CaseSchedulerPeer::PRO_UID );
- $c->addSelectColumn( CaseSchedulerPeer::TAS_UID );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_TIME_NEXT_RUN );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_LAST_RUN_TIME );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_STATE );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_LAST_STATE );
- $c->addSelectColumn( CaseSchedulerPeer::USR_UID );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_OPTION );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_START_TIME );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_START_DATE );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_EVERY_DAYS );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_WEEK_DAYS );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_START_DAY );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_MONTHS );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_END_DATE );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_REPEAT_EVERY );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_REPEAT_UNTIL );
- $c->addSelectColumn( CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING );
- $c->addSelectColumn( CaseSchedulerPeer::CASE_SH_PLUGIN_UID );
-
- return $c;
-
- }
-
- public function getAll ()
- {
- $oCriteria = $this->getAllCriteria();
- $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );
-
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRows = Array ();
- while ($aRow = $oDataset->getRow()) {
- $aRows[] = $aRow;
- $oDataset->next();
- }
- foreach ($aRows as $k => $aRow) {
- $oProcess = new Process();
- $aProcessRow = $oProcess->load( $aRow['PRO_UID'] );
-
- $oTask = new Task();
- $aTaskRow = $oTask->load( $aRow['TAS_UID'] );
-
- $aRows[$k] = array_merge( $aRow, $aProcessRow, $aTaskRow );
- }
-
- return $aRows;
- }
-
- /**
- * function getAllByProcess
- * Get All Scheduled Tasks for some process.
- *
- * @author gustavo cruz
- * @param $pro_uid process uid
- * @return $aRows a result set array
- */
- public function getAllByProcess ($pro_uid)
- {
-
- $oCriteria = $this->getAllCriteria();
- $oCriteria->add( CaseSchedulerPeer::PRO_UID, $pro_uid );
- $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );
-
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRows = Array ();
- while ($aRow = $oDataset->getRow()) {
- $aRows[] = $aRow;
- $oDataset->next();
- }
- foreach ($aRows as $k => $aRow) {
- $oProcess = new Process();
- $aProcessRow = $oProcess->load( $aRow['PRO_UID'] );
- $oTask = new Task();
- $aTaskRow = $oTask->load( $aRow['TAS_UID'] );
- $aRows[$k] = array_merge( $aRow, $aProcessRow, $aTaskRow );
- }
- return $aRows;
- }
-
- public function getProcessDescription ()
- {
- $c = new Criteria( 'workflow' );
- $c->clearSelectColumns();
- $c->addSelectColumn( ProcessPeer::PRO_UID );
-
- $oDataset = ProcessPeer::doSelectRS( $c );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRows = Array ();
- while ($aRow = $oDataset->getRow()) {
- $aRows[] = $aRow;
- $oDataset->next();
- }
-
- foreach ($aRows as $k => $aRow) {
- $oProcess = new Process();
- $aProcessRow = $oProcess->load( $aRow['PRO_UID'] );
-
- $aRows[$k] = array_merge( $aRow, array ('PRO_TITLE' => $aProcessRow['PRO_TITLE']
- ) );
- }
- return $aRows;
-
- }
-
- public function getTaskDescription ()
- {
- $c = new Criteria( 'workflow' );
- $c->clearSelectColumns();
- $c->addSelectColumn( TaskPeer::TAS_UID );
-
- $oDataset = TaskPeer::doSelectRS( $c );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRows = Array ();
- while ($aRow = $oDataset->getRow()) {
- $aRows[] = $aRow;
- $oDataset->next();
- }
- foreach ($aRows as $k => $aRow) {
-
- $oTask = new Task();
- $aTaskRow = $oTask->load( $aRow['TAS_UID'] );
-
- $aRows[$k] = array_merge( $aRow, array ('TAS_TITLE' => $aTaskRow['TAS_TITLE']
- ), array ('PRO_UID' => $aTaskRow['PRO_UID']
- ) );
- }
-
- // g::pr($aRows); die;
-
-
- return $aRows;
-
- }
-
- public function caseSchedulerCron ($date, &$log = array(), $cron = 0)
- {
- G::LoadClass( 'dates' );
- require_once ('classes/model/LogCasesScheduler.php');
- $oDates = new dates();
- $nTime = strtotime( $date );
- $dCurrentDate = date( 'Y-m-d', $nTime ) . ' 00:00:00';
- $dNextDay = date( 'Y-m-d', strtotime( "$dCurrentDate" ) ) . ' 23:59:59';
- $oCriteria = $this->getAllCriteria();
- $oCriteria->addAnd( CaseSchedulerPeer::SCH_STATE, 'INACTIVE', Criteria::NOT_EQUAL );
- $oCriteria->addAnd( CaseSchedulerPeer::SCH_STATE, 'PROCESSED', Criteria::NOT_EQUAL );
- $oCriteria->add( CaseSchedulerPeer::SCH_TIME_NEXT_RUN, $dCurrentDate, Criteria::GREATER_EQUAL );
- $oCriteria->addAnd( CaseSchedulerPeer::SCH_TIME_NEXT_RUN, $dNextDay, Criteria::LESS_EQUAL );
- $oCriteria->add( CaseSchedulerPeer::SCH_END_DATE, null, Criteria::EQUAL );
- $oCriteria->addOr( CaseSchedulerPeer::SCH_END_DATE, $dCurrentDate, Criteria::GREATER_EQUAL );
- $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $sValue = '';
- $sActualTime = '';
- $sDaysPerformTask = '';
- $sWeeks = '';
- $sStartDay = '';
- $sMonths = '';
- while ($aRow = $oDataset->getRow()) {
- if ($cron == 1) {
- $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
- $arrayCron["processcTimeStart"] = time();
- @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
- }
-
- $sSchedulerUid = $aRow['SCH_UID'];
- $sOption = $aRow['SCH_OPTION'];
- switch ($sOption) {
- case '1':
- $sDaysPerformTask = $aRow['SCH_DAYS_PERFORM_TASK'];
- $aDaysPerformTask = explode( '|', $sDaysPerformTask );
- $sValue = $aDaysPerformTask[0];
- if ($sValue != 1) {
- $sDaysPerformTask = $aDaysPerformTask[1];
- }
- break;
- case '2':
- $sDaysPerformTask = $aRow['SCH_EVERY_DAYS'];
- $sWeeks = $aRow['SCH_WEEK_DAYS'];
- break;
- case '3':
- $sStartDay = $aRow['SCH_START_DAY'];
- $sMonths = $aRow['SCH_MONTHS'];
- $aStartDay = explode( '|', $sStartDay );
- $sValue = $aStartDay[0];
- break;
- case '4':
- $aRow['SCH_STATE'] = 'PROCESSED';
- break;
- case '5':
- break;
-
- }
-
- $sActualTime = $aRow['SCH_TIME_NEXT_RUN'];
- $sActualDataHour = date( 'H', strtotime( $aRow['SCH_TIME_NEXT_RUN'] ) );
- $sActualDataMinutes = date( 'i', strtotime( $aRow['SCH_TIME_NEXT_RUN'] ) );
- $dActualSysHour = date( 'H', $nTime );
- $dActualSysMinutes = date( 'i', $nTime );
- $sActualDataTime = strtotime( $aRow['SCH_TIME_NEXT_RUN'] );
- $sActualSysTime = strtotime( $nTime );
+ * change Status of any Process
+ * @param string $sSchedulerUid
+ * @return boolean
+ */
+ public function changeStatus ($sSchedulerUid = '')
+ {
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_LAST_STATE'] = $Fields['SCH_STATE'];
+ if ($Fields['SCH_STATE'] == 'ACTIVE') {
+ $Fields['SCH_STATE'] = 'INACTIVE';
+ } else {
+ $Fields['SCH_STATE'] = 'ACTIVE';
+ }
+ $this->Update( $Fields );
+ }
+
+ public function getAllCriteria ()
+ {
+ $c = new Criteria( 'workflow' );
+ $c->clearSelectColumns();
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_UID );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_NAME );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_DEL_USER_NAME );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_DEL_USER_PASS );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_DEL_USER_UID );
+ $c->addSelectColumn( CaseSchedulerPeer::PRO_UID );
+ $c->addSelectColumn( CaseSchedulerPeer::TAS_UID );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_TIME_NEXT_RUN );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_LAST_RUN_TIME );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_STATE );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_LAST_STATE );
+ $c->addSelectColumn( CaseSchedulerPeer::USR_UID );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_OPTION );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_START_TIME );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_START_DATE );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_EVERY_DAYS );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_WEEK_DAYS );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_START_DAY );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_MONTHS );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_END_DATE );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_REPEAT_EVERY );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_REPEAT_UNTIL );
+ $c->addSelectColumn( CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING );
+ $c->addSelectColumn( CaseSchedulerPeer::CASE_SH_PLUGIN_UID );
+
+ return $c;
+ }
+
+ public function getAll ()
+ {
+ $oCriteria = $this->getAllCriteria();
+ $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );
+
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRows = Array ();
+ while ($aRow = $oDataset->getRow()) {
+ $aRows[] = $aRow;
+ $oDataset->next();
+ }
+ foreach ($aRows as $k => $aRow) {
+ $oProcess = new Process();
+ $aProcessRow = $oProcess->load( $aRow['PRO_UID'] );
+
+ $oTask = new Task();
+ $aTaskRow = $oTask->load( $aRow['TAS_UID'] );
+
+ $aRows[$k] = array_merge( $aRow, $aProcessRow, $aTaskRow );
+ }
+
+ return $aRows;
+ }
+
+ /**
+ * function getAllByProcess
+ * Get All Scheduled Tasks for some process.
+ *
+ * @author gustavo cruz
+ * @param $pro_uid process uid
+ * @return $aRows a result set array
+ */
+ public function getAllByProcess ($pro_uid)
+ {
+
+ $oCriteria = $this->getAllCriteria();
+ $oCriteria->add( CaseSchedulerPeer::PRO_UID, $pro_uid );
+ $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );
+
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRows = Array ();
+ while ($aRow = $oDataset->getRow()) {
+ $aRows[] = $aRow;
+ $oDataset->next();
+ }
+ foreach ($aRows as $k => $aRow) {
+ $oProcess = new Process();
+ $aProcessRow = $oProcess->load( $aRow['PRO_UID'] );
+ $oTask = new Task();
+ $aTaskRow = $oTask->load( $aRow['TAS_UID'] );
+ $aRows[$k] = array_merge( $aRow, $aProcessRow, $aTaskRow );
+ }
+ return $aRows;
+ }
+
+ public function getProcessDescription ()
+ {
+ $c = new Criteria( 'workflow' );
+ $c->clearSelectColumns();
+ $c->addSelectColumn( ProcessPeer::PRO_UID );
+
+ $oDataset = ProcessPeer::doSelectRS( $c );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRows = Array ();
+ while ($aRow = $oDataset->getRow()) {
+ $aRows[] = $aRow;
+ $oDataset->next();
+ }
+
+ foreach ($aRows as $k => $aRow) {
+ $oProcess = new Process();
+ $aProcessRow = $oProcess->load( $aRow['PRO_UID'] );
+
+ $aRows[$k] = array_merge( $aRow, array ('PRO_TITLE' => $aProcessRow['PRO_TITLE']
+ ) );
+ }
+ return $aRows;
+
+ }
+
+ public function getTaskDescription ()
+ {
+ $c = new Criteria( 'workflow' );
+ $c->clearSelectColumns();
+ $c->addSelectColumn( TaskPeer::TAS_UID );
+
+ $oDataset = TaskPeer::doSelectRS( $c );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRows = Array ();
+ while ($aRow = $oDataset->getRow()) {
+ $aRows[] = $aRow;
+ $oDataset->next();
+ }
+ foreach ($aRows as $k => $aRow) {
+
+ $oTask = new Task();
+ $aTaskRow = $oTask->load( $aRow['TAS_UID'] );
+
+ $aRows[$k] = array_merge( $aRow, array ('TAS_TITLE' => $aTaskRow['TAS_TITLE']
+ ), array ('PRO_UID' => $aTaskRow['PRO_UID']
+ ) );
+ }
+ return $aRows;
+ }
+
+ public function caseSchedulerCron ($date, &$log = array(), $cron = 0)
+ {
+ G::LoadClass( 'dates' );
+ require_once ('classes/model/LogCasesScheduler.php');
+ $oDates = new dates();
+ $nTime = strtotime( $date );
+ $dCurrentDate = date( 'Y-m-d', $nTime ) . ' 00:00:00';
+ $dNextDay = date( 'Y-m-d', strtotime( "$dCurrentDate" ) ) . ' 23:59:59';
+ $oCriteria = $this->getAllCriteria();
+ $oCriteria->addAnd( CaseSchedulerPeer::SCH_STATE, 'INACTIVE', Criteria::NOT_EQUAL );
+ $oCriteria->addAnd( CaseSchedulerPeer::SCH_STATE, 'PROCESSED', Criteria::NOT_EQUAL );
+ $oCriteria->add( CaseSchedulerPeer::SCH_TIME_NEXT_RUN, $dCurrentDate, Criteria::GREATER_EQUAL );
+ $oCriteria->addAnd( CaseSchedulerPeer::SCH_TIME_NEXT_RUN, $dNextDay, Criteria::LESS_EQUAL );
+ $oCriteria->add( CaseSchedulerPeer::SCH_END_DATE, null, Criteria::EQUAL );
+ $oCriteria->addOr( CaseSchedulerPeer::SCH_END_DATE, $dCurrentDate, Criteria::GREATER_EQUAL );
+ $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $sValue = '';
+ $sActualTime = '';
+ $sDaysPerformTask = '';
+ $sWeeks = '';
+ $sStartDay = '';
+ $sMonths = '';
+ while ($aRow = $oDataset->getRow()) {
+ if ($cron == 1) {
+ $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
+ $arrayCron["processcTimeStart"] = time();
+ @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
+ }
+
+ $sSchedulerUid = $aRow['SCH_UID'];
+ $sOption = $aRow['SCH_OPTION'];
+ switch ($sOption) {
+ case '1':
+ $sDaysPerformTask = $aRow['SCH_DAYS_PERFORM_TASK'];
+ $aDaysPerformTask = explode( '|', $sDaysPerformTask );
+ $sValue = $aDaysPerformTask[0];
+ if ($sValue != 1) {
+ $sDaysPerformTask = $aDaysPerformTask[1];
+ }
+ break;
+ case '2':
+ $sDaysPerformTask = $aRow['SCH_EVERY_DAYS'];
+ $sWeeks = $aRow['SCH_WEEK_DAYS'];
+ break;
+ case '3':
+ $sStartDay = $aRow['SCH_START_DAY'];
+ $sMonths = $aRow['SCH_MONTHS'];
+ $aStartDay = explode( '|', $sStartDay );
+ $sValue = $aStartDay[0];
+ break;
+ case '4':
+ $aRow['SCH_STATE'] = 'PROCESSED';
+ break;
+ case '5':
+ break;
+ }
+
+ $sActualTime = $aRow['SCH_TIME_NEXT_RUN'];
+ $sActualDataHour = date( 'H', strtotime( $aRow['SCH_TIME_NEXT_RUN'] ) );
+ $sActualDataMinutes = date( 'i', strtotime( $aRow['SCH_TIME_NEXT_RUN'] ) );
+ $dActualSysHour = date( 'H', $nTime );
+ $dActualSysMinutes = date( 'i', $nTime );
+ $sActualDataTime = strtotime( $aRow['SCH_TIME_NEXT_RUN'] );
+ $sActualSysTime = strtotime( $nTime );
+
// note added consider the posibility to encapsulate some in functionality in a class method or some funtions
- if ($sActualDataHour < $dActualSysHour) {
- $_PORT = (SERVER_PORT != '80') ? ':' . SERVER_PORT : '';
- $defaultEndpoint = 'http://' . SERVER_NAME . $_PORT . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
- println( " - Connecting webservice: $defaultEndpoint" );
- $user = $aRow["SCH_DEL_USER_NAME"];
- $pass = $aRow["SCH_DEL_USER_PASS"];
- $processId = $aRow["PRO_UID"];
- $taskId = $aRow["TAS_UID"];
- $client = new SoapClient( $defaultEndpoint );
- $params = array ('userid' => $user,'password' => 'md5:' . $pass);
- $result = $client->__SoapCall( 'login', array ($params) );
- eprint( " - Logging as user $user............." );
- if ($result->status_code == 0) {
- eprintln( "OK+", 'green' );
- $sessionId = $result->message;
- $newCaseLog = new LogCasesScheduler();
- $newRouteLog = new LogCasesScheduler();
- $variables = Array ();
- $params = array ('sessionId' => $sessionId,'processId' => $processId,'taskId' => $taskId,'variables' => $variables
- );
-
- $paramsLog = array ('PRO_UID' => $processId,'TAS_UID' => $taskId,'SCH_UID' => $sSchedulerUid,'USR_NAME' => $user,'RESULT' => '','EXEC_DATE' => date( 'Y-m-d' ),'EXEC_HOUR' => date( 'H:i:s' ),'WS_CREATE_CASE_STATUS' => '','WS_ROUTE_CASE_STATUS' => ''
- );
-
+ if ($sActualDataHour < $dActualSysHour) {
+ $_PORT = (SERVER_PORT != '80') ? ':' . SERVER_PORT : '';
+ $defaultEndpoint = 'http://' . SERVER_NAME . $_PORT . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
+ println( " - Connecting webservice: $defaultEndpoint" );
+ $user = $aRow["SCH_DEL_USER_NAME"];
+ $pass = $aRow["SCH_DEL_USER_PASS"];
+ $processId = $aRow["PRO_UID"];
+ $taskId = $aRow["TAS_UID"];
+ $client = new SoapClient( $defaultEndpoint );
+ $params = array ('userid' => $user,'password' => 'md5:' . $pass);
+ $result = $client->__SoapCall( 'login', array ($params) );
+ eprint( " - Logging as user $user............." );
+ if ($result->status_code == 0) {
+ eprintln( "OK+", 'green' );
+ $sessionId = $result->message;
+ $newCaseLog = new LogCasesScheduler();
+ $newRouteLog = new LogCasesScheduler();
+ $variables = Array ();
+ $params = array ('sessionId' => $sessionId,'processId' => $processId,'taskId' => $taskId,'variables' => $variables
+ );
+
+ $paramsLog = array ('PRO_UID' => $processId,'TAS_UID' => $taskId,'SCH_UID' => $sSchedulerUid,'USR_NAME' => $user,'RESULT' => '','EXEC_DATE' => date( 'Y-m-d' ),'EXEC_HOUR' => date( 'H:i:s' ),'WS_CREATE_CASE_STATUS' => '','WS_ROUTE_CASE_STATUS' => ''
+ );
+
$sw_transfer_control_plugin = false; //This SW will be true only if a plugin is allowed to continue the action
//If this Job was was registered to be performed by a plugin
- if ((isset( $aRow['CASE_SH_PLUGIN_UID'] )) && ($aRow['CASE_SH_PLUGIN_UID'] != "")) {
+ if ((isset( $aRow['CASE_SH_PLUGIN_UID'] )) && ($aRow['CASE_SH_PLUGIN_UID'] != "")) {
//Check if the plugin is active
- $pluginParts = explode( "--", $aRow['CASE_SH_PLUGIN_UID'] );
- if (count( $pluginParts ) == 2) {
+ $pluginParts = explode( "--", $aRow['CASE_SH_PLUGIN_UID'] );
+ if (count( $pluginParts ) == 2) {
//***************** Plugins **************************
- G::LoadClass( 'plugin' );
+ G::LoadClass( 'plugin' );
//here we are loading all plugins registered
//the singleton has a list of enabled plugins
- $sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
- if (file_exists( $sSerializedFile )) {
- $oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) );
- }
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
- $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
- foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPlugin) {
- if ((isset( $caseSchedulerPlugin->sNamespace )) && ($caseSchedulerPlugin->sNamespace == $pluginParts[0]) && (isset( $caseSchedulerPlugin->sActionId )) && ($caseSchedulerPlugin->sActionId == $pluginParts[1])) {
- $sw_transfer_control_plugin = true;
- $caseSchedulerSelected = $caseSchedulerPlugin;
- }
- }
-
- }
- }
+ $sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
+ $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ if (file_exists( $sSerializedFile )) {
+ $oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) );
+ }
+ $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
+ foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPlugin) {
+ if ((isset( $caseSchedulerPlugin->sNamespace )) && ($caseSchedulerPlugin->sNamespace == $pluginParts[0]) && (isset( $caseSchedulerPlugin->sActionId )) && ($caseSchedulerPlugin->sActionId == $pluginParts[1])) {
+ $sw_transfer_control_plugin = true;
+ $caseSchedulerSelected = $caseSchedulerPlugin;
+ }
+ }
+
+ }
+ }
+
//If there is a trigger that is registered to do this then transfer control
-
-
- if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
- eprintln( " - Transfering control to a Plugin: " . $caseSchedulerSelected->sNamespace . "/" . $caseSchedulerSelected->sActionId, 'green' );
-
- $oData['OBJ_SOAP'] = $client;
- $oData['SCH_UID'] = $aRow['SCH_UID'];
- $oData['params'] = $params;
- $oData['sessionId'] = $sessionId;
- $oData['userId'] = $user;
- $paramsLogResultFromPlugin = $oPluginRegistry->executeMethod( $caseSchedulerSelected->sNamespace, $caseSchedulerSelected->sActionExecute, $oData );
- $paramsLog['WS_CREATE_CASE_STATUS'] = $paramsLogResultFromPlugin['WS_CREATE_CASE_STATUS'];
- $paramsLog['WS_ROUTE_CASE_STATUS'] = $paramsLogResultFromPlugin['WS_ROUTE_CASE_STATUS'];
-
- $paramsLogResult = $paramsLogResultFromPlugin['paramsLogResult'];
- $paramsRouteLogResult = $paramsLogResultFromPlugin['paramsRouteLogResult'];
- } else {
- eprint( " - Creating the new case............." );
- $result = $client->__SoapCall( 'NewCase', array ($params) );
- if ($result->status_code == 0) {
- eprintln( "OK+ CASE #{$result->caseNumber} was created!", 'green' );
-
- $caseId = $result->caseId;
- $caseNumber = $result->caseNumber;
- $log[] = $caseNumber . ' was created!, ProcessID: ' . $aRow['PRO_UID'];
- $paramsLog['WS_CREATE_CASE_STATUS'] = "Case " . $caseNumber . " " . strip_tags( $result->message );
- $paramsLogResult = 'SUCCESS';
- $params = array ('sessionId' => $sessionId,'caseId' => $caseId,'delIndex' => "1");
- eprint( " - Routing the case #$caseNumber.............." );
- $result = $client->__SoapCall( 'RouteCase', array ($params) );
-
- if ($result->status_code == 0) {
- $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
- $retMsg = explode( "Debug", $paramsLog['WS_ROUTE_CASE_STATUS'] );
- $retMsg = $retMsg[0];
- eprintln( "OK+ $retMsg", 'green' );
- $paramsRouteLogResult = 'SUCCESS';
- } else {
- $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
- eprintln( "FAILED-> {$paramsLog ['WS_ROUTE_CASE_STATUS']}", 'red' );
- $paramsRouteLogResult = 'FAILED';
- }
- } else {
- $paramsLog['WS_CREATE_CASE_STATUS'] = strip_tags( $result->message );
- $paramsLogResult = 'FAILED';
-
- }
- }
- } else {
- eprintln( $result->message, 'red' );
+ if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
+ eprintln( " - Transfering control to a Plugin: " . $caseSchedulerSelected->sNamespace . "/" . $caseSchedulerSelected->sActionId, 'green' );
+ $oData['OBJ_SOAP'] = $client;
+ $oData['SCH_UID'] = $aRow['SCH_UID'];
+ $oData['params'] = $params;
+ $oData['sessionId'] = $sessionId;
+ $oData['userId'] = $user;
+ $paramsLogResultFromPlugin = $oPluginRegistry->executeMethod( $caseSchedulerSelected->sNamespace, $caseSchedulerSelected->sActionExecute, $oData );
+ $paramsLog['WS_CREATE_CASE_STATUS'] = $paramsLogResultFromPlugin['WS_CREATE_CASE_STATUS'];
+ $paramsLog['WS_ROUTE_CASE_STATUS'] = $paramsLogResultFromPlugin['WS_ROUTE_CASE_STATUS'];
+
+ $paramsLogResult = $paramsLogResultFromPlugin['paramsLogResult'];
+ $paramsRouteLogResult = $paramsLogResultFromPlugin['paramsRouteLogResult'];
+ } else {
+ eprint( " - Creating the new case............." );
+ $result = $client->__SoapCall( 'NewCase', array ($params) );
+ if ($result->status_code == 0) {
+ eprintln( "OK+ CASE #{$result->caseNumber} was created!", 'green' );
+
+ $caseId = $result->caseId;
+ $caseNumber = $result->caseNumber;
+ $log[] = $caseNumber . ' was created!, ProcessID: ' . $aRow['PRO_UID'];
+ $paramsLog['WS_CREATE_CASE_STATUS'] = "Case " . $caseNumber . " " . strip_tags( $result->message );
+ $paramsLogResult = 'SUCCESS';
+ $params = array ('sessionId' => $sessionId,'caseId' => $caseId,'delIndex' => "1");
+ eprint( " - Routing the case #$caseNumber.............." );
+ $result = $client->__SoapCall( 'RouteCase', array ($params) );
+
+ if ($result->status_code == 0) {
+ $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
+ $retMsg = explode( "Debug", $paramsLog['WS_ROUTE_CASE_STATUS'] );
+ $retMsg = $retMsg[0];
+ eprintln( "OK+ $retMsg", 'green' );
+ $paramsRouteLogResult = 'SUCCESS';
+ } else {
+ $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
+ eprintln( "FAILED-> {$paramsLog ['WS_ROUTE_CASE_STATUS']}", 'red' );
+ $paramsRouteLogResult = 'FAILED';
+ }
+ } else {
+ $paramsLog['WS_CREATE_CASE_STATUS'] = strip_tags( $result->message );
+ $paramsLogResult = 'FAILED';
+
+ }
+ }
+ } else {
+ eprintln( $result->message, 'red' );
// invalid user or bad password
- }
- if ($paramsLogResult == 'SUCCESS' && $paramsRouteLogResult == 'SUCCESS') {
- $paramsLog['RESULT'] = 'SUCCESS';
- } else {
- $paramsLog['RESULT'] = 'FAILED';
- }
-
- $newCaseLog->saveLogParameters( $paramsLog );
- $newCaseLog->save();
-
- if ($sOption != '4' && $sOption != '5') {
- $nSchLastRunTime = $sActualTime;
-
- $dEstimatedDate = $this->updateNextRun( $sOption, $sValue, $sActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths );
-
- if ($aRow['SCH_END_DATE'] != '') {
- if (date( "Y-m-d", strtotime( $dEstimatedDate ) ) > date( "Y-m-d", strtotime( $aRow['SCH_END_DATE'] ) )) {
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
- $Fields['SCH_STATE'] = 'PROCESSED';
- $this->Update( $Fields );
- }
- }
-
- $nSchTimeNextRun = $dEstimatedDate;
- $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
- } elseif ($sOption != '5') {
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
- $Fields['SCH_LAST_RUN_TIME'] = $Fields['SCH_TIME_NEXT_RUN'];
- $Fields['SCH_STATE'] = 'PROCESSED';
- $this->Update( $Fields );
- } else {
-
- }
- } else if ($sActualDataHour == $dActualSysHour && $sActualDataMinutes <= $dActualSysMinutes) {
- $_PORT = (isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] != '80') ? ':' . $_SERVER['SERVER_PORT'] : '';
+ }
+ if ($paramsLogResult == 'SUCCESS' && $paramsRouteLogResult == 'SUCCESS') {
+ $paramsLog['RESULT'] = 'SUCCESS';
+ } else {
+ $paramsLog['RESULT'] = 'FAILED';
+ }
+
+ $newCaseLog->saveLogParameters( $paramsLog );
+ $newCaseLog->save();
+
+ if ($sOption != '4' && $sOption != '5') {
+ $nSchLastRunTime = $sActualTime;
+
+ $dEstimatedDate = $this->updateNextRun( $sOption, $sValue, $sActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths );
+
+ if ($aRow['SCH_END_DATE'] != '') {
+ if (date( "Y-m-d", strtotime( $dEstimatedDate ) ) > date( "Y-m-d", strtotime( $aRow['SCH_END_DATE'] ) )) {
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
+ $Fields['SCH_STATE'] = 'PROCESSED';
+ $this->Update( $Fields );
+ }
+ }
+
+ $nSchTimeNextRun = $dEstimatedDate;
+ $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
+ } elseif ($sOption != '5') {
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
+ $Fields['SCH_LAST_RUN_TIME'] = $Fields['SCH_TIME_NEXT_RUN'];
+ $Fields['SCH_STATE'] = 'PROCESSED';
+ $this->Update( $Fields );
+ } else {
+
+ }
+ } elseif ($sActualDataHour == $dActualSysHour && $sActualDataMinutes <= $dActualSysMinutes) {
+ $_PORT = (isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] != '80') ? ':' . $_SERVER['SERVER_PORT'] : '';
//$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_PORT . '/sys' . SYS_SYS .'/'.SYS_LANG.'/classic/green/services/wsdl2';
- $defaultEndpoint = 'http://' . SERVER_NAME . $_PORT . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
- println( " - Connecting webservice: $defaultEndpoint" );
- $user = $aRow["SCH_DEL_USER_NAME"];
- $pass = $aRow["SCH_DEL_USER_PASS"];
- $processId = $aRow["PRO_UID"];
- $taskId = $aRow["TAS_UID"];
- $client = new SoapClient( $defaultEndpoint );
- $params = array ('userid' => $user,'password' => 'md5:' . $pass);
- $result = $client->__SoapCall( 'login', array ($params) );
- eprint( " - Logging as user $user............." );
- if ($result->status_code == 0) {
- eprintln( "OK+", 'green' );
- $sessionId = $result->message;
- $newCaseLog = new LogCasesScheduler();
- $newRouteLog = new LogCasesScheduler();
- $variables = Array ();
- $params = array ('sessionId' => $sessionId,'processId' => $processId,'taskId' => $taskId,'variables' => $variables
- );
-
- $paramsLog = array ('PRO_UID' => $processId,'TAS_UID' => $taskId,'SCH_UID' => $sSchedulerUid,'USR_NAME' => $user,'RESULT' => '','EXEC_DATE' => date( 'Y-m-d' ),'EXEC_HOUR' => date( 'H:i:s' ),'WS_CREATE_CASE_STATUS' => '','WS_ROUTE_CASE_STATUS' => ''
- );
-
- $result = $client->__SoapCall( 'NewCase', array ($params) );
-
- eprint( " - Creating the new case............." );
- if ($result->status_code == 0) {
- eprintln( "OK+ CASE #{$result->caseNumber} was created!", 'green' );
- $caseId = $result->caseId;
- $caseNumber = $result->caseNumber;
- $log[] = $caseNumber . ' was created!, ProcessID: ' . $aRow['PRO_UID'];
- $paramsLog['WS_CREATE_CASE_STATUS'] = "Case " . $caseNumber . " " . strip_tags( $result->message );
- $paramsLogResult = 'SUCCESS';
-
- $params = array ('sessionId' => $sessionId,'caseId' => $caseId,'delIndex' => "1"
- );
- $result = $client->__SoapCall( 'RouteCase', array ($params
- ) );
- eprint( " - Routing the case #$caseNumber.............." );
- if ($result->status_code == 0) {
- $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
- $retMsg = explode( "Debug", $paramsLog['WS_ROUTE_CASE_STATUS'] );
- $retMsg = $retMsg[0];
- eprintln( "OK+ $retMsg", 'green' );
- $paramsRouteLogResult = 'SUCCESS';
- } else {
- eprintln( "FAILED-> {$paramsLog ['WS_ROUTE_CASE_STATUS']}", 'red' );
- $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
- $paramsRouteLogResult = 'FAILED';
- }
-
- } else {
- $paramsLog['WS_CREATE_CASE_STATUS'] = strip_tags( $result->message );
- eprintln( "FAILED->{$paramsLog ['WS_CREATE_CASE_STATUS']}", 'red' );
- $paramsLogResult = 'FAILED';
-
- }
- } else {
+ $defaultEndpoint = 'http://' . SERVER_NAME . $_PORT . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
+ println( " - Connecting webservice: $defaultEndpoint" );
+ $user = $aRow["SCH_DEL_USER_NAME"];
+ $pass = $aRow["SCH_DEL_USER_PASS"];
+ $processId = $aRow["PRO_UID"];
+ $taskId = $aRow["TAS_UID"];
+ $client = new SoapClient( $defaultEndpoint );
+ $params = array ('userid' => $user,'password' => 'md5:' . $pass);
+ $result = $client->__SoapCall( 'login', array ($params) );
+ eprint( " - Logging as user $user............." );
+ if ($result->status_code == 0) {
+ eprintln( "OK+", 'green' );
+ $sessionId = $result->message;
+ $newCaseLog = new LogCasesScheduler();
+ $newRouteLog = new LogCasesScheduler();
+ $variables = Array ();
+ $params = array ('sessionId' => $sessionId,'processId' => $processId,'taskId' => $taskId,'variables' => $variables
+ );
+
+ $paramsLog = array ('PRO_UID' => $processId,'TAS_UID' => $taskId,'SCH_UID' => $sSchedulerUid,'USR_NAME' => $user,'RESULT' => '','EXEC_DATE' => date( 'Y-m-d' ),'EXEC_HOUR' => date( 'H:i:s' ),'WS_CREATE_CASE_STATUS' => '','WS_ROUTE_CASE_STATUS' => ''
+ );
+
+ $result = $client->__SoapCall( 'NewCase', array ($params) );
+
+ eprint( " - Creating the new case............." );
+ if ($result->status_code == 0) {
+ eprintln( "OK+ CASE #{$result->caseNumber} was created!", 'green' );
+ $caseId = $result->caseId;
+ $caseNumber = $result->caseNumber;
+ $log[] = $caseNumber . ' was created!, ProcessID: ' . $aRow['PRO_UID'];
+ $paramsLog['WS_CREATE_CASE_STATUS'] = "Case " . $caseNumber . " " . strip_tags( $result->message );
+ $paramsLogResult = 'SUCCESS';
+
+ $params = array ('sessionId' => $sessionId,'caseId' => $caseId,'delIndex' => "1"
+ );
+ $result = $client->__SoapCall( 'RouteCase', array ($params
+ ) );
+ eprint( " - Routing the case #$caseNumber.............." );
+ if ($result->status_code == 0) {
+ $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
+ $retMsg = explode( "Debug", $paramsLog['WS_ROUTE_CASE_STATUS'] );
+ $retMsg = $retMsg[0];
+ eprintln( "OK+ $retMsg", 'green' );
+ $paramsRouteLogResult = 'SUCCESS';
+ } else {
+ eprintln( "FAILED-> {$paramsLog ['WS_ROUTE_CASE_STATUS']}", 'red' );
+ $paramsLog['WS_ROUTE_CASE_STATUS'] = strip_tags( $result->message );
+ $paramsRouteLogResult = 'FAILED';
+ }
+
+ } else {
+ $paramsLog['WS_CREATE_CASE_STATUS'] = strip_tags( $result->message );
+ eprintln( "FAILED->{$paramsLog ['WS_CREATE_CASE_STATUS']}", 'red' );
+ $paramsLogResult = 'FAILED';
+ }
+ } else {
// invalid user or bad password
- eprintln( $result->message, 'red' );
- }
- if ($paramsLogResult == 'SUCCESS' && $paramsRouteLogResult == 'SUCCESS') {
- $paramsLog['RESULT'] = 'SUCCESS';
- } else {
- $paramsLog['RESULT'] = 'FAILED';
- }
-
- $newCaseLog->saveLogParameters( $paramsLog );
- $newCaseLog->save();
-
- if ($sOption != '4' && $sOption != '5') {
- $nSchLastRunTime = $sActualTime;
- $dEstimatedDate = $this->updateNextRun( $sOption, $sValue, $sActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths );
-
- if ($aRow['SCH_END_DATE'] != '') {
- if (date( "Y-m-d", strtotime( $dEstimatedDate ) ) > date( "Y-m-d", strtotime( $aRow['SCH_END_DATE'] ) )) {
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
- $Fields['SCH_STATE'] = 'PROCESSED';
- $this->Update( $Fields );
- }
- }
- $nSchTimeNextRun = $dEstimatedDate;
- $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
- } elseif ($sOption != '5') {
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
- $Fields['SCH_LAST_RUN_TIME'] = $Fields['SCH_TIME_NEXT_RUN'];
- $Fields['SCH_STATE'] = 'PROCESSED';
- $this->Update( $Fields );
- } else {
- $nSchLastRunTime = $sActualTime;
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_LAST_RUN_TIME'] = $Fields['SCH_TIME_NEXT_RUN'];
-
- $nSchTimeNextRun = strtotime( $Fields['SCH_TIME_NEXT_RUN'] );
- $nextRun = $Fields['SCH_REPEAT_EVERY'] * 60 * 60;
- $nSchTimeNextRun += $nextRun;
- $nSchTimeNextRun = date( "Y-m-d H:i", $nSchTimeNextRun );
-
- $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
- }
- }
-
- $oDataset->next();
- }
-
- }
-
- public function updateDate ($sSchedulerUid = '', $sSchTimeNextRun = '', $sSchLastRunTime = '')
- {
- $Fields = $this->Load( $sSchedulerUid );
- $Fields['SCH_TIME_NEXT_RUN'] = strtotime( $sSchTimeNextRun );
- $Fields['SCH_LAST_RUN_TIME'] = strtotime( $sSchLastRunTime );
- $this->Update( $Fields );
- }
-
- public function updateNextRun ($sOption, $sValue = '', $sActualTime = '', $sDaysPerformTask = '', $sWeeks = '', $sStartDay = '', $sMonths = '', $currentDate = '')
- {
- $nActualDate = $currentDate . " " . $sActualTime;
- // date("Y-m-d H:i:s", $sActualTime);
- // date("Y-m-d H:i:s", $sActualTime);
- $dEstimatedDate = '';
- switch ($sOption) {
- case '1':
- switch ($sValue) {
- case '1':
- $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate +1 day" ) );
- break;
- case '2':
- $nDayOfTheWeek = date( 'w', strtotime( $sActualTime ) );
- $nDayOfTheWeek = ($nDayOfTheWeek == 0) ? 7 : $nDayOfTheWeek;
-
- if ($nDayOfTheWeek >= 5) {
- $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate +3 day" ) );
- } else {
- $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate +1 day" ) );
- }
- break;
- case '3':
- $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate + " . $sDaysPerformTask . " day" ) );
- break;
- }
- break;
-
- case '2':
- if (strlen( $sWeeks ) > 0) {
+ eprintln( $result->message, 'red' );
+ }
+ if ($paramsLogResult == 'SUCCESS' && $paramsRouteLogResult == 'SUCCESS') {
+ $paramsLog['RESULT'] = 'SUCCESS';
+ } else {
+ $paramsLog['RESULT'] = 'FAILED';
+ }
+
+ $newCaseLog->saveLogParameters( $paramsLog );
+ $newCaseLog->save();
+
+ if ($sOption != '4' && $sOption != '5') {
+ $nSchLastRunTime = $sActualTime;
+ $dEstimatedDate = $this->updateNextRun( $sOption, $sValue, $sActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths );
+
+ if ($aRow['SCH_END_DATE'] != '') {
+ if (date( "Y-m-d", strtotime( $dEstimatedDate ) ) > date( "Y-m-d", strtotime( $aRow['SCH_END_DATE'] ) )) {
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
+ $Fields['SCH_STATE'] = 'PROCESSED';
+ $this->Update( $Fields );
+ }
+ }
+ $nSchTimeNextRun = $dEstimatedDate;
+ $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
+ } elseif ($sOption != '5') {
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
+ $Fields['SCH_LAST_RUN_TIME'] = $Fields['SCH_TIME_NEXT_RUN'];
+ $Fields['SCH_STATE'] = 'PROCESSED';
+ $this->Update( $Fields );
+ } else {
+ $nSchLastRunTime = $sActualTime;
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_LAST_RUN_TIME'] = $Fields['SCH_TIME_NEXT_RUN'];
+
+ $nSchTimeNextRun = strtotime( $Fields['SCH_TIME_NEXT_RUN'] );
+ $nextRun = $Fields['SCH_REPEAT_EVERY'] * 60 * 60;
+ $nSchTimeNextRun += $nextRun;
+ $nSchTimeNextRun = date( "Y-m-d H:i", $nSchTimeNextRun );
+
+ $this->updateDate( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
+ }
+ }
+ $oDataset->next();
+ }
+ }
+
+ public function updateDate ($sSchedulerUid = '', $sSchTimeNextRun = '', $sSchLastRunTime = '')
+ {
+ $Fields = $this->Load( $sSchedulerUid );
+ $Fields['SCH_TIME_NEXT_RUN'] = strtotime( $sSchTimeNextRun );
+ $Fields['SCH_LAST_RUN_TIME'] = strtotime( $sSchLastRunTime );
+ $this->Update( $Fields );
+ }
+
+ public function updateNextRun ($sOption, $sValue = '', $sActualTime = '', $sDaysPerformTask = '', $sWeeks = '', $sStartDay = '', $sMonths = '', $currentDate = '')
+ {
+ $nActualDate = $currentDate . " " . $sActualTime;
+ $dEstimatedDate = '';
+ switch ($sOption) {
+ case '1':
+ switch ($sValue) {
+ case '1':
+ $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate +1 day" ) );
+ break;
+ case '2':
+ $nDayOfTheWeek = date( 'w', strtotime( $sActualTime ) );
+ $nDayOfTheWeek = ($nDayOfTheWeek == 0) ? 7 : $nDayOfTheWeek;
+
+ if ($nDayOfTheWeek >= 5) {
+ $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate +3 day" ) );
+ } else {
+ $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate +1 day" ) );
+ }
+ break;
+ case '3':
+ $dEstimatedDate = date( 'Y-m-d H:i:s', strtotime( "$nActualDate + " . $sDaysPerformTask . " day" ) );
+ break;
+ }
+ break;
+ case '2':
+ if (strlen( $sWeeks ) > 0) {
//die($sActualTime);
- $nDayOfTheWeek = date( 'w', strtotime( $sActualTime ) );
+ $nDayOfTheWeek = date( 'w', strtotime( $sActualTime ) );
//$nDayOfTheWeek = 1;
//echo "*".$nDayOfTheWeek."*";
- $aWeeks = explode( '|', $sWeeks );
- $nFirstDay = $aWeeks[0];
- $aDaysWeek = array ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
- $nFirstDay = $nFirstDay - 1;
+ $aWeeks = explode( '|', $sWeeks );
+ $nFirstDay = $aWeeks[0];
+ $aDaysWeek = array ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+ $nFirstDay = $nFirstDay - 1;
//echo "¨¨".$nFirstDay."¨¨";
- $nDayOfTheWeek = ($nDayOfTheWeek == 0) ? 7 : $nDayOfTheWeek;
+ $nDayOfTheWeek = ($nDayOfTheWeek == 0) ? 7 : $nDayOfTheWeek;
//echo $nDayOfTheWeek;
- $nSW = 0;
- $nNextDay = 0;
- foreach ($aWeeks as $value) {
- if ($value > $nDayOfTheWeek) {
- $nNextDay = $value - 1;
- $nSW = 1;
- break;
- }
- }
-
- //die;
- if ($nSW == 1) {
- $dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate next " . $aDaysWeek[$nNextDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
- //print_r($dEstimatedDate);
- // die("03");
- } else {
- $nEveryDays = $sDaysPerformTask;
+ $nSW = 0;
+ $nNextDay = 0;
+ foreach ($aWeeks as $value) {
+ if ($value > $nDayOfTheWeek) {
+ $nNextDay = $value - 1;
+ $nSW = 1;
+ break;
+ }
+ }
+ if ($nSW == 1) {
+ $dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate next " . $aDaysWeek[$nNextDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
+ } else {
+ $nEveryDays = $sDaysPerformTask;
// $nEveryDays = '1';
- if ($nFirstDay >= $nDayOfTheWeek || $nEveryDays == 1) {
- $sTypeOperation = "next";
- } else {
- $sTypeOperation = "last";
- }
-
- if ($nEveryDays == 1) {
+ if ($nFirstDay >= $nDayOfTheWeek || $nEveryDays == 1) {
+ $sTypeOperation = "next";
+ } else {
+ $sTypeOperation = "last";
+ }
+
+ if ($nEveryDays == 1) {
//echo "**** $nActualDate *" . $sTypeOperation . "* *" . $aDaysWeek[$nFirstDay] . '*****' . date('H:i:s', strtotime($sActualTime)). "**";
- $dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
+ $dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
//echo "(date)*".$dEstimatedDate."*";
//die("01");
- } else {
- $nEveryDays = 1;
+ } else {
+ $nEveryDays = 1;
//$nActualDate = date('Y-m-d').' '.$sActualTime;
- $nDataTmp = date( 'Y-m-d', strtotime( "$nActualDate + " . $nEveryDays . " Week" ) );
- //echo "$nActualDate + " . $nEveryDays . " Week ";
- //echo "++";
- //echo strtotime( "+".$nEveryDays . " week"), "\n";
- //echo strtotime("$nActualDate +" . $nEveryDays . " Week ");
- //echo "++";
- //echo $nDataTmp;
- //echo "--";
- //echo $sTypeOperation;
- //echo $nFirstDay;
- //print_r ($aDaysWeek);
- //$sTypeOperation = "next";
- $dEstimatedDate = date( 'Y-m-d', strtotime( "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
- //echo (strtotime ("$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay]));
- //echo "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay];
- //echo $dEstimatedDate;
- //echo "--";
- //echo date('Y-m-d', strtotime ("$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay])) . ' ' . date('H:i:s', strtotime($sActualTime));
- //die("02");
- }
- //die("03");
- }
- }
- break;
- case '3':
- if (strlen( $sMonths ) > 0) { // Must have at least one selected month
+ $nDataTmp = date( 'Y-m-d', strtotime( "$nActualDate + " . $nEveryDays . " Week" ) );
+ $dEstimatedDate = date( 'Y-m-d', strtotime( "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
+ }
+ }
+ }
+ break;
+ case '3':
+ if (strlen( $sMonths ) > 0) {
+ // Must have at least one selected month
// Calculamos para la siguiente ejecucion, acorde a lo seleccionado
- $aStartDay = explode( '|', $sStartDay );
- $nYear = date( "Y", strtotime( $sActualTime ) );
- $nCurrentMonth = date( "m", strtotime( $sActualTime ) );
- $nCurrentDay = date( "d", strtotime( $sActualTime ) );
- $aMonths = explode( '|', $sMonths );
-
- $nSW = 0;
- $nNextMonth = 0;
- foreach ($aMonths as $value) {
- if ($value > $nCurrentMonth) {
- $nNextMonth = $value - 1;
- $nSW = 1;
- break;
- }
- }
-
- if ($nSW == 1) { // Mes encontrado
- $nExecNextMonth = $nNextMonth;
- } else {
- $nExecNextMonth = $aMonths[0] - 1;
- $nYear ++;
- }
-
- switch ($sValue) {
- case '1':
- $nExecNextMonth ++;
- $nCurrentDay = $aStartDay[1];
- $dEstimatedDate = date( 'Y-m-d', strtotime( "$nYear-$nExecNextMonth-$nCurrentDay" ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
- break;
- case '2':
- $aMontsShort = array ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
- $aWeeksShort = array ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
- $sNumDayWeek = $aStartDay[1];
- $sDayWeek = ($aStartDay[2] == 7 ? 0 : $aStartDay[2]);
- switch ($sNumDayWeek) {
- case '1':
- $sDaysWeekOpt = "+0";
- break;
- case '2':
- $sDaysWeekOpt = "+1";
- break;
- case '3':
- $sDaysWeekOpt = "+2";
- break;
- case '4':
- $sDaysWeekOpt = "+3";
- break;
- case '5':
- $sDaysWeekOpt = "-1";
- $nExecNextMonth ++;
- if ($nExecNextMonth >= 12) {
- $nExecNextMonth = 0;
- $nYear ++;
- }
- break;
- }
- $dEstimatedDate = date( 'Y-m-d', strtotime( $sDaysWeekOpt . ' week ' . $aWeeksShort[$sDayWeek - 1] . ' ' . $aMontsShort[$nExecNextMonth] . ' ' . $nYear ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
- // krumo($nExecNextMonth, $sDayWeek);
- // krumo($sDaysWeekOpt . ' week ' . $aWeeksShort[$sDayWeek-1] . ' ' . $aMontsShort[$nExecNextMonth] . ' ' . $nYear);
- break;
- }
-
- }
- break;
- }
- return $dEstimatedDate;
- }
-
- public function Exists ($sUid)
- {
- try {
- $oObj = CaseSchedulerPeer::retrieveByPk( $sUid );
- return (is_object( $oObj ) && get_class( $oObj ) == 'CaseScheduler');
- } catch (Exception $oError) {
- throw ($oError);
- }
- }
-}
-// CaseScheduler
+ $aStartDay = explode( '|', $sStartDay );
+ $nYear = date( "Y", strtotime( $sActualTime ) );
+ $nCurrentMonth = date( "m", strtotime( $sActualTime ) );
+ $nCurrentDay = date( "d", strtotime( $sActualTime ) );
+ $aMonths = explode( '|', $sMonths );
+
+ $nSW = 0;
+ $nNextMonth = 0;
+ foreach ($aMonths as $value) {
+ if ($value > $nCurrentMonth) {
+ $nNextMonth = $value - 1;
+ $nSW = 1;
+ break;
+ }
+ }
+
+ if ($nSW == 1) {
+ $nExecNextMonth = $nNextMonth;
+ } else {
+ $nExecNextMonth = $aMonths[0] - 1;
+ $nYear ++;
+ }
+
+ switch ($sValue) {
+ case '1':
+ $nExecNextMonth ++;
+ $nCurrentDay = $aStartDay[1];
+ $dEstimatedDate = date( 'Y-m-d', strtotime( "$nYear-$nExecNextMonth-$nCurrentDay" ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
+ break;
+ case '2':
+ $aMontsShort = array ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
+ $aWeeksShort = array ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+ $sNumDayWeek = $aStartDay[1];
+ $sDayWeek = ($aStartDay[2] == 7 ? 0 : $aStartDay[2]);
+ switch ($sNumDayWeek) {
+ case '1':
+ $sDaysWeekOpt = "+0";
+ break;
+ case '2':
+ $sDaysWeekOpt = "+1";
+ break;
+ case '3':
+ $sDaysWeekOpt = "+2";
+ break;
+ case '4':
+ $sDaysWeekOpt = "+3";
+ break;
+ case '5':
+ $sDaysWeekOpt = "-1";
+ $nExecNextMonth ++;
+ if ($nExecNextMonth >= 12) {
+ $nExecNextMonth = 0;
+ $nYear ++;
+ }
+ break;
+ }
+ $dEstimatedDate = date( 'Y-m-d', strtotime( $sDaysWeekOpt . ' week ' . $aWeeksShort[$sDayWeek - 1] . ' ' . $aMontsShort[$nExecNextMonth] . ' ' . $nYear ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
+ break;
+ }
+ }
+ break;
+ }
+ return $dEstimatedDate;
+ }
+
+ public function Exists ($sUid)
+ {
+ try {
+ $oObj = CaseSchedulerPeer::retrieveByPk( $sUid );
+ return (is_object( $oObj ) && get_class( $oObj ) == 'CaseScheduler');
+ } catch (Exception $oError) {
+ throw ($oError);
+ }
+ }
+}
diff --git a/workflow/engine/classes/model/CaseSchedulerPeer.php b/workflow/engine/classes/model/CaseSchedulerPeer.php
index 0910bb1cf..99f987afa 100755
--- a/workflow/engine/classes/model/CaseSchedulerPeer.php
+++ b/workflow/engine/classes/model/CaseSchedulerPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/CaseTracker.php b/workflow/engine/classes/model/CaseTracker.php
index b439443f4..ca965cb58 100755
--- a/workflow/engine/classes/model/CaseTracker.php
+++ b/workflow/engine/classes/model/CaseTracker.php
@@ -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
diff --git a/workflow/engine/classes/model/CaseTrackerObject.php b/workflow/engine/classes/model/CaseTrackerObject.php
index aaebf2883..f21f08121 100755
--- a/workflow/engine/classes/model/CaseTrackerObject.php
+++ b/workflow/engine/classes/model/CaseTrackerObject.php
@@ -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
diff --git a/workflow/engine/classes/model/CaseTrackerObjectPeer.php b/workflow/engine/classes/model/CaseTrackerObjectPeer.php
index 7b386795b..6e03b8ecb 100755
--- a/workflow/engine/classes/model/CaseTrackerObjectPeer.php
+++ b/workflow/engine/classes/model/CaseTrackerObjectPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/CaseTrackerPeer.php b/workflow/engine/classes/model/CaseTrackerPeer.php
index 9bf9d0c81..b90759a47 100755
--- a/workflow/engine/classes/model/CaseTrackerPeer.php
+++ b/workflow/engine/classes/model/CaseTrackerPeer.php
@@ -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
diff --git a/workflow/engine/classes/model/Configuration.php b/workflow/engine/classes/model/Configuration.php
index 8836e4874..4b8d90a41 100755
--- a/workflow/engine/classes/model/Configuration.php
+++ b/workflow/engine/classes/model/Configuration.php
@@ -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
+}
+
diff --git a/workflow/engine/classes/model/ConfigurationPeer.php b/workflow/engine/classes/model/ConfigurationPeer.php
index 5e6ebf5a4..e3d515134 100755
--- a/workflow/engine/classes/model/ConfigurationPeer.php
+++ b/workflow/engine/classes/model/ConfigurationPeer.php
@@ -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 .
- *
- * 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
diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php
index 654e3fb85..2e2df381a 100755
--- a/workflow/engine/classes/model/Content.php
+++ b/workflow/engine/classes/model/Content.php
@@ -1,107 +1,109 @@
-.
- *
- * 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;
+.
+ *
+ * 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;
+ }
+}
+
diff --git a/workflow/engine/classes/model/ContentPeer.php b/workflow/engine/classes/model/ContentPeer.php
index c3549b32d..99dbb2945 100755
--- a/workflow/engine/classes/model/ContentPeer.php
+++ b/workflow/engine/classes/model/ContentPeer.php
@@ -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 .
- *
- * 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
|