[cleanup] Remove unused pl-functions
authorStefan Hühner <stefan.huehner@openbravo.com>
Wed, 11 May 2011 17:12:46 +0200
changeset 12114 2822ff9e0659
parent 12113 503b38eee40c
child 12115 84cb6edcc057
[cleanup] Remove unused pl-functions
src-db/database/model/functions/AD_DISPLAY_LIST.xml
src-db/database/model/functions/AD_MESSAGE_GET.xml
src-db/database/model/functions/AD_ORGLIST.xml
src-db/database/model/functions/AD_TRANSLATE_ID.xml
src-db/database/model/functions/AD_UPDATE_SEQUENCE.xml
src-db/database/model/functions/C_ELEMENTVALUE_COPY.xml
src-db/database/model/functions/C_GETORDERLINE_TAXAMOUNT.xml
src-db/database/model/functions/C_GETPERIODNAME.xml
src-db/database/model/functions/C_ORDER_FACT_RESET.xml
src-db/database/model/functions/C_PAYMENTTERM_DUEDATE.xml
src-db/database/model/functions/C_PAYMENTTERM_DUEDAYS.xml
src-db/database/model/functions/GL_PERIOD_OPEN.xml
src-db/database/model/functions/M_GET_OFFERS_APPLIED.xml
src-db/database/model/functions/M_GET_PURCHASE_PRICE.xml
src-db/database/model/functions/M_PRODUCT_DELETE.xml
--- a/src-db/database/model/functions/AD_DISPLAY_LIST.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION AD_DISPLAY_LIST">
-    <function name="AD_DISPLAY_LIST" type="NVARCHAR">
-      <parameter name="p_referencevalue_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_value" type="NVARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_ad_language" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2009 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-* Title: Get RefList Name translated
-************************************************************************/
-  v_Display NVARCHAR2(120) ;
-BEGIN
-  IF(p_AD_Language='en_US') THEN
-    SELECT RL.NAME
-    INTO v_Display
-    FROM AD_REF_LIST RL
-    WHERE RL.AD_REFERENCE_ID=p_ReferenceValue_ID
-      AND RL.VALUE=p_Value;
-  ELSE
-    SELECT RLT.NAME
-    INTO v_Display
-    FROM AD_REF_LIST RL,
-      AD_REF_LIST_TRL RLT
-    WHERE RL.AD_REF_LIST_ID=RLT.AD_REF_LIST_ID
-      AND RLT.AD_LANGUAGE=p_AD_Language
-      AND RL.AD_REFERENCE_ID=p_ReferenceValue_ID
-      AND RL.VALUE=p_Value;
-  END IF;
-  RETURN v_Display;
-EXCEPTION
-WHEN OTHERS THEN
-  RETURN 'Not found!!!';
-END AD_DISPLAY_LIST
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/AD_MESSAGE_GET.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION AD_MESSAGE_GET">
-    <function name="AD_MESSAGE_GET" type="NVARCHAR">
-      <parameter name="p_value" type="NVARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_ad_language" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/******************************************************************************
-* The contents of this file are subject to the   Compiere License  Version 1.1
-* ("License"); You may not use this file except in compliance with the License
-* You may obtain a copy of the License at http://www.compiere.org/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                  Compiere  ERP &  Business Solution
-* The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
-* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
-* created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
-* Contributor(s): Openbravo SLU
-* Contributions are Copyright (C) 2001-2006 Openbravo S.L.U.
-******************************************************************************/
-  v_RetValue AD_Message.MsgText%TYPE;
-BEGIN
-BEGIN
-  SELECT MsgText -- Message
-  INTO v_RetValue
-  FROM AD_Message
-  WHERE Value = p_Value;
-  /*POSTGRESQL>
-  IF (NOT FOUND) THEN
-  RETURN <' || p_Value || '>';
-  END IF;
-  <POSTGRESQL*/
-  /*ORACLE>*/
-EXCEPTION
-WHEN OTHERS THEN
-  RETURN N'<' || p_Value || N'>';
-  /*<ORACLE*/
-END;
---
-RETURN v_RetValue;
-END AD_MESSAGE_GET
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/AD_ORGLIST.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION AD_ORGLIST">
-    <function name="AD_ORGLIST" type="VARCHAR">
-      <parameter name="p_roleid" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*************************************************************************
-* Title: Return the list (comma separated) of Organizations granted to the role
-************************************************************************/
-  v_orgList VARCHAR2(4000) ;
-  TYPE RECORD IS REF CURSOR;
-    Cur_Roles RECORD;
-BEGIN
-    v_orgList := '';
-    FOR Cur_Roles IN
-      (SELECT AD_Org_ID
-      FROM AD_ROLE_ORGACCESS
-      WHERE AD_ROLE_ID = p_roleID
-      ORDER BY AD_Org_ID
-      )
-    LOOP
-      v_orgList:=v_orgList||','||Cur_Roles.AD_Org_ID;
-    END LOOP;
-    RETURN SUBSTR(v_orgList, 2, 4000) ;
-END AD_ORGLIST
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/AD_TRANSLATE_ID.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION AD_TRANSLATE_ID">
-    <function name="AD_TRANSLATE_ID" type="VARCHAR">
-      <parameter name="p_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_offset" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_tablename" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_columnname" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_clientid" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*************************************************************************
-* Title: Return the value of the ID selected in the new client
-************************************************************************/
-  v_ID VARCHAR2(32);
-BEGIN
-  IF(p_ID IS NOT NULL) THEN
-    EXECUTE IMMEDIATE 'SELECT MAX('||p_columnName||') FROM '||p_tableName||' WHERE '||p_columnName||'='||p_ID||' AND AD_CLIENT_ID  ='||p_clientID INTO v_ID;
-    IF(v_ID IS NULL) THEN
-      v_ID:=p_ID;
-    ELSE
-      v_ID:=v_ID + p_offset;
-    END IF;
-  END IF;
-  RETURN v_ID;
-END AD_TRANSLATE_ID
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/AD_UPDATE_SEQUENCE.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION AD_UPDATE_SEQUENCE">
-    <function name="AD_UPDATE_SEQUENCE" type="NULL">
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
- BEGIN
-   NULL;
-   
-   --do nothing, just maintained for bacward compatibility
-END AD_UPDATE_SEQUENCE
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/C_ELEMENTVALUE_COPY.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_ELEMENTVALUE_COPY">
-    <function name="C_ELEMENTVALUE_COPY" type="NULL">
-      <parameter name="p_source_element_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_target_element_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-  * The contents of this file are subject to the Compiere Public
-  * License 1.1 ("License"); You may not use this file except in
-  * compliance with the License. You may obtain a copy of the License in
-  * the legal folder of your Openbravo installation.
-  * 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  Compiere  ERP &  Business Solution
-  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
-  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
-  * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
-  * All Rights Reserved.
-  * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.U.
-  *
-  * Specifically, this derivative work is based upon the following Compiere
-  * file and version.
-  *************************************************************************
-  *  Copies CoA
-  * All element values of p_Source_Element_ID to p_Target_Element_ID
-  */
-  TYPE RECORD IS REF CURSOR;
-    Cur_ElementValue RECORD;
-    v_xAD_Client_ID VARCHAR2(32);
-    v_xAD_Org_ID VARCHAR2(32);
-    v_xUpdated DATE;
-    v_xUpdatedBy VARCHAR2(32);
-    v_NextNo VARCHAR2(32);
-  BEGIN
-    --  Get target base info
-    SELECT AD_Client_ID,
-      AD_Org_ID,
-      Updated,
-      UpdatedBy
-    INTO v_xAD_Client_ID,
-      v_xAD_Org_ID,
-      v_xUpdated,
-      v_xUpdatedBy
-    FROM C_Element
-    WHERE C_Element_ID=p_Target_Element_ID;
-    FOR Cur_ElementValue IN
-      (SELECT *
-      FROM C_ElementValue
-      WHERE C_Element_ID=p_Source_Element_ID
-        AND IsActive='Y'
-      )
-    LOOP
-      AD_Sequence_Next('C_ElementValue', p_Target_Element_ID, v_NextNo) ;
-      INSERT
-      INTO C_ElementValue
-        (
-          C_ElementValue_ID, C_Element_ID, AD_Client_ID, AD_Org_ID,
-          IsActive, Created, CreatedBy, Updated,
-          UpdatedBy, Value, Name, Description,
-          AccountType, AccountSign, IsDocControlled, IsSummary,
-          ValidFrom, ValidTo, PostActual, PostBudget,
-          PostEncumbrance, PostStatistical, IsForeignCurrency, C_Currency_ID
-        )
-        VALUES
-        (
-          v_NextNo, p_Target_Element_ID, v_xAD_Client_ID, v_xAD_Org_ID,
-           'Y', v_xUpdated, v_xUpdatedBy, v_xUpdated,
-          v_xUpdatedBy, Cur_ElementValue.Value, Cur_ElementValue.Name, Cur_ElementValue.Description,
-          Cur_ElementValue.AccountType, Cur_ElementValue.AccountSign, Cur_ElementValue.IsDocControlled, Cur_ElementValue.IsSummary,
-          Cur_ElementValue.ValidFrom, Cur_ElementValue.ValidTo, Cur_ElementValue.PostActual, Cur_ElementValue.PostBudget,
-          Cur_ElementValue.PostEncumbrance, Cur_ElementValue.PostStatistical, Cur_ElementValue.IsForeignCurrency, Cur_ElementValue.C_Currency_ID
-        )
-        ;
-    END LOOP;
-    -- Commented by cromero 19102006 COMMIT;
-END C_ELEMENTVALUE_COPY
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/C_GETORDERLINE_TAXAMOUNT.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_GETORDERLINE_TAXAMOUNT">
-    <function name="C_GETORDERLINE_TAXAMOUNT" type="NUMERIC">
-      <parameter name="p_orderline" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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 SL
-* All portions are Copyright (C) 2010 Openbravo SL
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*************************************************************************
-* Title: Get Tax Amount of an Order Line
-************************************************************************/
-  v_amount NUMBER;
-BEGIN
-  SELECT SUM(taxamt) INTO v_amount
-  FROM c_orderlinetax
-  WHERE c_orderline_id = p_orderline;
-  RETURN v_amount;
-END C_GETORDERLINE_TAXAMOUNT
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/C_GETPERIODNAME.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_GETPERIODNAME">
-    <function name="C_GETPERIODNAME" type="NVARCHAR">
-      <parameter name="p_periodno" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_year_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-  v_Period NVARCHAR2(60) ;
-  --
-BEGIN
-  SELECT NAME
-  INTO v_Period
-  FROM C_PERIOD
-  WHERE C_YEAR_ID=p_Year_ID
-    AND periodno=p_PeriodNo;
-  RETURN v_Period;
-END C_GETPERIODNAME
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/C_ORDER_FACT_RESET.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_ORDER_FACT_RESET">
-    <function name="C_ORDER_FACT_RESET" type="NULL">
-      <parameter name="p_c_order_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-  v_AD_Table_ID VARCHAR2(32) ;
-BEGIN
-  SELECT AD_Table_ID INTO v_AD_Table_ID FROM AD_Table WHERE TABLENAME='C_Order';
-  IF v_AD_Table_ID IS NULL THEN
-    RAISE_APPLICATION_ERROR(-20000, '@TableNotFound@') ;
-  END IF;
-  UPDATE C_Order
-    SET Posted='N',
-    Processing='N'
-  WHERE C_Order_ID=p_C_Order_ID
-    AND(Posted<>'N'
-    OR Posted IS NULL
-    OR Processing<>'N'
-    OR Processing IS NULL) ;
-  DELETE FROM Fact_Acct  WHERE AD_Table_ID=v_AD_Table_ID  AND RECORD_ID=p_C_Order_ID;
-  -- Commented by cromero 19102006 COMMIT;
-  RETURN;
-EXCEPTION
-WHEN OTHERS THEN
-  RAISE;
-  ROLLBACK;
-  RETURN;
-END C_ORDER_FACT_RESET
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/C_PAYMENTTERM_DUEDATE.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_PAYMENTTERM_DUEDATE">
-    <function name="C_PAYMENTTERM_DUEDATE" type="TIMESTAMP">
-      <parameter name="p_paymentterm_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_docdate" type="TIMESTAMP" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_bpartner_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*************************************************************************
-* Title: Get Due DATE
-* Description:
-* Grace days are not considered!
-************************************************************************/
-    v_DueDate DATE;
-    --
-  TYPE RECORD IS REF CURSOR;
-    Cur_PT RECORD;
-  BEGIN
-    FOR Cur_PT IN
-      (SELECT *  FROM C_PaymentTerm  WHERE C_PaymentTerm_ID = p_PaymentTerm_ID)
-    LOOP
-      -- Pending: Vendor invoices not arranged
-      v_DueDate := C_PaymentDueDate(p_BPartner_ID, 'Y', Cur_PT.FixMonthDay, Cur_PT.FixMonthDay2, Cur_PT.FixMonthDay3, Cur_PT.NetDays, Cur_PT.FixMonthOffset, Cur_PT.NetDay, Cur_PT.IsNextbusinessday, p_DocDate) ;
-    END LOOP;
-    RETURN COALESCE(v_DueDate, TRUNC(p_DocDate)) ;
-END C_PAYMENTTERM_DUEDATE
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/C_PAYMENTTERM_DUEDAYS.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION C_PAYMENTTERM_DUEDAYS">
-    <function name="C_PAYMENTTERM_DUEDAYS" type="NUMERIC">
-      <parameter name="p_paymentterm_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_docdate" type="TIMESTAMP" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_paydate" type="TIMESTAMP" mode="in">
-        <default><![CDATA[now()]]></default>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2008 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-BEGIN
-  RETURN TRUNC(p_PayDate) - C_PAYMENTTERM_DUEDATE(p_PaymentTerm_ID, p_DocDate, NULL) ;
-END C_PAYMENTTERM_DUEDAYS
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/GL_PERIOD_OPEN.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION GL_PERIOD_OPEN">
-    <function name="GL_PERIOD_OPEN" type="VARCHAR">
-      <parameter name="p_ad_client_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_dateacct" type="TIMESTAMP" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_docbasetype" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_c_acctschema_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* The contents of this file are subject to the Compiere Public
-* License 1.1 ("License"); You may not use this file except in
-* compliance with the License. You may obtain a copy of the License in
-* the legal folder of your Openbravo installation.
-* 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  Compiere  ERP &  Business Solution
-* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
-* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
-* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
-* All Rights Reserved.
-* Contributor(s): Openbravo SLU
-* Contributions are Copyright (C) 2001-2009 Openbravo, S.L.U.
-*
-* Specifically, this derivative work is based upon the following Compiere
-* file and version.
-*************************************************************************
-* $Id: GL_Period_Open.sql,v 1.5 2003/02/07 05:49:58 jjanke Exp $
-***
-* Title: Period Control
-* Description:
-* Determine if period is open for DateAcct and DocBaseType (API, ..)
-* If C_AcctSchema_ID is specified, check only for this schema,
-* otherwise for the first of AD_Client_ID
-* Return
-*  C_Period_ID if period is open ot 0 if auto control
-*  -1 if period is not open
-*
-* Test:
-*  SELECT GL_Period_Open (11, '01-JAN-2002', 'ARI') FROM DUAL
-************************************************************************/
-    v_C_Calendar_ID VARCHAR2(32) ;
-    v_C_Period_ID   varchar2(32) := -1; -- not found
-    v_Temp_Period   NUMBER(10) ;
-    v_PeriodStatus  C_PeriodControl.PeriodStatus%TYPE;
-    --
-  TYPE RECORD IS REF CURSOR;
-    CUR_AS RECORD;
-  BEGIN
-    -- Get Calendar
-    SELECT MAX(C_Calendar_ID)
-    INTO v_C_Calendar_ID
-    FROM AD_ClientInfo
-    WHERE AD_Client_ID = p_AD_Client_ID;
-    IF(v_C_Calendar_ID IS NULL) THEN
-      DBMS_OUTPUT.PUT_LINE('NO Calendar') ;
-      RETURN NULL;
-    END IF;
-    --
-    FOR CUR_AS IN
-      (SELECT AutoPeriodControl,
-        Period_OpenHistory,
-        Period_OpenFuture
-      FROM C_AcctSchema
-      WHERE AD_Client_ID = p_AD_Client_ID
-        AND(p_C_AcctSchema_ID IS NULL
-        OR C_AcctSchema_ID = p_C_AcctSchema_ID)
-      )
-    LOOP
-      DBMS_OUTPUT.PUT_LINE('AcctSchema - Auto=' || CUR_AS.AutoPeriodControl) ;
-      v_C_Period_ID := 1;
-      IF(CUR_AS.AutoPeriodControl = 'Y') THEN
-        IF(p_DateAcct  BETWEEN(TRUNC(now(), 'MM') -CUR_AS.Period_OpenHistory) AND(ADD_MONTHS(TRUNC(now(), 'MM'), 1) +CUR_AS.Period_OpenFuture)) THEN
-          DBMS_OUTPUT.PUT_LINE('Open(A) ' ||(TRUNC(now(), 'MM') -CUR_AS.Period_OpenHistory) || ' - ' ||(ADD_MONTHS(TRUNC(now(), 'MM'), 1) +CUR_AS.Period_OpenFuture)) ;
-          v_C_Period_ID := 0; -- open
-        ELSE
-          DBMS_OUTPUT.PUT_LINE('Not in Limits (A) ' ||(TRUNC(now(), 'MM') -CUR_AS.Period_OpenHistory) || ' - ' ||(ADD_MONTHS(TRUNC(now(), 'MM'), 1) +CUR_AS.Period_OpenFuture)) ;
-          v_C_Period_ID := -1; -- closed
-        END IF;
-      END IF; -- No AutoPeriodControl --
-      -- Get Period if not AutoPeriodControl aoutside limits
-      IF(v_C_Period_ID <> -1) THEN
-        SELECT MAX(p.C_Period_ID)
-        INTO v_C_Period_ID
-        FROM C_Period p,
-          C_Year y
-        WHERE TRUNC(p_DateAcct) BETWEEN TRUNC(p.StartDate) AND TRUNC(p.EndDate)
-          AND p.C_Year_ID = y.C_Year_ID
-          AND y.C_Calendar_ID = v_C_Calendar_ID
-          AND p.PeriodType = 'S'; -- standard period
-        -- We have no Period defined
-        IF(v_C_Period_ID IS NULL) THEN
-          DBMS_OUTPUT.PUT_LINE('No Period found for Date ' || p_DateAcct) ;
-          v_C_Period_ID := -1;
-        ELSIF(CUR_AS.AutoPeriodControl <> 'Y') THEN
-          -- Check PeriodControl for Period and Document Type
-          SELECT MAX(PeriodStatus)
-          INTO v_PeriodStatus
-          FROM C_PeriodControl
-          WHERE C_Period_ID = v_C_Period_ID
-            AND DocBaseType = p_DocBaseType;
-          IF(v_PeriodStatus IS NULL) THEN
-            DBMS_OUTPUT.PUT_LINE('No PeriodStatus found for Period ' || v_C_Period_ID) ;
-            v_C_Period_ID := -1;
-          ELSIF(v_PeriodStatus = 'O') THEN
-            DBMS_OUTPUT.PUT_LINE('Open') ;
-          ELSE
-            DBMS_OUTPUT.PUT_LINE('NOT Open: PeriodStatus=' || v_PeriodStatus) ;
-            v_C_Period_ID := -1;
-          END IF;
-        END IF;
-      END IF;
-      EXIT;
-    END LOOP;
-    DBMS_OUTPUT.PUT_LINE('Period_ID=' || v_C_Period_ID) ;
-    RETURN v_C_Period_ID;
-END GL_PERIOD_OPEN
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/M_GET_OFFERS_APPLIED.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_GET_OFFERS_APPLIED">
-    <function name="M_GET_OFFERS_APPLIED" type="VARCHAR">
-      <parameter name="p_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_type" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-  TYPE RECORD IS REF CURSOR;
-  CurOffers RECORD;
-
-  v_offers VARCHAR2(500);
-BEGIN
-  IF p_Type = 'I' THEN --invoice
-    FOR CurOffers IN (SELECT o.addamt, o.discount, o.fixed, cursymbol
-                        FROM C_InvoiceLine_Offer io,
-                             M_Offer             o,
-                             C_Currency          c,
-                             C_Invoice           i,
-                             C_InvoiceLine       il
-                       WHERE o.M_Offer_ID = io.M_Offer_ID
-                         AND c.C_Currency_ID = i.C_Currency_ID
-                         AND i.C_Invoice_ID  = il.C_Invoice_ID
-                         AND il.C_InvoiceLine_ID = io.C_InvoiceLine_ID
-                         AND il.C_InvoiceLine_ID = p_Id
-                       ORDER BY COALESCE(io.line,0)) LOOP
-      IF CurOffers.Fixed IS NOT NULL THEN
-        IF v_Offers IS NOT NULL THEN
-          v_Offers := v_Offers || ' + ';
-        END IF;
-        v_Offers := v_Offers || 'F: ' || CurOffers.Fixed ||CurOffers.CurSymbol;
-      ELSE
-        IF COALESCE(CurOffers.AddAmt,0) <> 0 THEN
-          IF v_Offers IS NOT NULL THEN
-            v_Offers := v_Offers || ' + ';
-          END IF;
-          v_Offers := v_Offers || CurOffers.AddAmt || CurOffers.CurSymbol;
-        END IF;
-
-        IF COALESCE(CurOffers.Discount,0) <> 0 THEN
-          IF v_Offers IS NOT NULL THEN
-            v_Offers := v_Offers || ' + ';
-          END IF;
-          v_Offers := v_Offers || CurOffers.Discount || '%';
-        END IF;
-      END IF;
-    END LOOP;
-  ELSE                 --order
-    FOR CurOffers IN (SELECT o.addamt, o.discount, o.fixed, cursymbol
-                        FROM C_OrderLine_Offer io,
-                             M_Offer             o,
-                             C_Currency          c,
-                             C_Order             i,
-                             C_OrderLine       il
-                       WHERE o.M_Offer_ID = io.M_Offer_ID
-                         AND c.C_Currency_ID = i.C_Currency_ID
-                         AND i.C_Order_ID  = il.C_Order_ID
-                         AND il.C_OrderLine_ID = io.C_OrderLine_ID
-                         AND il.C_OrderLine_ID = p_Id
-                       ORDER BY COALESCE(io.line,0)) LOOP
-      IF CurOffers.Fixed IS NOT NULL THEN
-        IF v_Offers IS NOT NULL THEN
-          v_Offers := v_Offers || ' + ';
-        END IF;
-        v_Offers := v_Offers || 'F: ' || CurOffers.Fixed || CurOffers.CurSymbol;
-      ELSE
-        IF COALESCE(CurOffers.AddAmt,0) <> 0 THEN
-          IF v_Offers IS NOT NULL THEN
-            v_Offers := v_Offers || ' + ';
-          END IF;
-          v_Offers := v_Offers || CurOffers.AddAmt || CurOffers.CurSymbol;
-        END IF;
-
-        IF COALESCE(CurOffers.Discount,0) <> 0 THEN
-          IF v_Offers IS NOT NULL THEN
-            v_Offers := v_Offers || ' + ';
-          END IF;
-          v_Offers := v_Offers || CurOffers.Discount || '%';
-        END IF;
-      END IF;
-    END LOOP;
-  END IF;
-  RETURN v_Offers;
-END M_GET_OFFERS_APPLIED
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/M_GET_PURCHASE_PRICE.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_GET_PURCHASE_PRICE">
-    <function name="M_GET_PURCHASE_PRICE" type="NUMERIC">
-      <parameter name="p_product_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* 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) 2001-2008 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-  v_Price NUMBER;
-  TYPE RECORD IS REF CURSOR;
-    Cur_Orderline RECORD;
-    Cur_Invoiceline RECORD;
-    Cur_Pricelist_Version RECORD;
-
-    v_BaseCurrency VARCHAR2(32);
-  BEGIN
-    SELECT AD_CLIENT.C_CURRENCY_ID 
-      INTO v_BaseCurrency
-      FROM M_PRODUCT, AD_CLIENT
-      WHERE M_PRODUCT.M_PRODUCT_ID = p_Product_ID
-      AND M_PRODUCT.AD_CLIENT_ID = AD_CLIENT.AD_CLIENT_ID;
-    FOR Cur_Invoiceline IN
-      (SELECT COALESCE(C_CURRENCY_CONVERT(C_INVOICELINE.PRICEACTUAL, C_INVOICE.C_CURRENCY_ID, v_BaseCurrency, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, now())), NULL, C_INVOICELINE.AD_CLIENT_ID, C_INVOICELINE.AD_ORG_ID), 0) AS Price
-      FROM C_INVOICELINE,
-        C_INVOICE
-      WHERE C_INVOICELINE.C_INVOICE_ID = C_INVOICE.C_INVOICE_ID
-        AND C_INVOICE.ISSOTRX = 'N'
-        AND C_INVOICE.DOCSTATUS = 'CO'
-        AND C_INVOICE.PROCESSED = 'Y'
-        AND C_INVOICELINE.M_PRODUCT_ID = p_Product_ID
-      ORDER BY C_INVOICE.DATEINVOICED DESC
-      )
-    LOOP
-      v_Price := Cur_Invoiceline.PRICE;
-      EXIT;
-    END LOOP;
-    IF(v_Price IS NULL) THEN
-      FOR Cur_Orderline IN
-        (SELECT COALESCE(C_CURRENCY_CONVERT(C_ORDERLINE.PRICEACTUAL, COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID), v_BaseCurrency, TO_DATE(COALESCE(C_ORDERLINE.DATEORDERED, C_ORDER.DATEORDERED, now())), NULL, C_ORDERLINE.AD_CLIENT_ID, C_ORDERLINE.AD_ORG_ID), 0) AS Price
-        FROM C_ORDERLINE,
-          C_ORDER
-        WHERE C_ORDERLINE.C_ORDER_ID = C_ORDER.C_ORDER_ID
-          AND C_ORDER.ISSOTRX = 'N'
-          AND C_ORDER.DOCSTATUS = 'CO'
-          AND C_ORDER.PROCESSED = 'Y'
-          AND C_ORDERLINE.M_PRODUCT_ID = p_Product_ID
-        ORDER BY C_ORDER.DATEORDERED DESC
-        )
-      LOOP
-        v_Price := Cur_Orderline.PRICE;
-        EXIT;
-      END LOOP;
-    END IF;
-    IF(v_Price IS NULL) THEN
-      FOR Cur_Pricelist_Version IN
-        (SELECT COALESCE(C_CURRENCY_CONVERT(M_PRODUCTPRICE.PRICESTD, M_PRICELIST.C_CURRENCY_ID, v_BaseCurrency, TO_DATE(now()), NULL, M_PRODUCTPRICE.AD_CLIENT_ID, M_PRODUCTPRICE.AD_ORG_ID), 0) AS Price
-        FROM M_PRODUCTPRICE,
-          M_PRICELIST_VERSION,
-          M_PRICELIST
-        WHERE M_PRODUCTPRICE.M_PRICELIST_VERSION_ID = M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID
-          AND M_PRICELIST_VERSION.M_PRICELIST_ID = M_PRICELIST.M_PRICELIST_ID
-          AND M_PRICELIST.ISSOPRICELIST = 'N'  --  AND M_PRICELIST_VERSION.ISACTIVE= 'Y'
-          AND M_PRICELIST_VERSION.VALIDFROM < TO_DATE(now())
-          AND M_PRODUCTPRICE.M_PRODUCT_ID = p_Product_ID
-        ORDER BY M_PRICELIST_VERSION.VALIDFROM DESC
-        )
-      LOOP
-        v_Price := Cur_Pricelist_Version.PRICE;
-        EXIT;
-      END LOOP;
-    END IF;
-    IF(v_Price IS NULL) THEN
-      SELECT COALESCE(MAX(C_CURRENCY_CONVERT(M_PRODUCT_PO.PRICEPO, M_PRODUCT_PO.C_CURRENCY_ID, v_BaseCurrency, TO_DATE(now()), NULL, M_PRODUCT_PO.AD_CLIENT_ID, M_PRODUCT_PO.AD_ORG_ID)), 0)
-      INTO v_Price
-      FROM M_PRODUCT_PO
-      WHERE M_PRODUCT_PO.M_PRODUCT_ID = p_Product_ID
-      AND M_PRODUCT_PO.ISCURRENTVENDOR = 'Y';
-    END IF;
-    IF(v_Price IS NULL) THEN
-      v_Price := 0;
-    END IF;
-    RETURN v_Price;
-END M_GET_PURCHASE_PRICE
-]]></body>
-    </function>
-  </database>
--- a/src-db/database/model/functions/M_PRODUCT_DELETE.xml	Wed May 11 15:39:58 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_PRODUCT_DELETE">
-    <function name="M_PRODUCT_DELETE" type="NULL">
-      <parameter name="whereclause" type="VARCHAR" mode="in">
-        <default><![CDATA[NULL]]></default>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-  * The contents of this file are subject to the Compiere Public
-  * License 1.1 ("License"); You may not use this file except in
-  * compliance with the License. You may obtain a copy of the License in
-  * the legal folder of your Openbravo installation.
-  * 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  Compiere  ERP &  Business Solution
-  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
-  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
-  * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
-  * All Rights Reserved.
-  * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.U.
-  *
-  * Specifically, this derivative work is based upon the following Compiere
-  * file and version.
-  *************************************************************************
-  * Delete Products
-  */
-  TYPE RECORD IS REF CURSOR;
-    CUR_DEL RECORD;
-    --
-    SQL_Base VARCHAR2(255):='SELECT M_Product_ID FROM M_Product WHERE ';
-    -- SQL_Where  VARCHAR2(255) := 'ValueX IN (SELECT ValueX FROM M_Product GROUP BY ValueX HAVING Count(*) <> 1) AND INSTR(Value,''@'') <> 0';
-    SQL_Statement VARCHAR2(255):='';
-  BEGIN
-    -- Delete inactive
-    IF(whereClause IS NULL OR LENGTH(whereClause)=0) THEN
-      For CUR_DEL IN
-        (SELECT M_Product_ID, Value, Name  FROM M_Product  WHERE IsActive='N')
-      LOOP
-      BEGIN
-        DBMS_OUTPUT.PUT_LINE('Deleting ' || CUR_DEL.Name || ' - ') ;
-        DELETE FROM M_Product  WHERE M_Product_ID=CUR_DEL.M_Product_ID;
-        DBMS_OUTPUT.PUT_LINE('OK') ;
-      EXCEPTION
-      WHEN OTHERS THEN
-        DBMS_OUTPUT.PUT_LINE('Error ' || SQLERRM) ;
-      END;
-    END LOOP;
-  END IF;
-END M_PRODUCT_DELETE
-]]></body>
-    </function>
-  </database>