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; }
//Reset new_version flag. $sslf = TTnew('SystemSettingListFactory'); $sslf->getByName('new_version'); if ($sslf->getRecordCount() == 1) { $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'));
$obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $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();
$obj->Save(); //Save company name from license file. $clf = new CompanyListFactory(); $clf->getById($license->getPrimaryCompanyID()); 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'); }
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; }
function getRegistrationKey() { $sslf = new SystemSettingListFactory(); $sslf->getByName('registration_key'); if ($sslf->getRecordCount() == 1) { $key = $sslf->getCurrent()->getValue(); return $key; } return FALSE; }
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 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; }
//Create SQL, always try to install every schema version, as //installSchema() will check if its already been installed or not. $install_obj->setDatabaseDriver($config_vars['database']['type']); $install_obj->createSchemaRange(NULL, NULL); //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) {
if ($ttsc->getLocalRegistrationKey() == FALSE or $ttsc->getLocalRegistrationKey() == '') { $ttsc->saveRegistrationKey(); } //We must ensure that the data is up to date //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(); } }