@@ -24,33 +24,31 @@ public SettingsFormValidator(
24
24
}
25
25
26
26
/**
27
- * Validate form.
27
+ * Validates form if plugin is enabled .
28
28
*
29
29
* @throws ConfigurationException Exception
30
30
*/
31
31
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
+ }
54
52
}
55
53
}
56
- }
54
+ }
0 commit comments