DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TEMPLATE_ITEM_INFO

Source


1 PACKAGE BODY hr_template_item_info
2 /* $Header: hrtiminf.pkb 120.0 2005/05/31 03:13:47 appldev noship $ */
3 AS
4   --
5   -- Global variables
6   --
7   g_form_template_id             hr_form_templates_b.form_template_id%TYPE;
8   g_template_items               t_template_items := t_template_items();
9   --
10   g_form_template_id_pst         hr_form_templates_b.form_template_id%TYPE;
11   g_template_items_pst           t_template_items_pst;
12   g_index_number_pst             NUMBER;
13   g_null_template_items_pst      t_template_items_pst;
14   --
15   -- Global cursors
16   --
17   CURSOR csr_template_items
18     (p_application_id               IN     hr_form_templates_b.application_id%TYPE
19     ,p_form_id                      IN     hr_form_templates_b.form_id%TYPE
20     ,p_form_template_id             IN     hr_form_templates_b.form_template_id%TYPE
21     )
22   IS
23     SELECT tim.template_item_id
24           ,fim.full_item_name
25           ,fim.item_type
26           ,fwn.window_name
27           ,fcn.canvas_name
28           ,ftp.tab_page_name
29           ,fim.radio_button_name
30           ,itp.alignment
31           ,itp.bevel
32           ,itp.case_restriction
33           ,ipt.default_value
34           ,itp.enabled
35           ,itp.format_mask
36           ,itp.height
37           ,itp.information_formula_id
38           ,hr_form_item_info.full_item_name(itp.information_parameter_item_id1) information_parameter_item1
39           ,hr_form_item_info.full_item_name(itp.information_parameter_item_id2) information_parameter_item2
40           ,hr_form_item_info.full_item_name(itp.information_parameter_item_id3) information_parameter_item3
41           ,hr_form_item_info.full_item_name(itp.information_parameter_item_id4) information_parameter_item4
42           ,hr_form_item_info.full_item_name(itp.information_parameter_item_id5) information_parameter_item5
43           ,ipt.information_prompt
44           ,itp.insert_allowed
45           ,ipt.label
46           ,hr_form_item_info.full_item_name(itp.next_navigation_item_id) next_navigation_item
47           ,hr_form_item_info.full_item_name(itp.previous_navigation_item_id) previous_navigation_item
48           ,itp.prompt_alignment_offset
49           ,itp.prompt_display_style
50           ,itp.prompt_edge
51           ,itp.prompt_edge_alignment
52           ,itp.prompt_edge_offset
53           ,ipt.prompt_text
54           ,itp.prompt_text_alignment
55           ,itp.query_allowed
56           ,itp.required
57           ,ipt.tooltip_text
58           ,itp.update_allowed
59           ,itp.validation_formula_id
60           ,hr_form_item_info.full_item_name(itp.validation_parameter_item_id1) validation_parameter_item1
61           ,hr_form_item_info.full_item_name(itp.validation_parameter_item_id2) validation_parameter_item2
62           ,hr_form_item_info.full_item_name(itp.validation_parameter_item_id3) validation_parameter_item3
63           ,hr_form_item_info.full_item_name(itp.validation_parameter_item_id4) validation_parameter_item4
64           ,hr_form_item_info.full_item_name(itp.validation_parameter_item_id5) validation_parameter_item5
65           ,itp.visible
66           ,itp.width
67           ,itp.x_position
68           ,itp.y_position
69           ,itp.information_category
70           ,itp.information1
71           ,itp.information2
72           ,itp.information3
73           ,itp.information4
74           ,itp.information5
75           ,itp.information6
76           ,itp.information7
77           ,itp.information8
78           ,itp.information9
79           ,itp.information10
80           ,itp.information11
81           ,itp.information12
82           ,itp.information13
83           ,itp.information14
84           ,itp.information15
85           ,itp.information16
86           ,itp.information17
87           ,itp.information18
88           ,itp.information19
89           ,itp.information20
90           ,itp.information21
91           ,itp.information22
92           ,itp.information23
93           ,itp.information24
94           ,itp.information25
95           ,itp.information26
96           ,itp.information27
97           ,itp.information28
98           ,itp.information29
99           ,itp.information30
100       FROM hr_form_tab_pages_b ftp
101           ,hr_template_tab_pages_b ttp
102           ,hr_template_item_tab_pages tip
103           ,hr_form_windows_b fwn
104           ,hr_form_canvases_b fcn
105           ,hr_item_properties_tl ipt
106           ,hr_item_properties_b itp
107           ,hr_form_items_b fim
108           ,hr_template_items_b tim
109      WHERE ftp.form_tab_page_id (+) = ttp.form_tab_page_id
110        AND ttp.template_tab_page_id (+) = tip.template_tab_page_id
111        AND tip.template_item_id (+) = tim.template_item_id
112        AND fwn.form_window_id = fcn.form_window_id
113        AND fcn.form_canvas_id = fim.form_canvas_id
114        AND ipt.language = userenv('LANG')
115        AND ipt.item_property_id = itp.item_property_id
116        AND itp.template_item_id = tim.template_item_id
117        AND fim.form_item_id = tim.form_item_id
118        AND tim.form_template_id = p_form_template_id;
119 --
120 -- -----------------------------------------------------------------------------
121 -- |-----------------------------< template_items >----------------------------|
122 -- -----------------------------------------------------------------------------
123 FUNCTION template_items
124   (p_form_template_id             IN     hr_form_templates_b.form_template_id%TYPE
125   )
126 RETURN t_template_items
127 IS
128   --
129   l_template_items               t_template_items               := t_template_items();
130 --
131 BEGIN
132   --
133   IF (p_form_template_id = nvl(g_form_template_id,hr_api.g_number))
134   THEN
135     --
136     -- The template items have already been found with a previous call to this
137     -- function. Just return the global variable.
138     --
139     l_template_items := g_template_items;
140   --
141   ELSE
142     --
143     -- The identifier is different to the previous call to this function, or
144     -- this is the first call to this function.
145     --
146     FOR l_template_item IN csr_template_items
147       (p_application_id               => hr_form_template_info.application_id(p_form_template_id)
148       ,p_form_id                      => hr_form_template_info.form_id(p_form_template_id)
149       ,p_form_template_id             => p_form_template_id
150       )
151     LOOP
152       IF (l_template_item.template_item_id IS NULL)
153       THEN
154         l_template_item.visible := 5;
155       END IF;
156       l_template_items.EXTEND;
157       l_template_items(l_template_items.LAST) := l_template_item;
158     END LOOP;
159     --
160     -- Set the global variables so the values are available to the next call to
161     -- the function.
162     --
163     g_form_template_id := p_form_template_id;
164     g_template_items := l_template_items;
165   --
166   END IF;
167   --
168   RETURN(l_template_items);
169 --
170 END template_items;
171 --
172 -- -----------------------------------------------------------------------------
173 -- |---------------------------< template_items_pst >--------------------------|
174 -- -----------------------------------------------------------------------------
175 FUNCTION template_items_pst
176   (p_form_template_id             IN     hr_form_templates_b.form_template_id%TYPE
177   )
178 RETURN t_template_items_pst
179 IS
180   --
181   l_template_items_pst           t_template_items_pst;
182   l_index_number                 NUMBER;
183 --
184 BEGIN
185   --
186   IF (p_form_template_id = g_form_template_id_pst)
187   THEN
188     --
189     NULL;
190   --
191   ELSE
192     --
193     g_template_items_pst := g_null_template_items_pst;
194     l_index_number := 1;
195     FOR l_template_item IN csr_template_items
196       (p_application_id               => hr_form_template_info.application_id(p_form_template_id)
197       ,p_form_id                      => hr_form_template_info.form_id(p_form_template_id)
198       ,p_form_template_id             => p_form_template_id
199       )
200     LOOP
201       IF (l_template_item.template_item_id IS NULL)
202       THEN
203         l_template_item.visible := 5;
204       END IF;
205       g_template_items_pst(l_index_number) := l_template_item;
206       l_index_number := l_index_number + 1;
207     END LOOP;
208     --
209     g_form_template_id_pst := p_form_template_id;
210     g_index_number_pst := g_template_items_pst.FIRST;
211   --
212   END IF;
213   --
214   l_index_number := g_index_number_pst;
215   WHILE (   (l_index_number IS NOT NULL)
216         AND (l_index_number < g_index_number_pst + 50) )
217   LOOP
218     l_template_items_pst(l_index_number) := g_template_items_pst(l_index_number);
219     l_index_number := g_template_items_pst.NEXT(l_index_number);
220   END LOOP;
221   g_index_number_pst := l_index_number;
222   IF (l_template_items_pst.COUNT = 0)
223   THEN
224     g_form_template_id_pst := NULL;
225   END IF;
226   --
227   RETURN(l_template_items_pst);
228 --
229 END template_items_pst;
230 --
231 END hr_template_item_info;