details: /erp/devel/main/rev/65e186ea7da3
changeset: 8255:65e186ea7da3
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Mon Aug 23 13:41:08 2010 +0200
summary: Fixes issue 14262: Fixes module update when hearbeat is not active
The flow when updating a module (e.g. core) is to enable heartbeat first (if
is not active), then after a successfull activation the flow is returned to
the Module Management window. This flow redirection was sending a INSTALL
command so the execution flow was changed, and a NPE was thrown.
diffstat:
src/org/openbravo/erpCommon/ad_forms/Heartbeat.java | 9 +++++----
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java | 1 +
src/org/openbravo/erpCommon/ad_process/TestHeartbeat.java | 13 +++++++------
3 files changed, 13 insertions(+), 10 deletions(-)
diffs (83 lines):
diff -r eedf97667060 -r 65e186ea7da3
src/org/openbravo/erpCommon/ad_forms/Heartbeat.java
--- a/src/org/openbravo/erpCommon/ad_forms/Heartbeat.java Fri Aug 20
22:06:28 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/Heartbeat.java Mon Aug 23
13:41:08 2010 +0200
@@ -65,7 +65,7 @@
if (vars.commandIn("DEFAULT", "DEFAULT_MODULE", "UPDATE_MODULE")) {
printPageDataSheet(response, vars);
- } else if (vars.commandIn("CONFIGURE", "CONFIGURE_MODULE")) {
+ } else if (vars.commandIn("CONFIGURE", "CONFIGURE_MODULE_UPDATE",
"CONFIGURE_MODULE_INSTALL")) {
response.sendRedirect(strDireccion +
"/ad_process/TestHeartbeat.html?Command="
+ vars.getCommand() + "&inpcRecordId="
+ vars.getStringParameter("inpcRecordId", IsIDFilter.instance));
@@ -100,7 +100,8 @@
if (vars.commandIn("DEFAULT")) {
jsCommand += "CONFIGURE";
} else {
- jsCommand += "CONFIGURE_MODULE";
+ String moduleAction = vars.getCommand().equals("UPDATE_MODULE") ?
"UPDATE" : "INSTALL";
+ jsCommand += "CONFIGURE_MODULE_" + moduleAction;
}
jsCommand += "';";
xmlDocument.setParameter("cmd", jsCommand);
@@ -121,8 +122,8 @@
final Date today = new Date();
if ((rPostponeDate == null || rPostponeDate.equals("")) ||
date.before(today)) {
final String openRegistrationString = "\n function
openRegistration() { "
- + "\n var w = window.opener; " + "\n if(w) { " + "\n
w.setTimeout(\"openRegistration();\",100); "
- + "\n } " + "\n return true; \n }";
+ + "\n var w = window.opener; " + "\n if(w) { "
+ + "\n w.setTimeout(\"openRegistration();\",100); " + "\n } " +
"\n return true; \n }";
xmlDocument.setParameter("registration", openRegistrationString);
} else {
xmlDocument.setParameter("registration",
diff -r eedf97667060 -r 65e186ea7da3
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java Fri Aug
20 22:06:28 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java Mon Aug
23 13:41:08 2010 +0200
@@ -653,6 +653,7 @@
response.sendRedirect(strDireccion + "/ad_forms/Heartbeat.html?Command="
+ command
+ "_MODULE&inpcRecordId=" + inpcRecordId);
+ return;
}
if (!islocal && (updateModules == null || updateModules.length == 0)) {
diff -r eedf97667060 -r 65e186ea7da3
src/org/openbravo/erpCommon/ad_process/TestHeartbeat.java
--- a/src/org/openbravo/erpCommon/ad_process/TestHeartbeat.java Fri Aug 20
22:06:28 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/TestHeartbeat.java Mon Aug 23
13:41:08 2010 +0200
@@ -153,7 +153,7 @@
msg += "\n" + log;
msg = Utility.formatMessageBDToHtml(msg);
- if (vars.commandIn("CONFIGURE", "CONFIGURE_MODULE")) {
+ if (vars.commandIn("CONFIGURE", "CONFIGURE_MODULE_INSTALL",
"CONFIGURE_MODULE_UPDATE")) {
OBError err = new OBError();
err.setType("Error");
err.setMessage(msg);
@@ -216,20 +216,21 @@
OBScheduler.getInstance().reschedule(pr.getId(), bundle2);
}
- if (vars.commandIn("CONFIGURE_MODULE")) {
+ if (vars.commandIn("CONFIGURE_MODULE_INSTALL",
"CONFIGURE_MODULE_UPDATE")) {
// Continue with the module install
String recordId = vars.getStringParameter("inpcRecordId",
IsIDFilter.instance);
- String command = "INSTALL";
+ String command = vars.getCommand().endsWith("UPDATE") ? "UPDATE" :
"INSTALL";
- if (recordId.equals(ModuleManagement.UPDATE_ALL_RECORD_ID)) {
- command = "UPDATE";
- recordId = "&inpcUpdate=all";
+ if (command.equals("UPDATE")) {
+ recordId = (recordId.equals(ModuleManagement.UPDATE_ALL_RECORD_ID)
? "&inpcUpdate=all"
+ : "&inpcUpdate=" + recordId);
} else {
recordId = "&inpcRecordId=" + recordId;
}
response.sendRedirect(strDireccion +
"/ad_forms/ModuleManagement.html?Command=" + command
+ recordId);
+ return;
} else {
// Prompt HB configured
String msg = Utility.messageBD(connectionProvider, "HB_SUCCESS",
vars.getLanguage());
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits