details:   /erp/devel/pi/rev/8abd2ad43256
changeset: 6957:8abd2ad43256
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu Apr 08 14:10:42 2010 +0200
summary:   Buy out option for OBPS instances

diffstat:

 src-db/database/sourcedata/AD_TEXTINTERFACES.xml             |  11 +++
 src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html |   7 +-
 src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java |  30 ++++++--
 src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java   |  18 +++--
 src/org/openbravo/erpCommon/obps/ActivationKey.java          |  39 ++++++++---
 5 files changed, 76 insertions(+), 29 deletions(-)

diffs (275 lines):

diff -r c56bf3953565 -r 8abd2ad43256 
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml  Thu Apr 08 09:47:48 
2010 +0200
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml  Thu Apr 08 14:10:42 
2010 +0200
@@ -20663,6 +20663,17 @@
 <!--83A34A4C0D067671E040007F010125A3-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--83A34A4C0D067671E040007F010125A3--></AD_TEXTINTERFACES>
 
+<!--83B5190C0B3C56C7E040007F01013254--><AD_TEXTINTERFACES>
+<!--83B5190C0B3C56C7E040007F01013254-->  
<AD_TEXTINTERFACES_ID><![CDATA[83B5190C0B3C56C7E040007F01013254]]></AD_TEXTINTERFACES_ID>
+<!--83B5190C0B3C56C7E040007F01013254-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--83B5190C0B3C56C7E040007F01013254-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--83B5190C0B3C56C7E040007F01013254-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--83B5190C0B3C56C7E040007F01013254-->  <TEXT><![CDATA[Subscription 
Converted]]></TEXT>
+<!--83B5190C0B3C56C7E040007F01013254-->  
<FILENAME><![CDATA[/org/openbravo/erpCommon/ad_forms/InstanceManagement.html]]></FILENAME>
+<!--83B5190C0B3C56C7E040007F01013254-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--83B5190C0B3C56C7E040007F01013254-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--83B5190C0B3C56C7E040007F01013254--></AD_TEXTINTERFACES>
+
 <!--8774D7A6B6394D45BCDBF20FE4B98832--><AD_TEXTINTERFACES>
 <!--8774D7A6B6394D45BCDBF20FE4B98832-->  
<AD_TEXTINTERFACES_ID><![CDATA[8774D7A6B6394D45BCDBF20FE4B98832]]></AD_TEXTINTERFACES_ID>
 <!--8774D7A6B6394D45BCDBF20FE4B98832-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r c56bf3953565 -r 8abd2ad43256 
src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html
--- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html      Thu Apr 
08 09:47:48 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html      Thu Apr 
08 14:10:42 2010 +0200
@@ -13,7 +13,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) 2009 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -262,9 +262,12 @@
                  <td class="TitleCell">
                     <span class="LabelText">Subscription Status</span>
                   </td>
-                  <td id="OPSActive" colspan="5" class="TitleCell" 
style="text-align:left;">
+                  <td id="OPSActiveTitle" colspan="5" class="TitleCell" 
style="text-align:left;">
                     <span class="Label_ReadOnly_Text" id="subStatus"><span 
style="color:green;" id="subStatus_active">Active</span>.<span 
id="OPSExpirationTime">&nbsp;You have&nbsp;<span 
id="OPSdaysLeft">xx</span>&nbsp;days left before your&nbsp;<a 
class="LabelLink_noicon" href="http://www.openbravo.com/network"; 
target="_blank">Openbravo Professional 
Subscription</a>&nbsp;expires.</span></span>
                   </td>
+                  <td id="OPSConverted" colspan="5" class="TitleCell" 
style="text-align:left;">
+                    <span class="Label_ReadOnly_Text" id="subStatus"><span 
style="color:orange;" id="subStatus_active">Subscription 
Converted</span>.</span>
+                  </td>
                   <td id="OPSNoActiveYet" colspan="5" class="TitleCell" 
style="text-align:left;">
                     <span class="Label_ReadOnly_Text" id="subStatus"><span 
style="color:red;" id="subStatus_unactive">No Active Yet</span>.</span>
                   </td>
diff -r c56bf3953565 -r 8abd2ad43256 
src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java      Thu Apr 
08 09:47:48 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java      Thu Apr 
08 14:10:42 2010 +0200
@@ -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) 2009 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -181,27 +181,38 @@
   private void printPageActive(HttpServletResponse response, 
VariablesSecureApp vars,
       ActivationKey activationKey) throws IOException, ServletException {
     response.setContentType("text/html; charset=UTF-8");
-    String discard[] = { "", "", "", "" };
+    String discard[] = { "", "", "", "", "", "" };
     if (activationKey.isOPSInstance()) {
       discard[0] = "CEInstance";
-      if (activationKey.hasExpired()) {
-        discard[1] = "OPSActive";
+      if (activationKey.isSubscriptionConverted()) {
+        discard[1] = "OPSActiveTitle";
+        discard[2] = "OPSExpired";
+        discard[3] = "OPSNoActiveYet";
+      } else if (activationKey.hasExpired()) {
+        discard[1] = "OPSActiveTitle";
         discard[2] = "OPSNoActiveYet";
+        discard[3] = "OPSConverted";
+        discard[4] = "OPSActive";
       } else if (activationKey.isNotActiveYet()) {
         discard[1] = "OPSExpired";
-        discard[2] = "OPSActive";
+        discard[2] = "OPSActiveTitle";
+        discard[3] = "OPSConverted";
+        discard[4] = "OPSActive";
       } else {
         discard[1] = "OPSExpired";
         if (!activationKey.hasExpirationDate()) {
           discard[2] = "OPSExpirationTime";
         }
-        discard[3] = "OPSNoActiveYet";
+        discard[3] = "OPSConverted";
+        discard[4] = "OPSNoActiveYet";
       }
     } else {
       discard[0] = "OPSInstance";
-      discard[1] = "OPSActive";
+      discard[1] = "OPSActiveTitle";
       discard[2] = "OPSExpired";
-      discard[3] = "OPSNoActiveYet";
+      discard[3] = "OPSConverted";
+      discard[4] = "OPSNoActiveYet";
+      discard[5] = "OPSActive";
     }
 
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
@@ -265,7 +276,8 @@
             vars.getLanguage()).replace("\\n", "\n"));
     }
 
-    String cacheMsg = Utility.messageBD(this, "OUTDATED_FILES_CACHED", 
vars.getLanguage()).replace("\\n", "\n");
+    String cacheMsg = Utility.messageBD(this, "OUTDATED_FILES_CACHED", 
vars.getLanguage()).replace(
+        "\\n", "\n");
     cacheMsg = "var cacheMsg = \"" + cacheMsg + "\"";
     xmlDocument.setParameter("cacheMsg", cacheMsg);
 
diff -r c56bf3953565 -r 8abd2ad43256 
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Thu Apr 
08 09:47:48 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Thu Apr 
08 14:10:42 2010 +0200
@@ -899,20 +899,21 @@
 
       for (Module instMod : im.getModulesToInstall()) {
         if (instMod.getIsCommercial()) {
-          if (!OBPSActiveInstance
-              || ak.isModuleSubscribed(instMod.getModuleID()) == 
CommercialModuleStatus.NO_SUBSCRIBED) {
+          CommercialModuleStatus moduleStatus = 
ak.isModuleSubscribed(instMod.getModuleID());
+          if (!OBPSActiveInstance || moduleStatus == 
CommercialModuleStatus.NO_SUBSCRIBED
+              || moduleStatus == 
CommercialModuleStatus.CONVERTED_SUBSCRIPTION) {
             notAllowedMods.add(instMod);
             if (notSubscribed.length() > 0) {
               notSubscribed += ", ";
             }
             notSubscribed += instMod.getName();
-          } else if (ak.isModuleSubscribed(instMod.getModuleID()) == 
CommercialModuleStatus.EXPIRED) {
+          } else if (moduleStatus == CommercialModuleStatus.EXPIRED) {
             notAllowedMods.add(instMod);
             if (expired.length() > 0) {
               expired += ", ";
             }
             expired += instMod.getName();
-          } else if (ak.isModuleSubscribed(instMod.getModuleID()) == 
CommercialModuleStatus.NO_ACTIVE_YET) {
+          } else if (moduleStatus == CommercialModuleStatus.NO_ACTIVE_YET) {
             notAllowedMods.add(instMod);
             if (notActiveYet.length() > 0) {
               notActiveYet += ", ";
@@ -924,21 +925,22 @@
 
       for (Module updMod : im.getModulesToUpdate()) {
         if (updMod.getIsCommercial()) {
-          if (!OBPSActiveInstance
-              || ak.isModuleSubscribed(updMod.getModuleID()) == 
CommercialModuleStatus.NO_SUBSCRIBED) {
+          CommercialModuleStatus moduleStatus = 
ak.isModuleSubscribed(updMod.getModuleID());
+          if (!OBPSActiveInstance || moduleStatus == 
CommercialModuleStatus.NO_SUBSCRIBED
+              || moduleStatus == 
CommercialModuleStatus.CONVERTED_SUBSCRIPTION) {
             notAllowedMods.add(updMod);
             if (notSubscribed.length() > 0) {
               notSubscribed += ", ";
             }
             notSubscribed += updMod.getName();
 
-          } else if (ak.isModuleSubscribed(updMod.getModuleID()) == 
CommercialModuleStatus.EXPIRED) {
+          } else if (moduleStatus == CommercialModuleStatus.EXPIRED) {
             notAllowedMods.add(updMod);
             if (expired.length() > 0) {
               expired += ", ";
             }
             expired += updMod.getName();
-          } else if (ak.isModuleSubscribed(updMod.getModuleID()) == 
CommercialModuleStatus.NO_ACTIVE_YET) {
+          } else if (moduleStatus == CommercialModuleStatus.NO_ACTIVE_YET) {
             notAllowedMods.add(updMod);
             if (notActiveYet.length() > 0) {
               notActiveYet += ", ";
diff -r c56bf3953565 -r 8abd2ad43256 
src/org/openbravo/erpCommon/obps/ActivationKey.java
--- a/src/org/openbravo/erpCommon/obps/ActivationKey.java       Thu Apr 08 
09:47:48 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java       Thu Apr 08 
14:10:42 2010 +0200
@@ -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) 2009 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -68,6 +68,8 @@
   private static String opsLogId;
   private Long pendingTime;
   private boolean hasExpired = false;
+  private boolean subscriptionConvertedProperty = false;
+  private boolean subscriptionActuallyConverted = false;
 
   private boolean notActiveYet = false;
 
@@ -78,7 +80,7 @@
   }
 
   public enum CommercialModuleStatus {
-    NO_SUBSCRIBED, ACTIVE, EXPIRED, NO_ACTIVE_YET
+    NO_SUBSCRIBED, ACTIVE, EXPIRED, NO_ACTIVE_YET, CONVERTED_SUBSCRIPTION
   }
 
   private static final int MILLSECS_PER_DAY = 24 * 60 * 60 * 1000;
@@ -167,6 +169,8 @@
     Date startDate = null;
     Date endDate = null;
 
+    subscriptionConvertedProperty = 
"true".equals(getProperty("subscriptionConverted"));
+
     try {
       startDate = sd.parse(getProperty("startdate"));
 
@@ -195,13 +199,18 @@
     if (endDate != null) {
       pendingTime = ((endDate.getTime() - now.getTime()) / MILLSECS_PER_DAY) + 
1;
       if (now.after(endDate)) {
-        isActive = false;
-        hasExpired = true;
+        if (subscriptionConvertedProperty) {
+          // A bought out instance is actually converted when the license has 
expired.
+          subscriptionActuallyConverted = true;
+        } else {
+          isActive = false;
+          hasExpired = true;
 
-        errorMessage = "@OPSActivationExpired@ " + 
outputFormat.format(endDate);
+          errorMessage = "@OPSActivationExpired@ " + 
outputFormat.format(endDate);
 
-        setLogger();
-        return;
+          setLogger();
+          return;
+        }
       }
     }
     isActive = true;
@@ -508,6 +517,10 @@
     return pendingTime;
   }
 
+  public boolean isSubscriptionConverted() {
+    return subscriptionConvertedProperty;
+  }
+
   public boolean hasExpired() {
     return hasExpired;
   }
@@ -517,7 +530,7 @@
   }
 
   /**
-   * Obtains a List of all the modules that are installed in the instace which 
licenses has expired.
+   * Obtains a List of all the modules that are installed in the instance 
which license has expired.
    * 
    * @return List of the expired modules
    */
@@ -562,12 +575,18 @@
         if (moduleData.length > 2) {
           validTo = sd.parse(moduleData[2]);
         }
-        if (validFrom.before(now) && (validTo == null || validTo.after(now))) {
+        if (subscriptionActuallyConverted) {
+          moduleList.put(moduleData[0], 
CommercialModuleStatus.CONVERTED_SUBSCRIPTION);
+        } else if (validFrom.before(now) && (validTo == null || 
validTo.after(now))) {
           moduleList.put(moduleData[0], CommercialModuleStatus.ACTIVE);
         } else if (validFrom.after(now)) {
           moduleList.put(moduleData[0], CommercialModuleStatus.NO_ACTIVE_YET);
         } else if (validTo != null && validTo.before(now)) {
-          moduleList.put(moduleData[0], CommercialModuleStatus.EXPIRED);
+          if (subscriptionConvertedProperty) {
+            moduleList.put(moduleData[0], 
CommercialModuleStatus.CONVERTED_SUBSCRIPTION);
+          } else {
+            moduleList.put(moduleData[0], CommercialModuleStatus.EXPIRED);
+          }
         }
       } catch (Exception e) {
         log.error("Error reading module's dates module:" + moduleData[0], e);

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to