Skip to content

Commit 0e883ab

Browse files
author
Stanislav Idolov
authored
ENGCOM-3037: [Forwardport] Fix currency symbol setting back to default #17567 #18204
2 parents ad47d52 + c14aa54 commit 0e883ab

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,11 @@ public function getCurrencySymbolsData()
192192
*/
193193
public function setCurrencySymbolsData($symbols = [])
194194
{
195-
foreach ($this->getCurrencySymbolsData() as $code => $values) {
196-
if (isset($symbols[$code]) && ($symbols[$code] == $values['parentSymbol'] || empty($symbols[$code]))) {
197-
unset($symbols[$code]);
195+
if (!$this->_storeManager->isSingleStoreMode()) {
196+
foreach ($this->getCurrencySymbolsData() as $code => $values) {
197+
if (isset($symbols[$code]) && ($symbols[$code] == $values['parentSymbol'] || empty($symbols[$code]))) {
198+
unset($symbols[$code]);
199+
}
198200
}
199201
}
200202
$value = [];

app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
</label>
2424
<div class="admin__field-control">
2525
<input id="custom_currency_symbol<?= /* @escapeNotVerified */ $code ?>"
26-
class="required-entry admin__control-text"
26+
class="required-entry admin__control-text <?= $data['inherited'] ? 'disabled' : '' ?>"
2727
type="text"
2828
value="<?= $block->escapeHtmlAttr($data['displaySymbol']) ?>"
29-
<?= $data['inherited'] ? ' disabled="disabled"' : '' ?>
3029
name="custom_currency_symbol[<?= /* @escapeNotVerified */ $code ?>]">
3130
<div class="admin__field admin__field-option">
3231
<input id="custom_currency_symbol_inherit<?= /* @escapeNotVerified */ $code ?>"
@@ -49,16 +48,18 @@ require(['jquery', "mage/mage", 'prototype'], function(jQuery){
4948

5049
function toggleUseDefault(code, value)
5150
{
52-
checkbox = $('custom_currency_symbol_inherit'+code);
53-
input = $('custom_currency_symbol'+code);
54-
if (checkbox.checked) {
55-
input.value = value;
56-
input.disabled = true;
51+
checkbox = jQuery('#custom_currency_symbol_inherit'+code);
52+
input = jQuery('#custom_currency_symbol'+code);
53+
54+
if (checkbox.is(':checked')) {
55+
input.addClass('disabled');
56+
input.val(value);
57+
input.prop('readonly', true);
5758
} else {
58-
input.disabled = false;
59+
input.removeClass('disabled');
60+
input.prop('readonly', false);
5961
}
6062
}
61-
6263
window.toggleUseDefault = toggleUseDefault;
6364
});
6465
</script>

app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@
166166
.admin__control-text,
167167
.admin__control-textarea {
168168
width: 100%;
169+
&.disabled {
170+
background-color: #e9e9e9;
171+
border-color: #adadad;
172+
color: #303030;
173+
cursor: not-allowed;
174+
opacity: .5;
175+
}
169176
}
170177
}
171178

0 commit comments

Comments
 (0)