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;
 }
Exemplo n.º 2
0
     $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");
 fclose($handle);
 Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer), 'Company.php'));
 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;
 }
Exemplo n.º 4
0
    $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'));
        break;
    default:
Exemplo n.º 5
0
                     } 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);
 $smarty->assign_by_ref('success', $success);
 $smarty->assign_by_ref('post_js', $post_js);
 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 8
0
     $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');
     }
 }
 if (Debug::getVerbosity() >= 11) {
Exemplo n.º 9
0
            $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 {
    Debug::Text('Auto Update Notifications are disabled!', __FILE__, __LINE__, __METHOD__, 10);
}