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; }
$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(); } $ttsc = new TimeTrexSoapClient();
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; }