/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2011 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
SET SCAN OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  --
  -- Local constants and variables
  --
  l_sql varchar2(32000);

BEGIN

  --
  -- Register Query Registered Organization Chart Views
  --
  l_sql :=
'        SELECT f.function_id
              ,f.function_name view_name
              ,e.prompt view_title
              ,nvl(xxas_com_sec_pkg.get_parameter_value(f.parameters, ''pLayoutType''), ''HTML'') layout_type
              ,e.description description
              ,f.web_icon icon_name
        FROM   fnd_menus m
              ,fnd_menu_entries_vl e
              ,fnd_form_functions_vl f
        WHERE  m.menu_name = fnd_profile.value(''XXAS_ORG_REG_VIEWS_MENU'')
        AND    m.menu_id = e.menu_id
        AND    e.function_id = f.function_id
        ORDER BY e.entry_sequence ';

  xxas_com_sr_pkg.seed_query_service
    (p_service_name      => 'QueryRegisteredOrgViews'
    ,p_securing_function => 'XXAS_SRV_Q_REG_ORG_VIEWS_PERM'
    ,p_sql               => l_sql);

END;
/
COMMIT;
EXIT;
