Merge back Licenses project
authorAsier Lostalé <asier.lostale@openbravo.com>
Wed, 11 Aug 2010 09:24:06 +0200
changeset 8107 a45ffdf7b265
parent 8054 944c7f78b12f (current diff)
parent 8106 401aaff3c6f6 (diff)
child 8108 ee9b46697db3
Merge back Licenses project
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_REFERENCE.xml
src-db/database/sourcedata/AD_REF_LIST.xml
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
src/org/openbravo/erpCommon/modules/ImportModule.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/licenseRestrictions	Wed Aug 11 09:24:06 2010 +0200
@@ -0,0 +1,1 @@
+IeqpfXkoobemyDLAJHNBi3JrTdjgnU0BnGiX9k78CBHK1Eqdek/Lsi/HpeBev9c8sNQPOf9nwq8jWE4j7X4e6TUzdPX5xukYcTshjeB3wKh9Y6LE5rgEw+OqUm8bcaKH6Nm5Efg2yQnwsHqqTyjFQPXa9IdijkazSRrAEVg/X0WPMPEYYQRikHlz1CDJPiqEeQIhMejebxNmHa/VTLN5Hmhc+lyBfRVseGdJeJaf2Nh1YMwunKFAGMNKwPFFhqLyAXoGsNFs2BK5yPTgOEWaFRS+5Dei4fewUm7GI5k+a4xZ1qDrjYl+C/p6vod1oYf+KFsfH1P07v2k7J4VQ71XBANYXXDM81bgEWZJzz5F9mhUtabroQdejQdcTqGQPpX2ZOhmEfgelzN7WINpIF8rQHiMeVty8m3TG+zSTkc/Tj53UJaV8mjZ+cWSUAI7PFwIDbxeUcktfwV85yzpxAxu6Fln6h6fpxlmzy3DYhjBNTpMKYmjJX0ilomTCAivh31pfCMDOkoLwMmDQoov/bCPJfLej9RlhmC0Y1EswNL/IAbuINX3DNk2+G8i7yXUOE6FsUtDJ6WdVhSKw0BvCH/28oJ38rfx3aCcuLHjAJI23L5RjlQlqnVsGOZsDeJ5UWQGeBotYJWdfz1mSRAiPB4RE6dv9Ap0X90Y0MDYrJP2jW2FmIrY1R5UTh2XcvAomsToZdwLrolZIWe26RIn1yYRpGEf2wqg5sGQaOxQ39BB11Xhj2bzz96mnnqSP6GZiv52/cibVcp8VtErmClvF4OByPuKsswTUD8Fs9FYMNv+myfJ928PxuHmpjT99igMw7NNtbSD+lPckVSM9kKvUIuWxUgnSaly9FG2oP1DM2alkI9Vdc77EHW8Vjz5eID0EjM04rDKNvsbJygMCPF3XWaA2rpnUgcRB5Or0lCDe/z/zOoWK3p9N19TguH8y74cl0xd+jpkdfqfVEyUxqtTIG4/+0DZ8+VzPmOPArrFM51piby1Ym2L/J3Uuugiw1r8+RpRVdiTMLHKbe15KpuECf8W9KMpaYc7hzXo94aJXKvWuui1Y1vcrJhAXdN0ib8Wjz8473ecV/STAt5njB4dJiSjBfek+JYeXZz/Ft/fkPlvzW1DVbHx9RCmu068DWefuNvWMqJLr69pKCrea8PZXBJpit9tx/JSj454C1FOwigR+qsi24FOaaQ5Zy6m3VReW0cZ+9sQXLDwkjOfjvzJPFQ9A7kDTYOYzorjHPbCwy0JyXAxkHQ+wlV5+52WeM9uiTxAWtoyqcr+OhBb1btFqiaDhetH6LqxcGXm+0iLckp+cu4FY2t4eYY81PRKBUUCrdh8N0+N68P8XMht4rWIzeRzLVlY1PnFz0BDZa6IecwK2egOPmlH+xG8uhOYgIbbUE7nhcz8b1MDllGTOpTSG1e9UDJj8wBTWzeVIrVpJRztWjldY45skuAohNh7PxxDubeUv7701GVBqlg1mO2rb19evzDAMLUHF4i5exoWEy9uQqrF/qMT+W4I0zwJbgFHTs1HIpgQelm/gSysdnbnbQs14YceXv+BYMYurafh7N2lkUMnmkVkHpPk/08R0hCeOtKjkbSUCuOy9XPg153iJmxE3NCBeZl/gY2mmsMNtaswMEN05HKSkRqlu/CKedv/HrYYhXtdbaqkL8Ay0mcRtXimQCvr3aNQ9fcQLuLpmqJh5Uo=
\ No newline at end of file
--- a/src-db/database/model/tables/AD_MODULE.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/model/tables/AD_MODULE.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -145,6 +145,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="COMMERCIAL_TIER" primaryKey="false" required="true" type="VARCHAR" size="60" autoIncrement="false">
+        <default><![CDATA[NA]]></default>
+        <onCreateDefault><![CDATA[CASE WHEN ISCOMMERCIAL='N' THEN 'NA' ELSE '1' END]]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="AD_MODULE_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/src-db/database/model/tables/AD_MODULE_INSTALL.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/model/tables/AD_MODULE_INSTALL.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -145,6 +145,10 @@
         <default><![CDATA[N]]></default>
         <onCreateDefault><![CDATA['N']]></onCreateDefault>
       </column>
+      <column name="COMMERCIAL_TIER" primaryKey="false" required="true" type="VARCHAR" size="60" autoIncrement="false">
+        <default><![CDATA[NA]]></default>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="AD_MODULE_INSTALL_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/src-db/database/model/triggers/AD_MODULE_VERSION_TRG.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/model/triggers/AD_MODULE_VERSION_TRG.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -15,7 +15,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):  Valery Lezhebokov.
 ************************************************************************/
@@ -29,6 +29,16 @@
     
     IF AD_isTriggerEnabled()='N' THEN RETURN;
     END IF;
+    
+    IF UPDATING THEN
+      IF :new.IsCommercial = 'N' and :old.IsCommercial ='Y' THEN
+        :new.commercial_Tier := 'NA';
+      END IF;
+    END IF;
+    
+    IF :new.IsCommercial='Y' AND :new.commercial_Tier NOT IN ('1','2') THEN
+      RAISE_APPLICATION_ERROR(-20000, '@AD_MODULE_TIER_CHK@');
+    END IF;
 
     IF instr(:new.VERSION,'.') <= 0 OR instr(:new.VERSION,'.',1,2) <= 0 OR instr(:new.VERSION,'.',1,3) > 0 THEN
        RAISE_APPLICATION_ERROR(-20104, 'The version has to be formatted like x.y.z where x, y and z are integers.');
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -305722,6 +305722,80 @@
 <!--8BB9DE42018E7689E040007F010120AF-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--8BB9DE42018E7689E040007F010120AF--></AD_COLUMN>
 
+<!--8BCFEC1D2692D1A8E040007F010135A9--><AD_COLUMN>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_COLUMN_ID><![CDATA[8BCFEC1D2692D1A8E040007F010135A9]]></AD_COLUMN_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <NAME><![CDATA[Tier]]></NAME>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <DESCRIPTION><![CDATA[Tier for commercial modules]]></DESCRIPTION>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <HELP><![CDATA[Commercial modules are defined in different tiers:
+1st Tier: The module can be installed in any Professional instance that has bought the module.
+2nd Tier: The module can be installed in Standard Professional Edition instances that have bought it.]]></HELP>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <COLUMNNAME><![CDATA[Commercial_Tier]]></COLUMNNAME>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_TABLE_ID><![CDATA[9D36D488605044F5A0264D7C8B916657]]></AD_TABLE_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_REFERENCE_ID><![CDATA[17]]></AD_REFERENCE_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_REFERENCE_VALUE_ID><![CDATA[4452E6997DD14363AB4387B06939871A]]></AD_REFERENCE_VALUE_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <DEFAULTVALUE><![CDATA[NA]]></DEFAULTVALUE>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <SEQNO><![CDATA[400]]></SEQNO>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_ELEMENT_ID><![CDATA[8BCFEC1D2693D1A8E040007F010135A9]]></AD_ELEMENT_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <POSITION><![CDATA[37]]></POSITION>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--8BCFEC1D2692D1A8E040007F010135A9-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--8BCFEC1D2692D1A8E040007F010135A9--></AD_COLUMN>
+
+<!--8BD0E076B9695E1BE040007F01013C3C--><AD_COLUMN>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_COLUMN_ID><![CDATA[8BD0E076B9695E1BE040007F01013C3C]]></AD_COLUMN_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <NAME><![CDATA[Tier]]></NAME>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <DESCRIPTION><![CDATA[Tier for commercial modules]]></DESCRIPTION>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <HELP><![CDATA[Commercial modules are defined in different tiers:
+1st Tier: The module can be installed in any Professional instance that has bought the module.
+2nd Tier: The module can be installed in Standard Professional Edition instances that have bought it.]]></HELP>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <COLUMNNAME><![CDATA[Commercial_Tier]]></COLUMNNAME>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_TABLE_ID><![CDATA[8FD3DEA921D74CAFB5D4296A0375E958]]></AD_TABLE_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_REFERENCE_ID><![CDATA[17]]></AD_REFERENCE_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_REFERENCE_VALUE_ID><![CDATA[4452E6997DD14363AB4387B06939871A]]></AD_REFERENCE_VALUE_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <DEFAULTVALUE><![CDATA[NA]]></DEFAULTVALUE>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <SEQNO><![CDATA[370]]></SEQNO>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_ELEMENT_ID><![CDATA[8BCFEC1D2693D1A8E040007F010135A9]]></AD_ELEMENT_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <POSITION><![CDATA[37]]></POSITION>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--8BD0E076B9695E1BE040007F01013C3C-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--8BD0E076B9695E1BE040007F01013C3C--></AD_COLUMN>
+
 <!--8C70144E8ED14107BA4D9C7E358DD9C3--><AD_COLUMN>
 <!--8C70144E8ED14107BA4D9C7E358DD9C3-->  <AD_COLUMN_ID><![CDATA[8C70144E8ED14107BA4D9C7E358DD9C3]]></AD_COLUMN_ID>
 <!--8C70144E8ED14107BA4D9C7E358DD9C3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -24982,7 +24982,7 @@
 <!--7079E2FD4AA8799EE040007F010104AD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--7079E2FD4AA8799EE040007F010104AD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--7079E2FD4AA8799EE040007F010104AD-->  <COLUMNNAME><![CDATA[IsCommercial]]></COLUMNNAME>
-<!--7079E2FD4AA8799EE040007F010104AD-->  <NAME><![CDATA[IsCommercial]]></NAME>
+<!--7079E2FD4AA8799EE040007F010104AD-->  <NAME><![CDATA[Commercial]]></NAME>
 <!--7079E2FD4AA8799EE040007F010104AD-->  <PRINTNAME><![CDATA[Commercial]]></PRINTNAME>
 <!--7079E2FD4AA8799EE040007F010104AD-->  <DESCRIPTION><![CDATA[Commercial Module]]></DESCRIPTION>
 <!--7079E2FD4AA8799EE040007F010104AD-->  <HELP><![CDATA[Commercial modules are only available to Professional Subscription active Instances whereas non commercial ones can be downloaded and installed in Community Edition Instances.
@@ -26769,6 +26769,21 @@
 <!--8B53A1513DB8DD41E040007F01011767-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8B53A1513DB8DD41E040007F01011767--></AD_ELEMENT>
 
+<!--8BCFEC1D2693D1A8E040007F010135A9--><AD_ELEMENT>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <AD_ELEMENT_ID><![CDATA[8BCFEC1D2693D1A8E040007F010135A9]]></AD_ELEMENT_ID>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <COLUMNNAME><![CDATA[Commercial_Tier]]></COLUMNNAME>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <NAME><![CDATA[Tier]]></NAME>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <PRINTNAME><![CDATA[Tier]]></PRINTNAME>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <DESCRIPTION><![CDATA[Tier for commercial modules]]></DESCRIPTION>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <HELP><![CDATA[Commercial modules are defined in different tiers:
+1st Tier: The module can be installed in any Professional instance that has bought the module.
+2nd Tier: The module can be installed in Standard Professional Edition instances that have bought it.]]></HELP>
+<!--8BCFEC1D2693D1A8E040007F010135A9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8BCFEC1D2693D1A8E040007F010135A9--></AD_ELEMENT>
+
 <!--8C84C8C2042BA648E040007F010137E1--><AD_ELEMENT>
 <!--8C84C8C2042BA648E040007F010137E1-->  <AD_ELEMENT_ID><![CDATA[8C84C8C2042BA648E040007F010137E1]]></AD_ELEMENT_ID>
 <!--8C84C8C2042BA648E040007F010137E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -186474,7 +186474,7 @@
 <!--565E666A61B42693E040007F01002851-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--565E666A61B42693E040007F01002851-->  <DISPLAYLENGTH><![CDATA[2000]]></DISPLAYLENGTH>
 <!--565E666A61B42693E040007F01002851-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--565E666A61B42693E040007F01002851-->  <SEQNO><![CDATA[220]]></SEQNO>
+<!--565E666A61B42693E040007F01002851-->  <SEQNO><![CDATA[230]]></SEQNO>
 <!--565E666A61B42693E040007F01002851-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--565E666A61B42693E040007F01002851-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--565E666A61B42693E040007F01002851-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -186543,7 +186543,7 @@
 <!--565E666A61B72693E040007F01002851-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--565E666A61B72693E040007F01002851-->  <DISPLAYLENGTH><![CDATA[300]]></DISPLAYLENGTH>
 <!--565E666A61B72693E040007F01002851-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--565E666A61B72693E040007F01002851-->  <SEQNO><![CDATA[240]]></SEQNO>
+<!--565E666A61B72693E040007F01002851-->  <SEQNO><![CDATA[250]]></SEQNO>
 <!--565E666A61B72693E040007F01002851-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--565E666A61B72693E040007F01002851-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--565E666A61B72693E040007F01002851-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -187024,7 +187024,7 @@
 <!--56EB0A0CAC4FB232E040007F01001BD8-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--56EB0A0CAC4FB232E040007F01001BD8-->  <DISPLAYLENGTH><![CDATA[2000]]></DISPLAYLENGTH>
 <!--56EB0A0CAC4FB232E040007F01001BD8-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--56EB0A0CAC4FB232E040007F01001BD8-->  <SEQNO><![CDATA[230]]></SEQNO>
+<!--56EB0A0CAC4FB232E040007F01001BD8-->  <SEQNO><![CDATA[240]]></SEQNO>
 <!--56EB0A0CAC4FB232E040007F01001BD8-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--56EB0A0CAC4FB232E040007F01001BD8-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--56EB0A0CAC4FB232E040007F01001BD8-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -187486,7 +187486,7 @@
 <!--56EE494063ADD85BE040007F0100423B-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--56EE494063ADD85BE040007F0100423B-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--56EE494063ADD85BE040007F0100423B-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
-<!--56EE494063ADD85BE040007F0100423B-->  <SEQNO><![CDATA[250]]></SEQNO>
+<!--56EE494063ADD85BE040007F0100423B-->  <SEQNO><![CDATA[260]]></SEQNO>
 <!--56EE494063ADD85BE040007F0100423B-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--56EE494063ADD85BE040007F0100423B-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--56EE494063ADD85BE040007F0100423B-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -190742,7 +190742,7 @@
 <!--59D388C6AF9CDD4EE040007F010043D6-->  <DISPLAYLOGIC><![CDATA[@IsRegistered@='N']]></DISPLAYLOGIC>
 <!--59D388C6AF9CDD4EE040007F010043D6-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--59D388C6AF9CDD4EE040007F010043D6-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--59D388C6AF9CDD4EE040007F010043D6-->  <SEQNO><![CDATA[270]]></SEQNO>
+<!--59D388C6AF9CDD4EE040007F010043D6-->  <SEQNO><![CDATA[280]]></SEQNO>
 <!--59D388C6AF9CDD4EE040007F010043D6-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--59D388C6AF9CDD4EE040007F010043D6-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--59D388C6AF9CDD4EE040007F010043D6-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -191717,7 +191717,7 @@
 <!--5AC5BD9E47401294E040007F01001710-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--5AC5BD9E47401294E040007F01001710-->  <DISPLAYLENGTH><![CDATA[2000]]></DISPLAYLENGTH>
 <!--5AC5BD9E47401294E040007F01001710-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--5AC5BD9E47401294E040007F01001710-->  <SEQNO><![CDATA[260]]></SEQNO>
+<!--5AC5BD9E47401294E040007F01001710-->  <SEQNO><![CDATA[270]]></SEQNO>
 <!--5AC5BD9E47401294E040007F01001710-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--5AC5BD9E47401294E040007F01001710-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--5AC5BD9E47401294E040007F01001710-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -193985,7 +193985,7 @@
 <!--7079E2FD4AA9799EE040007F010104AD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--7079E2FD4AA9799EE040007F010104AD-->  <NAME><![CDATA[IsCommercial]]></NAME>
+<!--7079E2FD4AA9799EE040007F010104AD-->  <NAME><![CDATA[Commercial]]></NAME>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <DESCRIPTION><![CDATA[Commercial Module]]></DESCRIPTION>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <HELP><![CDATA[Commercial modules are only available to Professional Subscription active Instances whereas non commercial ones can be downloaded and installed in Community Edition Instances.
 Commercial modules can have a fee to be payed before they can be installed.]]></HELP>
@@ -193996,7 +193996,7 @@
 <!--7079E2FD4AA9799EE040007F010104AD-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <SEQNO><![CDATA[210]]></SEQNO>
-<!--7079E2FD4AA9799EE040007F010104AD-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
+<!--7079E2FD4AA9799EE040007F010104AD-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--7079E2FD4AA9799EE040007F010104AD-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
@@ -201454,6 +201454,54 @@
 <!--8B5531E0E2F582BCE040007F01011C1D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8B5531E0E2F582BCE040007F01011C1D--></AD_FIELD>
 
+<!--8BD10BA993814495E040007F010135AB--><AD_FIELD>
+<!--8BD10BA993814495E040007F010135AB-->  <AD_FIELD_ID><![CDATA[8BD10BA993814495E040007F010135AB]]></AD_FIELD_ID>
+<!--8BD10BA993814495E040007F010135AB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8BD10BA993814495E040007F010135AB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8BD10BA993814495E040007F010135AB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8BD10BA993814495E040007F010135AB-->  <NAME><![CDATA[Tier]]></NAME>
+<!--8BD10BA993814495E040007F010135AB-->  <DESCRIPTION><![CDATA[Tier for commercial modules]]></DESCRIPTION>
+<!--8BD10BA993814495E040007F010135AB-->  <HELP><![CDATA[Commercial modules are defined in different tiers:
+1st Tier: The module can be installed in any Professional instance that has bought the module.
+2nd Tier: The module can be installed in Standard Professional Edition instances that have bought it.]]></HELP>
+<!--8BD10BA993814495E040007F010135AB-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--8BD10BA993814495E040007F010135AB-->  <AD_TAB_ID><![CDATA[F53E35A11C564F20BE4082A7B8CFF6B7]]></AD_TAB_ID>
+<!--8BD10BA993814495E040007F010135AB-->  <AD_COLUMN_ID><![CDATA[8BCFEC1D2692D1A8E040007F010135A9]]></AD_COLUMN_ID>
+<!--8BD10BA993814495E040007F010135AB-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--8BD10BA993814495E040007F010135AB-->  <DISPLAYLOGIC><![CDATA[@IsCommercial@='Y']]></DISPLAYLOGIC>
+<!--8BD10BA993814495E040007F010135AB-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
+<!--8BD10BA993814495E040007F010135AB-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--8BD10BA993814495E040007F010135AB-->  <SEQNO><![CDATA[220]]></SEQNO>
+<!--8BD10BA993814495E040007F010135AB-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
+<!--8BD10BA993814495E040007F010135AB-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--8BD10BA993814495E040007F010135AB-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--8BD10BA993814495E040007F010135AB-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--8BD10BA993814495E040007F010135AB-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--8BD10BA993814495E040007F010135AB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8BD10BA993814495E040007F010135AB--></AD_FIELD>
+
+<!--8BD10BA993824495E040007F010135AB--><AD_FIELD>
+<!--8BD10BA993824495E040007F010135AB-->  <AD_FIELD_ID><![CDATA[8BD10BA993824495E040007F010135AB]]></AD_FIELD_ID>
+<!--8BD10BA993824495E040007F010135AB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8BD10BA993824495E040007F010135AB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8BD10BA993824495E040007F010135AB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8BD10BA993824495E040007F010135AB-->  <NAME><![CDATA[Maturity Status for Update]]></NAME>
+<!--8BD10BA993824495E040007F010135AB-->  <DESCRIPTION><![CDATA[Minimum Maturity Status of modules for update]]></DESCRIPTION>
+<!--8BD10BA993824495E040007F010135AB-->  <HELP><![CDATA[Defines the minimum accepted maturity status of modules when they are scanned for update.]]></HELP>
+<!--8BD10BA993824495E040007F010135AB-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--8BD10BA993824495E040007F010135AB-->  <AD_TAB_ID><![CDATA[F53E35A11C564F20BE4082A7B8CFF6B7]]></AD_TAB_ID>
+<!--8BD10BA993824495E040007F010135AB-->  <AD_COLUMN_ID><![CDATA[8A19431CC0DD20DBE040007F01013CCA]]></AD_COLUMN_ID>
+<!--8BD10BA993824495E040007F010135AB-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--8BD10BA993824495E040007F010135AB-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
+<!--8BD10BA993824495E040007F010135AB-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--8BD10BA993824495E040007F010135AB-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--8BD10BA993824495E040007F010135AB-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--8BD10BA993824495E040007F010135AB-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--8BD10BA993824495E040007F010135AB-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--8BD10BA993824495E040007F010135AB-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--8BD10BA993824495E040007F010135AB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8BD10BA993824495E040007F010135AB--></AD_FIELD>
+
 <!--8C84C8C20421A648E040007F010137E1--><AD_FIELD>
 <!--8C84C8C20421A648E040007F010137E1-->  <AD_FIELD_ID><![CDATA[8C84C8C20421A648E040007F010137E1]]></AD_FIELD_ID>
 <!--8C84C8C20421A648E040007F010137E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -29734,6 +29734,17 @@
 <!--0EABAB89726A4A3C800199142CF8E17F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--0EABAB89726A4A3C800199142CF8E17F--></AD_MESSAGE>
 
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516--><AD_MESSAGE>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <AD_MESSAGE_ID><![CDATA[0FC7B0C6F4FC4F04BEAD06F30E895516]]></AD_MESSAGE_ID>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <VALUE><![CDATA[OBPSAnyEdition]]></VALUE>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <MSGTEXT><![CDATA[Professional Edition]]></MSGTEXT>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--0FC7B0C6F4FC4F04BEAD06F30E895516--></AD_MESSAGE>
+
 <!--10E779E8F227496B86B3136A09EB6043--><AD_MESSAGE>
 <!--10E779E8F227496B86B3136A09EB6043-->  <AD_MESSAGE_ID><![CDATA[10E779E8F227496B86B3136A09EB6043]]></AD_MESSAGE_ID>
 <!--10E779E8F227496B86B3136A09EB6043-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -29756,6 +29767,17 @@
 <!--11314163807C4401B2964F93256597EA-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--11314163807C4401B2964F93256597EA--></AD_MESSAGE>
 
+<!--11509F0E2D6E4D4A96518FECB69A5B8F--><AD_MESSAGE>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <AD_MESSAGE_ID><![CDATA[11509F0E2D6E4D4A96518FECB69A5B8F]]></AD_MESSAGE_ID>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <VALUE><![CDATA[LearnHowToActivate]]></VALUE>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <MSGTEXT><![CDATA[<a href='http://www.openbravo.com/product/erp/module/acquire' target='_blank'>Learn how to</a> activate your instance.]]></MSGTEXT>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--11509F0E2D6E4D4A96518FECB69A5B8F--></AD_MESSAGE>
+
 <!--116AB3D795544212B785D0243B70B21F--><AD_MESSAGE>
 <!--116AB3D795544212B785D0243B70B21F-->  <AD_MESSAGE_ID><![CDATA[116AB3D795544212B785D0243B70B21F]]></AD_MESSAGE_ID>
 <!--116AB3D795544212B785D0243B70B21F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -29933,6 +29955,17 @@
 <!--17EB942A41BC417FA70FDFCA35027276-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--17EB942A41BC417FA70FDFCA35027276--></AD_MESSAGE>
 
+<!--17F9F89C2965434E9190E5E6FF92CF20--><AD_MESSAGE>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <AD_MESSAGE_ID><![CDATA[17F9F89C2965434E9190E5E6FF92CF20]]></AD_MESSAGE_ID>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <VALUE><![CDATA[OBPSStandardEdition]]></VALUE>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <MSGTEXT><![CDATA[Standard Professional Edition]]></MSGTEXT>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--17F9F89C2965434E9190E5E6FF92CF20-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--17F9F89C2965434E9190E5E6FF92CF20--></AD_MESSAGE>
+
 <!--1824C7A592B245A5A14EEF4F72FFDFE3--><AD_MESSAGE>
 <!--1824C7A592B245A5A14EEF4F72FFDFE3-->  <AD_MESSAGE_ID><![CDATA[1824C7A592B245A5A14EEF4F72FFDFE3]]></AD_MESSAGE_ID>
 <!--1824C7A592B245A5A14EEF4F72FFDFE3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -30252,6 +30285,17 @@
 <!--2ADD7BAB84FF44F8BA55C270DC4F7F41-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--2ADD7BAB84FF44F8BA55C270DC4F7F41--></AD_MESSAGE>
 
+<!--2BEC27AADFC4404C8170AA87F5107E1E--><AD_MESSAGE>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <AD_MESSAGE_ID><![CDATA[2BEC27AADFC4404C8170AA87F5107E1E]]></AD_MESSAGE_ID>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <VALUE><![CDATA[LicenseWithoutAccessTo]]></VALUE>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <MSGTEXT><![CDATA[Current license has not access to the following installed modules. Uninstall them before renewing the license:<br/>]]></MSGTEXT>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--2BEC27AADFC4404C8170AA87F5107E1E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--2BEC27AADFC4404C8170AA87F5107E1E--></AD_MESSAGE>
+
 <!--2C9BE7698E31458E966E9CFBF91A35BF--><AD_MESSAGE>
 <!--2C9BE7698E31458E966E9CFBF91A35BF-->  <AD_MESSAGE_ID><![CDATA[2C9BE7698E31458E966E9CFBF91A35BF]]></AD_MESSAGE_ID>
 <!--2C9BE7698E31458E966E9CFBF91A35BF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -30423,7 +30467,7 @@
 <!--34EFA62A7253493EB68EF2729587AF47-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--34EFA62A7253493EB68EF2729587AF47-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--34EFA62A7253493EB68EF2729587AF47-->  <VALUE><![CDATA[OPSLicensedTo]]></VALUE>
-<!--34EFA62A7253493EB68EF2729587AF47-->  <MSGTEXT><![CDATA[Professional Edition Instance licensed to]]></MSGTEXT>
+<!--34EFA62A7253493EB68EF2729587AF47-->  <MSGTEXT><![CDATA[@OBPSEdition@ Instance licensed to]]></MSGTEXT>
 <!--34EFA62A7253493EB68EF2729587AF47-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--34EFA62A7253493EB68EF2729587AF47-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--34EFA62A7253493EB68EF2729587AF47--></AD_MESSAGE>
@@ -30766,7 +30810,7 @@
 <!--48F0550A900840B0A9D9D74A23EA2E28-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--48F0550A900840B0A9D9D74A23EA2E28-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--48F0550A900840B0A9D9D74A23EA2E28-->  <VALUE><![CDATA[FEATURE_OBPS_ONLY]]></VALUE>
-<!--48F0550A900840B0A9D9D74A23EA2E28-->  <MSGTEXT><![CDATA[This feature is only available for Professional Edition subscribers.]]></MSGTEXT>
+<!--48F0550A900840B0A9D9D74A23EA2E28-->  <MSGTEXT><![CDATA[This feature is only available for @ProfessionalEditionType@ subscribers.]]></MSGTEXT>
 <!--48F0550A900840B0A9D9D74A23EA2E28-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--48F0550A900840B0A9D9D74A23EA2E28-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--48F0550A900840B0A9D9D74A23EA2E28--></AD_MESSAGE>
@@ -31003,6 +31047,17 @@
 <!--584FAADEFE06422E988159E2B3800F3B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--584FAADEFE06422E988159E2B3800F3B--></AD_MESSAGE>
 
+<!--59A653928EC7415C9B375F69451E19B2--><AD_MESSAGE>
+<!--59A653928EC7415C9B375F69451E19B2-->  <AD_MESSAGE_ID><![CDATA[59A653928EC7415C9B375F69451E19B2]]></AD_MESSAGE_ID>
+<!--59A653928EC7415C9B375F69451E19B2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--59A653928EC7415C9B375F69451E19B2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--59A653928EC7415C9B375F69451E19B2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--59A653928EC7415C9B375F69451E19B2-->  <VALUE><![CDATA[OPSLicenseEdition]]></VALUE>
+<!--59A653928EC7415C9B375F69451E19B2-->  <MSGTEXT><![CDATA[License Edition]]></MSGTEXT>
+<!--59A653928EC7415C9B375F69451E19B2-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--59A653928EC7415C9B375F69451E19B2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--59A653928EC7415C9B375F69451E19B2--></AD_MESSAGE>
+
 <!--59E27235F1D1402B9DC1E9EE5BC64814--><AD_MESSAGE>
 <!--59E27235F1D1402B9DC1E9EE5BC64814-->  <AD_MESSAGE_ID><![CDATA[59E27235F1D1402B9DC1E9EE5BC64814]]></AD_MESSAGE_ID>
 <!--59E27235F1D1402B9DC1E9EE5BC64814-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -32391,6 +32446,17 @@
 <!--B5701BDA0DF64BD8922EE3FB41F7BCCC-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--B5701BDA0DF64BD8922EE3FB41F7BCCC--></AD_MESSAGE>
 
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC--><AD_MESSAGE>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <AD_MESSAGE_ID><![CDATA[B5B771C2ACC04FE4A75C39249BFAD2EC]]></AD_MESSAGE_ID>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <VALUE><![CDATA[AD_MODULE_TIER_CHK]]></VALUE>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <MSGTEXT><![CDATA[Incorrect Tier/Commercial. Commercial modules must be defined in Tier 1 or Tier 2.]]></MSGTEXT>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B5B771C2ACC04FE4A75C39249BFAD2EC--></AD_MESSAGE>
+
 <!--B785B8EF16CB412DB2E0FE32F55E9869--><AD_MESSAGE>
 <!--B785B8EF16CB412DB2E0FE32F55E9869-->  <AD_MESSAGE_ID><![CDATA[B785B8EF16CB412DB2E0FE32F55E9869]]></AD_MESSAGE_ID>
 <!--B785B8EF16CB412DB2E0FE32F55E9869-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -33490,6 +33556,18 @@
 <!--FA5C4E4CAED74DEFA58E298F8771E547-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FA5C4E4CAED74DEFA58E298F8771E547--></AD_MESSAGE>
 
+<!--FB074AB5BE884C2FAEE6159575A47F09--><AD_MESSAGE>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <AD_MESSAGE_ID><![CDATA[FB074AB5BE884C2FAEE6159575A47F09]]></AD_MESSAGE_ID>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <VALUE><![CDATA[NoRestrictionsFile]]></VALUE>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <MSGTEXT><![CDATA[Restrictions file was not found in config/licenseRestrictions, or it was corrupted. 
+Fix it and restart Tomcat.]]></MSGTEXT>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--FB074AB5BE884C2FAEE6159575A47F09-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FB074AB5BE884C2FAEE6159575A47F09--></AD_MESSAGE>
+
 <!--FBD240BC51C8471F85D65EFB40E079B6--><AD_MESSAGE>
 <!--FBD240BC51C8471F85D65EFB40E079B6-->  <AD_MESSAGE_ID><![CDATA[FBD240BC51C8471F85D65EFB40E079B6]]></AD_MESSAGE_ID>
 <!--FBD240BC51C8471F85D65EFB40E079B6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODULE.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_MODULE.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -24,6 +24,7 @@
 <!--0-->  <REFERENCEDATAINFO><![CDATA[Standard document types for orders, invoices, etc. and settings]]></REFERENCEDATAINFO>
 <!--0-->  <VERSION_LABEL><![CDATA[dev]]></VERSION_LABEL>
 <!--0-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
+<!--0-->  <COMMERCIAL_TIER><![CDATA[NA]]></COMMERCIAL_TIER>
 <!--0--></AD_MODULE>
 
 </data>
--- a/src-db/database/sourcedata/AD_REFERENCE.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_REFERENCE.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -4452,6 +4452,19 @@
 <!--2969F07308CB43ECBCDAE151C12F03E0-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--2969F07308CB43ECBCDAE151C12F03E0--></AD_REFERENCE>
 
+<!--368E5F32B443454093D14D4E0AD44E13--><AD_REFERENCE>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <AD_REFERENCE_ID><![CDATA[368E5F32B443454093D14D4E0AD44E13]]></AD_REFERENCE_ID>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <NAME><![CDATA[OBPSLicenseEdition]]></NAME>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <DESCRIPTION><![CDATA[Editions of OBPS Licenses]]></DESCRIPTION>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <PARENTREFERENCE_ID><![CDATA[17]]></PARENTREFERENCE_ID>
+<!--368E5F32B443454093D14D4E0AD44E13-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--368E5F32B443454093D14D4E0AD44E13--></AD_REFERENCE>
+
 <!--36972531DA994BB38ECB91993058282F--><AD_REFERENCE>
 <!--36972531DA994BB38ECB91993058282F-->  <AD_REFERENCE_ID><![CDATA[36972531DA994BB38ECB91993058282F]]></AD_REFERENCE_ID>
 <!--36972531DA994BB38ECB91993058282F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -4493,6 +4506,19 @@
 <!--3F854F4DC7284CE4857A5EA941BE032C-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--3F854F4DC7284CE4857A5EA941BE032C--></AD_REFERENCE>
 
+<!--4452E6997DD14363AB4387B06939871A--><AD_REFERENCE>
+<!--4452E6997DD14363AB4387B06939871A-->  <AD_REFERENCE_ID><![CDATA[4452E6997DD14363AB4387B06939871A]]></AD_REFERENCE_ID>
+<!--4452E6997DD14363AB4387B06939871A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4452E6997DD14363AB4387B06939871A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4452E6997DD14363AB4387B06939871A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4452E6997DD14363AB4387B06939871A-->  <NAME><![CDATA[CommercialTier]]></NAME>
+<!--4452E6997DD14363AB4387B06939871A-->  <DESCRIPTION><![CDATA[Tiers for commercial modules]]></DESCRIPTION>
+<!--4452E6997DD14363AB4387B06939871A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--4452E6997DD14363AB4387B06939871A-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--4452E6997DD14363AB4387B06939871A-->  <PARENTREFERENCE_ID><![CDATA[17]]></PARENTREFERENCE_ID>
+<!--4452E6997DD14363AB4387B06939871A-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--4452E6997DD14363AB4387B06939871A--></AD_REFERENCE>
+
 <!--47209D76F3EE4B6D84222C5BDF170AA2--><AD_REFERENCE>
 <!--47209D76F3EE4B6D84222C5BDF170AA2-->  <AD_REFERENCE_ID><![CDATA[47209D76F3EE4B6D84222C5BDF170AA2]]></AD_REFERENCE_ID>
 <!--47209D76F3EE4B6D84222C5BDF170AA2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_REF_LIST.xml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml	Wed Aug 11 09:24:06 2010 +0200
@@ -8819,6 +8819,19 @@
 <!--46B566C2C5AA4248A2D5FE1A1A6CA209-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--46B566C2C5AA4248A2D5FE1A1A6CA209--></AD_REF_LIST>
 
+<!--472DC62462994E1B95D3A3283EEE20A7--><AD_REF_LIST>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <AD_REF_LIST_ID><![CDATA[472DC62462994E1B95D3A3283EEE20A7]]></AD_REF_LIST_ID>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <VALUE><![CDATA[NA]]></VALUE>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <NAME><![CDATA[N/A]]></NAME>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <DESCRIPTION><![CDATA[Tier not applicable (non commercial module)]]></DESCRIPTION>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <AD_REFERENCE_ID><![CDATA[4452E6997DD14363AB4387B06939871A]]></AD_REFERENCE_ID>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--472DC62462994E1B95D3A3283EEE20A7-->  <SEQNO><![CDATA[1]]></SEQNO>
+<!--472DC62462994E1B95D3A3283EEE20A7--></AD_REF_LIST>
+
 <!--49A96D77C74A44EA90AED7C50BBAFAE1--><AD_REF_LIST>
 <!--49A96D77C74A44EA90AED7C50BBAFAE1-->  <AD_REF_LIST_ID><![CDATA[49A96D77C74A44EA90AED7C50BBAFAE1]]></AD_REF_LIST_ID>
 <!--49A96D77C74A44EA90AED7C50BBAFAE1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -9648,6 +9661,18 @@
 <!--A6013E760F1240988DC3FB463EA569F7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--A6013E760F1240988DC3FB463EA569F7--></AD_REF_LIST>
 
+<!--A60D08A595E84734A6369720E2BFE84F--><AD_REF_LIST>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <AD_REF_LIST_ID><![CDATA[A60D08A595E84734A6369720E2BFE84F]]></AD_REF_LIST_ID>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <VALUE><![CDATA[2]]></VALUE>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <NAME><![CDATA[Tier 2 Commercial Module]]></NAME>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <DESCRIPTION><![CDATA[Tier 2 Commercial Modules can be installed in Standard Professioanl Edition Instances that have bought it.]]></DESCRIPTION>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <AD_REFERENCE_ID><![CDATA[4452E6997DD14363AB4387B06939871A]]></AD_REFERENCE_ID>
+<!--A60D08A595E84734A6369720E2BFE84F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--A60D08A595E84734A6369720E2BFE84F--></AD_REF_LIST>
+
 <!--AA2BD581FDB44700A4C6D3D47C3DD354--><AD_REF_LIST>
 <!--AA2BD581FDB44700A4C6D3D47C3DD354-->  <AD_REF_LIST_ID><![CDATA[AA2BD581FDB44700A4C6D3D47C3DD354]]></AD_REF_LIST_ID>
 <!--AA2BD581FDB44700A4C6D3D47C3DD354-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -9808,6 +9833,19 @@
 <!--B9AFFC82A5AF4D7CABCA5F7C16C726FE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--B9AFFC82A5AF4D7CABCA5F7C16C726FE--></AD_REF_LIST>
 
+<!--BA44026391FB4C52BDFCF41FD8B33B46--><AD_REF_LIST>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <AD_REF_LIST_ID><![CDATA[BA44026391FB4C52BDFCF41FD8B33B46]]></AD_REF_LIST_ID>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <VALUE><![CDATA[STD]]></VALUE>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <NAME><![CDATA[Standard Professional Edition]]></NAME>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <DESCRIPTION><![CDATA[Standard Professional Edition]]></DESCRIPTION>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <AD_REFERENCE_ID><![CDATA[368E5F32B443454093D14D4E0AD44E13]]></AD_REFERENCE_ID>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--BA44026391FB4C52BDFCF41FD8B33B46-->  <SEQNO><![CDATA[2]]></SEQNO>
+<!--BA44026391FB4C52BDFCF41FD8B33B46--></AD_REF_LIST>
+
 <!--BA7EB4B59E204625B9EDE4E7ABF27C10--><AD_REF_LIST>
 <!--BA7EB4B59E204625B9EDE4E7ABF27C10-->  <AD_REF_LIST_ID><![CDATA[BA7EB4B59E204625B9EDE4E7ABF27C10]]></AD_REF_LIST_ID>
 <!--BA7EB4B59E204625B9EDE4E7ABF27C10-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -10265,6 +10303,18 @@
 <!--E2B06CEADF4F4528BDB55A1FA694CBEB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--E2B06CEADF4F4528BDB55A1FA694CBEB--></AD_REF_LIST>
 
+<!--E4574A3EB1044B3491130B55BCE905A8--><AD_REF_LIST>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <AD_REF_LIST_ID><![CDATA[E4574A3EB1044B3491130B55BCE905A8]]></AD_REF_LIST_ID>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <VALUE><![CDATA[1]]></VALUE>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <NAME><![CDATA[Tier 1 Commercial Module]]></NAME>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <DESCRIPTION><![CDATA[Tier 1 Commercial Modules can be installed in all Proffesioanl Edition instances that have bought it.]]></DESCRIPTION>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <AD_REFERENCE_ID><![CDATA[4452E6997DD14363AB4387B06939871A]]></AD_REFERENCE_ID>
+<!--E4574A3EB1044B3491130B55BCE905A8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E4574A3EB1044B3491130B55BCE905A8--></AD_REF_LIST>
+
 <!--E5AF9D4589E84811B46A59D8F753226E--><AD_REF_LIST>
 <!--E5AF9D4589E84811B46A59D8F753226E-->  <AD_REF_LIST_ID><![CDATA[E5AF9D4589E84811B46A59D8F753226E]]></AD_REF_LIST_ID>
 <!--E5AF9D4589E84811B46A59D8F753226E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -10518,4 +10568,17 @@
 <!--FEA8CDC794994F3BA038301C4C4021D9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FEA8CDC794994F3BA038301C4C4021D9--></AD_REF_LIST>
 
+<!--FEAB443F9CF94815B0306F85A245AD40--><AD_REF_LIST>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <AD_REF_LIST_ID><![CDATA[FEAB443F9CF94815B0306F85A245AD40]]></AD_REF_LIST_ID>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <VALUE><![CDATA[B]]></VALUE>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <NAME><![CDATA[Basic Professional Edition]]></NAME>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <DESCRIPTION><![CDATA[Basic Professional Edition]]></DESCRIPTION>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <AD_REFERENCE_ID><![CDATA[368E5F32B443454093D14D4E0AD44E13]]></AD_REFERENCE_ID>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FEAB443F9CF94815B0306F85A245AD40-->  <SEQNO><![CDATA[1]]></SEQNO>
+<!--FEAB443F9CF94815B0306F85A245AD40--></AD_REF_LIST>
+
 </data>
--- a/src-wad/src/org/openbravo/wad/ActionButtonJava_Responser.javaxml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-wad/src/org/openbravo/wad/ActionButtonJava_Responser.javaxml	Wed Aug 11 09:24:06 2010 +0200
@@ -12,7 +12,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-2009 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -32,6 +32,8 @@
 import org.openbravo.scheduling.ProcessRunner;
 import org.openbravo.xmlEngine.XmlDocument;
 import org.openbravo.database.SessionInfo;
+import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
 import java.io.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
@@ -66,8 +68,18 @@
     SessionInfo.setProcessType("P");
     SessionInfo.setProcessId(strProcessId);
    
-    if (!vars.commandIn("DEFAULT") &amp;&amp; !hasGeneralAccess(vars, "P", strProcessId)) {
-      bdErrorGeneralPopUp(request, response, Utility.messageBD(this, "Error", vars.getLanguage()), Utility.messageBD(this, "AccessTableNoView", vars.getLanguage()));
+    if (!vars.commandIn("DEFAULT")) {
+      //Check access
+      FeatureRestriction featureRestriction = ActivationKey.getInstance().hasLicenseAccess("P",
+          strProcessId);
+      if (featureRestriction != FeatureRestriction.NO_RESTRICTION) {
+        licenseError("P", strProcessId, featureRestriction, response, request, vars, true);
+      }
+      if (!hasGeneralAccess(vars, "P", strProcessId)) {
+        bdErrorGeneralPopUp(request, response,
+            Utility.messageBD(this, "Error", vars.getLanguage()), Utility.messageBD(this,
+                "AccessTableNoView", vars.getLanguage()));
+      }
     }
     
       
--- a/src-wad/src/org/openbravo/wad/ActionButton_Responser.javaxml	Wed Aug 11 08:33:14 2010 +0200
+++ b/src-wad/src/org/openbravo/wad/ActionButton_Responser.javaxml	Wed Aug 11 09:24:06 2010 +0200
@@ -12,7 +12,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) 2001-2009 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -32,6 +32,8 @@
 import org.openbravo.scheduling.ProcessRunner;
 import org.openbravo.xmlEngine.XmlDocument;
 import org.openbravo.database.SessionInfo;
+import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
 import java.io.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
@@ -65,8 +67,18 @@
     SessionInfo.setProcessType("P");
     SessionInfo.setProcessId(strProcessId);
     
-    if (!vars.commandIn("DEFAULT") &amp;&amp; !hasGeneralAccess(vars, "P", strProcessId)) {
-      bdErrorGeneralPopUp(request, response, Utility.messageBD(this, "Error", vars.getLanguage()), Utility.messageBD(this, "AccessTableNoView", vars.getLanguage()));
+    if (!vars.commandIn("DEFAULT")) {
+      //Check access
+      FeatureRestriction featureRestriction = ActivationKey.getInstance().hasLicenseAccess("P",
+          strProcessId);
+      if (featureRestriction != FeatureRestriction.NO_RESTRICTION) {
+        licenseError("P", strProcessId, featureRestriction, response, request, vars, true);
+      }
+      if (!hasGeneralAccess(vars, "P", strProcessId)) {
+        bdErrorGeneralPopUp(request, response,
+            Utility.messageBD(this, "Error", vars.getLanguage()), Utility.messageBD(this,
+                "AccessTableNoView", vars.getLanguage()));
+      }
     }
     
       
--- a/src/org/openbravo/base/secureApp/Error.html	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/base/secureApp/Error.html	Wed Aug 11 09:24:06 2010 +0200
@@ -230,6 +230,7 @@
                     <td colspan="6" align="center" class="Button_CenterAlign_ContentCell">
                       <button type="button" 
                         class="ButtonLink" 
+                        id="backButton" 
                         onclick="goToPreviousPage();return false;" 
                         onfocus="buttonEvent('onfocus', this); window.status='Back'; return true;" 
                         onblur="buttonEvent('onblur', this);" 
--- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Wed Aug 11 09:24:06 2010 +0200
@@ -49,16 +49,19 @@
 import net.sf.jasperreports.engine.export.JRHtmlExporter;
 import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
 
+import org.hibernate.criterion.Expression;
 import org.openbravo.authentication.AuthenticationException;
 import org.openbravo.authentication.AuthenticationManager;
 import org.openbravo.authentication.basic.DefaultAuthenticationManager;
 import org.openbravo.base.HttpBaseServlet;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.data.FieldProvider;
 import org.openbravo.database.SessionInfo;
 import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
 import org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction;
 import org.openbravo.erpCommon.security.SessionLogin;
 import org.openbravo.erpCommon.utility.JRFieldProviderDataSource;
@@ -67,6 +70,14 @@
 import org.openbravo.erpCommon.utility.PrintJRData;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.system.SystemInformation;
+import org.openbravo.model.ad.ui.Form;
+import org.openbravo.model.ad.ui.FormTrl;
+import org.openbravo.model.ad.ui.Process;
+import org.openbravo.model.ad.ui.ProcessTrl;
+import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.model.ad.ui.WindowTrl;
+import org.openbravo.model.ad.ui.Workflow;
+import org.openbravo.model.ad.ui.WorkflowTrl;
 import org.openbravo.utils.FileUtility;
 import org.openbravo.utils.Replace;
 import org.openbravo.xmlEngine.XmlDocument;
@@ -233,8 +244,8 @@
           boolean correctSystemStatus = sysInfo.getSystemStatus() == null
               || this.globalParameters.getOBProperty("safe.mode", "false")
                   .equalsIgnoreCase("false") || sysInfo.getSystemStatus().equals("RB70");
-          ActivationKey ak = new ActivationKey();
-          LicenseRestriction limitation = ak.checkOPSLimitations(variables.getDBSession());
+          LicenseRestriction limitation = ActivationKey.getInstance().checkOPSLimitations(
+              variables.getDBSession());
           // We check if there is a Openbravo Professional Subscription restriction in the license,
           // or if the last rebuild didn't go well. If any of these are true, then the user is
           // allowed to login only as system administrator
@@ -354,7 +365,18 @@
       SessionInfo.setUserId(strUserAuth);
       SessionInfo.setSessionId(vars1.getSessionValue("#AD_Session_ID"));
 
-      if (vars1.getRole().equals("") || hasAccess(vars1)) {
+      // Hack to know whether the servlet is a poup. strPopup cannot be used because it indicates in
+      // has been called from a popup.
+      boolean isPopup = vars1.getCommand().indexOf("BUTTON") != -1
+          || vars1.getCommand().indexOf("POPUP") != -1
+          || !vars1.getStringParameter("inpProcessId").equals("");
+
+      FeatureRestriction featureRestriction = ActivationKey.getInstance().hasLicenseAccess(
+          classInfo.type, classInfo.id);
+      if (featureRestriction != FeatureRestriction.NO_RESTRICTION) {
+        licenseError(classInfo.type, classInfo.id, featureRestriction, response, request, vars1,
+            isPopup);
+      } else if (vars1.getRole().equals("") || hasAccess(vars1)) {
         if (classInfo.id != null && !classInfo.id.equals("")) {
           SessionInfo.setProcessId(classInfo.id);
           SessionInfo.setProcessType(classInfo.type);
@@ -400,8 +422,7 @@
               // the hash of the post data
               if (!hash.equals(vars1.getPostDataHash())) {
                 request.setAttribute("autosave", true);
-                if (vars1.getCommand().indexOf("BUTTON") != -1
-                    || !vars1.getStringParameter("inpProcessId").equals(""))
+                if (isPopup)
                   // Adding pop-up window attribute to close the window on failed auto-save
                   request.setAttribute("popupWindow", true);
                 // forward request
@@ -773,8 +794,13 @@
 
   private void bdErrorGeneral(HttpServletRequest request, HttpServletResponse response,
       String strTitle, String strText) throws IOException {
-    final XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/base/secureApp/Error")
-        .createXmlDocument();
+    String discard[] = { "" };
+    if (OBContext.getOBContext().isNewUI()) {
+      discard[0] = "backButton";
+    }
+
+    final XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/base/secureApp/Error",
+        discard).createXmlDocument();
 
     String myTheme;
     if (request != null)
@@ -864,6 +890,110 @@
     whitePage(response, "");
   }
 
+  protected void licenseError(String type, String id, FeatureRestriction featureRestriction,
+      HttpServletResponse response, HttpServletRequest request, VariablesSecureApp vars,
+      boolean isPopup) throws IOException {
+    String titleText = getArtifactName(type, id, vars.getLanguage());
+
+    String editionType;
+    switch (featureRestriction) {
+    case TIER2_RESTRICTION:
+      editionType = "OBPSStandardEdition";
+      break;
+    default:
+      editionType = "OBPSAnyEdition";
+      break;
+    }
+
+    // <p> in java, to allow multi-paragraph text via the parameter
+    String infoText = "<p>"
+        + Utility.messageBD(this, "FEATURE_OBPS_ONLY", vars.getLanguage()).replace(
+            "@ProfessionalEditionType@", Utility.messageBD(this, editionType, vars.getLanguage()))
+        + "</p>";
+    String linkText = Utility.messageBD(this, "LEARN_HOW", vars.getLanguage());
+    String afterLinkText = Utility.messageBD(this, "ACTIVATE_INSTANCE", vars.getLanguage());
+
+    if (isPopup) {
+      XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+          "org/openbravo/erpCommon/obps/ErrorActivatedInstancesOnly").createXmlDocument();
+
+      xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
+      xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
+      xmlDocument.setParameter("theme", vars.getTheme());
+      xmlDocument.setParameter("titleText", titleText);
+      xmlDocument.setParameter("infoText", infoText);
+      xmlDocument.setParameter("linkText", linkText);
+      xmlDocument.setParameter("afterLinkText", afterLinkText);
+
+      response.setContentType("text/html; charset=UTF-8");
+      PrintWriter out = response.getWriter();
+      out.println(xmlDocument.print());
+      out.close();
+    } else {
+      bdErrorGeneral(request, response, titleText, infoText + "\n"
+          + Utility.messageBD(this, "LearnHowToActivate", vars.getLanguage()));
+    }
+  }
+
+  private String getArtifactName(String type, String id, String language) {
+    OBContext.setAdminMode();
+    try {
+      if ("W".equals(type)) {
+        Tab tab = OBDal.getInstance().get(Tab.class, id);
+        if (tab != null) {
+          OBCriteria<WindowTrl> qtTrl = OBDal.getInstance().createCriteria(WindowTrl.class);
+          qtTrl.add(Expression.eq(WindowTrl.PROPERTY_WINDOW, tab.getWindow()));
+          qtTrl.add(Expression.eq(WindowTrl.PROPERTY_LANGUAGE + ".language", language));
+          if (qtTrl.list().size() != 0) {
+            return qtTrl.list().get(0).getName();
+          } else {
+            return tab.getWindow().getName();
+          }
+        }
+      } else if ("X".equals(type)) {
+        OBCriteria<FormTrl> qfTrl = OBDal.getInstance().createCriteria(FormTrl.class);
+        qfTrl.add(Expression.eq(FormTrl.PROPERTY_SPECIALFORM + ".id", id));
+        qfTrl.add(Expression.eq(FormTrl.PROPERTY_LANGUAGE + ".language", language));
+        if (qfTrl.list().size() != 0) {
+          return qfTrl.list().get(0).getName();
+        }
+
+        Form f = OBDal.getInstance().get(Form.class, id);
+        if (f != null) {
+          return f.getName();
+        }
+      } else if ("R".equals(type) || "P".equals(type)) {
+        OBCriteria<ProcessTrl> qfTrl = OBDal.getInstance().createCriteria(ProcessTrl.class);
+        qfTrl.add(Expression.eq(ProcessTrl.PROPERTY_PROCESS + ".id", id));
+        qfTrl.add(Expression.eq(ProcessTrl.PROPERTY_LANGUAGE + ".language", language));
+        if (qfTrl.list().size() != 0) {
+          return qfTrl.list().get(0).getName();
+        }
+
+        Process f = OBDal.getInstance().get(Process.class, id);
+        if (f != null) {
+          return f.getName();
+        }
+      } else if ("F".equals(type)) {
+        OBCriteria<WorkflowTrl> qfWorkflowTrl = OBDal.getInstance().createCriteria(
+            WorkflowTrl.class);
+        qfWorkflowTrl.add(Expression.eq(WorkflowTrl.PROPERTY_WORKFLOW + ".id", id));
+        qfWorkflowTrl.add(Expression.eq(WorkflowTrl.PROPERTY_LANGUAGE + ".language", language));
+        if (qfWorkflowTrl.list().size() != 0) {
+          return qfWorkflowTrl.list().get(0).getName();
+        }
+
+        Workflow f = OBDal.getInstance().get(Workflow.class, id);
+        if (f != null) {
+          return f.getName();
+        }
+      }
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return "";
+  }
+
   protected void whitePage(HttpServletResponse response, String strAlert) throws IOException {
     final XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
         "org/openbravo/base/secureApp/HtmlWhitePage").createXmlDocument();
@@ -1132,10 +1262,8 @@
           jasperPrint = JasperFillManager.fillReport(jasperReport, designParameters, con);
         }
       } catch (final Exception e) {
-          throw new ServletException(e.getCause() instanceof SQLException 
-              ? e.getCause().getMessage()
-              : e.getMessage()
-              , e);
+        throw new ServletException(e.getCause() instanceof SQLException ? e.getCause().getMessage()
+            : e.getMessage(), e);
       } finally {
         releaseRollbackConnection(con);
       }
--- a/src/org/openbravo/base/secureApp/LoginHandler.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/base/secureApp/LoginHandler.java	Wed Aug 11 09:24:06 2010 +0200
@@ -132,7 +132,7 @@
       String strUserAuth, String sessionId) throws IOException {
     OBContext.setAdminMode();
     try {
-      ActivationKey ak = new ActivationKey();
+      ActivationKey ak = ActivationKey.getInstance();
       boolean hasSystem = false;
 
       try {
--- a/src/org/openbravo/erpCommon/ad_forms/About.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/About.java	Wed Aug 11 09:24:06 2010 +0200
@@ -60,7 +60,7 @@
 
     OBContext.setAdminMode();
     try {
-      ActivationKey ak = new ActivationKey();
+      ActivationKey ak = ActivationKey.getInstance();
       response.setContentType("text/html; charset=UTF-8");
       PrintWriter out = response.getWriter();
       String discard[] = { "" };
@@ -68,17 +68,19 @@
 
       String licenseInfo = "";
       if (ActivationKey.isActiveInstance()) {
-        licenseInfo = Utility.messageBD(this, "OPSLicensedTo", vars.getLanguage()) + " "
-            + ak.getProperty("customer");
+        licenseInfo = Utility.messageBD(this, "OPSLicensedTo", vars.getLanguage()).replace(
+            "@OBPSEdition@",
+            Utility.getListValueName("OBPSLicenseEdition", ak.getLicenseClass().getCode(), vars
+                .getLanguage()))
+            + " " + ak.getProperty("customer");
       } else {
         licenseInfo = Utility.messageBD(this, "OPSCommunityEdition", vars.getLanguage());
-
         discard[0] = "paramOPSInfo";
       }
       xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_forms/About", discard)
           .createXmlDocument();
 
-      OBVersion version = new OBVersion();
+      OBVersion version = OBVersion.getInstance();
 
       xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
       xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
--- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java	Wed Aug 11 09:24:06 2010 +0200
@@ -55,8 +55,7 @@
     VariablesSecureApp vars = new VariablesSecureApp(request);
 
     if (vars.commandIn("DEFAULT")) {
-      ActivationKey activationKey = new ActivationKey();
-      printPageActive(response, vars, activationKey);
+      printPageActive(response, vars, ActivationKey.getInstance());
     } else if (vars.commandIn("SHOW_ACTIVATE")) {
       printPageNotActive(response, vars);
     } else if (vars.commandIn("ACTIVATE")) {
@@ -98,6 +97,7 @@
       System sys = OBDal.getInstance().get(System.class, "0");
       sys.setActivationKey(null);
       sys.setInstanceKey(null);
+      ActivationKey.reload();
       msg.setType("Success");
       msg.setMessage(Utility.messageBD(this, "Success", vars.getLanguage()));
     } catch (Exception e) {
@@ -124,12 +124,20 @@
         buf.append(new String(b, 0, n));
       }
 
-      System sys = OBDal.getInstance().get(System.class, "0");
-      sys.setActivationKey(buf.toString());
-      sys.setInstanceKey(vars.getStringParameter("publicKey"));
-      msg.setType("Success");
-      msg.setMessage(Utility.messageBD(this, "Success", vars.getLanguage()));
-
+      ActivationKey ak = new ActivationKey(vars.getStringParameter("publicKey"), buf.toString());
+      String nonAllowedMods = ak.verifyInstalledModules();
+      if (!nonAllowedMods.isEmpty()) {
+        msg.setType("Error");
+        msg.setMessage(Utility.messageBD(this, "LicenseWithoutAccessTo", vars.getLanguage())
+            + nonAllowedMods);
+      } else {
+        System sys = OBDal.getInstance().get(System.class, "0");
+        sys.setActivationKey(buf.toString());
+        sys.setInstanceKey(vars.getStringParameter("publicKey"));
+        ActivationKey.setInstance(ak);
+        msg.setType("Success");
+        msg.setMessage(Utility.messageBD(this, "Success", vars.getLanguage()));
+      }
     } catch (Exception e) {
       log4j.error(e);
       msg.setType("Error");
@@ -143,7 +151,7 @@
   private void printPageActivateLocal(HttpServletResponse response, VariablesSecureApp vars)
       throws IOException {
 
-    ActivationKey ak = new ActivationKey();
+    ActivationKey ak = ActivationKey.getInstance();
     String discard[] = { "", "" };
 
     if (ak.isOPSInstance()) {
@@ -290,7 +298,7 @@
   private void printPageNotActive(HttpServletResponse response, VariablesSecureApp vars)
       throws IOException, ServletException {
 
-    ActivationKey activationKey = new ActivationKey();
+    ActivationKey activationKey = ActivationKey.getInstance();
     response.setContentType("text/html; charset=UTF-8");
     String discard[] = { "", "" };
     if (activationKey.isOPSInstance()) {
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java	Wed Aug 11 09:24:06 2010 +0200
@@ -943,7 +943,7 @@
   private boolean checkCommercialModules(ImportModule im, Map<String, String> minVersions,
       HttpServletResponse response, VariablesSecureApp vars, Module selectedModule)
       throws IOException {
-    ActivationKey ak = new ActivationKey();
+    ActivationKey ak = ActivationKey.getInstance();
     ArrayList<Module> notAllowedMods = new ArrayList<Module>();
 
     String notSubscribed = "";
@@ -970,7 +970,7 @@
       }
       for (Module mod : im.getModulesToUpdate()) {
         if (mod.isIsCommercial()) {
-          if (selectedModule != null && !!mod.getModuleID().equals(selectedModule.getModuleID())) {
+          if (selectedModule != null && !mod.getModuleID().equals(selectedModule.getModuleID())) {
             // Show only in case there are commercial dependencies
             showNotActivatedError = true;
           }
--- a/src/org/openbravo/erpCommon/ad_forms/Role.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Role.java	Wed Aug 11 09:24:06 2010 +0200
@@ -192,12 +192,12 @@
       // We check if there is a Openbravo Professional Subscription restriction in the license,
       // or if the last rebuild didn't go well. If any of these are true, then the user is
       // allowed to login only as system administrator
-      ActivationKey ak = new ActivationKey();
       SystemInformation sysInfo = OBDal.getInstance().get(SystemInformation.class, "0");
       boolean correctSystemStatus = sysInfo.getSystemStatus() == null
           || this.globalParameters.getOBProperty("safe.mode", "false").equalsIgnoreCase("false")
           || sysInfo.getSystemStatus().equals("RB70");
-      LicenseRestriction limitation = ak.checkOPSLimitations(vars.getDBSession());
+      LicenseRestriction limitation = ActivationKey.getInstance().checkOPSLimitations(
+          vars.getDBSession());
       if (limitation == LicenseRestriction.OPS_INSTANCE_NOT_ACTIVE
           || limitation == LicenseRestriction.NUMBER_OF_CONCURRENT_USERS_REACHED
           || limitation == LicenseRestriction.MODULE_EXPIRED || !correctSystemStatus) {
--- a/src/org/openbravo/erpCommon/ad_workflow/WorkflowControl.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_workflow/WorkflowControl.java	Wed Aug 11 09:24:06 2010 +0200
@@ -29,6 +29,8 @@
 
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
 import org.openbravo.erpCommon.utility.MenuData;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.erpCommon.utility.VerticalMenu;
@@ -51,9 +53,17 @@
     final String strAD_Workflow_ID = vars.getGlobalVariable("inpadWorkflowId",
         "WorkflowControl|adWorkflowId");
 
-    if (!vars.commandIn("DEFAULT") && !hasGeneralAccess(vars, "F", strAD_Workflow_ID)) {
-      bdError(request, response, "AccessTableNoView", vars.getLanguage());
-      return;
+    if (!vars.commandIn("DEFAULT")) {
+      FeatureRestriction featureRestriction = ActivationKey.getInstance().hasLicenseAccess("F",
+          strAD_Workflow_ID);
+      if (featureRestriction != FeatureRestriction.NO_RESTRICTION) {
+        licenseError("F", strAD_Workflow_ID, featureRestriction, response, request, vars, true);
+      }
+
+      if (!hasGeneralAccess(vars, "F", strAD_Workflow_ID)) {
+        bdError(request, response, "AccessTableNoView", vars.getLanguage());
+        return;
+      }
     }
 
     if (vars.commandIn("DEFAULT")) {
--- a/src/org/openbravo/erpCommon/businessUtility/AuditTrailPopup.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/businessUtility/AuditTrailPopup.java	Wed Aug 11 09:24:06 2010 +0200
@@ -53,6 +53,7 @@
 import org.openbravo.dal.service.OBQuery;
 import org.openbravo.data.FieldProvider;
 import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
 import org.openbravo.erpCommon.utility.ComboTableData;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.SQLReturnObject;
@@ -108,6 +109,12 @@
       ServletException {
     VariablesSecureApp vars = new VariablesSecureApp(request);
 
+    // Prevent execution in Community instances
+    if (!ActivationKey.getInstance().isActive()) {
+      licenseError(classInfo.type, classInfo.id, FeatureRestriction.TIER1_RESTRICTION, response,
+          request, vars, true);
+    }
+
     String accesTabId = vars.getGlobalVariable("inpTabId", "AuditTrail.tabId", IsIDFilter.instance);
     if (!hasGeneralAccess(vars, "W", accesTabId)) {
       // do security check based on tabId passed in
@@ -121,7 +128,6 @@
 
       if (vars.commandIn("POPUP_HISTORY")) {
         // popup showing the history of a single record
-        checkIfEnabled(request, response, vars);
 
         removePageSessionVariables(vars);
         vars.removeSessionValue("AuditTrail.tabId");
@@ -172,7 +178,6 @@
 
       } else if (vars.commandIn("POPUP_DELETED")) {
         // popup showing all deleted records of a single tab
-        checkIfEnabled(request, response, vars);
 
         removePageSessionVariables(vars);
         vars.removeSessionValue("AuditTrail.recordId");
@@ -227,45 +232,6 @@
     }
   }
 
-  /**
-   * If the instance is not activated, show error message.
-   */
-  private boolean checkIfEnabled(HttpServletRequest request, HttpServletResponse response,
-      VariablesSecureApp vars) throws IOException {
-    // ActivationKey already initialized in i.e. HSAS, so just take static info
-    if (ActivationKey.isActiveInstance()) {
-      return true;
-    }
-    String titleText = Utility.messageBD(this, "AUDIT_TRAIL", vars.getLanguage());
-    // <p> in java, to allow multi-paragraph text via the parameter
-    String infoText = "<p>" + Utility.messageBD(this, "FEATURE_OBPS_ONLY", vars.getLanguage())
-        + "</p>";
-    String linkText = Utility.messageBD(this, "LEARN_HOW", vars.getLanguage());
-    String afterLinkText = Utility.messageBD(this, "ACTIVATE_INSTANCE", vars.getLanguage());
-    showErrorActivatedInstancesOnly(response, vars, titleText, infoText, linkText, afterLinkText);
-    return false;
-  }
-
-  private void showErrorActivatedInstancesOnly(HttpServletResponse response,
-      VariablesSecureApp vars, String titleText, String infoText, String linkText,
-      String afterLinkText) throws IOException {
-    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
-        "org/openbravo/erpCommon/obps/ErrorActivatedInstancesOnly").createXmlDocument();
-
-    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-    xmlDocument.setParameter("theme", vars.getTheme());
-    xmlDocument.setParameter("titleText", titleText);
-    xmlDocument.setParameter("infoText", infoText);
-    xmlDocument.setParameter("linkText", linkText);
-    xmlDocument.setParameter("afterLinkText", afterLinkText);
-
-    response.setContentType("text/html; charset=UTF-8");
-    PrintWriter out = response.getWriter();
-    out.println(xmlDocument.print());
-    out.close();
-  }
-
   private void removePageSessionVariables(VariablesSecureApp vars) {
     vars.removeSessionValue("AuditTrail.userId");
     vars.removeSessionValue("AuditTrail.fieldId");
--- a/src/org/openbravo/erpCommon/modules/ImportModule.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/modules/ImportModule.java	Wed Aug 11 09:24:06 2010 +0200
@@ -898,13 +898,22 @@
       rt[i].setDependencies(dyanaBeanToDependencies(dynDependencies, rt[i].getModuleID(),
           enforcements));
       // old modules don't have iscommercial column
-      Object isCommercial = dynModule.get("ISCOMMERCIAL");
-      rt[i].setIsCommercial(isCommercial != null && ((String) isCommercial).equals("Y"));
+
+      String commercial = (String) dynModule.get("ISCOMMERCIAL");
+      boolean isCommercial = commercial != null && commercial.equals("Y");
+      rt[i].setIsCommercial(isCommercial);
       // To show details in local ad_module_id is used
       rt[i].setModuleVersionID((String) dynModule.get("AD_MODULE_ID"));
 
       // use this for information that is not contained in standard fields
-      HashMap<String, HashMap<String, String>> additionalInfo = new HashMap<String, HashMap<String, String>>();
+      HashMap<String, Object> additionalInfo = new HashMap<String, Object>();
+      if (isCommercial) {
+        String tier = (String) dynModule.get("COMMERCIAL_TIER");
+        if (tier == null || tier.isEmpty()) {
+          tier = "1";
+        }
+        additionalInfo.put("tier", tier);
+      }
       additionalInfo.put("enforcements", enforcements);
       rt[i].setAdditionalInfo(additionalInfo);
       i++;
@@ -1610,7 +1619,7 @@
       HttpURLConnection conn = null;
 
       if (strUrl.startsWith("https://")) {
-        ActivationKey ak = new ActivationKey();
+        ActivationKey ak = ActivationKey.getInstance();
         String instanceKey = "obinstance=" + URLEncoder.encode(ak.getPublicKey(), "utf-8");
         conn = HttpsUtils.sendHttpsRequest(url, instanceKey, "localhost-1", "changeit");
       } else {
--- a/src/org/openbravo/erpCommon/obps/ActivationKey.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java	Wed Aug 11 09:24:06 2010 +0200
@@ -21,7 +21,10 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
 import java.math.BigInteger;
 import java.security.KeyFactory;
 import java.security.PublicKey;
@@ -35,6 +38,7 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Properties;
 import java.util.zip.CRC32;
 
@@ -44,18 +48,24 @@
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
 import org.hibernate.criterion.Expression;
+import org.hibernate.criterion.Order;
+import org.openbravo.base.exception.OBException;
 import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.modules.VersionUtility.VersionComparator;
+import org.openbravo.erpCommon.utility.OBVersion;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.access.Session;
 import org.openbravo.model.ad.module.Module;
+import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.service.db.DalConnectionProvider;
 
 public class ActivationKey {
-
   private final static String OB_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCPwCM5RfisLvWhujHajnLEjEpLC7DOXLySuJmHBqcQ8AQ63yZjlcv3JMkHMsPqvoHF3s2ztxRcxBRLc9C2T3uXQg0PTH5IAxsV4tv05S+tNXMIajwTeYh1LCoQyeidiid7FwuhtQNQST9/FqffK1oVFBnWUfgZKLMO2ZSHoEAORwIDAQAB";
+  private final static String OB_PUBLIC_KEY2 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeivfuzeE+hdv7mXEyOWTpGglsT1J+UHcp9RrHydgLgccPdQ5EjqtKVSc/jzzJV5g+9XaSxz9pK5TuzzdN4fJHPCnuO0EiwWI2dxS/t1Boo+gGageGZyFRMhMsULU4902gzmw1qugEskUSKONJcR65H06HYRn2fTgVbGvEhFMASwIDAQAB";
 
   private boolean isActive = false;
   private boolean hasActivationKey = false;
@@ -70,11 +80,17 @@
   private boolean hasExpired = false;
   private boolean subscriptionConvertedProperty = false;
   private boolean subscriptionActuallyConverted = false;
+  private LicenseClass licenseClass;
+  private List<String> tier1Artifacts;
+  private List<String> tier2Artifacts;
 
   private boolean notActiveYet = false;
 
   private static final Logger log4j = Logger.getLogger(ActivationKey.class);
 
+  private static final String TIER_1_PREMIUM_FEATURE = "T1P";
+  private static final String TIER_2_PREMIUM_FEATURE = "T2P";
+
   public enum LicenseRestriction {
     NO_RESTRICTION, OPS_INSTANCE_NOT_ACTIVE, NUMBER_OF_SOFT_USERS_REACHED, NUMBER_OF_CONCURRENT_USERS_REACHED, MODULE_EXPIRED
   }
@@ -83,14 +99,87 @@
     NO_SUBSCRIBED, ACTIVE, EXPIRED, NO_ACTIVE_YET, CONVERTED_SUBSCRIPTION
   }
 
+  public enum FeatureRestriction {
+    NO_RESTRICTION, TIER1_RESTRICTION, TIER2_RESTRICTION, UNKNOWN_RESTRICTION;
+  }
+
+  public enum LicenseClass {
+    BASIC("B"), STD("STD");
+    private String code;
+
+    private LicenseClass(String code) {
+      this.code = code;
+    }
+
+    public String getCode() {
+      return code;
+    }
+  }
+
   private static final int MILLSECS_PER_DAY = 24 * 60 * 60 * 1000;
   private static final int PING_TIMEOUT_SECS = 120;
 
+  private static ActivationKey instance = new ActivationKey();
+
+  /**
+   * Obtains the ActivationKey instance. Instances should be get in this way, rather than creating a
+   * new one.
+   * 
+   */
+  public static synchronized ActivationKey getInstance() {
+    return instance;
+  }
+
+  public static synchronized void setInstance(ActivationKey ak) {
+    instance = ak;
+  }
+
+  /**
+   * Reloads ActivationKey instance from information in DB.
+   */
+  public static synchronized ActivationKey reload() {
+    ActivationKey ak = getInstance();
+    org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
+        org.openbravo.model.ad.system.System.class, "0");
+    ak.loadInfo(sys.getActivationKey());
+    ak.loadRestrictions();
+    return ak;
+  }
+
+  /**
+   * ActivationKey constructor, this should not be used. ActivationKey should be treated as
+   * Singleton, so the {@link ActivationKey#getInstance()} method should be used instead.
+   * <p/>
+   * This constructor is public to maintain backwards compatibility.
+   */
   public ActivationKey() {
     org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
         org.openbravo.model.ad.system.System.class, "0");
     strPublicKey = sys.getInstanceKey();
     String activationKey = sys.getActivationKey();
+    loadInfo(activationKey);
+    loadRestrictions();
+  }
+
+  public ActivationKey(String publicKey, String activationKey) {
+    strPublicKey = publicKey;
+    loadInfo(activationKey);
+    loadRestrictions();
+  }
+
+  private void loadInfo(String activationKey) {
+    // Reset
+    isActive = false;
+    hasActivationKey = false;
+    errorMessage = "";
+    messageType = "Error";
+    instanceProperties = null;
+    opsLog = false;
+    hasExpired = false;
+    subscriptionConvertedProperty = false;
+    subscriptionActuallyConverted = false;
+    tier1Artifacts = null;
+    tier2Artifacts = null;
 
     if (strPublicKey == null || activationKey == null || strPublicKey.equals("")
         || activationKey.equals("")) {
@@ -108,54 +197,30 @@
     }
     hasActivationKey = true;
     try {
-      PublicKey obPk = getPublicKey(OB_PUBLIC_KEY); // get OB public key to check signature
-      Signature signer = Signature.getInstance("MD5withRSA");
-      signer.initVerify(obPk);
+      ByteArrayOutputStream bos = new ByteArrayOutputStream();
+      boolean signed = decrypt(activationKey.getBytes(), pk, bos, OB_PUBLIC_KEY);
 
-      Cipher cipher = Cipher.getInstance("RSA");
+      if (!signed) {
+        // Basic license is only supported from 2.50mp21, they are signed with second key. So in
+        // case first key does not work, try to use the second one.
+        bos = new ByteArrayOutputStream();
+        signed = decrypt(activationKey.getBytes(), pk, bos, OB_PUBLIC_KEY2);
+      }
 
-      ByteArrayInputStream bis = new ByteArrayInputStream(org.apache.commons.codec.binary.Base64
-          .decodeBase64(activationKey.getBytes()));
-      ByteArrayOutputStream bos = new ByteArrayOutputStream();
+      if (signed) {
+        byte[] props = bos.toByteArray();
+        ByteArrayInputStream isProps = new ByteArrayInputStream(props);
+        InputStreamReader reader = new InputStreamReader(isProps, "UTF-8");
+        instanceProperties = new Properties();
 
-      // Encryptation only accepts 128B size, it must be chuncked
-      final byte[] buf = new byte[128];
-      final byte[] signature = new byte[128];
-
-      // read the signature
-      if (!(bis.read(signature) > 0)) {
+        instanceProperties.load(reader);
+        reader.close();
+      } else {
         isActive = false;
         errorMessage = "@NotSigned@";
         setLogger();
         return;
       }
-
-      // decrypt
-      while ((bis.read(buf)) > 0) {
-        cipher.init(Cipher.DECRYPT_MODE, pk);
-        bos.write(cipher.doFinal(buf));
-      }
-
-      // verify signature
-      signer.update(bos.toByteArray());
-      boolean signed = signer.verify(signature);
-      log.debug("signature length:" + buf.length);
-      log.debug("singature:" + (new BigInteger(signature).toString(16).toUpperCase()));
-      log.debug("signed:" + signed);
-      if (!signed) {
-        isActive = false;
-        errorMessage = "@NotSigned@";
-        setLogger();
-        return;
-      }
-
-      byte[] props = bos.toByteArray();
-
-      ByteArrayInputStream isProps = new ByteArrayInputStream(props);
-      InputStreamReader reader = new InputStreamReader(isProps, "UTF-8");
-      instanceProperties = new Properties();
-
-      instanceProperties.load(reader);
     } catch (Exception e) {
       isActive = false;
       errorMessage = "@NotAValidKey@";
@@ -214,9 +279,109 @@
       }
     }
     isActive = true;
+
+    // Get license class, old Activation Keys do not have this info, so treat them as Standard
+    // Edition instances
+    String pLicenseClass = getProperty("licenseedition");
+    if (pLicenseClass == null || pLicenseClass.isEmpty() || pLicenseClass.equals("STD")) {
+      licenseClass = LicenseClass.STD;
+    } else if (pLicenseClass.equals("B")) {
+      licenseClass = LicenseClass.BASIC;
+    } else {
+      log4j.warn("Unknown license class:" + pLicenseClass + ". Using Basic!.");
+      licenseClass = LicenseClass.BASIC;
+    }
     setLogger();
   }
 
+  private boolean decrypt(byte[] bytes, PublicKey pk, ByteArrayOutputStream bos,
+      String strOBPublicKey) throws Exception {
+    PublicKey obPk = getPublicKey(strOBPublicKey); // get OB public key to check signature
+    Signature signer = Signature.getInstance("MD5withRSA");
+    signer.initVerify(obPk);
+
+    Cipher cipher = Cipher.getInstance("RSA");
+
+    ByteArrayInputStream bis = new ByteArrayInputStream(org.apache.commons.codec.binary.Base64
+        .decodeBase64(bytes));
+
+    // Encryptation only accepts 128B size, it must be chuncked
+    final byte[] buf = new byte[128];
+    final byte[] signature = new byte[128];
+
+    // read the signature
+    if (!(bis.read(signature) > 0)) {
+      return false;
+    }
+
+    // decrypt
+    while ((bis.read(buf)) > 0) {
+      cipher.init(Cipher.DECRYPT_MODE, pk);
+      bos.write(cipher.doFinal(buf));
+    }
+
+    // verify signature
+    signer.update(bos.toByteArray());
+    boolean signed = signer.verify(signature);
+    log.debug("signature length:" + buf.length);
+    log.debug("singature:" + (new BigInteger(signature).toString(16).toUpperCase()));
+    log.debug("signed:" + signed);
+    if (!signed) {
+      isActive = false;
+      errorMessage = "@NotSigned@";
+      setLogger();
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Loads information about the restricted artifacts due to license (Premium and Advance features).
+   */
+  @SuppressWarnings("unchecked")
+  private void loadRestrictions() {
+    tier1Artifacts = new ArrayList<String>();
+    tier2Artifacts = new ArrayList<String>();
+    if (isActive() && licenseClass == LicenseClass.STD) {
+      // Don't read restrictions for Standard instances
+      return;
+    }
+
+    try {
+      File restrictionsFile = new File(OBPropertiesProvider.getInstance().getOpenbravoProperties()
+          .get("source.path")
+          + "/config/licenseRestrictions");
+      FileInputStream fis = new FileInputStream(restrictionsFile);
+      byte fileContent[] = new byte[(int) restrictionsFile.length()];
+      fis.read(fileContent);
+      ByteArrayOutputStream bos = new ByteArrayOutputStream();
+      decrypt(fileContent, getPublicKey(OB_PUBLIC_KEY), bos, OB_PUBLIC_KEY);
+      ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
+      HashMap<String, ArrayList<String>> m1 = (HashMap<String, ArrayList<String>>) ois.readObject();
+      ois.close();
+
+      if (!isActive()) {
+        VersionComparator vc = new VersionComparator();
+        if (vc.compare("3.0.0", OBVersion.getInstance().getVersionNumber()) <= 0) {
+          // community 3.0 instance, restrict both tiers
+          tier1Artifacts.addAll(m1.get(TIER_1_PREMIUM_FEATURE));
+          tier2Artifacts.addAll(m1.get(TIER_2_PREMIUM_FEATURE));
+        }
+      } else if (licenseClass == LicenseClass.BASIC) {
+        // basic, restrict tier 2
+        tier2Artifacts.addAll(m1.get(TIER_2_PREMIUM_FEATURE));
+      }
+    } catch (Exception e) {
+      log4j.error("Error reading license restriction file", e);
+      tier1Artifacts = null;
+      tier2Artifacts = null;
+    }
+  }
+
+  public LicenseClass getLicenseClass() {
+    return licenseClass;
+  }
+
   @SuppressWarnings( { "static-access", "unchecked" })
   private void setLogger() {
     if (isActive() && !opsLog) {
@@ -452,10 +617,15 @@
     } catch (ParseException e) {
       log.error("Error parsing date", e);
     }
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     if (instanceProperties != null) {
       sb.append("<tr><td>").append(Utility.messageBD(conn, "OPSCustomer", lang))
           .append("</td><td>").append(getProperty("customer")).append("</td></tr>");
+
+      sb.append("<tr><td>").append(Utility.messageBD(conn, "OPSLicenseEdition", lang)).append(
+          "</td><td>").append(
+          Utility.getListValueName("OBPSLicenseEdition", licenseClass.getCode(), lang)).append(
+          "</td></tr>");
       sb.append("<tr><td>").append(Utility.messageBD(conn, "OPSLicenseType", lang)).append(
           "</td><td>").append(
           Utility.getListValueName("OPSLicenseType", getProperty("lincensetype"), lang)).append(
@@ -600,7 +770,8 @@
   }
 
   /**
-   * Returns the status for the commercial module passed as parameter
+   * Returns the status for the commercial module passed as parameter. Note that module tier is not
+   * checked here, this should be correctly handled in the license itself.
    * 
    * @param moduleId
    * @return the status for the commercial module passed as parameter
@@ -615,4 +786,86 @@
     return moduleList.get(moduleId);
   }
 
+  /**
+   * Checks whether there is access to an artifact because of license restrictions (checking core
+   * advance and premium features).
+   * 
+   * @param type
+   *          Type of artifact (Window, Report, Process...)
+   * @param id
+   *          Id of the Artifact
+   * @return true in case it has access, false if not
+   */
+  public FeatureRestriction hasLicenseAccess(String type, String id) {
+    String actualType = type;
+    VersionComparator vc = new VersionComparator();
+
+    if (actualType == null || actualType.isEmpty() || id == null || id.isEmpty()
+        || (!isActive() && vc.compare("3.0.0", OBVersion.getInstance().getVersionNumber()) > 0)
+        || licenseClass == LicenseClass.STD) {
+      return FeatureRestriction.NO_RESTRICTION;
+    }
+    log4j.debug("Type:" + actualType + " id:" + id);
+    if (tier1Artifacts == null || tier2Artifacts == null) {
+      log4j.error("No restrictions set, do not allow access");
+
+      throw new OBException(Utility.messageBD(new DalConnectionProvider(), "NoRestrictionsFile",
+          OBContext.getOBContext().getLanguage().getLanguage()));
+    }
+
+    String artifactId = id;
+    if ("W".equals(actualType)) {
+      // Access is granted to window, but permissions is checked for tabs
+      OBContext.setAdminMode();
+      try {
+        Tab tab = OBDal.getInstance().get(Tab.class, id);
+        if (tab == null) {
+          log4j.error("Could't find tab " + id + " to check access. Access not allowed");
+          return FeatureRestriction.UNKNOWN_RESTRICTION;
+        }
+        artifactId = tab.getWindow().getId();
+      } finally {
+        OBContext.restorePreviousMode();
+      }
+    } else if ("MW".equals(actualType)) {
+      // Menu window, it receives window instead of tab
+      actualType = "W";
+    } else if ("R".equals(actualType)) {
+      actualType = "P";
+    }
+    if (tier1Artifacts.contains(actualType + artifactId)) {
+      return FeatureRestriction.TIER1_RESTRICTION;
+    }
+    if (tier2Artifacts.contains(actualType + artifactId)) {
+      return FeatureRestriction.TIER2_RESTRICTION;
+    }
+    return FeatureRestriction.NO_RESTRICTION;
+  }
+
+  /**
+   * Verifies all the commercial installed modules are allowed to the instance.
+   * 
+   * @return List of non allowed modules
+   */
+  public String verifyInstalledModules() {
+    String rt = "";
+
+    OBContext.setAdminMode();
+    try {
+      OBCriteria<Module> mods = OBDal.getInstance().createCriteria(Module.class);
+      mods.add(Expression.eq(Module.PROPERTY_COMMERCIAL, true));
+      // Allow development of commercial modules which are not in the license.
+      mods.add(Expression.eq(Module.PROPERTY_INDEVELOPMENT, false));
+      mods.addOrder(Order.asc(Module.PROPERTY_NAME));
+      for (Module mod : mods.list()) {
+        if (!isActiveInstance()
+            || isModuleSubscribed(mod.getId()) == CommercialModuleStatus.NO_SUBSCRIBED) {
+          rt += (rt.isEmpty() ? "" : ", ") + mod.getName();
+        }
+      }
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return rt;
+  }
 }
--- a/src/org/openbravo/erpCommon/obps/ActiveInstanceProcess.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActiveInstanceProcess.java	Wed Aug 11 09:24:06 2010 +0200
@@ -52,18 +52,23 @@
     if (result.length == 2 && result[0] != null && result[1] != null
         && result[0].equals("@Success@")) {
       // now we have the activation key, lets save it
-      System sys = OBDal.getInstance().get(System.class, "0");
-      sys.setActivationKey(result[1]);
-      sys.setInstanceKey(publicKey);
-      ActivationKey ak = new ActivationKey();
-      if (ak.isActive()) {
+
+      ActivationKey ak = new ActivationKey(publicKey, result[1]);
+      String nonAllowedMods = ak.verifyInstalledModules();
+      if (!nonAllowedMods.isEmpty()) {
+        msg.setType("Error");
+        msg.setMessage("@LicenseWithoutAccessTo@ " + nonAllowedMods);
+      } else if (ak.isActive()) {
+        System sys = OBDal.getInstance().get(System.class, "0");
+        sys.setActivationKey(result[1]);
+        sys.setInstanceKey(publicKey);
+        ActivationKey.setInstance(ak);
         msg.setType("Success");
         msg.setMessage(result[0]);
       } else {
         msg.setType("Error");
         msg.setMessage(ak.getErrorMessage());
       }
-
     } else {
       // If there is error do not save keys, thus we maitain previous ones in case they were valid
       msg.setType("Error");
--- a/src/org/openbravo/erpCommon/obps/CheckCleanCache.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/CheckCleanCache.java	Wed Aug 11 09:24:06 2010 +0200
@@ -64,8 +64,7 @@
     boolean active = false;
     OBContext.setAdminMode();
     try {
-      ActivationKey ak = new ActivationKey();
-      active = ak.isActive();
+      active = ActivationKey.getInstance().isActive();
       log4j.debug("Instance activate: " + active);
     } finally {
       OBContext.restorePreviousMode();
--- a/src/org/openbravo/erpCommon/obps/ErrorActivatedInstancesOnly.html	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/ErrorActivatedInstancesOnly.html	Wed Aug 11 09:24:06 2010 +0200
@@ -33,7 +33,11 @@
   </script>
   <script language="JavaScript" type="text/javascript">
   function closeThisPage() {
-    window.close();
+    if (typeof parent === 'undefined'){
+      window.close();
+    } else { 
+      parent.window.close();
+    }
     return true;
   }
 
--- a/src/org/openbravo/erpCommon/obps/GetOpenbravoLogo.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/GetOpenbravoLogo.java	Wed Aug 11 09:24:06 2010 +0200
@@ -49,8 +49,7 @@
     boolean active = false;
     OBContext.setAdminMode();
     try {
-      ActivationKey ak = new ActivationKey();
-      active = ak.isActive();
+      active = ActivationKey.getInstance().isActive();
       log4j.debug("GetOpsLogo: activated: " + active);
     } finally {
       OBContext.restorePreviousMode();
--- a/src/org/openbravo/erpCommon/utility/Menu_data.xsql	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/Menu_data.xsql	Wed Aug 11 09:24:06 2010 +0200
@@ -12,7 +12,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) 2001-2006 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -40,9 +40,11 @@
                               when 'F' then MOMF.MAPPINGNAME
                               else MOMP.MAPPINGNAME
                               end) AS MAPPINGNAME, 
+        menuData.AD_Window_ID,
         menuData.AD_Process_ID, 
         menuData.AD_Task_ID, 
         menuData.AD_Workflow_ID, 
+        menuData.AD_Form_ID,
         menuData.url,
         P.IsExternalService,
         P.Service_Type
--- a/src/org/openbravo/erpCommon/utility/OBVersion.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/OBVersion.java	Wed Aug 11 09:24:06 2010 +0200
@@ -34,7 +34,13 @@
   private Module versionModule;
   private Module core;
 
-  public OBVersion() {
+  private static final OBVersion instance = new OBVersion();
+
+  public static OBVersion getInstance() {
+    return instance;
+  }
+
+  private OBVersion() {
     OBContext.setAdminMode();
     try {
       core = OBDal.getInstance().get(Module.class, CORE);
--- a/src/org/openbravo/erpCommon/utility/SystemInfo.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/SystemInfo.java	Wed Aug 11 09:24:06 2010 +0200
@@ -78,7 +78,7 @@
       systemInfo.put(i, getVersion(SystemInfoData.selectAntVersion(conn)));
       break;
     case OB_VERSION:
-      OBVersion version = new OBVersion();
+      OBVersion version = OBVersion.getInstance();
       systemInfo.put(i, version.getVersionNumber() + version.getMP());
       break;
     case OB_INSTALL_MODE:
--- a/src/org/openbravo/erpCommon/utility/VerticalMenu.java	Wed Aug 11 08:33:14 2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/VerticalMenu.java	Wed Aug 11 09:24:06 2010 +0200
@@ -34,6 +34,8 @@
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.ad_process.HeartbeatProcess;
 import org.openbravo.erpCommon.ad_process.HeartbeatProcess.HeartBeatOrRegistration;
+import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
 import org.openbravo.model.ad.access.Session;
 import org.openbravo.utils.FormatUtilities;
 import org.openbravo.xmlEngine.XmlDocument;
@@ -252,7 +254,26 @@
         final String strHijos = generarMenuVertical(menuData, strDireccion, menuData[i].nodeId,
             open);
         String strID = "";
-        if (!strHijos.equals("") || menuData[i].issummary.equals("N")) {
+
+        // Hide non accessible entries because of license
+        String menuAction = menuData[i].action;
+        if (menuAction.equals("W")) {
+          menuAction = "MW";
+        }
+        String artifactId = "";
+        if (menuAction.equals("MW")) {
+          artifactId = menuData[i].adWindowId;
+        } else if (menuAction.equals("P") || menuAction.equals("R")) {
+          artifactId = menuData[i].adProcessId;
+        } else if (menuAction.equals("X")) {
+          artifactId = menuData[i].adFormId;
+        } else if (menuAction.equals("F")) {
+          artifactId = menuData[i].adWorkflowId;
+        }
+        boolean hasLicenseAccess = ActivationKey.getInstance().hasLicenseAccess(menuAction,
+            artifactId) == FeatureRestriction.NO_RESTRICTION;
+
+        if (hasLicenseAccess && (!strHijos.equals("") || menuData[i].issummary.equals("N"))) {
           strText.append("<tr>\n");
           strText.append("  <td>\n");
           strText.append("    <table cellspacing=\"0\" cellpadding=\"0\"");
@@ -260,8 +281,9 @@
             strText.append(" id=\"").append(tipoVentanaNico(menuData[i].action)).append(
                 menuData[i].nodeId).append("\"");
             strID = tipoVentanaNico(menuData[i].action) + menuData[i].nodeId;
-          } else
+          } else {
             strText.append(" id=\"folder").append(menuData[i].nodeId).append("\"");
+          }
           strText.append(" onmouseover=\"window.status='");
           strText.append(FormatUtilities.replaceJS(menuData[i].description));
           strText.append("';return true;\"");