mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
It is now possible to select a different currency if desired (issue #37).
This commit is contained in:
@@ -94,14 +94,12 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas
|
||||
* Returns an object with id $id.
|
||||
*
|
||||
* @param int $objectId
|
||||
* @throws NotImplementedException
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return \Eloquent
|
||||
*/
|
||||
public function find($objectId)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
return \TransactionCurrency::find($objectId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -102,7 +102,7 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
|
||||
public function update(Eloquent $model, array $data)
|
||||
{
|
||||
$journalType = $this->getJournalType($data['what']);
|
||||
$currency = $this->getJournalCurrency($data['currency']);
|
||||
$currency = $this->getJournalCurrencyById($data['transaction_currency_id']);
|
||||
$model->description = $data['description'];
|
||||
$model->date = $data['date'];
|
||||
|
||||
@@ -304,6 +304,19 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
|
||||
return $currencyRepository->findByCode($currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $currencyId
|
||||
*
|
||||
* @return null|\TransactionCurrency
|
||||
*/
|
||||
public function getJournalCurrencyById($currencyId)
|
||||
{
|
||||
/** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencyRepository */
|
||||
$currencyRepository = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency');
|
||||
|
||||
return $currencyRepository->find($currencyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings("CamelCase") // I'm fine with this.
|
||||
*
|
||||
|
||||
@@ -30,8 +30,8 @@ class Form
|
||||
$value = self::fillFieldValue($name, $value);
|
||||
$options['step'] = 'any';
|
||||
$options['min'] = '0.01';
|
||||
$defaultCurrency = \Amount::getDefaultCurrency();
|
||||
$currencies = \TransactionCurrency::where('name', '!=', $defaultCurrency->name)->get();
|
||||
$defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency();
|
||||
$currencies = \TransactionCurrency::orderBy('code','ASC')->get();
|
||||
$html = \View::make('form.amount', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
|
||||
return $html;
|
||||
@@ -141,7 +141,7 @@ class Form
|
||||
$value = self::fillFieldValue($name, $value);
|
||||
$options['step'] = 'any';
|
||||
$defaultCurrency = \Amount::getDefaultCurrency();
|
||||
$currencies = \TransactionCurrency::where('name', '!=', $defaultCurrency->name)->get();
|
||||
$currencies = \TransactionCurrency::orderBy('code','ASC')->get();
|
||||
$html = \View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
return $html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user