-
-
Save danielborzov/1c70f3c35a5d8418330f1c5914f62c2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/functions/fn.cart.php b/app/functions/fn.cart.php | |
index da13a21d8c..79ec8fa47e 100644 | |
--- a/app/functions/fn.cart.php | |
+++ b/app/functions/fn.cart.php | |
@@ -794,7 +794,9 @@ function fn_update_currency($currency_data, $currency_id, $lang_code = DESCR_SL) | |
fn_set_hook('update_currency_pre', $currency_data, $currency_id, $lang_code); | |
$currency_data['currency_code'] = strtoupper($currency_data['currency_code']); | |
- $currency_data['coefficient'] = !empty($currency_data['is_primary']) || !isset($currency_data['coefficient']) ? 1 : $currency_data['coefficient']; | |
+ | |
+ $is_primary_currency = !empty($currency_data['is_primary']) && YesNo::toBool($currency_data['is_primary']); | |
+ $currency_data['coefficient'] = $is_primary_currency || !isset($currency_data['coefficient']) ? 1 : $currency_data['coefficient']; | |
$currency_data['symbol'] = empty($currency_data['symbol']) ? '' : SecurityHelper::sanitizeHtml($currency_data['symbol']); | |
if (empty($currency_data['coefficient']) || floatval($currency_data['coefficient']) <= 0) { | |
@@ -820,7 +822,7 @@ function fn_update_currency($currency_data, $currency_id, $lang_code = DESCR_SL) | |
))); | |
} | |
- if (!empty($currency_data['is_primary']) && $currency_data['is_primary'] === YesNo::YES) { | |
+ if ($is_primary_currency) { | |
db_query("UPDATE ?:currencies SET is_primary = 'N' WHERE is_primary = 'Y'"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment