1 Package per_add_bus AUTHID CURRENT_USER as
2 /* $Header: peaddrhi.pkh 120.1 2011/11/15 11:34:33 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Definitions - Internal Table Handler Use Only |
6 -- ----------------------------------------------------------------------------
7 --
8 g_called_from_form boolean := false; -- Global flag set to true by forms
9 -- code calling the RH. If true,
10 -- flexfield validation is not
11 --
12 -- ----------------------------------------------------------------------------
13 -- |---------------------------< insert_validate >----------------------------|
14 -- ----------------------------------------------------------------------------
15 -- {Start Of Comments}
16 --
17 -- Description:
18 -- This procedure controls the execution of all insert business rules
19 -- validation.
20 --
21 -- Pre Conditions:
22 -- This private procedure is called from ins procedure.
23 --
24 -- In Arguments:
25 -- A Pl/Sql record structure.
26 -- effective_date.
27 --
28 -- Post Success:
29 -- Processing continues.
30 --
31 -- Post Failure:
32 -- If a business rules fails the error will not be handled by this procedure
33 -- unless explicity coded.
34 --
35 -- Developer Implementation Notes:
36 -- For insert, your business rules should be coded within this procedure and
37 -- should ideally (unless really necessary) just be straight procedure or
38 -- function calls. Try and avoid using conditional branching logic.
39 --
40 -- Access Status:
41 -- Internal Table Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure insert_validate
46 (p_rec in out nocopy per_add_shd.g_rec_type
47 ,p_effective_date in date
48 ,p_validate_county in boolean default true
49 );
50 --
51 -- ----------------------------------------------------------------------------
52 -- |---------------------------< update_validate >----------------------------|
53 -- ----------------------------------------------------------------------------
54 -- {Start Of Comments}
55 --
56 -- Description:
57 -- This procedure controls the execution of all update business rules
58 -- validation.
59 --
60 -- Pre Conditions:
61 -- This private procedure is called from upd
62 -- 110.10 07-Jan-2000 mmillmor externalized procedure.
63 --
64 -- In Arguments:
65 -- A Pl/Sql record structure.
66 -- effective_date.
67 --
68 -- Post Success:
69 -- Processing continues.
70 --
71 -- Post Failure:
72 -- If a business rules fails the error will not be handled by this procedure
73 -- unless explicity coded.
74 --
75 -- Developer Implementation Notes:
76 -- For update, your business rules should be coded within this procedure and
77 -- should ideally (unless really necessary) just be straight procedure or
78 -- function calls. Try and avoid using conditional branching logic.
79 --
80 -- Access Status:
81 -- Internal Table Handler Use Only.
82 --
83 -- {End Of Comments}
84 -- ----------------------------------------------------------------------------
85 Procedure update_validate
86 (p_rec in out nocopy per_add_shd.g_rec_type
87 ,p_effective_date in date
88 ,p_prflagval_override in boolean default false
89 ,p_validate_county in boolean default true
90 );
91 --
92 -- ----------------------------------------------------------------------------
93 -- |---------------------------< delete_validate >----------------------------|
94 -- ----------------------------------------------------------------------------
95 -- {Start Of Comments}
96 --
97 -- Description:
98 -- This procedure controls the execution of all delete business rules
99 -- validation.
100 --
101 -- Pre Conditions:
102 -- This private procedure is called from del procedure.
103 --
104 -- In Arguments:
105 -- A Pl/Sql record structre.
106 --
107 -- Post Success:
108 -- Processing continues.
109 --
110 -- Post Failure:
111 -- If a business rules fails the error will not be handled by this procedure
112 -- unless explicity coded.
113 --
114 -- Developer Implementation Notes:
115 -- For delete, your business rules should be coded within this procedure and
116 -- should ideally (unless really necessary) just be straight procedure or
117 -- function calls. Try and avoid using conditional branching logic.
118 --
119 -- Access Status:
120 -- Internal Table Handler Use Only.
121 --
122 -- {End Of Comments}
123 -- ----------------------------------------------------------------------------
124 Procedure delete_validate(p_rec in out nocopy per_add_shd.g_rec_type);
125 --
126 -- ---------------------------------------------------------------------------
127 -- |---------------------< return_legislation_code >-------------------------|
128 -- ---------------------------------------------------------------------------
129 --
130 -- Description:
131 -- Return the legislation code for a specific address
132 --
133 -- Prerequisites:
134 -- The address identified by p_address_id already exists.
135 --
136 -- In Arguments:
137 -- p_address_id
138 --
139 -- Post Success:
140 -- If the address is found this function will return the address's business
141 -- group legislation code.
142 --
143 -- Post Failure:
144 -- An error is raised if the address does not exist.
145 --
146 -- Access Status:
147 -- Internal Development Use Only.
148 --
149 function return_legislation_code
150 (p_address_id in number
151 ) return varchar2;
152 --
153 --
154 -- ---------------------------------------------------------------------------
155 -- |--------------------------< chk_date_comb >------------------------------|
156 -- ---------------------------------------------------------------------------
157 --
158 -- Description:
159 --
160 -- Validates date_to/date_from for a primary address so that it
161 -- does not overlap with the date range of another primary address.
162 --
163 -- Validates that the date range of a non-primary co-exists with the
164 -- date range of a primary address.
165 --
166 -- Validate that primary addresses are contiguous.
167 --
168 -- Validates that the address_type for an address (primary or non)
169 -- is unique for a person with the given date range.
170 --
171 -- Pre-conditions:
172 -- Format of p_date_from and p_date_to must be correct.
173 --
174 -- In Arguments:
175 -- p_address_id
176 -- p_address_type
177 -- p_primary_flag
178 -- p_date_from
179 -- p_date_to
180 -- p_person_id
181 -- p_object_version_number
182 -- p_party_id -- HR/TCA merge
183 --
184 -- Post Success:
185 -- If no overlaps occur with either the address_type or primary flag then
186 -- processing continues.
187 --
188 -- If all non-primary addresses exist during the date range of one or
189 -- more contiguous primary addresses then processing continues.
190 --
191 -- If all primary addresses are contiguous then processing continues.
192 --
193 -- Post Failure:
194 -- If the date_to/date_from values cause a primary address to overlap
195 -- within the date range of another primary address for the same person,
196 -- or the address_type for either a primary or non-primary address is
197 -- not uniques within a given date range for a person then an application
198 -- error is raised and processing is terminated.
199 --
200 -- If an insert/update of a non-primary address is atempted where the
201 -- date range of the non-primary address does not co-exist with that of
202 -- a primary address then an application error is raised and processing
203 -- is terminated.
204 --
205 -- If an insert/update of a primary address causes the primary address
206 -- pattern to be non-contiguous then an application error is raised and
207 -- processing is terminated.
208 --
209 -- Access status:
210 -- Internal Table Handler Use Only.
211 --
212 -- {End Of Comments}
213 -- ----------------------------------------------------------------------------
214 procedure chk_date_comb
215 (p_address_id in per_addresses.address_id%TYPE
216 ,p_address_type in per_addresses.address_type%TYPE
217 ,p_date_from in per_addresses.date_from%TYPE
218 ,p_date_to in per_addresses.date_to%TYPE
219 ,p_person_id in per_addresses.person_id%TYPE
220 ,p_primary_flag in per_addresses.primary_flag%TYPE
221 ,p_object_version_number in per_addresses.object_version_number%TYPE
222 ,p_prflagval_override in boolean default false
223 ,p_party_id in per_addresses.party_id%TYPE
224 );
225 --
226 -- ----------------------------------------------------------------------------
227 -- |-------------------------< set_called_from_form >-------------------------|
228 -- ----------------------------------------------------------------------------
229 -- {Start Of Comments}
230 --
231 -- Description:
232 -- This procedure is used to set the global g_called_from_form which controls
233 -- the execution of the df data validation. When set the df validation is
234 -- bypassed.
235 --
236 -- Pre Conditions:
237 -- This is a public function
238 --
239 -- In Parameters:
240 --
241 -- Post Success:
242 -- The global variable is set.
243 --
244 -- Post Failure:
245 -- No failure condition exists.
246 --
247 -- Developer Implementation Notes:
248 -- None.
249 --
250 -- Access Status:
251 -- Internal Development Use Only.
252 --
253 -- {End Of Comments}
254 -- ----------------------------------------------------------------------------
255 Procedure set_called_from_form
256 ( p_flag in boolean );
257 --
258 end per_add_bus;