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;
 }
Example #2
0
}
$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'));
        break;
    default:
        break;
         $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");
     fclose($handle);
     Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer), 'Company.php'));
     break;
 default:
 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;
 }
Example #5
0
                             $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);
     $smarty->assign_by_ref('success', $success);
     $smarty->assign_by_ref('post_js', $post_js);
 default:
 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;
 }
Example #7
0
 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;
 }
Example #8
0
    Redirect::Page(URLBuilder::getURL(NULL, 'install.php'));
    exit;
}
//Disable installer now that we're done.
$data['installer_enabled'] = 'FALSE';
$install_obj->writeConfigFile($data);
//Reset new_version flag.
$sslf = new SystemSettingListFactory();
$sslf->getByName('new_version');
if ($sslf->getRecordCount() == 1) {
    $obj = $sslf->getCurrent();
} else {
    $obj = new SystemSettingListFactory();
}
$obj->setName('new_version');
$obj->setValue(0);
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'));
        break;
    default:
        break;