*/ try { G::LoadSystem('inputfilter'); $filter = new InputFilter(); $_POST = $filter->xssFilterHard($_POST); G::LoadInclude('ajax'); if (isset($_POST['form'])) { $_POST = $_POST['form']; } $_POST['function'] = get_ajax_value('function'); $_POST['function'] = $filter->xssFilterHard($_POST['function']); switch ($_POST['function']) { case 'savePredetermined': require_once "classes/model/Translation.php"; $tranlationsList = Translation::getTranslationEnvironments(); g::pr($tranlationsList); die; if (isset($meta['LAN_ID']) && $meta['LAN_ID'] == $_POST['lang']) { echo 'The Setting was saved successfully!'; } else { echo 'Some error occured while the setting was being save, try later please.'; } break; case 'languagesList': require_once 'classes/model/Language.php'; require_once 'classes/model/IsoCountry.php'; require_once 'classes/model/Translation.php'; G::loadClass('configuration'); $isoCountry = new isoCountry(); $translationRow = new Translation(); $response = new stdClass();
function calculateExecutionDateSingle() { try { $rowsCreated = 0; $rowsRejected = 0; G::LoadClass('dates'); $oDates = new dates(); //SELECT // EVENT.PRO_UID, // EVENT.TAS_UID , // EVENT.EVN_TAS_ESTIMATED_DURATION , // EVENT.EVN_WHEN, // APP_DELEGATION.APP_UID , // APP_DELEGATION.DEL_INDEX , // APP_DELEGATION.TAS_UID , // APP_DELEGATION.DEL_DELEGATE_DATE , // APP_DELEGATION.DEL_INIT_DATE , // APP_DELEGATION.DEL_TASK_DUE_DATE , // APP_DELEGATION.DEL_FINISH_DATE //from APP_DELEGATION // JOIN EVENT ON ( APP_DELEGATION.TAS_UID = EVENT.TAS_UID AND APP_DELEGATION.DEL_FINISH_DATE IS NULL ) // LEFT JOIN APP_EVENT ON ( APP_EVENT.APP_UID = APP_DELEGATION.APP_UID AND APP_EVENT.DEL_INDEX = APP_DELEGATION.DEL_INDEX ) // WHERE // APP_EVENT.APP_UID IS NULL // and EVN_STATUS = 'ACTIVE' // AND EVN_RELATED_TO = 'SINGLE' // and DEL_FINISH_DATE IS NULL //-- and APP_DELEGATION.DEL_DELEGATE_DATE > "2009-01-01 12:00:00" //ORDER BY APP_DELEGATION.DEL_DELEGATE_DATE //get info about the Event and the APP_DELEGATION to process $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(EventPeer::EVN_UID); $oCriteria->addSelectColumn(EventPeer::PRO_UID); $oCriteria->addSelectColumn(EventPeer::TAS_UID); $oCriteria->addSelectColumn(EventPeer::EVN_TAS_ESTIMATED_DURATION); $oCriteria->addSelectColumn(EventPeer::EVN_WHEN); $oCriteria->addSelectColumn(EventPeer::EVN_WHEN_OCCURS); $oCriteria->addSelectColumn(EventPeer::EVN_RELATED_TO); $oCriteria->addSelectColumn(EventPeer::EVN_MAX_ATTEMPTS); $oCriteria->addSelectColumn(AppDelegationPeer::APP_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); $aConditions = array(); $aConditions[] = array(AppDelegationPeer::TAS_UID, EventPeer::TAS_UID); //$aConditions[] = array(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::IS_NULL ); //is null is supported by addJoinMC by the way. $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); $aConditions = array(); $aConditions[] = array(AppDelegationPeer::APP_UID, AppEventPeer::APP_UID); $aConditions[] = array(AppDelegationPeer::DEL_INDEX, AppEventPeer::DEL_INDEX); $aConditions[] = array(EventPeer::EVN_UID, AppEventPeer::EVN_UID); $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); $oCriteria->add(AppEventPeer::APP_UID, null, Criteria::ISNULL); $oCriteria->add(EventPeer::EVN_STATUS, 'ACTIVE'); $oCriteria->add(EventPeer::EVN_RELATED_TO, 'SINGLE'); $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); // $oCriteria->add(AppDelegationPeer::DEL_DELEGATE_DATE, date('Y-m-d') , Criteria::GREATER_THAN ); $oDataset = EventPeer::doSelectRs($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $aRows = array(); while ($oDataset->next()) { $aRows[] = $oDataset->getRow(); } g::pr($aRows); die; $oDataset->next(); while ($aData = $oDataset->getRow()) { $estimatedDuration = (double) $aData['EVN_TAS_ESTIMATED_DURATION']; $when = (double) $aData['EVN_WHEN']; $whenOccurs = $aData['EVN_WHEN_OCCURS']; if ($whenOccurs == 'AFTER_TIME') { //for multiple $sDueDate = date('Y-m-d H:i:s', $oDates->calculateDate($aData['DEL_DELEGATE_DATE'], $estimatedDuration, 'days', 1)); $sDueDate = $aData['DEL_TASK_DUE_DATE']; $calculatedDueDateA = $oDates->calculateDate($sDueDate, $when, 'days', 1); $sActionDate = date('Y-m-d H:i:s', $calculatedDueDateA['DUE_DATE_SECONDS']); $validStartDate = $sActionDate >= $aData['DEL_DELEGATE_DATE']; } else { $sDueDate = $aData['DEL_DELEGATE_DATE']; $calculatedDueDateA = $oDates->calculateDate($sDueDate, $when, 'days', 1); $sActionDate = date('Y-m-d H:i:s', $calculatedDueDateA['DUE_DATE_SECONDS']); $validStartDate = $sActionDate >= $aData['DEL_DELEGATE_DATE']; } $aData['APP_EVN_ACTION_DATE'] = $sActionDate; $aData['APP_EVN_ATTEMPTS'] = $aData['EVN_MAX_ATTEMPTS']; if ($validStartDate) { $rowsCreated++; $oAppEvent = new AppEvent(); $oAppEvent->create($aData); } else { $rowsRejected++; $aData['APP_EVN_STATUS'] = 'INVALID'; $oAppEvent = new AppEvent(); $oAppEvent->create($aData); } $oDataset->next(); } return "Created {$rowsCreated} SINGLE rows in APP_EVENT and rejected {$rowsRejected} rows "; } catch (Exception $oError) { throw new Exception($oError->getMessage()); } }
function getExternalStepAction() { $oPluginRegistry =& PMPluginRegistry::getSingleton(); g::pr($oPluginRegistry->getSteps()); return $oPluginRegistry->getSteps(); }