details: http://code.openbravo.com/erp/devel/pi/rev/86b6a904958a changeset: 4610:86b6a904958a user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Aug 14 18:27:49 2009 +0200 summary: fixed NPE when trying to activate an instance which license is not active yet
diffstat: src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html | 10 ++++++++++ src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java | 12 +++++++++--- src/org/openbravo/erpCommon/obps/ActivationKey.java | 8 ++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diffs (110 lines): diff -r 8b660ee052d1 -r 86b6a904958a src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html --- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html Fri Aug 14 14:30:04 2009 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html Fri Aug 14 18:27:49 2009 +0200 @@ -265,6 +265,9 @@ <td id="OPSActive" colspan="5" class="TitleCell" style="text-align:left;"> <span class="Label_ReadOnly_Text" ><span style="color:green;">Active</span>.<span id="OPSExpirationTime"> You have <span id="OPSdaysLeft">xx</span> days left before your <a class="LabelLink_noicon" href="http://www.openbravo.com/network" target="_blank">Openbravo Professional Subscription</a> expires.</span></span> </td> + <td id="OPSNoActiveYet" colspan="5" class="TitleCell" style="text-align:left;"> + <span class="Label_ReadOnly_Text" ><span style="color:red;">No Active Yet</span>.</span> + </td> <td id="OPSExpired" colspan="5" class="TitleCell" style="text-align:left;"> <p class="Label_ReadOnly_Text"><span class="Label_ReadOnly_Text" ><span style="color:red;">Expired</span>.</p> <p class="Label_ReadOnly_Text"><span id="OPSExpirationTime">You need to renew the System’s Openbravo Professional Subscription. Users will not be able to login, until you do so.</span></p> @@ -334,6 +337,11 @@ <p class="Label_ReadOnly_Text">If you are connected to the Internet, you can do so online.</p> <p class="Label_ReadOnly_Text">Otherwise, you need to provide a new Activation File that can be downloaded from <a class="LabelLink_noicon" href="http://butler.openbravo.com/heartbeat-server/DownloadActivationKey.html" target="_blank">Openbravo Butler</a>.</p> </span> + <span id="OPSNoActiveYet" class="Label_ReadOnly_Text" > + <p class="Label_ReadOnly_Text">If you have changed your subscription details, the Activation must be refreshed for them to be in place.</p> + <p class="Label_ReadOnly_Text">If you are connected to the Internet, you can do so online.</p> + <p class="Label_ReadOnly_Text">Otherwise, you need to provide a new Activation File that can be downloaded from <a class="LabelLink_noicon" href="http://butler.openbravo.com/heartbeat-server/DownloadActivationKey.html" target="_blank">Openbravo Butler</a>.</p> + </span> <span id="OPSExpired" class="Label_ReadOnly_Text" > <p class="Label_ReadOnly_Text">To reactivate an expired Professional Subscription, you need to refresh your Activation File.</p> <p class="Label_ReadOnly_Text">If you are connected to the Internet, you can do so online.</p> @@ -366,6 +374,7 @@ <td class="Button_left"><img class="Button_Icon Button_Icon" alt="Browse File System" title="Browse File System" src="../../../../../web/images/blank.gif" border="0" /></td> <td class="Button_text" id="CEInstance">Activate Online</td> <td class="Button_text" id="OPSActive">Refresh Online</td> + <td class="Button_text" id="OPSNoActiveYet">Refresh Online</td> <td class="Button_text" id="OPSExpired">Reactivate Online</td> <td class="Button_right"></td> </tr> @@ -393,6 +402,7 @@ <td class="Button_left"><img class="Button_Icon Button_Icon" alt="Browse File System" title="Browse File System" src="../../../../../web/images/blank.gif" border="0" /></td> <td class="Button_text" id="CEInstance">Activate with Activation File</td> <td class="Button_text" id="OPSActive">Refresh with Activation File</td> + <td class="Button_text" id="OPSNoActiveYet">Refresh with Activation File</td> <td class="Button_text" id="OPSExpired">Reactivate with Activation File</td> <td class="Button_right"></td> </tr> diff -r 8b660ee052d1 -r 86b6a904958a src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java --- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java Fri Aug 14 14:30:04 2009 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java Fri Aug 14 18:27:49 2009 +0200 @@ -186,16 +186,22 @@ discard[0] = "CEInstance"; if (activationKey.hasExpired()) { discard[1] = "OPSActive"; + discard[2] = "OPSNoActiveYet"; + } else if (activationKey.isNotActiveYet()) { + discard[1] = "OPSExpired"; + discard[2] = "OPSActive"; } else { discard[1] = "OPSExpired"; if (!activationKey.hasExpirationDate()) { discard[2] = "OPSExpirationTime"; } + discard[3] = "OPSNoActiveYet"; } } else { discard[0] = "OPSInstance"; discard[1] = "OPSActive"; discard[2] = "OPSExpired"; + discard[3] = "OPSNoActiveYet"; } XmlDocument xmlDocument = xmlEngine.readXmlTemplate( @@ -252,9 +258,9 @@ else xmlDocument.setParameter("instanceInfo", activationKey.toString(this, vars.getLanguage())); - if (activationKey.hasExpirationDate()) { - xmlDocument.setParameter("OPSdaysLeft", activationKey.getPendingDays().toString()); - } + // if (activationKey.hasExpirationDate()) { + // xmlDocument.setParameter("OPSdaysLeft", activationKey.getPendingDays().toString()); + // } PrintWriter out = response.getWriter(); out.println(xmlDocument.print()); out.close(); diff -r 8b660ee052d1 -r 86b6a904958a src/org/openbravo/erpCommon/obps/ActivationKey.java --- a/src/org/openbravo/erpCommon/obps/ActivationKey.java Fri Aug 14 14:30:04 2009 +0200 +++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java Fri Aug 14 18:27:49 2009 +0200 @@ -60,6 +60,8 @@ private Long pendingTime; private boolean hasExpired = false; + private boolean notActiveYet = false; + public enum LicenseRestriction { NO_RESTRICTION, OPS_INSTANCE_NOT_ACTIVE, NUMBER_OF_SOFT_USERS_REACHED, NUMBER_OF_CONCURRENT_USERS_REACHED } @@ -164,6 +166,7 @@ Date now = new Date(); if (startDate == null || now.before(startDate)) { isActive = false; + notActiveYet = true; errorMessage = "@OPSNotActiveTill@ " + startDate; setLogger(); return; @@ -375,4 +378,9 @@ return hasExpired; } + public boolean isNotActiveYet() { + + return notActiveYet; + } + } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits