function updatePageSize() { G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size']; $arr['dateSave'] = date('Y-m-d H:i:s'); $config = array(); $config[] = $arr; $c->aConfig = $config; $c->saveConfig('skinsList', 'pageSize', '', $_SESSION['USER_LOGGED']); echo '{success: true}'; }
$result = new stdclass(); switch ($request) { case "getUserMaskList": $result->rows = Configurations::getUserNameFormats(); print G::json_encode($result); break; case "getDateFormats": $result->rows = Configurations::getDateFormats(); print G::json_encode($result); break; case "getCasesListDateFormat": $result->rows = Configurations::getDateFormats(); print G::json_encode($result); break; case "getCasesListRowNumber": for ($i = 10; $i <= 50; $i += 5) { $formats[] = array("id" => "{$i}", "name" => "{$i}"); } $result->rows = $formats; print G::json_encode($result); break; case "save": $conf = new Configurations(); $conf->aConfig = array("format" => $_POST["userFormat"], "dateFormat" => $_POST["dateFormat"], "startCaseHideProcessInf" => isset($_POST["hideProcessInf"]) ? true : false, "casesListDateFormat" => $_POST["casesListDateFormat"], "casesListRowNumber" => intval($_POST["casesListRowNumber"]), "casesListRefreshTime" => intval($_POST["txtCasesRefreshTime"])); $conf->saveConfig("ENVIRONMENT_SETTINGS", ""); $response = new stdclass(); $response->success = true; $response->msg = G::LoadTranslation("ID_SAVED_SUCCESSFULLY"); echo G::json_encode($response); break; }
/** * fix the 32K issue, by migrating /files directory structure to an uid tree structure based. * @param $workspace got the site(s) the manager wants to upgrade */ public function upgradeCasesDirectoryStructure ($workspace) { define('PATH_DOCUMENT', PATH_DATA . 'sites/' . $workspace . '/' . 'files/'); $doclevel = explode('/', PATH_DOCUMENT); $length = sizeof(PATH_DOCUMENT); $filesDir = $doclevel[$length - 1]; if (is_dir(PATH_DOCUMENT) && is_writable($filesDir)) { CLI::logging(CLI::error("Error:" . PATH_DOCUMENT . " is not writable... please check the su permissions.\n")); return; } $directory = array(); $blackHoleDir = G::getBlackHoleDir(); $directory = glob(PATH_DOCUMENT . "*", GLOB_ONLYDIR); $dirslength = sizeof($directory); if (! @chdir(PATH_DOCUMENT)) { CLI::logging(CLI::error("Cannot use Document directory. The upgrade must be done as root.\n")); return; } //Start migration for ($index = 0; $index < $dirslength; $index++) { $depthdirlevel = explode('/', $directory[$index]); $lastlength = sizeof($depthdirlevel); $UIdDir = $depthdirlevel[$lastlength - 1]; $lenDir = strlen($UIdDir); if ($lenDir == 32 && $UIdDir != $blackHoleDir) { $len = count(scandir($UIdDir)); if ($len > 2) { //lenght = 2, because the function check . and .. dir links $newDiretory = G::getPathFromUIDPlain($UIdDir); CLI::logging("Migrating $UIdDir to $newDiretory\n"); G::mk_dir($newDiretory, 0777); //echo `cp -R $UIdDir/* $newDiretory/`; if (G::recursive_copy($UIdDir, $newDiretory)) { CLI::logging("Removing $UIdDir...\n"); G::rm_dir($UIdDir); rmdir($UIdDir);//remove the diretory itself, G::rm_dir cannot do it } else { CLI::logging(CLI::error("Error: Failure at coping from $UIdDir...\n")); } } else { CLI::logging("$UIdDir is empty, removing it\n"); rmdir($UIdDir);//remove the diretory itself } } } //Start '0' directory migration $black = PATH_DOCUMENT . $blackHoleDir . '/'; if (is_dir($black)) { $newpattern = array(); $file = glob($black . '*.*');//files only $dirlen = count($file); for ($index = 0; $index < $dirlen; $index++) { $levelfile = explode('/', $file[$index]); $lastlevel = sizeof($levelfile); $goalFile = $levelfile[$lastlevel - 1]; $newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile); CLI::logging("Migrating $blackHoleDir file: $goalFile\n"); G::mk_dir($blackHoleDir . PATH_SEP . $newpattern[0], 0777); //echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`; if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) { unlink($file[$index]); } else { CLI::logging(CLI::error("Error: Failure at copy $file[$index] files...\n")); } } } //Set value of 2 to the directory structure version. $this->initPropel(true); G::LoadClass("configuration"); $conf = new Configurations(); if (!$conf->exists("ENVIRONMENT_SETTINGS")) { $conf->aConfig = array ("format" => '@userName (@firstName @lastName)', "dateFormat" => 'd/m/Y', "startCaseHideProcessInf" => false, "casesListDateFormat" => 'Y-m-d H:i:s', "casesListRowNumber" => 25, "casesListRefreshTime" => 120 ); $conf->saveConfig( 'ENVIRONMENT_SETTINGS', '' ); } $conf->setDirectoryStructureVer(2); CLI::logging(CLI::info("Version Directory Structure is 2 now.\n")); }
$index = sizeof($aCat) - 1; $aCat[$index]['TOTAL_PROCESSES'] = isset($aProcess[$aCat[$index]['CATEGORY_UID']]) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0; } $result['data'] = $aCat; $result['totalCount'] = $total_categories; echo G::json_encode($result); break; case 'updatePageSize': G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size']; $arr['dateSave'] = date('Y-m-d H:i:s'); $config = array(); $config[] = $arr; $c->aConfig = $config; $c->saveConfig('processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED']); echo '{success: true}'; break; case 'checkCategoryName': require_once 'classes/model/ProcessCategory.php'; $catName = $_REQUEST['cat_name']; $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME); $oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName); $oDataset = ProcessCategoryPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $row = $oDataset->getRow(); $response = isset($row['CATEGORY_NAME']) ? 'false' : 'true'; echo $response; break;
$configuration = new Configurations(); $importResults = $language->import($languageFile); G::LoadClass("wsTools"); $renegerateContent = new workspaceTools(SYS_SYS); $messs = $renegerateContent->upgradeContent(); $result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n"; $result->msg .= G::LoadTranslation("ID_FILE_NUM_RECORD") . $importResults->recordsCount . "\n"; $result->msg .= G::LoadTranslation("ID_SUCCESS_RECORD") . $importResults->recordsCountSuccess . "\n"; $result->msg .= G::LoadTranslation("ID_FAILED_RECORD") . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n"; if ($importResults->errMsg != '') { $result->msg .= G::LoadTranslation("ID_ERROR_REGISTERED") . " \n" . $importResults->errMsg . "\n"; } //$result->msg = htmlentities($result->msg); $result->success = true; //saving metadata $configuration->aConfig = array('headers' => $importResults->headers, 'language' => $importResults->lang, 'import-date' => date('Y-m-d H:i:s'), 'user' => '', 'version' => '1.0'); $configuration->saveConfig('LANGUAGE_META', $importResults->lang); $dir = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP; if (!is_writable($dir)) { throw new Exception(G::LoadTranslation('ID_TRANSLATIONS_FOLDER_PERMISSIONS')); } G::uploadFile($languageFile, $dir, $languageFilename, 0777); ini_set('max_execution_time', $sMaxExecutionTime); } catch (Exception $oError) { $result->msg = $oError->getMessage(); //print_r($oError->getTrace()); $result->success = false; //G::SendTemporalMessage($oError->getMessage(), 'error', 'string'); //G::header('location: languages_ImportForm'); } echo G::json_encode($result);
/** * Update properties of an Task * @var string $prj_uid. Uid for Process * @var string $act_uid. Uid for Activity * @var array $arrayProperty. Data for properties of Activity * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * return object */ public function updateProperties($prj_uid, $act_uid, $arrayProperty) { //Copy of processmaker/workflow/engine/methods/tasks/tasks_Ajax.php //case "saveTaskData": try { if (isset($arrayProperty['properties'])) { $arrayProperty = array_change_key_case($arrayProperty['properties'], CASE_UPPER); } $prj_uid = $this->validateProUid($prj_uid); $act_uid = $this->validateActUid($act_uid); $arrayProperty["TAS_UID"] = $act_uid; $arrayProperty["PRO_UID"] = $prj_uid; $task = new \Task(); $aTaskInfo = $task->load($arrayProperty["TAS_UID"]); $arrayResult = array(); if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") { if (!is_numeric($arrayProperty["TAS_SELFSERVICE_TIME"]) || $arrayProperty["TAS_SELFSERVICE_TIME"]=='') { throw (new \Exception("Invalid value specified for 'tas_selfservice_time'")); } } foreach ($arrayProperty as $k => $v) { $arrayProperty[$k] = str_replace("@amp@", "&", $v); } if (isset($arrayProperty["TAS_SEND_LAST_EMAIL"])) { $arrayProperty["TAS_SEND_LAST_EMAIL"] = ($arrayProperty["TAS_SEND_LAST_EMAIL"] == "TRUE")? "TRUE" : "FALSE"; } else { if (isset($arrayProperty["SEND_EMAIL"])) { $arrayProperty["TAS_SEND_LAST_EMAIL"] = ($arrayProperty["SEND_EMAIL"] == "TRUE")? "TRUE" : "FALSE"; } else { $arrayProperty["TAS_SEND_LAST_EMAIL"] = (is_null($aTaskInfo["TAS_SEND_LAST_EMAIL"]))? "FALSE" : $aTaskInfo["TAS_SEND_LAST_EMAIL"]; } } //Validating TAS_ASSIGN_VARIABLE value if (!isset($arrayProperty["TAS_ASSIGN_TYPE"])) { $derivateType = $task->kgetassigType($arrayProperty["PRO_UID"], $arrayProperty["TAS_UID"]); if (is_null($derivateType)) { $arrayProperty["TAS_ASSIGN_TYPE"] = "BALANCED"; } else { $arrayProperty["TAS_ASSIGN_TYPE"] = $derivateType["TAS_ASSIGN_TYPE"]; } } switch ($arrayProperty["TAS_ASSIGN_TYPE"]) { case 'BALANCED': case 'MANUAL': case 'REPORT_TO': $this->unsetVar($arrayProperty, "TAS_ASSIGN_VARIABLE"); $this->unsetVar($arrayProperty, "TAS_GROUP_VARIABLE"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIMEOUT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME_UNIT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TRIGGER_UID"); break; case 'EVALUATE': if (empty($arrayProperty["TAS_ASSIGN_VARIABLE"])) { throw (new \Exception("Invalid value specified for 'tas_assign_variable'")); } $this->unsetVar($arrayProperty, "TAS_GROUP_VARIABLE"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIMEOUT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME_UNIT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TRIGGER_UID"); break; case 'SELF_SERVICE': case 'SELF_SERVICE_EVALUATE': if ($arrayProperty["TAS_ASSIGN_TYPE"] == "SELF_SERVICE_EVALUATE") { if (empty($arrayProperty["TAS_GROUP_VARIABLE"])) { throw (new \Exception("Invalid value specified for 'tas_group_variable'")); } } else { $arrayProperty["TAS_GROUP_VARIABLE"] = ''; } $arrayProperty["TAS_ASSIGN_TYPE"] = "SELF_SERVICE"; if (!($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == 0 || $arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == 1)) { throw (new \Exception("Invalid value specified for 'tas_selfservice_timeout'")); } if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") { if (empty($arrayProperty["TAS_SELFSERVICE_TIME"])) { throw (new \Exception("Invalid value specified for 'tas_assign_variable'")); } if (empty($arrayProperty["TAS_SELFSERVICE_TIME_UNIT"])) { throw (new \Exception("Invalid value specified for 'tas_selfservice_time_unit'")); } if (empty($arrayProperty["TAS_SELFSERVICE_TRIGGER_UID"])) { throw (new \Exception("Invalid value specified for 'tas_selfservice_trigger_uid'")); } } else { $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME_UNIT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TRIGGER_UID"); } break; } //Validating TAS_TRANSFER_FLY value if ($arrayProperty["TAS_TRANSFER_FLY"] == "FALSE") { if (!isset($arrayProperty["TAS_DURATION"])) { throw (new \Exception("Invalid value specified for 'tas_duration'")); } $valuesTimeUnit = array('DAYS','HOURS'); if ((!isset($arrayProperty["TAS_TIMEUNIT"])) || (!in_array($arrayProperty["TAS_TIMEUNIT"], $valuesTimeUnit))) { throw (new \Exception("Invalid value specified for 'tas_timeunit'")); } $valuesTypeDay = array('1','2',''); if ((!isset($arrayProperty["TAS_TYPE_DAY"])) || (!in_array($arrayProperty["TAS_TYPE_DAY"], $valuesTypeDay))) { throw (new \Exception("Invalid value specified for 'tas_type_day'")); } if (!isset($arrayProperty["TAS_CALENDAR"])) { throw (new \Exception("Invalid value specified for 'tas_calendar'")); } } else { $this->unsetVar($arrayProperty, "TAS_DURATION"); $this->unsetVar($arrayProperty, "TAS_TIMEUNIT"); $this->unsetVar($arrayProperty, "TAS_TYPE_DAY"); $this->unsetVar($arrayProperty, "TAS_CALENDAR"); } if ($arrayProperty["TAS_SEND_LAST_EMAIL"] == "TRUE") { if (empty($arrayProperty["TAS_DEF_SUBJECT_MESSAGE"])) { throw (new \Exception("Invalid value specified for 'tas_def_subject_message'")); } $valuesDefMessageType = array('template','text'); if ((!isset($arrayProperty["TAS_DEF_MESSAGE_TYPE"])) || (!in_array($arrayProperty["TAS_DEF_MESSAGE_TYPE"], $valuesDefMessageType))) { throw (new \Exception("Invalid value specified for 'tas_def_message_type'")); } if ($arrayProperty["TAS_DEF_MESSAGE_TYPE"] == 'template') { if (empty($arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"])) { throw (new \Exception("Invalid value specified for 'tas_def_message_template'")); } $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE"); } else { if (empty($arrayProperty["TAS_DEF_MESSAGE"])) { throw (new \Exception("Invalid value specified for 'tas_def_message'")); } $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE_TEMPLATE"); } //Additional configuration if (isset($arrayProperty["TAS_DEF_MESSAGE_TYPE"])) { \G::LoadClass("configuration"); $oConf = new \Configurations(); if (!isset($arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"])) { $arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"] = "alert_message.html"; } $oConf->aConfig = array("TAS_DEF_MESSAGE_TYPE" => $arrayProperty["TAS_DEF_MESSAGE_TYPE"], "TAS_DEF_MESSAGE_TEMPLATE" => $arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"]); $oConf->saveConfig("TAS_EXTRA_PROPERTIES", $arrayProperty["TAS_UID"], "", ""); } } else { $this->unsetVar($arrayProperty, "TAS_DEF_SUBJECT_MESSAGE"); $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE_TYPE"); $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE"); $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE_TEMPLATE"); } $result = $task->update($arrayProperty); if (!empty($arrayProperty['CONSOLIDATE_DATA'])) { if (!empty($arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'])) { G::LoadClass("consolidatedCases"); $consolidated = new \ConsolidatedCases(); $dataConso = array( 'con_status' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_enable'], 'tas_uid' => $arrayProperty['TAS_UID'], 'dyn_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'], 'pro_uid' => $arrayProperty['PRO_UID'], 'rep_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_report_table'], 'table_name' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_table'], 'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title'] ); $consolidated->saveConsolidated($dataConso); } } $arrayResult["status"] = "OK"; if ($result == 3) { $arrayResult["status"] = "CRONCL"; } return $arrayResult; } catch (Exception $e) { throw $e; } }
print(G::json_encode($result)); die; } */ /* Saving preferences */ $def_lang = $form['PREF_DEFAULT_LANG']; $def_menu = $form['PREF_DEFAULT_MENUSELECTED']; $def_cases_menu = isset($form['PREF_DEFAULT_CASES_MENUSELECTED']) ? $form['PREF_DEFAULT_CASES_MENUSELECTED'] : ''; G::loadClass('configuration'); $oConf = new Configurations(); $aConf = array('DEFAULT_LANG' => $def_lang, 'DEFAULT_MENU' => $def_menu, 'DEFAULT_CASES_MENU' => $def_cases_menu); /* UPDATING SESSION VARIABLES */ $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']); //$_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; $oConf->aConfig = $aConf; $oConf->saveConfig('USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED']); } if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) { /* UPDATING SESSION VARIABLES */ $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']); $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; } //Save Calendar assigment if (isset($form['USR_CALENDAR'])) { //Save Calendar ID for this user G::LoadClass("calendar"); $calendarObj = new Calendar(); $calendarObj->assignCalendarTo($aData['USR_UID'], $form['USR_CALENDAR'], 'USER'); } $result->success = true; print G::json_encode($result);
public function saveOrderDashlet($data) { $this->setResponseType('json'); try { $orderDashlet[0] = Bootstrap::json_decode($data->positionCol0); $orderDashlet[1] = Bootstrap::json_decode($data->positionCol1); $orderDashlet[2] = Bootstrap::json_decode($data->positionCol2); G::loadClass('configuration'); $oConfiguration = new Configurations(); $aConfiguration = $oConfiguration->load('Dashboard', '', '', $_SESSION['USER_LOGGED']); $dataDashboard = array(); if (isset($aConfiguration["CFG_VALUE"])) { $dataDashboard = $aConfiguration["CFG_VALUE"]; } $dataNow['ORDER'] = $orderDashlet; if (isset($data->columns)) { $dataNow['COLUMNS'] = Bootstrap::json_decode($data->columns); } $dataDashboard = array_merge($dataDashboard, $dataNow); $oConfiguration->aConfig = $dataDashboard; $oConfiguration->saveConfig('Dashboard', '', '', $_SESSION['USER_LOGGED']); $result->success = '1'; return $result; } catch (Exception $error) { //ToDo: Display a error message } }
* License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ //if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response; G::LoadInclude('ajax'); $_POST['action'] = get_ajax_value('action'); switch ($_POST['action']) { case 'updatePageSize': G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size']; $arr['dateSave'] = date('Y-m-d H:i:s'); $config = array(); $config[] = $arr; $c->aConfig = $config; $c->saveConfig('casesSchedulerLogList', 'pageSize', '', $_SESSION['USER_LOGGED']); echo '{success: true}'; break; break; }
<?php $request = isset($_REQUEST['request']) ? $_REQUEST['request'] : null; switch ($request) { case 'getLangList': $Translations = G::getModel('Translation'); $result = new stdClass(); $result->rows = array(); $langs = $Translations->getTranslationEnvironments(); foreach ($langs as $lang) { $result->rows[] = array('LAN_ID' => $lang['LOCALE'], 'LAN_NAME' => $lang['LANGUAGE']); } print G::json_encode($result); break; case 'saveSettings': $memcache =& PMmemcached::getSingleton(defined('SYS_SYS') ? SYS_SYS : ''); G::LoadClass('configuration'); $conf = new Configurations(); $conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', ''); $conf->aConfig['login_enableForgotPassword'] = isset($_REQUEST['forgotPasswd']); $conf->aConfig['login_enableVirtualKeyboard'] = isset($_REQUEST['virtualKeyboad']); $conf->aConfig['login_defaultLanguage'] = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en'; $conf->saveConfig('ENVIRONMENT_SETTINGS', ''); //remove from memcache when this value is updated/created $memcache->delete('flagForgotPassword'); $response->success = true; echo G::json_encode($response); break; }
$field['new' . $key] = urldecode($value); } //join $ntable->ses->execute($ntable->replaceDataField($ntable->sqlUpdate, $field)); break; case "insert": $ntable->prepareQuery(); parse_str(get_ajax_value('field'), $field); foreach ($field as $key => $value) { $field[$key] = urldecode($value); } $ntable->ses->execute($ntable->replaceDataField($ntable->sqlInsert, $field)); break; case "printForm": parse_str(get_ajax_value('field'), $field); parse_str(get_ajax_value('field'), $field); foreach ($field as $key => $value) { $field[$key] = urldecode($value); } $ntable->printForm(get_ajax_value('filename'), $field); return; } $ntable->renderTable("content"); G::LoadClass("configuration"); $conf = new Configurations(); $conf->setConfig($ntable->__Configuration, $ntable, $conf->aConfig); if (isset($_SESSION["USER_LOGGED"])) { $conf->saveConfig("pagedTable", $ntable->__OBJ_UID, "", $_SESSION["USER_LOGGED"], ""); } else { $conf->saveConfig("pagedTable", $ntable->__OBJ_UID); }
* @autor erik <*****@*****.**> */ foreach ($aData as $k => $v) { $aData[$k] = str_replace('@amp@', '&', $v); } if (isset($aData['SEND_EMAIL'])) { $aData['TAS_SEND_LAST_EMAIL'] = $aData['SEND_EMAIL'] == 'TRUE' ? 'TRUE' : 'FALSE'; } else { $aData['TAS_SEND_LAST_EMAIL'] = 'FALSE'; } //Additional configuration if (isset($aData['TAS_DEF_MESSAGE_TYPE']) && isset($aData['TAS_DEF_MESSAGE_TEMPLATE'])) { G::LoadClass('configuration'); $oConf = new Configurations(); $oConf->aConfig = array('TAS_DEF_MESSAGE_TYPE' => $aData['TAS_DEF_MESSAGE_TYPE'], 'TAS_DEF_MESSAGE_TEMPLATE' => $aData['TAS_DEF_MESSAGE_TEMPLATE']); $oConf->saveConfig('TAS_EXTRA_PROPERTIES', $aData['TAS_UID'], '', ''); unset($aData['TAS_DEF_MESSAGE_TYPE']); unset($aData['TAS_DEF_MESSAGE_TEMPLATE']); } //Validating TAS_ASSIGN_VARIABLE value if ($aData['TAS_ASSIGN_TYPE'] == 'SELF_SERVICE_EVALUATE') { $aData['TAS_ASSIGN_TYPE'] = 'SELF_SERVICE'; } else { $aData['TAS_GROUP_VARIABLE'] = ''; } $result = $oTask->update($aData); $response["status"] = "OK"; if ($result == 3) { $response["status"] = "CRONCL"; } echo G::json_encode($response);
public function setHashPassword($object) { $type = array('md5', 'sha256'); if (!in_array($object->hash, $type)) { throw new Exception('Type: ' . $object->hash . ' No valid.'); return false; } G::LoadClass("configuration"); $config = new Configurations(); $typeEncrypt = $config->getConfiguration('ENTERPRISE_SETTING_ENCRYPT', ''); if ($typeEncrypt == null) { $typeEncrypt = array('current' => $object->hash, 'previous' => 'md5'); } else { $typeEncrypt['previous'] = $typeEncrypt['current']; $typeEncrypt['current'] = $object->hash; } if ($object->hash != $typeEncrypt['previous']) { $config->aConfig = $typeEncrypt; $config->saveConfig('ENTERPRISE_SETTING_ENCRYPT', ''); } require_once 'classes/model/RbacUsersPeer.php'; require_once 'classes/model/UsersProperties.php'; $userProperty = new UsersProperties(); $criteria = new Criteria($object->workspace->dbInfo['DB_RBAC_NAME']); $criteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL); $dataset = RbacUsersPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($dataset->next()) { $row = $dataset->getRow(); $property = $userProperty->loadOrCreateIfNotExists($row['USR_UID'], array()); $property['USR_LOGGED_NEXT_TIME'] = 1; $userProperty->update($property); } }
} parse_str(get_ajax_value('update'), $fieldup); foreach ($fieldup as $key => $value) { $field['new' . $key] = urldecode($value); } //join $ntable->ses->execute($ntable->replaceDataField($ntable->sqlUpdate, $field)); break; case "insert": $ntable->prepareQuery(); parse_str(get_ajax_value('field'), $field); foreach ($field as $key => $value) { $field[$key] = urldecode($value); } $ntable->ses->execute($ntable->replaceDataField($ntable->sqlInsert, $field)); break; case "printForm": parse_str(get_ajax_value('field'), $field); parse_str(get_ajax_value('field'), $field); foreach ($field as $key => $value) { $field[$key] = urldecode($value); } $ntable->printForm(get_ajax_value('filename'), $field); return; } $ntable->renderTable('content'); G::LoadClass('configuration'); $conf = new Configurations(); $conf->setConfig($ntable->__Configuration, $ntable, $conf->aConfig); $conf->saveConfig('pagedTable', $ntable->__OBJ_UID, '', $_SESSION['USER_LOGGED'], '');
$index = sizeof($aCals) - 1; $aCals[$index]['TOTAL_USERS'] = isset($aUsers[$aCals[$index]['CALENDAR_UID']]) ? $aUsers[$aCals[$index]['CALENDAR_UID']] : 0; $aCals[$index]['TOTAL_TASKS'] = isset($aTasks[$aCals[$index]['CALENDAR_UID']]) ? $aTasks[$aCals[$index]['CALENDAR_UID']] : 0; $aCals[$index]['TOTAL_PROCESS'] = isset($aProcess[$aCals[$index]['CALENDAR_UID']]) ? $aProcess[$aCals[$index]['CALENDAR_UID']] : 0; } echo '{cals: ' . G::json_encode($aCals) . ', total_cals: ' . $total_cals . '}'; break; case 'updatePageSize': G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size']; $arr['dateSave'] = date('Y-m-d H:i:s'); $config = array(); $config[] = $arr; $c->aConfig = $config; $c->saveConfig('calendarList', 'pageSize', '', $_SESSION['USER_LOGGED']); echo '{success: true}'; break; case 'canDeleteCalendar': $cal_uid = $_POST['CAL_UID']; G::LoadClass('calendar'); $cal = new calendar(); $total = 0; $u = $cal->getAllCounterByCalendar('USER'); $t_u = isset($u[$cal_uid]) ? $u[$cal_uid] : 0; $t = $cal->getAllCounterByCalendar('TASK'); $t_t = isset($t[$cal_uid]) ? $t[$cal_uid] : 0; $p = $cal->getAllCounterByCalendar('PROCESS'); $t_p = isset($p[$cal_uid]) ? $p[$cal_uid] : 0; $total = $t_u + $t_t + $t_p; $response = $total == 0 ? 'true' : 'false';
/** * Upgrade the AppCacheView table to the latest system version. * * This recreates the table and populates with data. * * @param bool $checkOnly only check if the upgrade is needed if true * @param string $lang not currently used */ public function upgradeCacheView($fill = true) { $this->initPropel(true); $lang = "en"; require_once 'classes/model/AppCacheView.php'; //check the language, if no info in config about language, the default is 'en' G::loadClass('configuration'); $oConf = new Configurations(); $oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', ''); $appCacheViewEngine = $oConf->aConfig; //setup the appcacheview object, and the path for the sql files $appCache = new AppCacheView(); $appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP); $userGrants = $appCache->checkGrantsForUser(false); $currentUser = $userGrants['user']; $currentUserIsSuper = $userGrants['super']; //if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user. if (!$currentUserIsSuper) { $appCache->checkGrantsForUser(true); $appCache->setSuperForUser($currentUser); $currentUserIsSuper = true; } CLI::logging("-> Creating table\n"); //now check if table APPCACHEVIEW exists, and it have correct number of fields, etc. $res = $appCache->checkAppCacheView(); CLI::logging("-> Creating triggers\n"); //now check if we have the triggers installed $triggers = array(); $triggers[] = $appCache->triggerAppDelegationInsert($lang, $checkOnly); $triggers[] = $appCache->triggerAppDelegationUpdate($lang, $checkOnly); $triggers[] = $appCache->triggerApplicationUpdate($lang, $checkOnly); $triggers[] = $appCache->triggerApplicationDelete($lang, $checkOnly); $triggers[] = $appCache->triggerContentUpdate($lang, $checkOnly); if ($fill) { CLI::logging("-> Rebuild Cache View\n"); //build using the method in AppCacheView Class $res = $appCache->fillAppCacheView($lang); //set status in config table $confParams = array('LANG' => $lang, 'STATUS' => 'active'); } $oConf->aConfig = $confParams; $oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', ''); // removing casesList configuration records. TODO: removing these lines that resets all the configurations records $oCriteria = new Criteria(); $oCriteria->add(ConfigurationPeer::CFG_UID, "casesList"); $oCriteria->add(ConfigurationPeer::OBJ_UID, array("todo", "draft", "sent", "unassigned", "paused", "cancelled"), Criteria::NOT_IN); ConfigurationPeer::doDelete($oCriteria); // end of reset }
$snameLogo = str_replace("[Ñ]", "N", $snameLogo); return $snameLogo; } $sfunction = $_GET['function']; switch ($sfunction) { case 'replacementLogo': $snameLogo = urldecode($_GET['NAMELOGO']); $snameLogo = trim($snameLogo); $snameLogo = changeNamelogo($snameLogo); G::loadClass('configuration'); $oConf = new Configurations(); $aConf = array('WORKSPACE_LOGO_NAME' => SYS_SYS, 'DEFAULT_LOGO_NAME' => $snameLogo); $oConf->aConfig = $aConf; $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', ''); G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); //header('location: uplogo.php'); //G::header('location: uplogo'); break; case 'restoreLogo': $snameLogo = $_GET['NAMELOGO']; G::loadClass('configuration'); $oConf = new Configurations(); $aConf = array('WORKSPACE_LOGO_NAME' => '', 'DEFAULT_LOGO_NAME' => ''); $oConf->aConfig = $aConf; $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', ''); G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); break; } } catch (Exception $oException) { die($oException->getMessage()); }
/** * Replacement Logo * @global type $_REQUEST * @global type $RBAC */ public function replacementLogo() { global $_REQUEST; $sfunction = $_REQUEST['nameFunction']; $_GET['NAMELOGO'] = $_REQUEST['NAMELOGO']; try { global $RBAC; switch ($RBAC->userCanAccess('PM_LOGIN')) { case -2: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header('location: ../login/login'); die; break; case -1: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; break; } switch ($sfunction) { case 'replacementLogo': $snameLogo = urldecode($_GET['NAMELOGO']); $snameLogo = trim($snameLogo); $snameLogo = self::changeNamelogo($snameLogo); G::loadClass('configuration'); $oConf = new Configurations(); $aConf = array('WORKSPACE_LOGO_NAME' => SYS_SYS, 'DEFAULT_LOGO_NAME' => $snameLogo); $oConf->aConfig = $aConf; $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', ''); G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); break; case 'restoreLogo': $snameLogo = $_GET['NAMELOGO']; G::loadClass('configuration'); $oConf = new Configurations(); $aConf = array('WORKSPACE_LOGO_NAME' => '', 'DEFAULT_LOGO_NAME' => ''); $oConf->aConfig = $aConf; $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', ''); G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); break; } } catch (Exception $oException) { die($oException->getMessage()); } exit; }
//APPLICATION UPDATE $res = $appCache->triggerApplicationUpdate($lang, true); //$result->info[] = array ('name' => 'Trigger APPLICATION UPDATE', 'value'=> $res); //APPLICATION DELETE $res = $appCache->triggerApplicationDelete($lang, true); //$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res); //CONTENT UPDATE $res = $appCache->triggerContentUpdate($lang, true); //$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res); //build using the method in AppCacheView Class $res = $appCache->fillAppCacheView($lang); //$result->info[] = array ('name' => 'build APP_CACHE_VIEW', 'value'=> $res); //set status in config table $confParams = array('LANG' => $lang, 'STATUS' => 'active'); $conf->aConfig = $confParams; $conf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', ''); $response = new StdClass(); $result->success = true; $result->msg = "Completed successfully"; echo G::json_encode($result); } catch (Exception $e) { $confParams = array('lang' => $lang, 'status' => 'failed'); $appCacheViewEngine = $oServerConf->setProperty('APP_CACHE_VIEW_ENGINE', $confParams); echo '{success: false, msg:"' . $e->getMessage() . '"}'; } break; case 'recreate-root': $sh = md5(filemtime(PATH_GULLIVER . "/class.g.php")); $h = G::encrypt($_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . 1, $sh); $insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n"; $lines = array();
$oData = RolesPeer::doSelectRS($Criterias['COUNTER']); $oData->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oData->next(); $row = $oData->getRow(); $total_roles = $row['CNT']; echo '{roles: ' . G::json_encode($aRows) . ', total_roles: ' . $total_roles . '}'; break; case 'updatePageSize': G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size']; $arr['dateSave'] = date('Y-m-d H:i:s'); $config = array(); $config[] = $arr; $c->aConfig = $config; $c->saveConfig('rolesList', 'pageSize', '', $_SESSION['USER_LOGGED']); echo '{success: true}'; break; case 'checkRoleCode': $rol_code = $_POST['ROL_CODE']; $rol_uid = isset($_POST['ROL_UID']) ? $_POST['ROL_UID'] : ''; $oCriteria = new Criteria('rbac'); $oCriteria->addSelectColumn(RolesPeer::ROL_UID); $oCriteria->add(RolesPeer::ROL_CODE, $rol_code); if ($rol_uid != '') { $oCriteria->add(RolesPeer::ROL_UID, $rol_uid, Criteria::NOT_EQUAL); } $oDataset = RolesPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); if ($oDataset->next()) { $response = 'false';
/** * Update properties of an Task * @var string $prj_uid. Uid for Process * @var string $act_uid. Uid for Activity * @var array $arrayProperty. Data for properties of Activity * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * return object */ public function updateProperties($prj_uid, $act_uid, $arrayProperty) { //Copy of processmaker/workflow/engine/methods/tasks/tasks_Ajax.php //case "saveTaskData": try { if (isset($arrayProperty['properties'])) { $arrayProperty = array_change_key_case($arrayProperty['properties'], CASE_UPPER); } $prj_uid = $this->validateProUid($prj_uid); $act_uid = $this->validateActUid($act_uid); $arrayProperty["TAS_UID"] = $act_uid; $arrayProperty["PRO_UID"] = $prj_uid; $task = new \Task(); $aTaskInfo = $task->load($arrayProperty["TAS_UID"]); $bpmnActivity = \BpmnActivityPeer::retrieveByPK($act_uid); $arrayResult = array(); if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") { if (!is_numeric($arrayProperty["TAS_SELFSERVICE_TIME"]) || $arrayProperty["TAS_SELFSERVICE_TIME"] == '') { throw new \Exception("Invalid value specified for 'tas_selfservice_time'"); } } foreach ($arrayProperty as $k => $v) { $arrayProperty[$k] = str_replace("@amp@", "&", $v); } if (isset($arrayProperty["TAS_SEND_LAST_EMAIL"])) { $arrayProperty["TAS_SEND_LAST_EMAIL"] = $arrayProperty["TAS_SEND_LAST_EMAIL"] == "TRUE" ? "TRUE" : "FALSE"; } else { if (isset($arrayProperty["SEND_EMAIL"])) { $arrayProperty["TAS_SEND_LAST_EMAIL"] = $arrayProperty["SEND_EMAIL"] == "TRUE" ? "TRUE" : "FALSE"; } else { $arrayProperty["TAS_SEND_LAST_EMAIL"] = is_null($aTaskInfo["TAS_SEND_LAST_EMAIL"]) ? "FALSE" : $aTaskInfo["TAS_SEND_LAST_EMAIL"]; } } //Validating TAS_ASSIGN_VARIABLE value if (!isset($arrayProperty["TAS_ASSIGN_TYPE"])) { $derivateType = $task->kgetassigType($arrayProperty["PRO_UID"], $arrayProperty["TAS_UID"]); if (is_null($derivateType)) { $arrayProperty["TAS_ASSIGN_TYPE"] = "BALANCED"; } else { $arrayProperty["TAS_ASSIGN_TYPE"] = $derivateType["TAS_ASSIGN_TYPE"]; } } $flagTaskIsMultipleInstance = $bpmnActivity->getActType() == "TASK" && preg_match("/^(?:EMPTY|USERTASK|MANUALTASK)\$/", $bpmnActivity->getActTaskType()) && $bpmnActivity->getActLoopType() == "PARALLEL"; $flagTaskAssignTypeIsMultipleInstance = preg_match("/^(?:MULTIPLE_INSTANCE|MULTIPLE_INSTANCE_VALUE_BASED)\$/", $arrayProperty["TAS_ASSIGN_TYPE"]); if ($flagTaskIsMultipleInstance && !$flagTaskAssignTypeIsMultipleInstance) { $arrayProperty["TAS_ASSIGN_TYPE"] = "MULTIPLE_INSTANCE"; $flagTaskAssignTypeIsMultipleInstance = true; } if ($flagTaskIsMultipleInstance && !$flagTaskAssignTypeIsMultipleInstance) { throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_INVALID_ASSIGNMENT_METHOD_FOR_MULTIPLE_INSTANCE_ACTIVITY", array(strtolower("ACT_UID"), $act_uid))); } if (!$flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance) { $arrayProperty["TAS_ASSIGN_TYPE"] = "BALANCED"; $flagTaskAssignTypeIsMultipleInstance = false; } if (!$flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance) { throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_INVALID_ASSIGNMENT_METHOD_FOR_ACTIVITY", array(strtolower("ACT_UID"), $act_uid))); } switch ($arrayProperty["TAS_ASSIGN_TYPE"]) { case 'BALANCED': case 'MANUAL': case 'REPORT_TO': $this->unsetVar($arrayProperty, "TAS_ASSIGN_VARIABLE"); $this->unsetVar($arrayProperty, "TAS_GROUP_VARIABLE"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIMEOUT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME_UNIT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TRIGGER_UID"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_EXECUTION"); break; case 'EVALUATE': if (empty($arrayProperty["TAS_ASSIGN_VARIABLE"])) { throw new \Exception("Invalid value specified for 'tas_assign_variable'"); } $this->unsetVar($arrayProperty, "TAS_GROUP_VARIABLE"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIMEOUT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME_UNIT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TRIGGER_UID"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_EXECUTION"); break; case 'SELF_SERVICE': case 'SELF_SERVICE_EVALUATE': if ($arrayProperty["TAS_ASSIGN_TYPE"] == "SELF_SERVICE_EVALUATE") { if (empty($arrayProperty["TAS_GROUP_VARIABLE"])) { throw new \Exception("Invalid value specified for 'tas_group_variable'"); } } else { $arrayProperty["TAS_GROUP_VARIABLE"] = ''; } $arrayProperty["TAS_ASSIGN_TYPE"] = "SELF_SERVICE"; if (!($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == 0 || $arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == 1)) { throw new \Exception("Invalid value specified for 'tas_selfservice_timeout'"); } if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") { if (empty($arrayProperty["TAS_SELFSERVICE_TIME"])) { throw new \Exception("Invalid value specified for 'tas_assign_variable'"); } if (empty($arrayProperty["TAS_SELFSERVICE_TIME_UNIT"])) { throw new \Exception("Invalid value specified for 'tas_selfservice_time_unit'"); } if (empty($arrayProperty["TAS_SELFSERVICE_TRIGGER_UID"])) { throw new \Exception("Invalid value specified for 'tas_selfservice_trigger_uid'"); } if (empty($arrayProperty["TAS_SELFSERVICE_EXECUTION"])) { throw new \Exception("Invalid value specified for 'tas_selfservice_execution'"); } } else { $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TIME_UNIT"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_TRIGGER_UID"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_EXECUTION"); } break; case "MULTIPLE_INSTANCE_VALUE_BASED": if (trim($arrayProperty["TAS_ASSIGN_VARIABLE"]) == "") { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array(strtolower("TAS_ASSIGN_VARIABLE")))); } break; } //Validating TAS_TRANSFER_FLY value if ($arrayProperty["TAS_TRANSFER_FLY"] == "FALSE") { if (!isset($arrayProperty["TAS_DURATION"])) { throw new \Exception("Invalid value specified for 'tas_duration'"); } $valuesTimeUnit = array('DAYS', 'HOURS', 'MINUTES'); if (!isset($arrayProperty["TAS_TIMEUNIT"]) || !in_array($arrayProperty["TAS_TIMEUNIT"], $valuesTimeUnit)) { throw new \Exception("Invalid value specified for 'tas_timeunit'"); } $valuesTypeDay = array('1', '2', ''); if (!isset($arrayProperty["TAS_TYPE_DAY"]) || !in_array($arrayProperty["TAS_TYPE_DAY"], $valuesTypeDay)) { throw new \Exception("Invalid value specified for 'tas_type_day'"); } if (!isset($arrayProperty["TAS_CALENDAR"])) { throw new \Exception("Invalid value specified for 'tas_calendar'"); } } else { $this->unsetVar($arrayProperty, "TAS_DURATION"); $this->unsetVar($arrayProperty, "TAS_TIMEUNIT"); $this->unsetVar($arrayProperty, "TAS_TYPE_DAY"); $this->unsetVar($arrayProperty, "TAS_CALENDAR"); } if ($arrayProperty["TAS_SEND_LAST_EMAIL"] == "TRUE") { if (empty($arrayProperty["TAS_DEF_SUBJECT_MESSAGE"])) { throw new \Exception("Invalid value specified for 'tas_def_subject_message'"); } $valuesDefMessageType = array('template', 'text'); if (!isset($arrayProperty["TAS_DEF_MESSAGE_TYPE"]) || !in_array($arrayProperty["TAS_DEF_MESSAGE_TYPE"], $valuesDefMessageType)) { throw new \Exception("Invalid value specified for 'tas_def_message_type'"); } if ($arrayProperty["TAS_DEF_MESSAGE_TYPE"] == 'template') { if (empty($arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"])) { throw new \Exception("Invalid value specified for 'tas_def_message_template'"); } $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE"); } else { if (empty($arrayProperty["TAS_DEF_MESSAGE"])) { throw new \Exception("Invalid value specified for 'tas_def_message'"); } $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE_TEMPLATE"); } //Additional configuration if (isset($arrayProperty["TAS_DEF_MESSAGE_TYPE"])) { \G::LoadClass("configuration"); $oConf = new \Configurations(); if (!isset($arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"])) { $arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"] = "alert_message.html"; } $oConf->aConfig = array("TAS_DEF_MESSAGE_TYPE" => $arrayProperty["TAS_DEF_MESSAGE_TYPE"], "TAS_DEF_MESSAGE_TEMPLATE" => $arrayProperty["TAS_DEF_MESSAGE_TEMPLATE"]); $oConf->saveConfig("TAS_EXTRA_PROPERTIES", $arrayProperty["TAS_UID"], "", ""); } } else { $this->unsetVar($arrayProperty, "TAS_DEF_SUBJECT_MESSAGE"); $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE_TYPE"); $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE"); $this->unsetVar($arrayProperty, "TAS_DEF_MESSAGE_TEMPLATE"); } $result = $task->update($arrayProperty); if (!empty($arrayProperty['CONSOLIDATE_DATA'])) { if (!empty($arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'])) { G::LoadClass("consolidatedCases"); $consolidated = new \ConsolidatedCases(); $dataConso = array('con_status' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_enable'], 'tas_uid' => $arrayProperty['TAS_UID'], 'dyn_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'], 'pro_uid' => $arrayProperty['PRO_UID'], 'rep_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_report_table'], 'table_name' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_table'], 'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title']); $consolidated->saveConsolidated($dataConso); } } $arrayResult["status"] = "OK"; if ($result == 3) { $arrayResult["status"] = "CRONCL"; } return $arrayResult; } catch (Exception $e) { throw $e; } }
public static function execute() { //Check if this is the version to apply the patch $count = 0; $task = new Task(); if (patch::$isPathchable && method_exists($task, 'getTasGroupVariable')) { $con = Propel::getConnection("workflow"); $stmt = $con->prepareStatement("select TAS_UID from TASK where TAS_ASSIGN_TYPE = 'SELF_SERVICE';"); $recordSet = $stmt->executeQuery(); $recordSet->next(); $aRow = $recordSet->getRow(); while ($aRow) { $tasUid = $aRow['TAS_UID']; $conUser = Propel::getConnection("workflow"); $stmtUser = $conUser->prepareStatement("select * from TASK_USER where TAS_UID = '" . $tasUid . "';"); $recordSetTaskUser = $stmtUser->executeQuery(); if ($recordSetTaskUser->next()) { echo "Patching uid: " . $tasUid . "\n"; //Set the values if they match the pattern $conChange = Propel::getConnection("workflow"); $stmtChange = $conChange->prepareStatement("update TASK set TAS_GROUP_VARIABLE = '' where TAS_UID = '" . $tasUid . "';"); $recordResult = $stmtChange->executeQuery(); $count++; } $recordSet->next(); $aRow = $recordSet->getRow(); } } //Fix BUG-15394 G::LoadClass("configuration"); $conf = new Configurations(); if (!$conf->exists("HOTFIX")) { //HOTFIX, Create empty record $conf->aConfig = array(); $conf->saveConfig("HOTFIX", ""); } $arrayHotfix = $conf->getConfiguration("HOTFIX", ""); $arrayHotfix = is_array($arrayHotfix) ? $arrayHotfix : array($arrayHotfix); $pmVersion = self::pmVersion(System::getVersion()) . ""; if (($pmVersion == "2.5.2.4" || $pmVersion == "2.8") && !in_array("15394", $arrayHotfix)) { $cnn = Propel::getConnection("workflow"); $stmt = $cnn->prepareStatement("UPDATE USERS_PROPERTIES SET USR_LOGGED_NEXT_TIME = 0"); $rs = $stmt->executeQuery(); //HOTFIX, Update record (add 15394) $arrayHotfix[] = "15394"; $conf->aConfig = $arrayHotfix; $conf->saveConfig("HOTFIX", ""); } //echo echo $count . " records where patched to use SELF_SERVICE feature.\n"; }