PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | app/Helpers/CurrencyHelper.php +15 -11 3.0.2.7 → 3.0.16 View file →
@@ -271,22 +271,26 @@
271 271 * @return string Formatted amount
272 272 */
273 273 public static function format(float $amount, string $code = 'USD', bool $showCode = false): string
274 274 {
275 - $code = strtoupper($code);
276 - $currency = self::CURRENCIES[$code] ?? null;
277 -
278 - if (!$currency) {
279 - return number_format($amount, 2) . ' ' . $code;
275 + if (function_exists('yatra_format_price')) {
276 + $result = yatra_format_price($amount, $code, false);
277 + } else {
278 + $code = strtoupper($code);
279 + $currency = self::CURRENCIES[$code] ?? null;
280 +
281 + if (!$currency) {
282 + return number_format($amount, 2) . ' ' . $code;
283 + }
284 +
285 + $formatted = number_format($amount, $currency['decimal_digits']);
286 + $result = $currency['symbol'] . $formatted;
280 287 }
281 -
282 - $formatted = number_format($amount, $currency['decimal_digits']);
283 - $result = $currency['symbol'] . $formatted;
284 -
288 +
285 289 if ($showCode) {
286 - $result .= ' ' . $code;
290 + $result .= ' ' . strtoupper($code);
287 291 }
288 -
292 +
289 293 return $result;
290 294 }
291 295
292 296 /**