From 5249ae0291e7b2b7bc54a5875829c830b3222825 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 5 May 2016 22:49:09 +0300 Subject: [PATCH] Added Pakistani Rupee --- app/Libraries/Utils.php | 3 ++- database/seeds/CurrenciesSeeder.php | 2 ++ resources/views/money_script.blade.php | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 7c1b11dfd8..4699603d4d 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -341,6 +341,7 @@ class Utils $currency = self::getFromCache($currencyId, 'currencies'); $thousand = $currency->thousand_separator; $decimal = $currency->decimal_separator; + $precision = $currency->precision; $code = $currency->code; $swapSymbol = false; @@ -355,7 +356,7 @@ class Utils } } - $value = number_format($value, $currency->precision, $decimal, $thousand); + $value = number_format($value, $precision, $decimal, $thousand); $symbol = $currency->symbol; if ($showCode || !$symbol) { diff --git a/database/seeds/CurrenciesSeeder.php b/database/seeds/CurrenciesSeeder.php index b3da84dad0..3b44d55d8d 100644 --- a/database/seeds/CurrenciesSeeder.php +++ b/database/seeds/CurrenciesSeeder.php @@ -8,6 +8,7 @@ class CurrenciesSeeder extends Seeder { Eloquent::unguard(); + // http://www.localeplanet.com/icu/currency.html $currencies = [ ['name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], @@ -56,6 +57,7 @@ class CurrenciesSeeder extends Seeder ['name' => 'Japanese Yen', 'code' => 'JPY', 'symbol' => '¥', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Maldivian Rufiyaa', 'code' => 'MVR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Costa Rican Colón', 'code' => 'CRC', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], + ['name' => 'Pakistani Rupee', 'code' => 'PKR', 'symbol' => 'Rs ', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'], ]; foreach ($currencies as $currency) { diff --git a/resources/views/money_script.blade.php b/resources/views/money_script.blade.php index f6d5067bc0..0dc44eac64 100644 --- a/resources/views/money_script.blade.php +++ b/resources/views/money_script.blade.php @@ -66,6 +66,7 @@ } var currency = currencyMap[currencyId]; + var precision = currency.precision; var thousand = currency.thousand_separator; var decimal = currency.decimal_separator; var code = currency.code; @@ -82,7 +83,7 @@ } } - value = accounting.formatMoney(value, '', 2, thousand, decimal); + value = accounting.formatMoney(value, '', precision, thousand, decimal); var symbol = currency.symbol; if (hideSymbol) {