function postInstall() { global $config_vars; Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9); $sslf = new SystemSettingListFactory(); // // Tax Data Version // $sslf->getByName('tax_data_version'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $tax_data_version = '20091101'; $obj->setName('tax_data_version'); $obj->setValue($tax_data_version); if ($obj->isValid()) { Debug::text('Setting Tax Data Version to: ' . $tax_data_version, __FILE__, __LINE__, __METHOD__, 9); $obj->Save(); } // // Tax Engine Version // $sslf->getByName('tax_engine_version'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $tax_engine_version = '1.0.12'; $obj->setName('tax_engine_version'); $obj->setValue($tax_engine_version); if ($obj->isValid()) { Debug::text('Setting Tax Engine Version to: ' . $tax_engine_version, __FILE__, __LINE__, __METHOD__, 9); $obj->Save(); } return TRUE; }
} if (isset($_GET['language']) and $_GET['language'] != '') { TTi18n::setLocale($_GET['language']); //Sets master locale } else { TTi18n::setLanguage($current_user_prefs->getLanguage()); TTi18n::setCountry($current_user->getCountry()); TTi18n::setLocale(); //Sets master locale } $profiler->stopTimer("setLocale()"); if ($current_user->isInformationComplete() == TRUE and $current_user_prefs->isPreferencesComplete() == FALSE and (!stristr($_SERVER['SCRIPT_NAME'], 'permissiondenied') and !stristr($_SERVER['SCRIPT_NAME'], 'logout') and !stristr($_SERVER['SCRIPT_NAME'], 'about') and !stristr($_SERVER['SCRIPT_NAME'], 'punch.php') and !stristr($_SERVER['SCRIPT_NAME'], 'ajax_server') and !stristr($_SERVER['SCRIPT_NAME'], 'global.js') and !stristr($_SERVER['SCRIPT_NAME'], 'menu.js')) and !isset($_GET['incomplete']) and !isset($_POST['incomplete']) and ($permission->Check('user_preference', 'enabled') and ($permission->Check('user_preference', 'edit') or $permission->Check('user_preference', 'edit_child') or $permission->Check('user_preference', 'edit_own')))) { Redirect::Page(URLBuilder::getURL(array('incomplete' => 1), Environment::GetBaseURL() . 'users/EditUserPreference.php')); } //Get all system settings, so they can be used even if the user isn't logged in, such as the login page. $sslf = new SystemSettingListFactory(); $system_settings = $sslf->getAllArray(); unset($sslf); //Handle station functionality if (isset($_COOKIE['StationID'])) { Debug::text('Station ID Cookie found! ' . $_COOKIE['StationID'], __FILE__, __LINE__, __METHOD__, 10); $slf = new StationListFactory(); $slf->getByStationIdandCompanyId($_COOKIE['StationID'], $current_company->getId()); $current_station = $slf->getCurrent(); unset($slf); if ($current_station->isNew()) { Debug::text('Station ID is NOT IN DB!! ' . $_COOKIE['StationID'], __FILE__, __LINE__, __METHOD__, 10); } } //Debug::Arr($current_station, 'Current Station Object: ', __FILE__, __LINE__, __METHOD__, 10); //Debug::text('Current Company: '. $current_company->getName(), __FILE__, __LINE__, __METHOD__, 10);
/** * Returns array of notifications message to be displayed to the user. * @param string $action Action that is being performed, possible values: 'login', 'preference', 'notification', 'pay_period' * @return array */ function getNotifications($action = FALSE) { global $config_vars, $disable_database_connection; $retarr = FALSE; //Skip this step if disable_database_connection is enabled or the user is going through the installer still switch (strtolower($action)) { case 'login': if ((!isset($disable_database_connection) or isset($disable_database_connection) and $disable_database_connection != TRUE) and (!isset($config_vars['other']['installer_enabled']) or isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] != TRUE)) { //Get all system settings, so they can be used even if the user isn't logged in, such as the login page. $sslf = new SystemSettingListFactory(); $system_settings = $sslf->getAllArray(); } unset($sslf); //Check license validity if ((DEPLOYMENT_ON_DEMAND == FALSE and $this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) { if (!isset($system_settings['license'])) { $system_settings['license'] = NULL; } $license = new TTLicense(); $license_validate = $license->validateLicense($system_settings['license']); $license_message = $license->getFullErrorMessage($license_validate, TRUE); if ($license_message != '') { $destination_url = 'http://www.timetrex.com/r.php?id=899'; if ($license_validate === TRUE) { //License likely expires soon. $retarr[] = array('delay' => 0, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('WARNING: %1', $license_message), 'destination' => $destination_url); } else { //License error. $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1', $license_message), 'destination' => $destination_url); } } unset($license, $license_validate, $license_message, $destination); } //System Requirements not being met. if (isset($system_settings['valid_install_requirements']) and DEPLOYMENT_ON_DEMAND == FALSE and (int) $system_settings['valid_install_requirements'] == 0) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 system requirement check has failed! Please contact your %1 administrator immediately to re-run the %1 installer to correct the issue.', APPLICATION_NAME), 'destination' => NULL); } //Check version mismatch if (isset($system_settings['system_version']) and DEPLOYMENT_ON_DEMAND == FALSE and APPLICATION_VERSION != $system_settings['system_version']) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 application version does not match database version. Please re-run the %1 installer to complete the upgrade process.', APPLICATION_NAME), 'destination' => NULL); } //Only display message to the primary company. if (time() - (int) APPLICATION_VERSION_DATE > 86400 * 475 and ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) { //~1yr and 3mths $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: This %1 version (v%2) is severely out of date and may no longer be supported. Please upgrade to the latest version as soon as possible as invalid calculations may already be occurring.', array(APPLICATION_NAME, APPLICATION_VERSION)), 'destination' => NULL); } //New version available notification. if (DEMO_MODE == FALSE and (isset($system_settings['new_version']) and $system_settings['new_version'] == 1) and ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) { //Only display this every two weeks. $new_version_available_notification_arr = UserSettingFactory::getUserSetting($this->getCurrentUserObject()->getID(), 'new_version_available_notification'); if (!isset($new_version_available_notification_arr['value']) or isset($new_version_available_notification_arr['value']) and $new_version_available_notification_arr['value'] <= time() - 86400 * 14) { UserSettingFactory::setUserSetting($this->getCurrentUserObject()->getID(), 'new_version_available_notification', time()); $retarr[] = array('delay' => -1, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: A new version of %1 available, it is highly recommended that you upgrade as soon as possible. Click here to download the latest version.', array(APPLICATION_NAME)), 'destination' => getTTProductEdition() == TT_PRODUCT_COMMUNITY ? 'http://www.timetrex.com/r.php?id=19' : 'http://www.timetrex.com/r.php?id=9'); } unset($new_version_available_notification); } //Check for major new version. $new_version_notification_arr = UserSettingFactory::getUserSetting($this->getCurrentUserObject()->getID(), 'new_version_notification'); if (DEMO_MODE == FALSE and (!isset($config_vars['branding']['application_name']) or ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) and $this->getPermissionObject()->getLevel() >= 20 and $this->getCurrentUserObject()->getCreatedDate() <= APPLICATION_VERSION_DATE and (!isset($new_version_notification_arr['value']) or isset($new_version_notification_arr['value']) and Misc::MajorVersionCompare(APPLICATION_VERSION, $new_version_notification_arr['value'], '>'))) { UserSettingFactory::setUserSetting($this->getCurrentUserObject()->getID(), 'new_version_notification', APPLICATION_VERSION); $retarr[] = array('delay' => -1, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: Your instance of %1 has been upgraded to v%2, click here to see whats new.', array(APPLICATION_NAME, APPLICATION_VERSION)), 'destination' => 'http://www.timetrex.com/r.php?id=300'); } unset($new_version_notification); //Check installer enabled. if (isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] == 1) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 is currently in INSTALL MODE. Please go to your timetrex.ini.php file and set "installer_enabled" to "FALSE".', APPLICATION_NAME), 'destination' => NULL); } //Make sure CronJobs are running correctly. $cjlf = new CronJobListFactory(); $cjlf->getMostRecentlyRun(); if ($cjlf->getRecordCount() > 0) { //Is last run job more then 48hrs old? $cj_obj = $cjlf->getCurrent(); if (PRODUCTION == TRUE and DEMO_MODE == FALSE and $cj_obj->getLastRunDate() < time() - 172800 and $cj_obj->getCreatedDate() < time() - 172800) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Critical maintenance jobs have not run in the last 48hours. Please contact your %1 administrator immediately.', APPLICATION_NAME), 'destination' => NULL); } } unset($cjlf, $cj_obj); //Check if any pay periods are past their transaction date and not closed. if (DEMO_MODE == FALSE and $this->getPermissionObject()->Check('pay_period_schedule', 'enabled') and $this->getPermissionObject()->Check('pay_period_schedule', 'view')) { $pplf = TTnew('PayPeriodListFactory'); $pplf->getByCompanyIdAndStatusAndTransactionDate($this->getCurrentCompanyObject()->getId(), array(10, 30), TTDate::getBeginDayEpoch(time())); //Open or Post Adjustment pay periods. if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { if ($pp_obj->getCreatedDate() < time() - 86400 * 40) { //Ignore pay period schedules newer than 40 days. They are automatically closed after 45 days. $retarr[] = array('delay' => 0, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Pay periods past their transaction date have not been closed yet. It\'s critical that these pay periods are closed to prevent data loss, click here to close them now.'), 'destination' => array('menu_name' => 'Pay Periods')); break; } } } unset($pplf, $pp_obj); } //CHeck for unread messages $mclf = new MessageControlListFactory(); $unread_messages = $mclf->getNewMessagesByCompanyIdAndUserId($this->getCurrentCompanyObject()->getId(), $this->getCurrentUserObject()->getId()); Debug::text('UnRead Messages: ' . $unread_messages, __FILE__, __LINE__, __METHOD__, 10); if ($unread_messages > 0) { $retarr[] = array('delay' => 25, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: You have %1 new message(s) waiting, click here to read them now.', $unread_messages), 'destination' => array('menu_name' => 'Messages')); } unset($mclf, $unread_messages); if (DEMO_MODE == FALSE) { $elf = new ExceptionListFactory(); $elf->getFlaggedExceptionsByUserIdAndPayPeriodStatus($this->getCurrentUserObject()->getId(), 10); $display_exception_flag = FALSE; if ($elf->getRecordCount() > 0) { foreach ($elf as $e_obj) { if ($e_obj->getColumn('severity_id') == 30) { $display_exception_flag = 'red'; } break; } } if (isset($display_exception_flag) and $display_exception_flag !== FALSE) { Debug::Text('Exception Flag to Display: ' . $display_exception_flag, __FILE__, __LINE__, __METHOD__, 10); $retarr[] = array('delay' => 30, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: You have critical severity exceptions pending, click here to view them now.'), 'destination' => array('menu_name' => 'Exceptions')); } unset($elf, $e_obj, $display_exception_flag); } if (DEMO_MODE == FALSE and $this->getPermissionObject()->getLevel() >= 20 and ($this->getCurrentUserObject()->getWorkEmail() == '' and $this->getCurrentUserObject()->getHomeEmail() == '')) { $retarr[] = array('delay' => 30, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Please click here and enter an email address for your account, this is required to receive important notices and prevent your account from being locked out.'), 'destination' => array('menu_name' => 'Contact Information')); } break; default: break; } //Check timezone is proper. $current_user_prefs = $this->getCurrentUserObject()->getUserPreferenceObject(); if ($current_user_prefs->setDateTimePreferences() == FALSE) { //Setting timezone failed, alert user to this fact. //WARNING: %1 was unable to set your time zone. Please contact your %1 administrator immediately.{/t} {if $permission->Check('company','enabled') AND $permission->Check('company','edit_own')}<a href="http://forums.timetrex.com/viewtopic.php?t=40">{t}For more information please click here.{/t}</a>{/if} if ($this->getPermissionObject()->Check('company', 'enabled') and $this->getPermissionObject()->Check('company', 'edit_own')) { $destination_url = 'http://www.timetrex.com/r.php?id=1010'; $sub_message = TTi18n::getText('For more information please click here.'); } else { $destination_url = NULL; $sub_message = NULL; } $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 was unable to set your time zone. Please contact your %1 administrator immediately.', APPLICATION_NAME) . ' ' . $sub_message, 'destination' => $destination_url); unset($destination_url, $sub_message); } return $retarr; }
$obj->setName('update_notify'); if (isset($data['update_notify']) and $data['update_notify'] == 1 or getTTProductEdition() > 10 or $external_installer == 1) { $obj->setValue(1); } else { $obj->setValue(0); } if ($obj->isValid()) { $obj->Save(); } //Write anonymous_auto_update feature to system settings. $sslf = new SystemSettingListFactory(); $sslf->getByName('anonymous_update_notify'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('anonymous_update_notify'); if (isset($data['anonymous_update_notify']) and $data['anonymous_update_notify'] == 1) { $obj->setValue(1); } elseif (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) { $obj->setValue(0); } else { $obj->setValue(0); } if ($obj->isValid()) { $obj->Save(); } $ttsc = new TimeTrexSoapClient(); $ttsc->saveRegistrationKey(); $handle = fopen('http://www.timetrex.com/' . URLBuilder::getURL(array('v' => $install_obj->getFullApplicationVersion(), 'page' => 'system_setting', 'update_notify' => (int) $data['update_notify'], 'anonymous_update_notify' => (int) $data['anonymous_update_notify']), 'pre_install.php'), "r");
function sendCompanyData($company_id, $force = FALSE) { Debug::Text('Sending Company Data...', __FILE__, __LINE__, __METHOD__, 10); if ($company_id == '') { return FALSE; } //Check for anonymous update notifications if ($force == FALSE or getTTProductEdition() == 10) { $sslf = new SystemSettingListFactory(); $sslf->getByName('anonymous_update_notify'); if ($sslf->getRecordCount() == 1) { $anonymous_update_notify = $sslf->getCurrent()->getValue(); } else { $anonymous_update_notify = 0; } } else { $anonymous_update_notify = 0; } $clf = new CompanyListFactory(); $clf->getById($company_id); if ($clf->getRecordCount() > 0) { foreach ($clf as $c_obj) { $company_data['id'] = $c_obj->getId(); $company_data['registration_key'] = $this->getLocalRegistrationKey(); $company_data['status_id'] = $c_obj->getStatus(); $company_data['product_edition_id'] = $c_obj->getProductEdition(); $company_data['is_professional_edition_available'] = getTTProductEdition(); $company_data['product_edition_available'] = getTTProductEdition(); if ($anonymous_update_notify == 0) { $company_data['name'] = $c_obj->getName(); $company_data['short_name'] = $c_obj->getShortName(); $company_data['business_number'] = $c_obj->getBusinessNumber(); $company_data['address1'] = $c_obj->getAddress1(); $company_data['address2'] = $c_obj->getAddress2(); $company_data['work_phone'] = $c_obj->getWorkPhone(); $company_data['fax_phone'] = $c_obj->getFaxPhone(); } $company_data['city'] = $c_obj->getCity(); $company_data['country'] = $c_obj->getCountry(); $company_data['province'] = $c_obj->getProvince(); $company_data['postal_code'] = $c_obj->getPostalCode(); Debug::Text('Sent Company Data...', __FILE__, __LINE__, __METHOD__, 10); $retval = $this->getSoapObject()->saveCompanyData($company_data); //$this->printSoapDebug(); return $retval; } } return FALSE; }
$obj = $sslf->getCurrent(); } else { $obj = TTnew('SystemSettingListFactory'); } $obj->setName('new_version'); $obj->setValue(0); if ($obj->isValid()) { $obj->Save(); } //Reset system requirement flag, as all requirements should have passed. $sslf = new SystemSettingListFactory(); $sslf->getByName('valid_install_requirements'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('valid_install_requirements'); $obj->setValue(1); if ($obj->isValid()) { $obj->Save(); } $action = Misc::findSubmitButton(); switch ($action) { case 'back': Debug::Text('Back', __FILE__, __LINE__, __METHOD__, 10); Redirect::Page(URLBuilder::getURL(NULL, 'User.php')); break; case 'next': Debug::Text('Next', __FILE__, __LINE__, __METHOD__, 10); Redirect::Page(URLBuilder::getURL(NULL, '../Login.php'));
function getRegistrationKey() { $sslf = new SystemSettingListFactory(); $sslf->getByName('registration_key'); if ($sslf->getRecordCount() == 1) { $key = $sslf->getCurrent()->getValue(); return $key; } return FALSE; }
if ($clf->getRecordCount() > 0) { $c_obj = $clf->getCurrent(); } else { $c_obj = $current_company; } $c_obj->setName($license->getOrganizationName(), TRUE); if ($c_obj->isValid()) { $c_obj->Save(); } //Save registration key $sslf = new SystemSettingListFactory(); $sslf->getByName('registration_key'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('registration_key'); $obj->setValue($license->getRegistrationKey()); if ($obj->isValid()) { $obj->Save(); } $post_js = 'window.opener.location.reload();'; } } else { $error = TTi18n::gettext('Invalid License File'); } } break; } $smarty->assign_by_ref('error', $error);
function createSchema($version) { if ($version == '') { return FALSE; } $install = FALSE; $group = substr($version, -1, 1); $version_number = substr($version, 0, strlen($version) - 1); Debug::text('Version: ' . $version . ' Version Number: ' . $version_number . ' Group: ' . $group, __FILE__, __LINE__, __METHOD__, 9); //Only create schema if current system settings do not exist, or they are //older then this current schema version. if ($this->checkTableExists('system_setting') == TRUE) { Debug::text('System Setting Table DOES exist...', __FILE__, __LINE__, __METHOD__, 9); $sslf = new SystemSettingListFactory(); $sslf->getByName('schema_version_group_' . substr($version, -1, 1)); if ($sslf->getRecordCount() > 0) { $ss_obj = $sslf->getCurrent(); Debug::text('Found System Setting Entry: ' . $ss_obj->getValue(), __FILE__, __LINE__, __METHOD__, 9); if ($ss_obj->getValue() < $version_number) { Debug::text('Schema version is older, installing...', __FILE__, __LINE__, __METHOD__, 9); $install = TRUE; } else { Debug::text('Schema version is equal, or newer then what we are trying to install...', __FILE__, __LINE__, __METHOD__, 9); $install = FALSE; } } else { Debug::text('Did not find System Setting Entry...', __FILE__, __LINE__, __METHOD__, 9); $install = TRUE; } } else { Debug::text('System Setting Table does not exist...', __FILE__, __LINE__, __METHOD__, 9); $install = TRUE; } if ($install == TRUE) { $is_obj = new InstallSchema($this->getDatabaseDriver(), $version, $this->getDatabaseConnection(), $this->getIsUpgrade()); return $is_obj->InstallSchema(); } return TRUE; }
private function _postPostInstall() { Debug::text('Modify Schema version in system settings table!', __FILE__, __LINE__, __METHOD__, 9); //Modify schema version in system_settings table. $sslf = new SystemSettingListFactory(); $sslf->getByName('schema_version_group_' . $this->getSchemaGroup()); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('schema_version_group_' . $this->getSchemaGroup()); $obj->setValue($this->getVersion()); if ($obj->isValid()) { Debug::text('Setting Schema Version to: ' . $this->getVersion() . ' Group: ' . $this->getSchemaGroup(), __FILE__, __LINE__, __METHOD__, 9); $obj->Save(); return TRUE; } return FALSE; }
//All schema versions //FIXME: Notify the user of any errors. $install_obj->setVersions(); } else { Debug::Text('bDatabase does not exist.', __FILE__, __LINE__, __METHOD__, 10); } $progress_bar->setValue(100); $progress_bar->display(); if ($install_obj->getIsUpgrade() == TRUE) { //Make sure when using external installer that update notifications are always enabled. $sslf = new SystemSettingListFactory(); $sslf->getByName('update_notify'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('update_notify'); if ($external_installer == 1) { $obj->setValue(1); } if ($obj->isValid()) { $obj->Save(); } $next_page = URLBuilder::getURL(array('external_installer' => $external_installer), 'PostUpgrade.php'); } else { if ($external_installer == 1) { $next_page = URLBuilder::getURL(array('action:next' => 1, 'external_installer' => $external_installer), 'SystemSettings.php'); } else { $next_page = URLBuilder::getURL(array('external_installer' => $external_installer), 'SystemSettings.php'); }
//Otherwise version check will fail. $ttsc->sendCompanyData($c_obj->getId()); $ttsc->sendCompanyUserLocationData($c_obj->getId()); $ttsc->sendCompanyUserCountData($c_obj->getId()); $ttsc->sendCompanyVersionData($c_obj->getId()); //Only need to call this on the last company if ($i == $clf->getRecordCount() - 1) { $latest_version = $ttsc->isLatestVersion($c_obj->getId()); $latest_tax_engine_version = $ttsc->isLatestTaxEngineVersion($c_obj->getId()); $latest_tax_data_version = $ttsc->isLatestTaxDataVersion($c_obj->getId()); $sslf = new SystemSettingListFactory(); $sslf->getByName('new_version'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('new_version'); if ($latest_version == FALSE or $latest_tax_engine_version == FALSE or $latest_tax_data_version == FALSE) { $obj->setValue(1); } else { $obj->setValue(0); } if ($obj->isValid()) { $obj->Save(); } } $i++; } } } else {
function getAllArray() { $id = 'all'; $retarr = $this->getCache($id); if ($retarr === FALSE) { $sslf = new SystemSettingListFactory(); $sslf->getAll(); if ($sslf->getRecordCount() > 0) { foreach ($sslf as $ss_obj) { $retarr[$ss_obj->getName()] = $ss_obj->getValue(); } $this->saveCache($retarr, $id); return $retarr; } else { return FALSE; } } return $retarr; }
/** * Get about data . * */ function getAboutData($ytd = 0, $all_companies = FALSE) { global $config_vars; $clf = new CompanyListFactory(); $sslf = new SystemSettingListFactory(); $system_settings = $sslf->getAllArray(); $clf->getByID(PRIMARY_COMPANY_ID); if ($clf->getRecordCount() == 1) { $primary_company = $clf->getCurrent(); } $current_user = $this->getCurrentUserObject(); if (isset($primary_company) and PRIMARY_COMPANY_ID == $current_user->getCompany()) { $current_company = $primary_company; } else { $current_company = $clf->getByID($current_user->getCompany())->getCurrent(); } //$current_user_prefs = $current_user->getUserPreferenceObject(); $data = $system_settings; if (isset($data['new_version']) and $data['new_version'] == TRUE) { $data['new_version'] = TRUE; } else { $data['new_version'] = FALSE; } $data['product_edition'] = Option::getByKey(DEPLOYMENT_ON_DEMAND == TRUE ? $current_company->getProductEdition() : getTTProductEdition(), $current_company->getOptions('product_edition')); $data['application_name'] = APPLICATION_NAME; $data['organization_url'] = ORGANIZATION_URL; //Get Employee counts for this month, and last month $month_of_year_arr = TTDate::getMonthOfYearArray(); //This month if (isset($ytd) and $ytd == 1) { $begin_month_epoch = strtotime('-2 years'); } else { $begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400); } $cuclf = TTnew('CompanyUserCountListFactory'); if (isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id'] and $all_companies == TRUE) { $cuclf->getTotalMonthlyMinAvgMaxByCompanyStatusAndStartDateAndEndDate(10, $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); } else { $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); } Debug::Text('Company User Count Rows: ' . $cuclf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); if ($cuclf->getRecordCount() > 0) { foreach ($cuclf as $cuc_obj) { $data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users')); } } if (isset($data['user_counts']) == FALSE) { $data['user_counts'] = array(); } $cjlf = TTnew('CronJobListFactory'); $cjlf->getMostRecentlyRun(); if ($cjlf->getRecordCount() > 0) { $cj_obj = $cjlf->getCurrent(); $data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate() == FALSE ? TTi18n::getText('Never') : TTDate::getDate('DATE+TIME', $cj_obj->getLastRunDate())); } $data['show_license_data'] = FALSE; if ((DEPLOYMENT_ON_DEMAND == FALSE and $current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) { if (!isset($system_settings['license'])) { $system_settings['license'] = NULL; } $data['show_license_data'] = TRUE; //Set this so the license upload area at least shows up regardles of edition. $data['license_data'] = array(); $license = new TTLicense(); $retval = $license->validateLicense($system_settings['license']); if ($retval == TRUE) { $data['license_data'] = array('organization_name' => $license->getOrganizationName(), 'major_version' => $license->getMajorVersion(), 'minor_version' => $license->getMinorVersion(), 'product_name' => $license->getProductName(), 'active_employee_licenses' => $license->getActiveEmployeeLicenses(), 'issue_date' => TTDate::getDate('DATE', $license->getIssueDate()), 'expire_date' => $license->getExpireDate(), 'expire_date_display' => TTDate::getDate('DATE', $license->getExpireDate()), 'registration_key' => $license->getRegistrationKey(), 'message' => $license->getFullErrorMessage($retval), 'retval' => $retval); } } //Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__,10); return $this->returnHandler($data); }
*/ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php'; // //Check system requirements. // if (PRODUCTION == TRUE and DEPLOYMENT_ON_DEMAND == FALSE) { Debug::Text('Checking system requirements... ' . TTDate::getDate('DATE+TIME', time()), __FILE__, __LINE__, __METHOD__, 10); $install_obj = new Install(); $failed_requirment_requirements = $install_obj->getFailedRequirements(FALSE, array('clean_cache', 'file_checksums')); $sslf = new SystemSettingListFactory(); $sslf->getByName('valid_install_requirements'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('valid_install_requirements'); if (is_array($failed_requirment_requirements) and count($failed_requirment_requirements) > 1) { $obj->setValue(0); Debug::Text('Failed system requirements: ' . implode($failed_requirment_requirements), __FILE__, __LINE__, __METHOD__, 10); TTLog::addEntry(0, 510, 'Failed system requirements: ' . implode($failed_requirment_requirements), 0, 'company'); } else { $obj->setValue(1); } if ($obj->isValid()) { $obj->Save(); } unset($install_obj, $sslf, $obj, $check_all_requirements); Debug::Text('Checking system requirements complete... ' . TTDate::getDate('DATE+TIME', time()), __FILE__, __LINE__, __METHOD__, 10); }