From a9fa2492408366b9b496abf9bc09fe07f7e6d981 Mon Sep 17 00:00:00 2001 From: cuneytsenturk Date: Thu, 6 Sep 2018 11:11:53 +0300 Subject: [PATCH] close #478 Fixed: Not able to create income/expense in older installations --- app/Models/Setting/Currency.php | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/app/Models/Setting/Currency.php b/app/Models/Setting/Currency.php index 792ef4f80..bdba35591 100644 --- a/app/Models/Setting/Currency.php +++ b/app/Models/Setting/Currency.php @@ -73,4 +73,74 @@ class Currency extends Model { $this->attributes['rate'] = (double) $value; } + + /** + * Get the current precision. + * + * @return string + */ + public function getPrecisionAttribute($value) + { + if (empty($value)) { + return config('money.' . $this->code . '.precision'); + } + + return $value; + } + + /** + * Get the current symbol. + * + * @return string + */ + public function getSymbolAttribute($value) + { + if (empty($value)) { + return config('money.' . $this->code . '.symbol'); + } + + return $value; + } + + /** + * Get the current symbol_first. + * + * @return string + */ + public function getSymbolFirstAttribute($value) + { + if (empty($value)) { + return config('money.' . $this->code . '.symbol_first'); + } + + return $value; + } + + /** + * Get the current decimal_mark. + * + * @return string + */ + public function getDecimalMarkAttribute($value) + { + if (empty($value)) { + return config('money.' . $this->code . '.decimal_mark'); + } + + return $value; + } + + /** + * Get the current thousands_separator. + * + * @return string + */ + public function getThousandsSeparatorAttribute($value) + { + if (empty($value)) { + return config('money.' . $this->code . '.thousands_separator'); + } + + return $value; + } }