details:   https://code.openbravo.com/erp/devel/pi/rev/a9cb2adbb872
changeset: 22352:a9cb2adbb872
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Mar 05 16:27:13 2014 +0100
summary:   fixed bug 25803: unclear error when installing a module with invalid 
local

  If remote check fails, check wether local dependencies are ok and display
  a message if not

diffstat:

 src-db/database/sourcedata/AD_MESSAGE.xml                  |  24 +++++++++
 src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java |  36 +++++++++++++-
 2 files changed, 59 insertions(+), 1 deletions(-)

diffs (108 lines):

diff -r 552e87ea78fc -r a9cb2adbb872 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Wed Mar 05 15:08:44 2014 +0000
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Mar 05 16:27:13 2014 +0100
@@ -18952,6 +18952,18 @@
 <!--548069F5D9E04ECF80B3EA2EA7218036-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--548069F5D9E04ECF80B3EA2EA7218036--></AD_MESSAGE>
 
+<!--54914ED3F566442D8BE408DA1B8A8855--><AD_MESSAGE>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  
<AD_MESSAGE_ID><![CDATA[54914ED3F566442D8BE408DA1B8A8855]]></AD_MESSAGE_ID>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  
<VALUE><![CDATA[ModuleLocalDepErrorsExplain]]></VALUE>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  <MSGTEXT><![CDATA[The modules that 
are currently installed in this instance do not satisfy their dependencies. It 
will not be possible to install/update any other modules until this situation 
is fixed.]]></MSGTEXT>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--54914ED3F566442D8BE408DA1B8A8855-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--54914ED3F566442D8BE408DA1B8A8855--></AD_MESSAGE>
+
 <!--550B591157934DF9BB724C6BB77EBA9B--><AD_MESSAGE>
 <!--550B591157934DF9BB724C6BB77EBA9B-->  
<AD_MESSAGE_ID><![CDATA[550B591157934DF9BB724C6BB77EBA9B]]></AD_MESSAGE_ID>
 <!--550B591157934DF9BB724C6BB77EBA9B-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -19216,6 +19228,18 @@
 <!--5A28BAA7FC0A06FAE040007F01000F92-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--5A28BAA7FC0A06FAE040007F01000F92--></AD_MESSAGE>
 
+<!--5B27965536AF40C98FC886033F10EB65--><AD_MESSAGE>
+<!--5B27965536AF40C98FC886033F10EB65-->  
<AD_MESSAGE_ID><![CDATA[5B27965536AF40C98FC886033F10EB65]]></AD_MESSAGE_ID>
+<!--5B27965536AF40C98FC886033F10EB65-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5B27965536AF40C98FC886033F10EB65-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5B27965536AF40C98FC886033F10EB65-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5B27965536AF40C98FC886033F10EB65-->  
<VALUE><![CDATA[ModuleLocalDepErrorsTitle]]></VALUE>
+<!--5B27965536AF40C98FC886033F10EB65-->  <MSGTEXT><![CDATA[Dependency Errors 
in Installed Modules]]></MSGTEXT>
+<!--5B27965536AF40C98FC886033F10EB65-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--5B27965536AF40C98FC886033F10EB65-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5B27965536AF40C98FC886033F10EB65-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--5B27965536AF40C98FC886033F10EB65--></AD_MESSAGE>
+
 <!--5BBAF581EEC94A11BB175D2398CE0B76--><AD_MESSAGE>
 <!--5BBAF581EEC94A11BB175D2398CE0B76-->  
<AD_MESSAGE_ID><![CDATA[5BBAF581EEC94A11BB175D2398CE0B76]]></AD_MESSAGE_ID>
 <!--5BBAF581EEC94A11BB175D2398CE0B76-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 552e87ea78fc -r a9cb2adbb872 
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Wed Mar 
05 15:08:44 2014 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Wed Mar 
05 16:27:13 2014 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -41,6 +41,8 @@
 
 import org.apache.commons.dbcp.BasicDataSource;
 import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.ddlutils.Platform;
 import org.apache.ddlutils.PlatformFactory;
 import org.apache.ddlutils.model.Database;
@@ -83,6 +85,7 @@
 import org.openbravo.erpCommon.utility.NavigationBar;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.OBErrorBuilder;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.erpCommon.utility.SQLReturnObject;
 import org.openbravo.erpCommon.utility.ToolBar;
 import org.openbravo.erpCommon.utility.Utility;
@@ -1294,6 +1297,37 @@
         message = im.getCheckError();
         discard[5] = "discardContinue";
 
+        if (!islocal) {
+          // installing/updating a module from CR. Let's check if local 
dependencies are OK
+          boolean locallyOk = true;
+          OBError localDepsMsg = new OBError();
+          try {
+            locallyOk = VersionUtility.checkLocal(vars, new Module[0], new 
Module[0],
+                new Module[0], localDepsMsg);
+          } catch (Exception e) {
+            log4j.error("Error checking local dependencies", e);
+          }
+
+          if (!locallyOk) {
+            if (!StringUtils.isEmpty(localDepsMsg.getMessage())) {
+              String localErrorsMsg = "<br><b>"
+                  + OBMessageUtils.messageBD("ModuleLocalDepErrorsTitle") + 
"</b><br>"
+                  + OBMessageUtils.messageBD("ModuleLocalDepErrorsExplain") + 
"<ul>";
+              for (String localError : localDepsMsg.getMessage().split("\\n")) 
{
+                localErrorsMsg += "<li>" + 
StringEscapeUtils.escapeHtml(localError);
+              }
+              localErrorsMsg += "</ul>";
+
+              if (message == null || message.getMessage() == null || 
message.getMessage().isEmpty()) {
+                message = localDepsMsg;
+                message.setMessage(localErrorsMsg);
+              } else {
+                message.setMessage(message.getMessage() + "<br>" + 
localErrorsMsg);
+              }
+            }
+          }
+        }
+
         if (message == null || message.getMessage() == null || 
message.getMessage().isEmpty()) {
           // No message: set generic one
           message = new OBError();

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to