Fixes issue 15721: Module dependency validation has been fixed
authorAugusto Mauch <augusto.mauch@openbravo.com>
Wed, 19 Sep 2012 14:38:29 +0200
changeset 17980 0619603e5e54
parent 17979 f95e6cf72b42
child 17981 d9a38ada2c86
Fixes issue 15721: Module dependency validation has been fixed

The process that the modules dependencies was not working properly with modules that had major dependencies having defined a last version.
src/org/openbravo/erpCommon/modules/VersionUtility.java
--- a/src/org/openbravo/erpCommon/modules/VersionUtility.java	Wed Sep 19 13:02:06 2012 +0200
+++ b/src/org/openbravo/erpCommon/modules/VersionUtility.java	Wed Sep 19 14:38:29 2012 +0200
@@ -134,8 +134,8 @@
       }
       if (dep.maxVer != null && !dep.maxVer.isEmpty()) {
         // if lastVersion!=null, firstVersion >= installedVersion >= lastVersion
-        if (versionCompare(dep.minVer, dep.maxVer, false) == 1
-            && versionCompare(mod.availableMinVer, dep.maxVer, true) == 1) {
+        if (versionCompare(dep.minVer, mod.availableMaxVer, false) == 1
+            || versionCompare(mod.availableMinVer, dep.maxVer, true) == 1) {
           errors.add(depParentMod + " @CR_DependensOnModule@ \"" + strModName
               + "\" @CR_InVersion@ \"" + dep.maxVer + "\", @CR_MaxAvailableVersion@ \""
               + mod.availableMinVer + "\". ");
@@ -493,8 +493,9 @@
         n2[i] = Integer.parseInt(s2[i]);
     }
 
-    if (n1[0] > n2[0] || (n1[0] == n2[0] && n1[1] > n2[1])
-        || (n1[0] == n2[0] && n1[1] == n2[1] && n1[2] > n2[2]))
+    if ((!onlyMayorVersion && (n1[0] > n2[0] || (n1[0] == n2[0] && n1[1] > n2[1]) || (n1[0] == n2[0]
+        && n1[1] == n2[1] && n1[2] > n2[2])))
+        || (onlyMayorVersion && (n1[0] > n2[0] || (n1[0] == n2[0] && n1[1] > n2[1]))))
       return 1;
     else if ((onlyMayorVersion && n1[0] == n2[0] && n1[1] == n2[1] && n1[2] <= n2[2])
         || (!onlyMayorVersion && n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]))