<?php
/*
* Search if 'Enable Estimated Multi-Currency' is active
*/
$query = "SELECT `value` "
        ."FROM `setting` "
        ."WHERE `name` = 'Enable Estimated Multi-Currency' ";
$result = $this->db->query($query);

list($MultiCurrencySettingVALUE) = $result->fetch();

if ($MultiCurrencySettingVALUE == 1) {
    /*
    * Search the value of the 'Default Currency'
    */
    $query = "SELECT `value` "
            ."FROM `setting` "
            ."WHERE `name` = 'Default Currency' ";
    $result = $this->db->query($query);
    list($DefaultCurrency) = $result->fetch();
    
    /*
    * Turn off the setting for Multi-currency
    */
    $query = "UPDATE `setting` "
            ."SET `value` = '0' "
            ."WHERE `name` = 'Enable Estimated Multi-Currency' ";
    $this->db->query($query);
    
    /*
    * You were using the Multi-currency setting, so the system will need to change all your
    * customers currency to the default one, because all your customers were really using
    * the default currency for been charged.
    */
    $query = "UPDATE `users` "
            ."SET `currency` = '".$DefaultCurrency."' "
            ."WHERE `currency` NOT IN('".$DefaultCurrency."', '0') ";
    $this->db->query($query);
}

?>
