DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_CC_UTILS

Source


1 package body PA_CC_UTILS as
2 -- $Header: PAXCCUTB.pls 120.1.12020000.3 2013/03/06 09:51:37 admarath ship $
3 
4   /*
5    * Package body global variables.
6    *
7    * g_function_stack holds the name of the called functions in a stack format.
8    * g_counter is used to mark the current location in the function stack.
9    * g_space is used to provide indentation in the stack of function calls
10    */
11   g_function_stack               PA_PLSQL_DATATYPES.Char50TabTyp;
12   g_function_counter             NUMBER := 0;
13   g_space                        VARCHAR2(1000);
14 
15 -- $Header: PAXCCUTB.pls 120.1.12020000.3 2013/03/06 09:51:37 admarath ship $
16 --
17 --  FUNCTION
18 --              is_receiver_control_setup
19 --
20 --
21 g1_debug_mode varchar2(1) := NVL(FND_PROFILE.value('PA_DEBUG_MODE'), 'N');
22 
23 Function is_receiver_control_setup (x_provider_org_id  IN number,
24 x_receiver_org_id	 IN number) return number
25 is
26         cursor c1 is
27                 SELECT 1
28                 FROM    sys.dual
29                 where exists (SELECT NULL
30                         FROM   pa_cc_org_relationships
31                         where  prvdr_org_id = x_provider_org_id
32                         and    recvr_org_id = x_receiver_org_id
33                         and    vendor_site_id is not null);
34 
35         c1_rec c1%rowtype;
36 begin
37 
38    if (x_provider_org_id is null and x_receiver_org_id is null) then
39       return(null);
40    end if;
41 
42    open c1;
43    fetch c1 into c1_rec;
44    if c1%notfound then
45       close c1;
46       return(0);
47    else
48       close c1;
49       return(1);
50    end if;
51 
52 exception
53    when others then
54       return(SQLCODE);
55 end is_receiver_control_setup;
56 
57 --  FUNCTION
58 --              check_pvdr_rcvr_control_exist
59 --
60 --
61 Function check_pvdr_rcvr_control_exist (x_project_id  IN number)
62 return number
63 is
64         cursor c1 is
65                 SELECT 1
66                 FROM    sys.dual
67                 where exists (SELECT NULL
68                         FROM   pa_cc_org_relationships
69                         where  prvdr_project_id = x_project_id);
70 
71         c1_rec c1%rowtype;
72 begin
73 
74    if (x_project_id is null) then
75       return(null);
76    end if;
77 
78    open c1;
79    fetch c1 into c1_rec;
80    if c1%notfound then
81       close c1;
82       return(0);
83    else
84       close c1;
85       return(1);
86    end if;
87 
88 exception
89    when others then
90       return(SQLCODE);
91 end check_pvdr_rcvr_control_exist;
92 -------------------------------------------------------------
93 
94 -------------------------------------------------------------------------------
95 --              log_message
96 -------------------------------------------------------------------------------
97 
98 /*PROCEDURE log_message( p_message    IN VARCHAR2,
99                        p_write_mode IN NUMBER DEFAULT 0) IS
100 		       bug 2681003 -- removed the default for the GSCC complaince*/
101 PROCEDURE log_message( p_message    IN VARCHAR2,
102                        p_write_mode IN NUMBER ) IS
103   l_function    VARCHAR2(50) := NULL;
104 BEGIN
105    IF  g_function_stack.exists(g_function_counter) THEN
106      l_function := g_function_stack(g_function_counter);
107    END IF;
108    IF g1_debug_mode  = 'Y' THEN
109    pa_debug.write_file('LOG',
110 	    to_char(sysdate,'HH:MI:SS:') || g_space ||
111 	    l_function || ': '  ||p_message, p_write_mode);
112    END IF;
113 
114 EXCEPTION
115 
116 WHEN OTHERS
117  THEN
118    raise;
119 
120 END log_message;
121 
122 -------------------------------------------------------------------------------
123 --              set_curr_function
124 -------------------------------------------------------------------------------
125 
126 PROCEDURE set_curr_function(p_function IN VARCHAR2) IS
127 BEGIN
128    /*
129     * Push the current function in the stack.
130     * Also add an extra space for indentation.
131     */
132    g_function_counter := g_function_counter + 1;
133    g_function_stack(g_function_counter) := p_function;
134    g_space   := g_space || ' ';
135    /* Added for bug 14244273  */
136    IF Length(g_space) >=1000 THEN
137       g_space := ' ';
138    END IF;
139 
140    if g_function_counter = 1 then
141      pa_debug.init_err_stack(p_function);
142    else
143      pa_debug.set_err_stack(p_function);
144    end if;
145 END set_curr_function;
146 
147 -------------------------------------------------------------------------------
148 --              reset_curr_function
149 -------------------------------------------------------------------------------
150 
151 PROCEDURE reset_curr_function IS
152 BEGIN
153     /*
154      * Pop the function from the current stack.
155      * Remove the extra space.
156      */
157     g_function_stack.delete(g_function_counter);
158     g_function_counter := g_function_counter -1;
159     g_space   := substr(g_space,1,length(g_space)-1);
160     pa_debug.Reset_err_stack;
161 END reset_curr_function;
162 
163 END PA_CC_UTILS ;