diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd27f73..cf4bfec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
+## 2.1.1
+### Fixed
+- Fixed an issue where settings fields were readonly even when not being overridden by config file. [#20](https://github.com/surprisehighway/craft-avatax/issues/20)
+
## 2.1.0 - 2020-02-20
### Added
- Added Commerce 3 compatibility.
diff --git a/composer.json b/composer.json
index 2ed819e..0dfaafa 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "surprisehighway/craft-avatax",
"description": "Calculate and add sales tax to an order's base tax using Avalara's Avatax service.",
"type": "craft-plugin",
- "version": "2.1.0",
+ "version": "2.1.1",
"keywords": [
"craft",
"cms",
diff --git a/src/templates/settings.twig b/src/templates/settings.twig
index 610e4f1..dc49f58 100644
--- a/src/templates/settings.twig
+++ b/src/templates/settings.twig
@@ -11,25 +11,12 @@
{% macro configWarning(setting) -%}
{%- set configArray = craft.app.config.getConfigFromFile("avatax") -%}
{%- if configArray[setting] is defined -%}
- {{- "This is being overridden by the `#{setting}` setting in the `config/avatax.php` file."|raw }}
- {%- else -%}
- {{ false }}
+ {{- "This is being overridden by the #{setting}
setting in the config/avatax.php
file."|raw }}
{%- endif -%}
{%- endmacro %}
{% from _self import configWarning %}
-{% macro configDisabled(setting) -%}
- {%- set configArray = craft.app.config.getConfigFromFile("avatax") -%}
- {%- if configArray[setting] is defined -%}
- {{ true }}
- {%- else -%}
- {{ false }}
- {%- endif -%}
-{%- endmacro %}
-
-{% from _self import configDisabled %}
-
@@ -65,7 +52,6 @@
name: 'accountId',
value: settings['accountId'],
warning: configWarning('accountId'),
- readonly: configDisabled('accountId'),
errors: settings.getErrors('accountId')
})
}}
@@ -77,7 +63,6 @@
name: 'licenseKey',
value: settings['licenseKey'],
warning: configWarning('licenseKey'),
- readonly: configDisabled('licenseKey'),
errors: settings.getErrors('licenseKey')
})
}}
@@ -89,7 +74,6 @@
name: 'companyCode',
value: settings['companyCode'],
warning: configWarning('companyCode'),
- readonly: configDisabled('companyCode'),
errors: settings.getErrors('companyCode')
})
}}
@@ -105,7 +89,6 @@
name: 'sandboxAccountId',
value: settings['sandboxAccountId'],
warning: configWarning('sandboxAccountId'),
- readonly: configDisabled('sandboxAccountId'),
errors: settings.getErrors('sandboxAccountId')
})
}}
@@ -117,7 +100,6 @@
name: 'sandboxLicenseKey',
value: settings['sandboxLicenseKey'],
warning: configWarning('sandboxLicenseKey'),
- readonly: configDisabled('sandboxLicenseKey'),
errors: settings.getErrors('sandboxLicenseKey')
})
}}
@@ -129,7 +111,6 @@
name: 'sandboxCompanyCode',
value: settings['sandboxCompanyCode'],
warning: configWarning('sandboxCompanyCode'),
- readonly: configDisabled('sandboxCompanyCode'),
errors: settings.getErrors('sandboxCompanyCode')
})
}}
@@ -139,7 +120,7 @@
Origin Ship From Address is being overridden by the shipFrom config setting in your `avataxtax.php` config file.
Origin Ship From Address is being overridden by the shipFrom config setting in your `avataxtax.php` config file.
{{ configWarning('enableTaxCalculation') }}
{% endif %} @@ -337,12 +306,11 @@ id: 'enableCommitting', name: 'enableCommitting', on: settings['enableCommitting'], - readonly: configDisabled('enableCommitting'), errors: settings.getErrors('enableCommitting') }) }} - {% if configDisabled('enableCommitting') %} + {% if configWarning('enableCommitting') %}{{ configWarning('enableCommitting') }}
{% endif %} @@ -359,12 +327,11 @@ id: 'enableAddressValidation', name: 'enableAddressValidation', on: settings['enableAddressValidation'], - readonly: configDisabled('enableAddressValidation'), errors: settings.getErrors('enableAddressValidation') }) }} - {% if configDisabled('enableAddressValidation') %} + {% if configWarning('enableAddressValidation') %}{{ configWarning('enableAddressValidation') }}
{% endif %} @@ -381,12 +348,11 @@ id: 'enablePartialRefunds', name: 'enablePartialRefunds', on: settings['enablePartialRefunds'], - readonly: configDisabled('enablePartialRefunds'), errors: settings.getErrors('enablePartialRefunds') }) }} - {% if configDisabled('enablePartialRefunds') %} + {% if configWarning('enablePartialRefunds') %}{{ configWarning('enablePartialRefunds') }}
{% endif %} @@ -407,12 +373,11 @@ id: 'debug', name: 'debug', on: settings.debug, - readonly: configDisabled('debug'), errors: settings.getErrors('debug') }) }} - {% if configDisabled('debug') %} + {% if configWarning('debug') %}{{ configWarning('debug') }}
{% endif %}