//Debug::setVerbosity(11);
$smarty->assign('title', TTi18n::gettext($title = 'Currency List'));
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'page', 'sort_column', 'sort_order', 'ids')));
URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('sort_column' => $sort_column, 'sort_order' => $sort_order, 'page' => $page));
$sort_array = NULL;
if ($sort_column != '') {
    $sort_array = array($sort_column => $sort_order);
}
Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10);
$action = Misc::findSubmitButton();
switch ($action) {
    case 'update_rates':
        CurrencyFactory::updateCurrencyRates($current_company->getId());
        Redirect::Page(URLBuilder::getURL(NULL, 'CurrencyList.php'));
        break;
    case 'add':
        Redirect::Page(URLBuilder::getURL(NULL, 'EditCurrency.php'));
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $clf = new CurrencyListFactory();
        if (isset($ids) and is_array($ids)) {
            foreach ($ids as $id) {
                $clf->getByIdAndCompanyId($id, $current_company->getId());
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Powered by TimeTrex" logo. If the display of the logo is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by TimeTrex".
 ********************************************************************************/
/*
 * $Revision: 417 $
 * $Id: AddRecurringHoliday.php 417 2006-12-06 22:58:53Z ipso $
 * $Date: 2006-12-06 14:58:53 -0800 (Wed, 06 Dec 2006) $
 */
/*
 * Updates Currency Exchange Rates.
 * This file should run once a day.
 *
 */
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';
//Debug::setVerbosity(11);
$clf = new CompanyListFactory();
$clf->getAll();
if ($clf->getRecordCount() > 0) {
    foreach ($clf as $c_obj) {
        if ($c_obj->getStatus() != 30) {
            CurrencyFactory::updateCurrencyRates($c_obj->getId());
        }
    }
}
Debug::writeToLog();
Debug::Display();