details: https://code.openbravo.com/erp/devel/pi/rev/96cf2a09397d
changeset: 13155:96cf2a09397d
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Thu Jul 14 14:12:30 2011 +0200
summary: fixed bug 17986: StackOverflow trying to install a commercial not
subscribed module
diffstat:
src/org/openbravo/erpCommon/obps/ActivationKey.java | 14 ++++++++++++-
src/org/openbravo/erpCommon/obps/ActiveInstanceProcess.java | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
diffs (55 lines):
diff -r 8b477943b87d -r 96cf2a09397d
src/org/openbravo/erpCommon/obps/ActivationKey.java
--- a/src/org/openbravo/erpCommon/obps/ActivationKey.java Thu Jul 14
12:22:38 2011 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java Thu Jul 14
14:12:30 2011 +0200
@@ -875,11 +875,19 @@
* @return the status for the commercial module passed as parameter
*/
public CommercialModuleStatus isModuleSubscribed(String moduleId) {
+ return isModuleSubscribed(moduleId, true);
+ }
+
+ private CommercialModuleStatus isModuleSubscribed(String moduleId, boolean
refreshIfNeeded) {
HashMap<String, CommercialModuleStatus> moduleList =
getSubscribedModules();
if (!moduleList.containsKey(moduleId)) {
log4j.debug("Module " + moduleId + " is not in the list of subscribed
modules");
+ if (!refreshIfNeeded) {
+ return CommercialModuleStatus.NO_SUBSCRIBED;
+ }
+
Date timeToRefresh = null;
if (lastRefreshTime != null) {
Calendar calendar = Calendar.getInstance();
@@ -1036,6 +1044,10 @@
* @return List of non allowed modules
*/
public String verifyInstalledModules() {
+ return verifyInstalledModules(true);
+ }
+
+ String verifyInstalledModules(boolean refreshIfneeded) {
String rt = "";
OBContext.setAdminMode();
@@ -1047,7 +1059,7 @@
mods.add(Restrictions.eq(Module.PROPERTY_INDEVELOPMENT, false));
mods.addOrder(Order.asc(Module.PROPERTY_NAME));
for (Module mod : mods.list()) {
- if (isModuleSubscribed(mod.getId()) ==
CommercialModuleStatus.NO_SUBSCRIBED) {
+ if (isModuleSubscribed(mod.getId(), refreshIfneeded) ==
CommercialModuleStatus.NO_SUBSCRIBED) {
rt += (rt.isEmpty() ? "" : ", ") + mod.getName();
}
}
diff -r 8b477943b87d -r 96cf2a09397d
src/org/openbravo/erpCommon/obps/ActiveInstanceProcess.java
--- a/src/org/openbravo/erpCommon/obps/ActiveInstanceProcess.java Thu Jul
14 12:22:38 2011 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActiveInstanceProcess.java Thu Jul
14 14:12:30 2011 +0200
@@ -70,7 +70,7 @@
SystemInformation sysInfo =
OBDal.getInstance().get(SystemInformation.class, "0");
sysInfo.setInstancePurpose(purpose);
ActivationKey ak = new ActivationKey(publicKey, result[1]);
- String nonAllowedMods = ak.verifyInstalledModules();
+ String nonAllowedMods = ak.verifyInstalledModules(false);
if (!nonAllowedMods.isEmpty()) {
msg.setType("Error");
msg.setMessage("@LicenseWithoutAccessTo@ " + nonAllowedMods);
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits