function setCurrency($id) { $id = trim($id); Debug::Text('Currency ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $culf = new CurrencyListFactory(); if ($this->Validator->isResultSetWithRows('currency', $culf->getByID($id), TTi18n::gettext('Invalid Currency'))) { $this->data['currency_id'] = $id; return TRUE; } return FALSE; }
function setCurrency($id) { $id = trim($id); Debug::Text('Currency ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $culf = new CurrencyListFactory(); $old_currency_id = $this->getCurrency(); if ($this->Validator->isResultSetWithRows('currency', $culf->getByID($id), TTi18n::gettext('Invalid Currency'))) { $this->data['currency_id'] = $id; if ($culf->getRecordCount() == 1 and ($this->isNew() or $old_currency_id != $id)) { $this->setCurrencyRate($culf->getCurrent()->getReverseConversionRate()); } return TRUE; } return FALSE; }