/** * Stores the preferred currency of the order. * IMPORTANTLY we store the exchange rate for future reference... * @param EcommerceCurrency $currency */ public function UpdateCurrency($newCurrency) { if ($this->IsSubmitted()) { user_error("Can not set the exchange rate after the order has been submitted", E_USER_NOTICE); } else { if (!is_a($newCurrency, Object::getCustomClass("EcommerceCurrency"))) { $newCurrency = EcommerceCurrency::default_currency(); } $this->CurrencyUsedID = $newCurrency->ID; $this->ExchangeRate = $newCurrency->ExchangeRate(); $this->write(); } }