Related to issue 33650: code review improvements
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Fri, 27 Apr 2018 09:51:48 +0200
changeset 33892 7c01d27cda0f
parent 33891 a96849b0f373
child 33893 a30751ea9d69
Related to issue 33650: code review improvements
Improved functions documentation and comments
src-db/database/model/functions/AD_GET_ORG_LE_BU.xml
src-db/database/model/functions/AD_ORG_GETCALENDAROWNER.xml
src-db/database/model/functions/AD_ORG_GETPERIODCONTROLALLOW.xml
src-db/database/model/functions/AD_ORG_READY.xml
--- a/src-db/database/model/functions/AD_GET_ORG_LE_BU.xml	Thu Apr 26 16:25:58 2018 +0200
+++ b/src-db/database/model/functions/AD_GET_ORG_LE_BU.xml	Fri Apr 27 09:51:48 2018 +0200
@@ -23,6 +23,21 @@
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
+
+/*
+* if p_type = 'LE', returns the Legal Entity
+*    p_type = 'BU', returns the Business Unit
+*    p_type = NULL, returns either the Business Unit or Legal Entity found.
+*
+* This function works only for organizations set as ready. For the flows where 
+* the organization is not set as ready yet, please use AD_GET_ORG_LE_BU_TREENODE instead.
+*
+* Only when working with ready organizations, and in processes where performance is important, 
+* it is highly recommended to directly query AD_Org.AD_LEGALENTITY_ORG_ID or 
+* AD_Org.AD_BUSINESSUNIT_ORG_ID columns. 
+*/
+
+
   v_org_header_id ad_org.ad_org_id%TYPE;
 
 BEGIN
--- a/src-db/database/model/functions/AD_ORG_GETCALENDAROWNER.xml	Thu Apr 26 16:25:58 2018 +0200
+++ b/src-db/database/model/functions/AD_ORG_GETCALENDAROWNER.xml	Fri Apr 27 09:51:48 2018 +0200
@@ -24,6 +24,12 @@
 /*
 * It returns the calendar owner organization of the p_organization Organization.
 * If calendar owner organization is not set, it returns NULL.
+*
+* This function works only for organizations set as ready. For the flows where 
+* the organization is not set as ready yet, please use AD_ORG_GETCALENDAROWNERTN instead.
+*
+* Only when working with ready organizations, and in processes where performance is important, 
+* it is highly recommended to directly query AD_Org.AD_CALENDAROWNER_ORG_ID column. 
 */
 
   v_CalendarOwner_Org_ID AD_Org.AD_CalendarOwner_Org_ID%TYPE;
--- a/src-db/database/model/functions/AD_ORG_GETPERIODCONTROLALLOW.xml	Thu Apr 26 16:25:58 2018 +0200
+++ b/src-db/database/model/functions/AD_ORG_GETPERIODCONTROLALLOW.xml	Fri Apr 27 09:51:48 2018 +0200
@@ -24,6 +24,12 @@
 /*
 * It returns the period allowed organization of the p_organization Organization.
 * If period allowed organization is not set, it returns NULL.
+*
+* This function works only for organizations set as ready. For the flows where 
+* the organization is not set as ready yet, please use AD_ORG_GETPERIODCONTROLALLOWTN instead.
+*
+* Only when working with ready organizations, and in processes where performance is important, 
+* it is highly recommended to directly query AD_Org.AD_PERIODCONTROLALLOWED_ORG_ID column. 
 */
 
   v_periodcontrolallowed_org_id AD_Org.AD_periodcontrolallowed_org_id%TYPE;
--- a/src-db/database/model/functions/AD_ORG_READY.xml	Thu Apr 26 16:25:58 2018 +0200
+++ b/src-db/database/model/functions/AD_ORG_READY.xml	Fri Apr 27 09:51:48 2018 +0200
@@ -190,7 +190,7 @@
           v_BusinessUnit_Org_ID := NULL;
         END;
 
-        -- Set Persist Org Information
+        -- Set Persist Org Information. Variables usage avoids mutating table in Oracle
         UPDATE AD_ORG
         SET AD_PeriodControlAllowed_Org_ID = v_PeriodControlAllowed_Org_ID,
             AD_CalendarOwner_Org_ID = v_CalendarOwner_Org_ID,
@@ -251,7 +251,7 @@
         v_BusinessUnit_Org_ID := NULL;
       END;
 
-      -- Set Persist Org Information
+      -- Set Persist Org Information. Variables usage avoids mutating table in Oracle
       UPDATE AD_ORG
       SET AD_PeriodControlAllowed_Org_ID = v_PeriodControlAllowed_Org_ID,
           AD_CalendarOwner_Org_ID = v_CalendarOwner_Org_ID,