Skip to content

Commit 9cc3883

Browse files
committed
AC-8440: Tax rate admin ui error
1 parent b1846f1 commit 9cc3883

File tree

1 file changed

+12
-15
lines changed
  • app/code/Magento/Tax/view/adminhtml/templates/rate

1 file changed

+12
-15
lines changed

app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,25 @@ require([
3333
window.updater.sortedRegions[country].length);
3434
3535
if (!hasRegions && selectEl) {
36-
var hasWildcard = false, i;
36+
var i, zeroOptIndex = -1, emptyOptIndex = -1;
3737
3838
for (i = 0; i < selectEl.options.length; i++) {
39-
if (selectEl.options[i].value === '*') { hasWildcard = true; break; }
39+
if (selectEl.options[i].value === '0') { zeroOptIndex = i; break; }
40+
if (emptyOptIndex === -1 && selectEl.options[i].value === '') { emptyOptIndex = i; }
4041
}
41-
if (!hasWildcard) {
42-
var opt = document.createElement('option');
43-
opt.value = '*';
44-
opt.text = '*';
45-
opt.title = '*';
46-
try {
47-
selectEl.options.add(opt, 1);
48-
} catch (e)
49-
{
50-
selectEl.insertBefore(opt, selectEl.options[1] || null);
51-
}
42+
43+
if (zeroOptIndex !== -1) {
44+
selectEl.selectedIndex = zeroOptIndex;
45+
} else if (emptyOptIndex !== -1) {
46+
selectEl.selectedIndex = emptyOptIndex;
47+
} else if (selectEl.options.length) {
48+
selectEl.selectedIndex = 0;
5249
}
53-
selectEl.value = '*';
50+
5451
selectEl.disabled = true; // keep disable mode
5552
}
5653
if (!hasRegions && textEl) {
57-
textEl.value = '*';
54+
textEl.value = '';
5855
}
5956
}
6057
$('#tax_country_id').on('change', function () { setTimeout(enforceWildcard, 0); });

0 commit comments

Comments
 (0)