@@ -24,33 +24,31 @@ public SettingsFormValidator(
2424 }
2525
2626 /**
27- * Validate form.
27+ * Validates form if plugin is enabled .
2828 *
2929 * @throws ConfigurationException Exception
3030 */
3131 public void validate () throws ConfigurationException {
32- if (!form .getSettings ().pluginEnabled ) {
33- return ;
34- }
35-
36- if (!MagentoBasePathUtil .isMagentoFolderValid (form .getMagentoPath ())) {
37- throw new ConfigurationException (
38- validatorBundle .message ("validator.package.validPath" )
39- );
40- }
41-
42- final String magentoVersion = form .getMagentoVersion ();
43- if (magentoVersion .length () == 0 ) {
44- throw new ConfigurationException (
45- validatorBundle .message ("validator.notEmpty" , "Magento Version" )
46- );
47- }
48-
49- if (!magentoVersion .matches (RegExUtil .MAGENTO_VERSION )
50- && !magentoVersion .equals (MagentoVersionUtil .DEFAULT_VERSION )) {
51- throw new ConfigurationException (
52- validatorBundle .message ("validator.magentoVersionInvalid" )
53- );
32+ if (form .isBeingUsed ()) {
33+ if (!MagentoBasePathUtil .isMagentoFolderValid (form .getMagentoPath ())) {
34+ throw new ConfigurationException (
35+ validatorBundle .message ("validator.package.validPath" )
36+ );
37+ }
38+
39+ final String magentoVersion = form .getMagentoVersion ();
40+ if (magentoVersion .length () == 0 ) {
41+ throw new ConfigurationException (
42+ validatorBundle .message ("validator.notEmpty" , "Magento Version" )
43+ );
44+ }
45+
46+ if (!magentoVersion .matches (RegExUtil .MAGENTO_VERSION )
47+ && !magentoVersion .equals (MagentoVersionUtil .DEFAULT_VERSION )) {
48+ throw new ConfigurationException (
49+ validatorBundle .message ("validator.magentoVersionInvalid" )
50+ );
51+ }
5452 }
5553 }
56- }
54+ }
0 commit comments