src-db/database/model/functions/AD_ORGLIST.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Wed, 03 Sep 2008 17:55:37 +0000
changeset 1605 8a0fe0193bef
parent 756 ae11e4610537
child 6701 690d2af86089
permissions -rw-r--r--
Merge r2.5x intro trunk
carlos@0
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="FUNCTION AD_ORGLIST">
adrian@94
     3
    <function name="AD_ORGLIST" type="VARCHAR">
juanpablo@1605
     4
      <parameter name="p_roleid" type="VARCHAR" mode="in">
antonio@735
     5
        <default/>
antonio@735
     6
      </parameter>
gorkaion@239
     7
      <body><![CDATA[/*************************************************************************
carlos@0
     8
* The contents of this file are subject to the Openbravo  Public  License
carlos@0
     9
* Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
    10
* Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
    11
* file except in compliance with the License. You  may  obtain  a copy of
carlos@0
    12
* the License at http://www.openbravo.com/legal/license.html
carlos@0
    13
* Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
    14
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    15
* License for the specific  language  governing  rights  and  limitations
carlos@0
    16
* under the License.
carlos@0
    17
* The Original Code is Openbravo ERP.
carlos@0
    18
* The Initial Developer of the Original Code is Openbravo SL
carlos@0
    19
* All portions are Copyright (C) 2001-2006 Openbravo SL
carlos@0
    20
* All Rights Reserved.
carlos@0
    21
* Contributor(s):  ______________________________________.
carlos@0
    22
************************************************************************/
carlos@0
    23
/*************************************************************************
carlos@0
    24
* Title: Return the list (comma separated) of Organizations granted to the role
carlos@0
    25
************************************************************************/
carlos@0
    26
  v_orgList VARCHAR2(4000) ;
carlos@0
    27
  TYPE RECORD IS REF CURSOR;
carlos@0
    28
    Cur_Roles RECORD;
carlos@0
    29
BEGIN
carlos@0
    30
    v_orgList := '';
carlos@0
    31
    FOR Cur_Roles IN
carlos@0
    32
      (SELECT AD_Org_ID
carlos@0
    33
      FROM AD_ROLE_ORGACCESS
carlos@0
    34
      WHERE AD_ROLE_ID = p_roleID
carlos@0
    35
      ORDER BY AD_Org_ID
carlos@0
    36
      )
carlos@0
    37
    LOOP
carlos@0
    38
      v_orgList:=v_orgList||','||Cur_Roles.AD_Org_ID;
carlos@0
    39
    END LOOP;
carlos@0
    40
    RETURN SUBSTR(v_orgList, 2, 4000) ;
antonio@735
    41
END AD_ORGLIST
gorkaion@239
    42
]]></body>
adrian@94
    43
    </function>
adrian@94
    44
  </database>