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; }
$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"); fclose($handle); Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer), 'Company.php')); break; default: Debug::Text('Request URI: ' . $_SERVER['REQUEST_URI'], __FILE__, __LINE__, __METHOD__, 10); $data = array('host_name' => $_SERVER['HTTP_HOST'], 'base_url' => str_replace('/install', '', dirname($_SERVER['REQUEST_URI'])), 'log_dir' => $config_vars['path']['log'], 'storage_dir' => $config_vars['path']['storage'], 'cache_dir' => $config_vars['cache']['dir']); $smarty->assign_by_ref('data', $data); break; } $handle = @fopen('http://www.timetrex.com/' . URLBuilder::getURL(array('v' => $install_obj->getFullApplicationVersion(), 'page' => 'system_setting'), 'pre_install.php'), "r");
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; }
function saveRegistrationKey() { $sslf = new SystemSettingListFactory(); $sslf->getByName('registration_key'); if ($sslf->getRecordCount() == 0) { //Get registration key from TimeTrex server. $key = $this->getRegistrationKey(); Debug::Text('Registration Key from server: ' . $key, __FILE__, __LINE__, __METHOD__, 10); if ($key != '') { $key = md5(uniqid()); } else { Debug::Text('Failed getting registration key...', __FILE__, __LINE__, __METHOD__, 10); } $sslf->setName('registration_key'); $sslf->setValue($key); if ($sslf->isValid() == TRUE) { $sslf->Save(); } return TRUE; } else { Debug::Text('Registration key is already set, skipping...', __FILE__, __LINE__, __METHOD__, 10); } return TRUE; }
function setVersions() { if (is_array($this->versions)) { foreach ($this->versions as $name => $value) { $sslf = new SystemSettingListFactory(); $sslf->getByName($name); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName($name); $obj->setValue($value); if ($obj->isValid()) { if ($obj->Save() === FALSE) { return FALSE; } } else { return FALSE; } } } return TRUE; }