related to issue 38879 added modulescript with default value of preference
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 04 Jul 2018 09:22:23 +0200
changeset 34271 d0cc6cddbf69
parent 34270 fceb99795039
child 34272 a3c948281b97
related to issue 38879 added modulescript with default value of preference

added modulescript with default value of hierarchical price list
preference depends on the openbravo version.
src-util/modulescript/build/classes/org/openbravo/modulescript/HierarchicalPriceListPreference.class
src-util/modulescript/build/classes/org/openbravo/modulescript/HierarchicalPriceListPreferenceData.class
src-util/modulescript/src/org/openbravo/modulescript/HierarchicalPriceListPreference.java
src-util/modulescript/src/org/openbravo/modulescript/HierarchicalPriceListPreference_data.xsql
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/HierarchicalPriceListPreference.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/HierarchicalPriceListPreferenceData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/HierarchicalPriceListPreference.java	Wed Jul 04 09:22:23 2018 +0200
@@ -0,0 +1,46 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2018 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.modulescript;
+
+import org.openbravo.database.ConnectionProvider;
+
+public class HierarchicalPriceListPreference extends ModuleScript {
+
+  @Override
+  public void execute() {
+    try {
+      ConnectionProvider cp = getConnectionProvider();      
+      HierarchicalPriceListPreferenceData.createHierarchicalPriceListPref(cp);     
+    }
+    catch (Exception e) {
+      handleError(e);
+    }
+  }
+  
+  @Override
+  protected ModuleScriptExecutionLimits getModuleScriptExecutionLimits() {
+    return new ModuleScriptExecutionLimits("0", null, 
+        new OpenbravoVersion(3,0,32857));
+  }
+  
+  @Override
+  protected boolean executeOnInstall() {
+    return false;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/HierarchicalPriceListPreference_data.xsql	Wed Jul 04 09:22:23 2018 +0200
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2018 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<SqlClass name="HierarchicalPriceListPreferenceData" package="org.openbravo.modulescript">
+  <SqlClassComment></SqlClassComment>
+   <SqlMethod name="select" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT 1 as DUMMY FROM DUAL
+      ]]>
+    </Sql>
+  </SqlMethod> 
+     <SqlMethod name="createHierarchicalPriceListPref" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        INSERT INTO ad_preference (ad_preference_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, ad_window_id, ad_user_id, attribute,value, property, ispropertylist, visibleat_client_id, visibleat_org_id, visibleat_role_id, selected, ad_module_id, inherited_from) 
+        VALUES (get_uuid(), '0', '0', 'Y', NOW(), '0', NOW(), '0',null, null, null, 'N','HierarchicalPriceList','Y',null ,null ,null ,'N' ,null ,null )
+      ]]>
+    </Sql>
+  </SqlMethod>
+
+</SqlClass>