Beispiel #1
0
         } else {
             $encoded_data = urlencode(base64_encode(serialize($encoded_data)));
         }
         //Debug::Text(' Encoded Data ('.strlen($encoded_data).'): '. $encoded_data, __FILE__, __LINE__, __METHOD__,10);
     }
     Redirect::Page(URLBuilder::getURL(array('data' => $encoded_data), 'https://www.timetrex.com/university.php'));
     exit;
     break;
 case 'check_for_updates':
     Debug::Text('Check For Update!', __FILE__, __LINE__, __METHOD__, 10);
     $ttsc = new TimeTrexSoapClient();
     //We must ensure that the data is up to date
     //Otherwise version check will fail.
     $ttsc->sendCompanyData($current_company->getId(), TRUE);
     $ttsc->sendCompanyUserLocationData($current_company->getId());
     $ttsc->sendCompanyUserCountData($current_company->getId());
     $ttsc->sendCompanyVersionData($current_company->getId());
     $latest_version = $ttsc->isLatestVersion($current_company->getId());
     $latest_tax_engine_version = $ttsc->isLatestTaxEngineVersion($current_company->getId());
     $latest_tax_data_version = $ttsc->isLatestTaxDataVersion($current_company->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);
         $data['new_version'] = 1;
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php';
$ttsc = new TimeTrexSoapClient();
if ($ttsc->isUpdateNotifyEnabled() == TRUE) {
    $clf = new CompanyListFactory();
    $clf->getAll();
    if ($clf->getRecordCount() > 0) {
        $i = 0;
        foreach ($clf as $c_obj) {
            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) {
Beispiel #3
0
 function isNewVersionAvailable($ytd = 0, $all_companies = FALSE)
 {
     Debug::Text('Check For Update!', __FILE__, __LINE__, __METHOD__, 10);
     $current_company = $this->getCurrentCompanyObject();
     $data = $this->getAboutData($ytd, $all_companies);
     $ttsc = new TimeTrexSoapClient();
     //We must ensure that the data is up to date
     //Otherwise version check will fail.
     $ttsc->sendCompanyData($current_company->getId(), TRUE);
     $ttsc->sendCompanyUserLocationData($current_company->getId());
     $ttsc->sendCompanyUserCountData($current_company->getId());
     $ttsc->sendCompanyVersionData($current_company->getId());
     $license = new TTLicense();
     $license->getLicenseFile(FALSE);
     //Download updated license file if one exists.
     $latest_version = $ttsc->isLatestVersion($current_company->getId());
     $latest_tax_engine_version = $ttsc->isLatestTaxEngineVersion($current_company->getId());
     $latest_tax_data_version = $ttsc->isLatestTaxDataVersion($current_company->getId());
     $sslf = TTnew('SystemSettingListFactory');
     $sslf->getByName('new_version');
     if ($sslf->getRecordCount() == 1) {
         $obj = $sslf->getCurrent();
     } else {
         $obj = TTnew('SystemSettingListFactory');
     }
     $obj->setName('new_version');
     if ($latest_version == FALSE or $latest_tax_engine_version == FALSE or $latest_tax_data_version == FALSE) {
         $obj->setValue(1);
         $data['new_version'] = TRUE;
     } else {
         $obj->setValue(0);
         $data['new_version'] = FALSE;
     }
     if ($obj->isValid()) {
         $obj->Save();
     }
     return $this->returnHandler($data);
 }