* $Date: 2007-11-07 08:49:35 -0800 (Wed, 07 Nov 2007) $
 */
/*
 * Checks for any version updates...
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php';
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');