You are here

function currency_save in Currency 7.2

Saves a currency.

Parameters

Currency $currency:

Return value

integer The result of drupal_write_record().

1 call to currency_save()
CurrencyCRUDWebTestCase::testCRUD in currency/tests/CurrencyCRUDWebTestCase.test
Test CRUD functionality.
1 string reference to 'currency_save'
currency_schema in currency/currency.install
Implements hook_schema().

File

currency/currency.module, line 711
Provides currency information and allows users to add custom currencies.

Code

function currency_save(Currency $currency) {
  if ($currency->export_type & EXPORT_IN_DATABASE) {
    $update = array(
      'ISO4217Code',
    );
  }
  else {
    $update = array();
    $currency->export_type = EXPORT_IN_DATABASE;
  }
  $status = drupal_write_record('currency', $currency, $update);
  if (module_exists('i18n_string')) {
    i18n_string_object_update('currency', $currency);
  }
  return $status;
}