DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_LOCATION_API

Source


1 PACKAGE BODY hr_location_api AS
2 /* $Header: hrlocapi.pkb 120.1.12010000.1 2008/07/28 03:29:45 appldev ship $ */
3 --
4 -- Package Variables
5 --
6 g_package            VARCHAR2(33) := '  hr_location_api.';
7 --
8 --------------------------------------------------------------------------------
9 g_dummy  number(1);  -- Dummy for cursor returns which are not needed
10 g_business_group_id number(15); -- For validating translation;
11 g_legislation_code varchar2(150); -- For validating translation;
12 --------------------------------------------------------------------------------
13 -- ----------------------------------------------------------------------------
14 -- |-----------------------------< create_location >--------------------------|
15 -- ----------------------------------------------------------------------------
16 --
17 PROCEDURE create_location
18   (   p_validate                       IN  BOOLEAN   DEFAULT false
19      ,p_effective_date                 IN  DATE
20      ,p_language_code                  IN  VARCHAR2  DEFAULT hr_api.userenv_lang
21      ,p_location_code                  IN  VARCHAR2
22      ,p_description                    IN  VARCHAR2  DEFAULT NULL
23      ,p_timezone_code                  IN  VARCHAR2  DEFAULT NULL
24      ,p_tp_header_id                   IN  NUMBER    DEFAULT NULL
25      ,p_ece_tp_location_code           IN  VARCHAR2  DEFAULT NULL
26      ,p_address_line_1                 IN  VARCHAR2  DEFAULT NULL
27      ,p_address_line_2                 IN  VARCHAR2  DEFAULT NULL
28      ,p_address_line_3                 IN  VARCHAR2  DEFAULT NULL
29      ,p_bill_to_site_flag              IN  VARCHAR2  DEFAULT 'Y'
30      ,p_country                        IN  VARCHAR2  DEFAULT NULL
31      ,p_designated_receiver_id         IN  NUMBER    DEFAULT NULL
32      ,p_in_organization_flag           IN  VARCHAR2  DEFAULT 'Y'
33      ,p_inactive_date                  IN  DATE      DEFAULT NULL
34      ,p_operating_unit_id              IN  NUMBER    DEFAULT NULL
35      ,p_inventory_organization_id      IN  NUMBER    DEFAULT NULL
36      ,p_office_site_flag               IN  VARCHAR2  DEFAULT 'Y'
37      ,p_postal_code                    IN  VARCHAR2  DEFAULT NULL
38      ,p_receiving_site_flag            IN  VARCHAR2  DEFAULT 'Y'
39      ,p_region_1                       IN  VARCHAR2  DEFAULT NULL
40      ,p_region_2                       IN  VARCHAR2  DEFAULT NULL
41      ,p_region_3                       IN  VARCHAR2  DEFAULT NULL
42      ,p_ship_to_location_id            IN  NUMBER    DEFAULT NULL
43      ,p_ship_to_site_flag              IN  VARCHAR2  DEFAULT 'Y'
44      ,p_style                          IN  VARCHAR2  DEFAULT NULL
45      ,p_tax_name                       IN  VARCHAR2  DEFAULT NULL
46      ,p_telephone_number_1             IN  VARCHAR2  DEFAULT NULL
47      ,p_telephone_number_2             IN  VARCHAR2  DEFAULT NULL
48      ,p_telephone_number_3             IN  VARCHAR2  DEFAULT NULL
49      ,p_town_or_city                   IN  VARCHAR2  DEFAULT NULL
50      ,p_loc_information13              IN  VARCHAR2  DEFAULT NULL
51      ,p_loc_information14              IN  VARCHAR2  DEFAULT NULL
52      ,p_loc_information15              IN  VARCHAR2  DEFAULT NULL
53      ,p_loc_information16              IN  VARCHAR2  DEFAULT NULL
54      ,p_loc_information17              IN  VARCHAR2  DEFAULT NULL
55      ,p_loc_information18              IN  VARCHAR2  DEFAULT NULL
56      ,p_loc_information19              IN  VARCHAR2  DEFAULT NULL
57      ,p_loc_information20              IN  VARCHAR2  DEFAULT NULL
58      ,p_attribute_category             IN  VARCHAR2  DEFAULT NULL
59      ,p_attribute1                     IN  VARCHAR2  DEFAULT NULL
60      ,p_attribute2                     IN  VARCHAR2  DEFAULT NULL
61      ,p_attribute3                     IN  VARCHAR2  DEFAULT NULL
62      ,p_attribute4                     IN  VARCHAR2  DEFAULT NULL
63      ,p_attribute5                     IN  VARCHAR2  DEFAULT NULL
64      ,p_attribute6                     IN  VARCHAR2  DEFAULT NULL
65      ,p_attribute7                     IN  VARCHAR2  DEFAULT NULL
66      ,p_attribute8                     IN  VARCHAR2  DEFAULT NULL
67      ,p_attribute9                     IN  VARCHAR2  DEFAULT NULL
68      ,p_attribute10                    IN  VARCHAR2  DEFAULT NULL
69      ,p_attribute11                    IN  VARCHAR2  DEFAULT NULL
70      ,p_attribute12                    IN  VARCHAR2  DEFAULT NULL
71      ,p_attribute13                    IN  VARCHAR2  DEFAULT NULL
72      ,p_attribute14                    IN  VARCHAR2  DEFAULT NULL
73      ,p_attribute15                    IN  VARCHAR2  DEFAULT NULL
74      ,p_attribute16                    IN  VARCHAR2  DEFAULT NULL
75      ,p_attribute17                    IN  VARCHAR2  DEFAULT NULL
76      ,p_attribute18                    IN  VARCHAR2  DEFAULT NULL
77      ,p_attribute19                    IN  VARCHAR2  DEFAULT NULL
78      ,p_attribute20                    IN  VARCHAR2  DEFAULT NULL
79      ,p_global_attribute_category      IN  VARCHAR2  DEFAULT NULL
80      ,p_global_attribute1              IN  VARCHAR2  DEFAULT NULL
81      ,p_global_attribute2              IN  VARCHAR2  DEFAULT NULL
82      ,p_global_attribute3              IN  VARCHAR2  DEFAULT NULL
83      ,p_global_attribute4              IN  VARCHAR2  DEFAULT NULL
84      ,p_global_attribute5              IN  VARCHAR2  DEFAULT NULL
85      ,p_global_attribute6              IN  VARCHAR2  DEFAULT NULL
86      ,p_global_attribute7              IN  VARCHAR2  DEFAULT NULL
87      ,p_global_attribute8              IN  VARCHAR2  DEFAULT NULL
88      ,p_global_attribute9              IN  VARCHAR2  DEFAULT NULL
89      ,p_global_attribute10             IN  VARCHAR2  DEFAULT NULL
90      ,p_global_attribute11             IN  VARCHAR2  DEFAULT NULL
91      ,p_global_attribute12             IN  VARCHAR2  DEFAULT NULL
92      ,p_global_attribute13             IN  VARCHAR2  DEFAULT NULL
93      ,p_global_attribute14             IN  VARCHAR2  DEFAULT NULL
94      ,p_global_attribute15             IN  VARCHAR2  DEFAULT NULL
95      ,p_global_attribute16             IN  VARCHAR2  DEFAULT NULL
96      ,p_global_attribute17             IN  VARCHAR2  DEFAULT NULL
97      ,p_global_attribute18             IN  VARCHAR2  DEFAULT NULL
98      ,p_global_attribute19             IN  VARCHAR2  DEFAULT NULL
99      ,p_global_attribute20             IN  VARCHAR2  DEFAULT NULL
100      ,p_business_group_id              IN  NUMBER    DEFAULT NULL
101      ,p_location_id                    OUT NOCOPY NUMBER
102      ,p_object_version_number          OUT NOCOPY NUMBER
103 
104   ) IS
105   --
106   -- Declare cursors and local variables
107   --
108   l_proc                  VARCHAR2(72) := g_package||'create_location';
109   l_location_id           hr_locations_all.location_id%TYPE;
110   l_object_version_number hr_locations_all.object_version_number%TYPE;
111   l_language_code         hr_locations_all_tl.language%TYPE;
112   l_inactive_date         DATE;
113   --
114 BEGIN
115   --
116   hr_utility.set_location('Entering:'|| l_proc, 10);
117   --
118   -- Issue a savepoint
119   --
120   savepoint create_location;
121   --
122   hr_utility.set_location(l_proc, 15);
123   --
124   --  All date input parameters must be truncated to remove time elements
125   --
126   l_inactive_date := trunc (p_inactive_date);
127   --
128   --
129   -- Validate the language parameter.  l_language_code should be passed to functions
130   -- instead of p_language_code from now on, to allow an IN OUT parameter to
131   -- be passed through.
132   --
133   l_language_code := p_language_code;
134   hr_api.validate_language_code(p_language_code => l_language_code);
135   --
136   hr_utility.set_location(l_proc, 20);
137   --
138     BEGIN
139     --
140     -- Start of API User Hook for the before hook of create_location
141     --
142     hr_location_bk1.create_location_b
143      (
144      p_effective_date                => p_effective_date
145     ,p_language_code                 => l_language_code
146     ,p_location_code                 => p_location_code
147     ,p_description                   => p_description
148     ,p_timezone_code                 => p_timezone_code
149     ,p_tp_header_id                  => p_tp_header_id
150     ,p_ece_tp_location_code          => p_ece_tp_location_code
151     ,p_address_line_1                => p_address_line_1
152     ,p_address_line_2                => p_address_line_2
153     ,p_address_line_3                => p_address_line_3
154     ,p_bill_to_site_flag             => p_bill_to_site_flag
155     ,p_country                       => p_country
156     ,p_designated_receiver_id        => p_designated_receiver_id
157     ,p_in_organization_flag          => p_in_organization_flag
158     ,p_inactive_date                 => l_inactive_date
159     ,p_operating_unit_id             => p_operating_unit_id
160     ,p_inventory_organization_id     => p_inventory_organization_id
161     ,p_office_site_flag              => p_office_site_flag
162     ,p_postal_code                   => p_postal_code
163     ,p_receiving_site_flag           => p_receiving_site_flag
164     ,p_region_1                      => p_region_1
165     ,p_region_2                      => p_region_2
166     ,p_region_3                      => p_region_3
167     ,p_ship_to_location_id           => p_ship_to_location_id
168     ,p_ship_to_site_flag             => p_ship_to_site_flag
169     ,p_style                         => p_style
170     ,p_tax_name                      => p_tax_name
171     ,p_telephone_number_1            => p_telephone_number_1
172     ,p_telephone_number_2            => p_telephone_number_2
173     ,p_telephone_number_3            => p_telephone_number_3
174     ,p_town_or_city                  => p_town_or_city
175     ,p_loc_information13             => p_loc_information13
176     ,p_loc_information14             => p_loc_information14
177     ,p_loc_information15             => p_loc_information15
178     ,p_loc_information16             => p_loc_information16
179     ,p_loc_information17             => p_loc_information17
180     ,p_loc_information18             => p_loc_information18
181     ,p_loc_information19             => p_loc_information19
182     ,p_loc_information20             => p_loc_information20
183     ,p_attribute_category            => p_attribute_category
184     ,p_attribute1                    => p_attribute1
185     ,p_attribute2                    => p_attribute2
186     ,p_attribute3                    => p_attribute3
187     ,p_attribute4                    => p_attribute4
188     ,p_attribute5                    => p_attribute5
189     ,p_attribute6                    => p_attribute6
190     ,p_attribute7                    => p_attribute7
191     ,p_attribute8                    => p_attribute8
192     ,p_attribute9                    => p_attribute9
193     ,p_attribute10                   => p_attribute10
194     ,p_attribute11                   => p_attribute11
195     ,p_attribute12                   => p_attribute12
196     ,p_attribute13                   => p_attribute13
197     ,p_attribute14                   => p_attribute14
198     ,p_attribute15                   => p_attribute15
199     ,p_attribute16                   => p_attribute16
200     ,p_attribute17                   => p_attribute17
201     ,p_attribute18                   => p_attribute18
202     ,p_attribute19                   => p_attribute19
203     ,p_attribute20                   => p_attribute20
204     ,p_global_attribute_category     => p_global_attribute_category
205     ,p_global_attribute1             => p_global_attribute1
206     ,p_global_attribute2             => p_global_attribute2
207     ,p_global_attribute3             => p_global_attribute3
208     ,p_global_attribute4             => p_global_attribute4
209     ,p_global_attribute5             => p_global_attribute5
210     ,p_global_attribute6             => p_global_attribute6
211     ,p_global_attribute7             => p_global_attribute7
212     ,p_global_attribute8             => p_global_attribute8
213     ,p_global_attribute9             => p_global_attribute9
214     ,p_global_attribute10            => p_global_attribute10
215     ,p_global_attribute11            => p_global_attribute11
216     ,p_global_attribute12            => p_global_attribute12
217     ,p_global_attribute13            => p_global_attribute13
218     ,p_global_attribute14            => p_global_attribute14
219     ,p_global_attribute15            => p_global_attribute15
220     ,p_global_attribute16            => p_global_attribute16
221     ,p_global_attribute17            => p_global_attribute17
222     ,p_global_attribute18            => p_global_attribute18
223     ,p_global_attribute19            => p_global_attribute19
224     ,p_global_attribute20            => p_global_attribute20
225     ,p_business_group_id             => p_business_group_id
226      );
227      EXCEPTION
228        WHEN hr_api.cannot_find_prog_unit THEN
229          hr_api.cannot_find_prog_unit_error
230            (  p_module_name => 'CREATE_LOCATION'
231              ,p_hook_type   => 'BP'
232            );
233     --
234     -- End of API User Hook for the before hook of create_location
235     --
236   END;
237   -- Process Logic
238   --
239   -- Insert non-translatable rows into HR_LOCATIONS_ALL first
240 
241   hr_utility.set_location(l_proc, 25);
242 
243   hr_location_internal.create_generic_location
244   (   p_effective_date                => p_effective_date
245      ,p_location_id                   => l_location_id
246      ,p_object_version_number         => l_object_version_number
247      ,p_location_code                 => p_location_code
248      ,p_timezone_code                 => p_timezone_code
249      ,p_address_line_1                => p_address_line_1
250      ,p_address_line_2                => p_address_line_2
251      ,p_address_line_3                => p_address_line_3
252      ,p_bill_to_site_flag             => p_bill_to_site_flag
253      ,p_country                       => p_country
254      ,p_description                   => p_description
255      ,p_designated_receiver_id        => p_designated_receiver_id
256      ,p_in_organization_flag          => p_in_organization_flag
257      ,p_inactive_date                 => l_inactive_date
258      ,p_operating_unit_id             => p_operating_unit_id
259      ,p_inventory_organization_id     => p_inventory_organization_id
260      ,p_office_site_flag              => p_office_site_flag
261      ,p_postal_code                   => p_postal_code
262      ,p_receiving_site_flag           => p_receiving_site_flag
263      ,p_region_1                      => p_region_1
264      ,p_region_2                      => p_region_2
265      ,p_region_3                      => p_region_3
266      ,p_ship_to_location_id           => p_ship_to_location_id
267      ,p_ship_to_site_flag             => p_ship_to_site_flag
268      ,p_style                         => p_style
269      -- Bug 4195237 : 'p_tax_name' parameter is disabled.
270      -- Passing 'null' to hr_location_internal
271      ,p_tax_name                      => null
272      ,p_telephone_number_1            => p_telephone_number_1
273      ,p_telephone_number_2            => p_telephone_number_2
274      ,p_telephone_number_3            => p_telephone_number_3
275      ,p_town_or_city                  => p_town_or_city
276      ,p_loc_information13             => p_loc_information13
277      ,p_loc_information14             => p_loc_information14
278      ,p_loc_information15             => p_loc_information15
279      ,p_loc_information16             => p_loc_information16
280      ,p_loc_information17             => p_loc_information17
281      ,p_loc_information18             => p_loc_information18
282      ,p_loc_information19             => p_loc_information19
283      ,p_loc_information20             => p_loc_information20
284      ,p_attribute_category            => p_attribute_category
285      ,p_attribute1                    => p_attribute1
286      ,p_attribute2                    => p_attribute2
287      ,p_attribute3                    => p_attribute3
288      ,p_attribute4                    => p_attribute4
289      ,p_attribute5                    => p_attribute5
290      ,p_attribute6                    => p_attribute6
291      ,p_attribute7                    => p_attribute7
292      ,p_attribute8                    => p_attribute8
293      ,p_attribute9                    => p_attribute9
294      ,p_attribute10                   => p_attribute10
295      ,p_attribute11                   => p_attribute11
296      ,p_attribute12                   => p_attribute12
297      ,p_attribute13                   => p_attribute13
298      ,p_attribute14                   => p_attribute14
299      ,p_attribute15                   => p_attribute15
300      ,p_attribute16                   => p_attribute16
301      ,p_attribute17                   => p_attribute17
302      ,p_attribute18                   => p_attribute18
303      ,p_attribute19                   => p_attribute19
304      ,p_attribute20                   => p_attribute20
305      ,p_global_attribute_category     => p_global_attribute_category
306      ,p_global_attribute1             => p_global_attribute1
307      ,p_global_attribute2             => p_global_attribute2
308      ,p_global_attribute3             => p_global_attribute3
309      ,p_global_attribute4             => p_global_attribute4
310      ,p_global_attribute5             => p_global_attribute5
311      ,p_global_attribute6             => p_global_attribute6
312      ,p_global_attribute7             => p_global_attribute7
313      ,p_global_attribute8             => p_global_attribute8
314      ,p_global_attribute9             => p_global_attribute9
315      ,p_global_attribute10            => p_global_attribute10
316      ,p_global_attribute11            => p_global_attribute11
317      ,p_global_attribute12            => p_global_attribute12
318      ,p_global_attribute13            => p_global_attribute13
319      ,p_global_attribute14            => p_global_attribute14
320      ,p_global_attribute15            => p_global_attribute15
321      ,p_global_attribute16            => p_global_attribute16
322      ,p_global_attribute17            => p_global_attribute17
323      ,p_global_attribute18            => p_global_attribute18
324      ,p_global_attribute19            => p_global_attribute19
325      ,p_global_attribute20            => p_global_attribute20
326      ,p_legal_address_flag            => 'N'
327      ,p_tp_header_id                  => p_tp_header_id
328      ,p_ece_tp_location_code          => p_ece_tp_location_code
329      ,p_business_group_id             => p_business_group_id
330    );
331 
332   --
333   BEGIN
334     --
335     -- Start of API User Hook for the after hook of create_location
336     --
337     hr_location_bk1.create_location_a
338      (
339      p_effective_date                => p_effective_date
340     ,p_language_code                 => l_language_code
341     ,p_location_code                 => p_location_code
342     ,p_description                   => p_description
343     ,p_timezone_code                 => p_timezone_code
344     ,p_tp_header_id                  => p_tp_header_id
345     ,p_ece_tp_location_code          => p_ece_tp_location_code
346     ,p_address_line_1                => p_address_line_1
347     ,p_address_line_2                => p_address_line_2
348     ,p_address_line_3                => p_address_line_3
349     ,p_bill_to_site_flag             => p_bill_to_site_flag
350     ,p_country                       => p_country
351     ,p_designated_receiver_id        => p_designated_receiver_id
352     ,p_in_organization_flag          => p_in_organization_flag
353     ,p_inactive_date                 => l_inactive_date
354     ,p_operating_unit_id             => p_operating_unit_id
355     ,p_inventory_organization_id     => p_inventory_organization_id
356     ,p_office_site_flag              => p_office_site_flag
357     ,p_postal_code                   => p_postal_code
358     ,p_receiving_site_flag           => p_receiving_site_flag
359     ,p_region_1                      => p_region_1
360     ,p_region_2                      => p_region_2
361     ,p_region_3                      => p_region_3
362     ,p_ship_to_location_id           => p_ship_to_location_id
363     ,p_ship_to_site_flag             => p_ship_to_site_flag
364     ,p_style                         => p_style
365     ,p_tax_name                      => p_tax_name
366     ,p_telephone_number_1            => p_telephone_number_1
367     ,p_telephone_number_2            => p_telephone_number_2
368     ,p_telephone_number_3            => p_telephone_number_3
369     ,p_town_or_city                  => p_town_or_city
370     ,p_loc_information13             => p_loc_information13
371     ,p_loc_information14             => p_loc_information14
372     ,p_loc_information15             => p_loc_information15
373     ,p_loc_information16             => p_loc_information16
374     ,p_loc_information17             => p_loc_information17
375     ,p_loc_information18             => p_loc_information18
376     ,p_loc_information19             => p_loc_information19
377     ,p_loc_information20             => p_loc_information20
378     ,p_attribute_category            => p_attribute_category
379     ,p_attribute1                    => p_attribute1
380     ,p_attribute2                    => p_attribute2
381     ,p_attribute3                    => p_attribute3
382     ,p_attribute4                    => p_attribute4
383     ,p_attribute5                    => p_attribute5
384     ,p_attribute6                    => p_attribute6
385     ,p_attribute7                    => p_attribute7
386     ,p_attribute8                    => p_attribute8
387     ,p_attribute9                    => p_attribute9
388     ,p_attribute10                   => p_attribute10
389     ,p_attribute11                   => p_attribute11
390     ,p_attribute12                   => p_attribute12
391     ,p_attribute13                   => p_attribute13
392     ,p_attribute14                   => p_attribute14
393     ,p_attribute15                   => p_attribute15
394     ,p_attribute16                   => p_attribute16
395     ,p_attribute17                   => p_attribute17
396     ,p_attribute18                   => p_attribute18
397     ,p_attribute19                   => p_attribute19
398     ,p_attribute20                   => p_attribute20
399     ,p_global_attribute_category     => p_global_attribute_category
400     ,p_global_attribute1             => p_global_attribute1
401     ,p_global_attribute2             => p_global_attribute2
402     ,p_global_attribute3             => p_global_attribute3
403     ,p_global_attribute4             => p_global_attribute4
404     ,p_global_attribute5             => p_global_attribute5
405     ,p_global_attribute6             => p_global_attribute6
406     ,p_global_attribute7             => p_global_attribute7
407     ,p_global_attribute8             => p_global_attribute8
408     ,p_global_attribute9             => p_global_attribute9
409     ,p_global_attribute10            => p_global_attribute10
410     ,p_global_attribute11            => p_global_attribute11
411     ,p_global_attribute12            => p_global_attribute12
412     ,p_global_attribute13            => p_global_attribute13
413     ,p_global_attribute14            => p_global_attribute14
414     ,p_global_attribute15            => p_global_attribute15
415     ,p_global_attribute16            => p_global_attribute16
416     ,p_global_attribute17            => p_global_attribute17
417     ,p_global_attribute18            => p_global_attribute18
418     ,p_global_attribute19            => p_global_attribute19
419     ,p_global_attribute20            => p_global_attribute20
420     ,p_business_group_id             => p_business_group_id
421     ,p_location_id                   => l_location_id
422     ,p_object_version_number         => l_object_version_number
423     );
424    EXCEPTION
425     WHEN hr_api.cannot_find_prog_unit THEN
426       hr_api.cannot_find_prog_unit_error
427         (p_module_name => 'CREATE_LOCATION'
428         ,p_hook_type   => 'AP'
429         );
430     --
431     -- End of API User Hook for the after hook of create_location
432     --
433   END;
434   hr_utility.set_location(l_proc, 60);
435   --
436   -- When in validation only mode raise the Validate_Enabled exception
437   --
438     IF p_validate THEN
439     RAISE hr_api.validate_enabled;
440   END IF;
441    -- Set all output arguments
442   --
443   p_location_id := l_location_id;
444   p_object_version_number := l_object_version_number;
445   --
446 EXCEPTION
447   --
448   WHEN hr_api.validate_enabled THEN
449     --
450     -- As the Validate_Enabled exception has been raised
451     -- we must rollback to the savepoint
452     --
453     ROLLBACK TO create_location;
454     --
455     -- Only set output warning arguments
456     -- (Any key or derived arguments must be set to null
457     -- when validation only mode is being used.)
458     --
459     p_location_id := NULL;
460     p_object_version_number  := NULL;
461     hr_utility.set_location(' Leaving:'||l_proc, 80);
462   WHEN OTHERS THEN
463     --
464     -- A validation or unexpected error has occurred
465     ROLLBACK TO create_location;
466     -- Set OUT parameters.
467     p_location_id := NULL;
468     p_object_version_number  := NULL;
469     hr_utility.set_location(' Leaving:'||l_proc, 90);
470     RAISE;
471    --
472 END create_location;
473 -- ----------------------------------------------------------------------------
474 -- |--------------------------< update_location >-----------------------------|
475 -- ----------------------------------------------------------------------------
476 --
477 PROCEDURE update_location
478   (   p_validate                       IN  BOOLEAN   DEFAULT false
479      ,p_effective_date                 IN  DATE
480      ,p_language_code                  IN  VARCHAR2  DEFAULT hr_api.userenv_lang
481      ,p_location_id                    IN  NUMBER
482      ,p_location_code                  IN  VARCHAR2  DEFAULT hr_api.g_varchar2
483      ,p_description                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
484      ,p_timezone_code                  IN  VARCHAR2  DEFAULT hr_api.g_varchar2
485      ,p_tp_header_id                   IN  NUMBER    DEFAULT hr_api.g_number
486      ,p_ece_tp_location_code           IN  VARCHAR2  DEFAULT hr_api.g_varchar2
487      ,p_address_line_1                 IN  VARCHAR2  DEFAULT hr_api.g_varchar2
488      ,p_address_line_2                 IN  VARCHAR2  DEFAULT hr_api.g_varchar2
489      ,p_address_line_3                 IN  VARCHAR2  DEFAULT hr_api.g_varchar2
490      ,p_bill_to_site_flag              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
491      ,p_country                        IN  VARCHAR2  DEFAULT hr_api.g_varchar2
492      ,p_designated_receiver_id         IN  NUMBER    DEFAULT hr_api.g_number
493      ,p_in_organization_flag           IN  VARCHAR2  DEFAULT hr_api.g_varchar2
494      ,p_inactive_date                  IN  DATE      DEFAULT hr_api.g_date
495      ,p_operating_unit_id              IN  NUMBER    DEFAULT NULL
496      ,p_inventory_organization_id      IN  NUMBER    DEFAULT hr_api.g_number
497      ,p_office_site_flag               IN  VARCHAR2  DEFAULT hr_api.g_varchar2
498      ,p_postal_code                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
499      ,p_receiving_site_flag            IN  VARCHAR2  DEFAULT hr_api.g_varchar2
500      ,p_region_1                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
501      ,p_region_2                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
502      ,p_region_3                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
503      ,p_ship_to_location_id            IN  NUMBER    DEFAULT hr_api.g_number
504      ,p_ship_to_site_flag              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
505      ,p_style                          IN  VARCHAR2  DEFAULT hr_api.g_varchar2
506      ,p_tax_name                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
507      ,p_telephone_number_1             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
508      ,p_telephone_number_2             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
509      ,p_telephone_number_3             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
510      ,p_town_or_city                   IN  VARCHAR2  DEFAULT hr_api.g_varchar2
511      ,p_loc_information13              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
512      ,p_loc_information14              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
513      ,p_loc_information15              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
514      ,p_loc_information16              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
515      ,p_loc_information17              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
516      ,p_loc_information18              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
517      ,p_loc_information19              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
518      ,p_loc_information20              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
519      ,p_attribute_category             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
520      ,p_attribute1                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
521      ,p_attribute2                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
522      ,p_attribute3                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
523      ,p_attribute4                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
524      ,p_attribute5                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
525      ,p_attribute6                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
526      ,p_attribute7                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
527      ,p_attribute8                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
528      ,p_attribute9                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
529      ,p_attribute10                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
530      ,p_attribute11                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
531      ,p_attribute12                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
532      ,p_attribute13                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
533      ,p_attribute14                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
534      ,p_attribute15                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
535      ,p_attribute16                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
536      ,p_attribute17                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
537      ,p_attribute18                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
538      ,p_attribute19                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
539      ,p_attribute20                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
540      ,p_global_attribute_category      IN  VARCHAR2  DEFAULT hr_api.g_varchar2
541      ,p_global_attribute1              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
542      ,p_global_attribute2              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
543      ,p_global_attribute3              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
544      ,p_global_attribute4              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
545      ,p_global_attribute5              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
546      ,p_global_attribute6              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
547      ,p_global_attribute7              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
548      ,p_global_attribute8              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
549      ,p_global_attribute9              IN  VARCHAR2  DEFAULT hr_api.g_varchar2
550      ,p_global_attribute10             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
551      ,p_global_attribute11             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
552      ,p_global_attribute12             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
553      ,p_global_attribute13             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
554      ,p_global_attribute14             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
555      ,p_global_attribute15             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
556      ,p_global_attribute16             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
557      ,p_global_attribute17             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
558      ,p_global_attribute18             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
559      ,p_global_attribute19             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
560      ,p_global_attribute20             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
561      ,p_object_version_number          IN OUT NOCOPY NUMBER
562   ) IS
563   --
564   -- Declare cursors and local variables
565   --
566   l_proc                  VARCHAR2(72) := g_package||'update_location';
567   l_object_version_number hr_locations.object_version_number%TYPE;
568   l_language_code         hr_locations_all_tl.language%TYPE;
569   l_inactive_date         DATE;
570 
571   l_temp_ovn   number := p_object_version_number;
572   --
573   l_address_line_1        VARCHAR2(240);
574   l_address_line_2        VARCHAR2(240);
575   l_address_line_3        VARCHAR2(240);
576   l_country               VARCHAR2(60);
577   l_postal_code           VARCHAR2(30);
578   l_region_1              VARCHAR2(120);
579   l_region_2              VARCHAR2(120);
580   l_region_3              VARCHAR2(120);
581   l_style                 VARCHAR2(30);
582   l_town_or_city          VARCHAR2(30);
583 
584 BEGIN
585   --
586   hr_utility.set_location('Entering:'|| l_proc, 10);
587   --
588   -- Issue a savepoint.
589   --
590   savepoint update_location;
591   --
592   --
593   --  All date input parameters must be truncated to remove time elements
594   --
595   l_inactive_date := trunc (p_inactive_date);
596   --
597   -- Validate the language parameter.
598   -- l_language_code should be passed to functions
599   -- instead of p_language_code from now on, to allow an IN OUT parameter to be
600   -- passed through.
601   --
602   l_language_code := p_language_code;
603   hr_api.validate_language_code(p_language_code => l_language_code);
604   hr_utility.set_location(l_proc, 20);
605 
606   if hr_general2.is_location_legal_adr(p_location_id => p_location_id) then
607   --
608     --
609     -- Check that the non updateable parameter for legal address has
610     -- not been passed in.
611     --
612     -- p_address_line_1
613     -- p_address_line_2
614     -- p_address_line_3
615     -- p_country
616     -- p_inactive_date
617     -- p_postal_code
618     -- p_region_1
619     -- p_region_2
620     -- p_region_3
621     -- p_style
622     -- p_town_or_city
623 
624     -- fix 3219077 start
625        select address_line_1
626              ,address_line_2
627              ,address_line_3
628              ,country
629              ,inactive_date
630              ,postal_code
631              ,region_1
632              ,region_2
633              ,region_3
634              ,style
635              ,town_or_city
636        into   l_address_line_1
637              ,l_address_line_2
638              ,l_address_line_3
639              ,l_country
640              ,l_inactive_date
641              ,l_postal_code
642              ,l_region_1
643              ,l_region_2
644              ,l_region_3
645              ,l_style
646              ,l_town_or_city
647        from   hr_locations_all loc
648      where  loc.location_id = p_location_id;
649   -- fix 3219077 end
650 
651        hr_utility.set_location(l_proc, 25);
652 
653     if (
654 
655        nvl(p_address_line_1,hr_api.g_varchar2) <>
656                     nvl(l_address_line_1,hr_api.g_varchar2)  OR
657        nvl(p_address_line_2,hr_api.g_varchar2) <>
658                     nvl(l_address_line_2,hr_api.g_varchar2) OR
659        nvl(p_address_line_3,hr_api.g_varchar2) <>
660                     nvl(l_address_line_3,hr_api.g_varchar2) OR
661        nvl(p_country,hr_api.g_varchar2)        <>
662                     nvl(l_country,hr_api.g_varchar2) OR
663        nvl(p_inactive_date,hr_api.g_date)  <>
664                     nvl(l_inactive_date,hr_api.g_date)     OR
665        nvl(p_postal_code,hr_api.g_varchar2)    <>
666                     nvl(l_postal_code,hr_api.g_varchar2) OR
667        nvl(p_region_1,hr_api.g_varchar2)       <>
668                     nvl(l_region_1,hr_api.g_varchar2) OR
669        nvl(p_region_2,hr_api.g_varchar2)       <>
670                     nvl(l_region_2,hr_api.g_varchar2) OR
671        nvl(p_region_3,hr_api.g_varchar2)       <>
672                     nvl(l_region_3,hr_api.g_varchar2) OR
673        nvl(p_style,hr_api.g_varchar2)          <>
674                     nvl(l_style,hr_api.g_varchar2) OR
675        nvl(p_town_or_city,hr_api.g_varchar2)   <>
676                     nvl(l_town_or_city,hr_api.g_varchar2)
677        )
678     then
679 
680        hr_utility.set_location(l_proc, 26);
681 
682        hr_utility.set_message(800, 'HR_50049_NON_UPDATEABLE_VALUES');
683        hr_utility.raise_error;
684 
685     end if;
686 
687   end if;
688 
689   -- Process Logic
690   --
691   l_object_version_number := p_object_version_number;
692   --
693     BEGIN
694     --
695     -- Start of API User Hook for the before hook of update_location
696     --
697     hr_location_bk2.update_location_b
698       (
699      p_effective_date                => p_effective_date
700     ,p_language_code                 => l_language_code
701     ,p_location_id                   => p_location_id
702     ,p_location_code                 => p_location_code
703     ,p_description                   => p_description
704     ,p_timezone_code                 => p_timezone_code
705     ,p_tp_header_id                  => p_tp_header_id
706     ,p_ece_tp_location_code          => p_ece_tp_location_code
707     ,p_address_line_1                => p_address_line_1
708     ,p_address_line_2                => p_address_line_2
709     ,p_address_line_3                => p_address_line_3
710     ,p_bill_to_site_flag             => p_bill_to_site_flag
711     ,p_country                       => p_country
712     ,p_designated_receiver_id        => p_designated_receiver_id
713     ,p_in_organization_flag          => p_in_organization_flag
714     ,p_inactive_date                 => l_inactive_date
715     ,p_operating_unit_id             => p_operating_unit_id
716     ,p_inventory_organization_id     => p_inventory_organization_id
717     ,p_office_site_flag              => p_office_site_flag
718     ,p_postal_code                   => p_postal_code
719     ,p_receiving_site_flag           => p_receiving_site_flag
720     ,p_region_1                      => p_region_1
721     ,p_region_2                      => p_region_2
722     ,p_region_3                      => p_region_3
723     ,p_ship_to_location_id           => p_ship_to_location_id
724     ,p_ship_to_site_flag             => p_ship_to_site_flag
725     ,p_style                         => p_style
726     ,p_tax_name                      => p_tax_name
727     ,p_telephone_number_1            => p_telephone_number_1
728     ,p_telephone_number_2            => p_telephone_number_2
729     ,p_telephone_number_3            => p_telephone_number_3
730     ,p_town_or_city                  => p_town_or_city
731     ,p_loc_information13             => p_loc_information13
732     ,p_loc_information14             => p_loc_information14
733     ,p_loc_information15             => p_loc_information15
734     ,p_loc_information16             => p_loc_information16
735     ,p_loc_information17             => p_loc_information17
736     ,p_loc_information18             => p_loc_information18
737     ,p_loc_information19             => p_loc_information19
738     ,p_loc_information20             => p_loc_information20
739     ,p_attribute_category            => p_attribute_category
740     ,p_attribute1                    => p_attribute1
741     ,p_attribute2                    => p_attribute2
742     ,p_attribute3                    => p_attribute3
743     ,p_attribute4                    => p_attribute4
744     ,p_attribute5                    => p_attribute5
745     ,p_attribute6                    => p_attribute6
746     ,p_attribute7                    => p_attribute7
747     ,p_attribute8                    => p_attribute8
748     ,p_attribute9                    => p_attribute9
749     ,p_attribute10                   => p_attribute10
750     ,p_attribute11                   => p_attribute11
751     ,p_attribute12                   => p_attribute12
752     ,p_attribute13                   => p_attribute13
753     ,p_attribute14                   => p_attribute14
754     ,p_attribute15                   => p_attribute15
755     ,p_attribute16                   => p_attribute16
756     ,p_attribute17                   => p_attribute17
757     ,p_attribute18                   => p_attribute18
758     ,p_attribute19                   => p_attribute19
759     ,p_attribute20                   => p_attribute20
760     ,p_global_attribute_category     => p_global_attribute_category
761     ,p_global_attribute1             => p_global_attribute1
762     ,p_global_attribute2             => p_global_attribute2
763     ,p_global_attribute3             => p_global_attribute3
764     ,p_global_attribute4             => p_global_attribute4
765     ,p_global_attribute5             => p_global_attribute5
766     ,p_global_attribute6             => p_global_attribute6
767     ,p_global_attribute7             => p_global_attribute7
768     ,p_global_attribute8             => p_global_attribute8
769     ,p_global_attribute9             => p_global_attribute9
770     ,p_global_attribute10            => p_global_attribute10
771     ,p_global_attribute11            => p_global_attribute11
772     ,p_global_attribute12            => p_global_attribute12
773     ,p_global_attribute13            => p_global_attribute13
774     ,p_global_attribute14            => p_global_attribute14
775     ,p_global_attribute15            => p_global_attribute15
776     ,p_global_attribute16            => p_global_attribute16
777     ,p_global_attribute17            => p_global_attribute17
778     ,p_global_attribute18            => p_global_attribute18
779     ,p_global_attribute19            => p_global_attribute19
780     ,p_global_attribute20            => p_global_attribute20
781     ,p_object_version_number         => l_object_version_number
782      );
783    EXCEPTION
784     WHEN hr_api.cannot_find_prog_unit THEN
785       hr_api.cannot_find_prog_unit_error
786         (p_module_name => 'UPDATE_LOCATION'
787         ,p_hook_type   => 'BP'
788         );
789     --
790     -- End of API User Hook for the before hook of update_location
791     --
792   END;
793   --
794   -- Insert non-translatable rows in HR_LOCATIONS_ALL Table
795   --
796   hr_location_internal.update_generic_location
797     ( p_effective_date                => p_effective_date
798      ,p_language_code                 => l_language_code  -- Added for bug 3368450.
799      ,p_location_id                   => p_location_id
800      ,p_timezone_code                 => p_timezone_code
801      ,p_object_version_number         => l_object_version_number
802      ,p_tp_header_id                  => p_tp_header_id
803      ,p_ece_tp_location_code          => p_ece_tp_location_code
804      ,p_location_code                 => p_location_code
805      ,p_address_line_1                => p_address_line_1
806      ,p_address_line_2                => p_address_line_2
807      ,p_address_line_3                => p_address_line_3
808      ,p_bill_to_site_flag             => p_bill_to_site_flag
809      ,p_country                       => p_country
810      ,p_description                   => p_description
811      ,p_designated_receiver_id        => p_designated_receiver_id
812      ,p_in_organization_flag          => p_in_organization_flag
813      ,p_inactive_date                 => l_inactive_date
814      ,p_operating_unit_id             => p_operating_unit_id
815      ,p_inventory_organization_id     => p_inventory_organization_id
816      ,p_office_site_flag              => p_office_site_flag
817      ,p_postal_code                   => p_postal_code
818      ,p_receiving_site_flag           => p_receiving_site_flag
819      ,p_region_1                      => p_region_1
820      ,p_region_2                      => p_region_2
821      ,p_region_3                      => p_region_3
822      ,p_ship_to_location_id           => p_ship_to_location_id
823      ,p_ship_to_site_flag             => p_ship_to_site_flag
824      ,p_style                         => p_style
825      -- Bug 4195237 : 'p_tax_name' parameter is disabled.
826      -- Passing 'null' to hr_location_internal
827      ,p_tax_name                      => null
828      ,p_telephone_number_1            => p_telephone_number_1
829      ,p_telephone_number_2            => p_telephone_number_2
830      ,p_telephone_number_3            => p_telephone_number_3
831      ,p_town_or_city                  => p_town_or_city
832      ,p_loc_information13             => p_loc_information13
833      ,p_loc_information14             => p_loc_information14
834      ,p_loc_information15             => p_loc_information15
835      ,p_loc_information16             => p_loc_information16
836      ,p_loc_information17             => p_loc_information17
837      ,p_loc_information18             => p_loc_information18
838      ,p_loc_information19             => p_loc_information19
839      ,p_loc_information20             => p_loc_information20
840      ,p_attribute_category            => p_attribute_category
841      ,p_attribute1                    => p_attribute1
842      ,p_attribute2                    => p_attribute2
843      ,p_attribute3                    => p_attribute3
844      ,p_attribute4                    => p_attribute4
845      ,p_attribute5                    => p_attribute5
846      ,p_attribute6                    => p_attribute6
847      ,p_attribute7                    => p_attribute7
848      ,p_attribute8                    => p_attribute8
849      ,p_attribute9                    => p_attribute9
850      ,p_attribute10                   => p_attribute10
851      ,p_attribute11                   => p_attribute11
852      ,p_attribute12                   => p_attribute12
853      ,p_attribute13                   => p_attribute13
854      ,p_attribute14                   => p_attribute14
855      ,p_attribute15                   => p_attribute15
856      ,p_attribute16                   => p_attribute16
857      ,p_attribute17                   => p_attribute17
858      ,p_attribute18                   => p_attribute18
859      ,p_attribute19                   => p_attribute19
860      ,p_attribute20                   => p_attribute20
861      ,p_global_attribute_category     => p_global_attribute_category
862      ,p_global_attribute1             => p_global_attribute1
863      ,p_global_attribute2             => p_global_attribute2
864      ,p_global_attribute3             => p_global_attribute3
865      ,p_global_attribute4             => p_global_attribute4
866      ,p_global_attribute5             => p_global_attribute5
867      ,p_global_attribute6             => p_global_attribute6
868      ,p_global_attribute7             => p_global_attribute7
869      ,p_global_attribute8             => p_global_attribute8
870      ,p_global_attribute9             => p_global_attribute9
871      ,p_global_attribute10            => p_global_attribute10
872      ,p_global_attribute11            => p_global_attribute11
873      ,p_global_attribute12            => p_global_attribute12
874      ,p_global_attribute13            => p_global_attribute13
875      ,p_global_attribute14            => p_global_attribute14
876      ,p_global_attribute15            => p_global_attribute15
877      ,p_global_attribute16            => p_global_attribute16
878      ,p_global_attribute17            => p_global_attribute17
879      ,p_global_attribute18            => p_global_attribute18
880      ,p_global_attribute19            => p_global_attribute19
881      ,p_global_attribute20            => p_global_attribute20
882     );
883 
884 --
885     BEGIN
886     --
887     -- Start of API User Hook for the after hook of update_location
888     --
889     hr_location_bk2.update_location_a
890       (
891      p_effective_date                => p_effective_date
892     ,p_language_code                 => l_language_code
893     ,p_location_id                   => p_location_id
894     ,p_location_code                 => p_location_code
895     ,p_description                   => p_description
896     ,p_timezone_code                 => p_timezone_code
897     ,p_tp_header_id                  => p_tp_header_id
898     ,p_ece_tp_location_code          => p_ece_tp_location_code
899     ,p_address_line_1                => p_address_line_1
900     ,p_address_line_2                => p_address_line_2
901     ,p_address_line_3                => p_address_line_3
902     ,p_bill_to_site_flag             => p_bill_to_site_flag
903     ,p_country                       => p_country
904     ,p_designated_receiver_id        => p_designated_receiver_id
905     ,p_in_organization_flag          => p_in_organization_flag
906     ,p_inactive_date                 => l_inactive_date
907     ,p_operating_unit_id             => p_operating_unit_id
908     ,p_inventory_organization_id     => p_inventory_organization_id
909     ,p_office_site_flag              => p_office_site_flag
910     ,p_postal_code                   => p_postal_code
911     ,p_receiving_site_flag           => p_receiving_site_flag
912     ,p_region_1                      => p_region_1
913     ,p_region_2                      => p_region_2
914     ,p_region_3                      => p_region_3
915     ,p_ship_to_location_id           => p_ship_to_location_id
916     ,p_ship_to_site_flag             => p_ship_to_site_flag
917     ,p_style                         => p_style
918     ,p_tax_name                      => p_tax_name
919     ,p_telephone_number_1            => p_telephone_number_1
920     ,p_telephone_number_2            => p_telephone_number_2
921     ,p_telephone_number_3            => p_telephone_number_3
922     ,p_town_or_city                  => p_town_or_city
923     ,p_loc_information13             => p_loc_information13
924     ,p_loc_information14             => p_loc_information14
925     ,p_loc_information15             => p_loc_information15
926     ,p_loc_information16             => p_loc_information16
927     ,p_loc_information17             => p_loc_information17
928     ,p_loc_information18             => p_loc_information18
929     ,p_loc_information19             => p_loc_information19
930     ,p_loc_information20             => p_loc_information20
931     ,p_attribute_category            => p_attribute_category
932     ,p_attribute1                    => p_attribute1
933     ,p_attribute2                    => p_attribute2
934     ,p_attribute3                    => p_attribute3
935     ,p_attribute4                    => p_attribute4
936     ,p_attribute5                    => p_attribute5
937     ,p_attribute6                    => p_attribute6
938     ,p_attribute7                    => p_attribute7
939     ,p_attribute8                    => p_attribute8
940     ,p_attribute9                    => p_attribute9
941     ,p_attribute10                   => p_attribute10
942     ,p_attribute11                   => p_attribute11
943     ,p_attribute12                   => p_attribute12
944     ,p_attribute13                   => p_attribute13
945     ,p_attribute14                   => p_attribute14
946     ,p_attribute15                   => p_attribute15
947     ,p_attribute16                   => p_attribute16
948     ,p_attribute17                   => p_attribute17
949     ,p_attribute18                   => p_attribute18
950     ,p_attribute19                   => p_attribute19
951     ,p_attribute20                   => p_attribute20
952     ,p_global_attribute_category     => p_global_attribute_category
953     ,p_global_attribute1             => p_global_attribute1
954     ,p_global_attribute2             => p_global_attribute2
955     ,p_global_attribute3             => p_global_attribute3
956     ,p_global_attribute4             => p_global_attribute4
957     ,p_global_attribute5             => p_global_attribute5
958     ,p_global_attribute6             => p_global_attribute6
959     ,p_global_attribute7             => p_global_attribute7
960     ,p_global_attribute8             => p_global_attribute8
961     ,p_global_attribute9             => p_global_attribute9
962     ,p_global_attribute10            => p_global_attribute10
963     ,p_global_attribute11            => p_global_attribute11
964     ,p_global_attribute12            => p_global_attribute12
965     ,p_global_attribute13            => p_global_attribute13
966     ,p_global_attribute14            => p_global_attribute14
967     ,p_global_attribute15            => p_global_attribute15
968     ,p_global_attribute16            => p_global_attribute16
969     ,p_global_attribute17            => p_global_attribute17
970     ,p_global_attribute18            => p_global_attribute18
971     ,p_global_attribute19            => p_global_attribute19
972     ,p_global_attribute20            => p_global_attribute20
973     ,p_object_version_number         => l_object_version_number
974      );
975    EXCEPTION
976     WHEN hr_api.cannot_find_prog_unit THEN
977       hr_api.cannot_find_prog_unit_error
978         (p_module_name => 'UPDATE_LOCATION'
979         ,p_hook_type   => 'AP'
980         );
981     --
982     -- End of API User Hook for the after hook of update_location
983     --
984   END;
985   --
986   hr_utility.set_location(l_proc, 60);
987   --
988   -- When in validation only mode raise the Validate_Enabled exception
989   --
990   IF p_validate THEN
991     RAISE hr_api.validate_enabled;
992   END IF;
993   --
994   -- Set all output arguments.  If p_validate was TRUE, this bit is
995   -- never reached, so p_object_version_number is passed back unchanged.
996   --
997   p_object_version_number := l_object_version_number;
998   --
999   hr_utility.set_location(' Leaving:'||l_proc, 70);
1000   --
1001 EXCEPTION
1002   --
1003   WHEN hr_api.validate_enabled THEN
1004     --
1005     -- As the Validate_Enabled exception has been raised
1006     -- we must rollback to the savepoint
1007     --
1008     ROLLBACK TO update_location;
1009     --
1010     -- Only set output warning arguments
1011     -- (Any key or derived arguments must be set to null
1012     -- when validation only mode is being used.)
1013     -- Reset IN OUT parameters.
1014     p_object_version_number := l_temp_ovn;
1015     hr_utility.set_location(' Leaving:'||l_proc, 80);
1016   WHEN OTHERS THEN
1017     --
1018     -- A validation or unexpected error has occurred
1019     ROLLBACK TO update_location;
1020     -- Reset IN OUT parameters.
1021     p_object_version_number := l_temp_ovn;
1022     hr_utility.set_location(' Leaving:'||l_proc, 90);
1023     RAISE;
1024     --
1025     --
1026 END update_location;
1027 -- ----------------------------------------------------------------------------
1028 -- |-------------------------< delete_location >------------------------------|
1029 -- ----------------------------------------------------------------------------
1030 --
1031 PROCEDURE delete_location
1032    (  p_validate                     IN BOOLEAN DEFAULT false
1033      ,p_location_id                  IN hr_locations.location_id%TYPE
1034      ,p_object_version_number        IN hr_locations.object_version_number%TYPE )
1035 
1036 IS
1037   --
1038   --
1039   -- Declare cursors and local variables
1040   --
1041   l_proc                  VARCHAR2(72) := g_package||'delete_location';
1042   --
1043 BEGIN
1044   --
1045   hr_utility.set_location('Entering:'|| l_proc, 10);
1046   --
1047   -- Issue a savepoint
1048   --
1049   savepoint delete_location;
1050   --
1051     BEGIN
1052     hr_utility.set_location( l_proc, 20);
1053     hr_location_bk3.delete_location_b (
1054       p_location_id                 => p_location_id,
1055       p_object_version_number       => p_object_version_number );
1056     --
1057   EXCEPTION
1058     WHEN hr_api.cannot_find_prog_unit THEN
1059       hr_api.cannot_find_prog_unit_error
1060         (p_module_name => 'DELETE_LOCATION'
1061         ,p_hook_type   => 'BP'
1062    );
1063   END;
1064   --
1065   -- Process Logic
1066   -- =============
1067   --
1068   --  Need to lock main table to maintain the locking ladder order
1069   --
1070   hr_utility.set_location( l_proc, 30);
1071   hr_loc_shd.lck (   p_location_id                 => p_location_id,
1072                      p_object_version_number       => p_object_version_number );
1073   --
1074   --  Remove all matching translation rows
1075   --
1076   hr_utility.set_location( l_proc, 35);
1077   hr_lot_del.del_tl (
1078     p_location_id                 => p_location_id );
1079   --
1080   --  Remove non-translated data row
1081   --
1082   hr_utility.set_location( l_proc, 40);
1083   hr_loc_del.del(
1084     p_location_id                 => p_location_id,
1085     p_object_version_number       => p_object_version_number );
1086   --
1087     BEGIN
1088     hr_utility.set_location( l_proc, 50);
1089     hr_location_bk3.delete_location_a (
1090       p_location_id                 => p_location_id,
1091       p_object_version_number       => p_object_version_number );
1092     --
1093   EXCEPTION
1094     WHEN hr_api.cannot_find_prog_unit THEN
1095       hr_api.cannot_find_prog_unit_error
1096         (p_module_name => 'DELETE_LOCATION'
1097         ,p_hook_type   => 'AP'
1098    );
1099   END;
1100 --
1101 --
1102   hr_utility.set_location(' Leaving:'||l_proc, 60);
1103   --
1104   -- When in validation only mode raise the Validate_Enabled exception
1105   --
1106   IF p_validate THEN
1107      RAISE hr_api.validate_enabled;
1108   END IF;
1109   --
1110   --
1111 EXCEPTION
1112   --
1113   WHEN hr_api.validate_enabled THEN
1114     --
1115     -- As the Validate_Enabled exception has been raised
1116     -- we must rollback to the savepoint
1117     --
1118     ROLLBACK TO delete_location;
1119     --
1120     -- Only set output warning arguments
1121     -- (Any key or derived arguments must be set to null
1122     -- when validation only mode is being used.)
1123     --
1124     hr_utility.set_location(' Leaving:'||l_proc, 80);
1125   WHEN OTHERS THEN
1126     --
1127     -- A validation or unexpected error has occurred
1128     ROLLBACK TO delete_location;
1129     hr_utility.set_location(' Leaving:'||l_proc, 90);
1130     RAISE;
1131     --
1132 END delete_location;
1133 --
1134 
1135 --------------------------------------------------------------------------------
1136 -- ----------------------------------------------------------------------------
1137 -- |---------------------< create_location_legal_adr >-----------------------|
1138 -- ----------------------------------------------------------------------------
1139 --
1140 PROCEDURE create_location_legal_adr
1141   (   p_validate                       IN  BOOLEAN   DEFAULT false
1142      ,p_effective_date                 IN  DATE
1143      ,p_language_code                  IN  VARCHAR2  DEFAULT hr_api.userenv_lang
1144      ,p_location_code                  IN  VARCHAR2
1145      ,p_description                    IN  VARCHAR2  DEFAULT NULL
1146      ,p_timezone_code                  IN  VARCHAR2  DEFAULT NULL
1147      ,p_address_line_1                 IN  VARCHAR2  DEFAULT NULL
1148      ,p_address_line_2                 IN  VARCHAR2  DEFAULT NULL
1149      ,p_address_line_3                 IN  VARCHAR2  DEFAULT NULL
1150      ,p_country                        IN  VARCHAR2  DEFAULT NULL
1151      ,p_inactive_date                  IN  DATE      DEFAULT NULL
1152      ,p_postal_code                    IN  VARCHAR2  DEFAULT NULL
1153      ,p_region_1                       IN  VARCHAR2  DEFAULT NULL
1154      ,p_region_2                       IN  VARCHAR2  DEFAULT NULL
1155      ,p_region_3                       IN  VARCHAR2  DEFAULT NULL
1156      ,p_style                          IN  VARCHAR2  DEFAULT NULL
1157      ,p_town_or_city                   IN  VARCHAR2  DEFAULT NULL
1158      ,p_attribute_category             IN  VARCHAR2  DEFAULT NULL
1159      ,p_attribute1                     IN  VARCHAR2  DEFAULT NULL
1160      ,p_attribute2                     IN  VARCHAR2  DEFAULT NULL
1161      ,p_attribute3                     IN  VARCHAR2  DEFAULT NULL
1162      ,p_attribute4                     IN  VARCHAR2  DEFAULT NULL
1163      ,p_attribute5                     IN  VARCHAR2  DEFAULT NULL
1164      ,p_attribute6                     IN  VARCHAR2  DEFAULT NULL
1165      ,p_attribute7                     IN  VARCHAR2  DEFAULT NULL
1166      ,p_attribute8                     IN  VARCHAR2  DEFAULT NULL
1167      ,p_attribute9                     IN  VARCHAR2  DEFAULT NULL
1168      ,p_attribute10                    IN  VARCHAR2  DEFAULT NULL
1169      ,p_attribute11                    IN  VARCHAR2  DEFAULT NULL
1170      ,p_attribute12                    IN  VARCHAR2  DEFAULT NULL
1171      ,p_attribute13                    IN  VARCHAR2  DEFAULT NULL
1172      ,p_attribute14                    IN  VARCHAR2  DEFAULT NULL
1173      ,p_attribute15                    IN  VARCHAR2  DEFAULT NULL
1174      ,p_attribute16                    IN  VARCHAR2  DEFAULT NULL
1175      ,p_attribute17                    IN  VARCHAR2  DEFAULT NULL
1176      ,p_attribute18                    IN  VARCHAR2  DEFAULT NULL
1177      ,p_attribute19                    IN  VARCHAR2  DEFAULT NULL
1178      ,p_attribute20                    IN  VARCHAR2  DEFAULT NULL
1179      ,p_business_group_id              IN  NUMBER    DEFAULT NULL
1180      ,p_location_id                    OUT NOCOPY NUMBER
1181      ,p_object_version_number          OUT NOCOPY NUMBER
1182 
1183   ) IS
1184   --
1185   -- Declare cursors and local variables
1186   --
1187   l_proc                  VARCHAR2(72) := g_package||'create_location_legal_adr';
1188   l_location_id           hr_locations_all.location_id%TYPE;
1189   l_object_version_number hr_locations_all.object_version_number%TYPE;
1190   l_language_code         hr_locations_all_tl.language%TYPE;
1191   l_inactive_date         DATE;
1192   --
1193 BEGIN
1194   --
1195   hr_utility.set_location('Entering:'|| l_proc, 10);
1196   --
1197   -- Issue a savepoint
1198   --
1199   savepoint create_location_legal_adr;
1200   --
1201   hr_utility.set_location(l_proc, 15);
1202   --
1203   --  All date input parameters must be truncated to remove time elements
1204   --
1205   l_inactive_date := trunc (p_inactive_date);
1206   --
1207   --
1208   -- Validate the language parameter.  l_language_code should be passed to functions
1209   -- instead of p_language_code from now on, to allow an IN OUT parameter to
1210   -- be passed through.
1211   --
1212   l_language_code := p_language_code;
1213   hr_api.validate_language_code(p_language_code => l_language_code);
1214   --
1215   hr_utility.set_location(l_proc, 20);
1216   --
1217 
1218     BEGIN
1219     --
1220     -- Start of API User Hook for the before hook of create_generic_location
1221     --
1222     hr_location_bk4.create_location_legal_adr_b(
1223      p_effective_date                => p_effective_date
1224     ,p_language_code                 => l_language_code
1225     ,p_location_code                 => p_location_code
1226     ,p_description                   => p_description
1227     ,p_timezone_code                 => p_timezone_code
1228     ,p_address_line_1                => p_address_line_1
1229     ,p_address_line_2                => p_address_line_2
1230     ,p_address_line_3                => p_address_line_3
1231     ,p_country                       => p_country
1232     ,p_inactive_date                 => l_inactive_date
1233     ,p_postal_code                   => p_postal_code
1234     ,p_region_1                      => p_region_1
1235     ,p_region_2                      => p_region_2
1236     ,p_region_3                      => p_region_3
1237     ,p_style                         => p_style
1238     ,p_town_or_city                  => p_town_or_city
1239     ,p_attribute_category            => p_attribute_category
1240     ,p_attribute1                    => p_attribute1
1241     ,p_attribute2                    => p_attribute2
1242     ,p_attribute3                    => p_attribute3
1243     ,p_attribute4                    => p_attribute4
1244     ,p_attribute5                    => p_attribute5
1245     ,p_attribute6                    => p_attribute6
1246     ,p_attribute7                    => p_attribute7
1247     ,p_attribute8                    => p_attribute8
1248     ,p_attribute9                    => p_attribute9
1249     ,p_attribute10                   => p_attribute10
1250     ,p_attribute11                   => p_attribute11
1251     ,p_attribute12                   => p_attribute12
1252     ,p_attribute13                   => p_attribute13
1253     ,p_attribute14                   => p_attribute14
1254     ,p_attribute15                   => p_attribute15
1255     ,p_attribute16                   => p_attribute16
1256     ,p_attribute17                   => p_attribute17
1257     ,p_attribute18                   => p_attribute18
1258     ,p_attribute19                   => p_attribute19
1259     ,p_attribute20                   => p_attribute20
1260     ,p_business_group_id             => p_business_group_id
1261      );
1262      EXCEPTION
1263        WHEN hr_api.cannot_find_prog_unit THEN
1264          hr_api.cannot_find_prog_unit_error
1265            (  p_module_name => 'create_location_legal_adr'
1266              ,p_hook_type   => 'BP'
1267            );
1268     --
1269     -- End of API User Hook for the before hook of create_generic_location
1270     --
1271   END;
1272 
1273   -- Process Logic
1274   --
1275   -- Call the internal API
1276 
1277   hr_location_internal.create_generic_location
1278   (   p_effective_date                => p_effective_date
1279      ,p_location_id                   => l_location_id
1280      ,p_object_version_number         => l_object_version_number
1281      ,p_location_code                 => p_location_code
1282      ,p_address_line_1                => p_address_line_1
1283      ,p_address_line_2                => p_address_line_2
1284      ,p_address_line_3                => p_address_line_3
1285      ,p_country                       => p_country
1286      ,p_description                   => p_description
1287      ,p_inactive_date                 => l_inactive_date
1288      ,p_postal_code                   => p_postal_code
1289      ,p_region_1                      => p_region_1
1290      ,p_region_2                      => p_region_2
1291      ,p_region_3                      => p_region_3
1292      ,p_style                         => p_style
1293      ,p_town_or_city                  => p_town_or_city
1294      ,p_attribute_category            => p_attribute_category
1295      ,p_attribute1                    => p_attribute1
1296      ,p_attribute2                    => p_attribute2
1297      ,p_attribute3                    => p_attribute3
1298      ,p_attribute4                    => p_attribute4
1299      ,p_attribute5                    => p_attribute5
1300      ,p_attribute6                    => p_attribute6
1301      ,p_attribute7                    => p_attribute7
1302      ,p_attribute8                    => p_attribute8
1303      ,p_attribute9                    => p_attribute9
1304      ,p_attribute10                   => p_attribute10
1305      ,p_attribute11                   => p_attribute11
1306      ,p_attribute12                   => p_attribute12
1307      ,p_attribute13                   => p_attribute13
1308      ,p_attribute14                   => p_attribute14
1309      ,p_attribute15                   => p_attribute15
1310      ,p_attribute16                   => p_attribute16
1311      ,p_attribute17                   => p_attribute17
1312      ,p_attribute18                   => p_attribute18
1313      ,p_attribute19                   => p_attribute19
1314      ,p_attribute20                   => p_attribute20
1315      ,p_legal_address_flag            => 'Y'
1316      ,p_business_group_id             => p_business_group_id
1317    );
1318 
1319   --
1320   BEGIN
1321     --
1322     -- Start of API User Hook for the after hook of create_generic_location
1323     --
1324     hr_location_bk4.create_location_legal_adr_a
1325       (
1326      p_effective_date                => p_effective_date
1327     ,p_language_code                 => l_language_code
1328     ,p_location_code                 => p_location_code
1329     ,p_description                   => p_description
1330     ,p_timezone_code                 => p_timezone_code
1331     ,p_address_line_1                => p_address_line_1
1332     ,p_address_line_2                => p_address_line_2
1333     ,p_address_line_3                => p_address_line_3
1334     ,p_country                       => p_country
1335     ,p_inactive_date                 => l_inactive_date
1336     ,p_postal_code                   => p_postal_code
1337     ,p_region_1                      => p_region_1
1338     ,p_region_2                      => p_region_2
1339     ,p_region_3                      => p_region_3
1340     ,p_style                         => p_style
1341     ,p_town_or_city                  => p_town_or_city
1342     ,p_attribute_category            => p_attribute_category
1343     ,p_attribute1                    => p_attribute1
1344     ,p_attribute2                    => p_attribute2
1345     ,p_attribute3                    => p_attribute3
1346     ,p_attribute4                    => p_attribute4
1347     ,p_attribute5                    => p_attribute5
1348     ,p_attribute6                    => p_attribute6
1349     ,p_attribute7                    => p_attribute7
1350     ,p_attribute8                    => p_attribute8
1351     ,p_attribute9                    => p_attribute9
1352     ,p_attribute10                   => p_attribute10
1353     ,p_attribute11                   => p_attribute11
1354     ,p_attribute12                   => p_attribute12
1355     ,p_attribute13                   => p_attribute13
1356     ,p_attribute14                   => p_attribute14
1357     ,p_attribute15                   => p_attribute15
1358     ,p_attribute16                   => p_attribute16
1359     ,p_attribute17                   => p_attribute17
1360     ,p_attribute18                   => p_attribute18
1361     ,p_attribute19                   => p_attribute19
1362     ,p_attribute20                   => p_attribute20
1363     ,p_business_group_id             => p_business_group_id
1364     ,p_location_id                   => l_location_id
1365     ,p_object_version_number         => l_object_version_number
1366    );
1367    EXCEPTION
1368     WHEN hr_api.cannot_find_prog_unit THEN
1369       hr_api.cannot_find_prog_unit_error
1370         (p_module_name => 'create_location_legal_adr'
1371         ,p_hook_type   => 'AP'
1372         );
1373     --
1374     -- End of API User Hook for the after hook of create_generic_location
1375     --
1376   END;
1377 
1378   hr_utility.set_location(l_proc, 60);
1379   --
1380   -- When in validation only mode raise the Validate_Enabled exception
1381   --
1382     IF p_validate THEN
1383     RAISE hr_api.validate_enabled;
1384   END IF;
1385   --
1386   -- Set all output arguments
1387   --
1388   p_location_id := l_location_id;
1389   p_object_version_number := l_object_version_number;
1390 EXCEPTION
1391   --
1392   WHEN hr_api.validate_enabled THEN
1393     --
1394     -- As the Validate_Enabled exception has been raised
1395     -- we must rollback to the savepoint
1396     --
1397     ROLLBACK TO create_location_legal_adr;
1398     --
1399     -- Only set output warning arguments
1400     -- (Any key or derived arguments must be set to null
1401     -- when validation only mode is being used.)
1402     --
1403     p_location_id := NULL;
1404     p_object_version_number  := NULL;
1405     hr_utility.set_location(' Leaving:'||l_proc, 80);
1406   WHEN OTHERS THEN
1407     --
1408     -- A validation or unexpected error has occurred
1409     ROLLBACK TO create_location_legal_adr;
1410     -- Set OUT parameters.
1411     p_location_id := NULL;
1412     p_object_version_number  := NULL;
1413     hr_utility.set_location(' Leaving:'||l_proc, 90);
1414     RAISE;
1415    --
1416 END create_location_legal_adr;
1417 -- ----------------------------------------------------------------------------
1418 -- |--------------------< update_location_legal_adr >--------------------------|
1419 -- ----------------------------------------------------------------------------
1420 --
1421 PROCEDURE update_location_legal_adr
1422   (   p_validate                       IN  BOOLEAN   DEFAULT false
1423      ,p_effective_date                 IN  DATE
1424      ,p_location_id                    IN  NUMBER
1425      ,p_description                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1426      ,p_timezone_code                  IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1427      ,p_address_line_1                 IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1428      ,p_address_line_2                 IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1429      ,p_address_line_3                 IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1430      ,p_inactive_date                  IN  DATE      DEFAULT hr_api.g_date
1431      ,p_postal_code                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1432      ,p_region_1                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1433      ,p_region_2                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1434      ,p_region_3                       IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1435      ,p_style                          IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1436      ,p_town_or_city                   IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1437      ,p_attribute_category             IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1438      ,p_attribute1                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1439      ,p_attribute2                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1440      ,p_attribute3                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1441      ,p_attribute4                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1442      ,p_attribute5                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1443      ,p_attribute6                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1444      ,p_attribute7                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1445      ,p_attribute8                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1446      ,p_attribute9                     IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1447      ,p_attribute10                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1448      ,p_attribute11                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1449      ,p_attribute12                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1450      ,p_attribute13                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1451      ,p_attribute14                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1452      ,p_attribute15                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1453      ,p_attribute16                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1454      ,p_attribute17                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1455      ,p_attribute18                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1456      ,p_attribute19                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1457      ,p_attribute20                    IN  VARCHAR2  DEFAULT hr_api.g_varchar2
1458      ,p_object_version_number          IN OUT NOCOPY NUMBER
1459   ) IS
1460   --
1461   -- Declare cursors and local variables
1462   --
1463   l_proc                  VARCHAR2(72) := g_package||'update_location_legal_adr';
1464   l_object_version_number hr_locations.object_version_number%TYPE;
1465   l_temp_ovn   number(9) := p_object_version_number;
1466   --
1467 BEGIN
1468   --
1469   hr_utility.set_location('Entering:'|| l_proc, 10);
1470   --
1471   -- Issue a savepoint.
1472   --
1473   savepoint update_location_legal_adr;
1474   --
1475   -- Process Logic
1476   --
1477   l_object_version_number := p_object_version_number;
1478   --
1479     BEGIN
1480     --
1481     -- Start of API User Hook for the before hook of update_location_legal_adr
1482     --
1483     hr_location_bk5.update_location_legal_adr_b
1484       (
1485      p_effective_date                => p_effective_date
1486     ,p_location_id                   => p_location_id
1487     ,p_description                   => p_description
1488     ,p_timezone_code                 => p_timezone_code
1489     ,p_address_line_1                => p_address_line_1
1490     ,p_address_line_2                => p_address_line_2
1491     ,p_address_line_3                => p_address_line_3
1492     ,p_inactive_date                 => p_inactive_date
1493     ,p_postal_code                   => p_postal_code
1494     ,p_region_1                      => p_region_1
1495     ,p_region_2                      => p_region_2
1496     ,p_region_3                      => p_region_3
1497     ,p_style                         => p_style
1498     ,p_town_or_city                  => p_town_or_city
1499     ,p_attribute_category            => p_attribute_category
1500     ,p_attribute1                    => p_attribute1
1501     ,p_attribute2                    => p_attribute2
1502     ,p_attribute3                    => p_attribute3
1503     ,p_attribute4                    => p_attribute4
1504     ,p_attribute5                    => p_attribute5
1505     ,p_attribute6                    => p_attribute6
1506     ,p_attribute7                    => p_attribute7
1507     ,p_attribute8                    => p_attribute8
1508     ,p_attribute9                    => p_attribute9
1509     ,p_attribute10                   => p_attribute10
1510     ,p_attribute11                   => p_attribute11
1511     ,p_attribute12                   => p_attribute12
1512     ,p_attribute13                   => p_attribute13
1513     ,p_attribute14                   => p_attribute14
1514     ,p_attribute15                   => p_attribute15
1515     ,p_attribute16                   => p_attribute16
1516     ,p_attribute17                   => p_attribute17
1517     ,p_attribute18                   => p_attribute18
1518     ,p_attribute19                   => p_attribute19
1519     ,p_attribute20                   => p_attribute20
1520     ,p_object_version_number         => l_object_version_number
1521       );
1522    EXCEPTION
1523     WHEN hr_api.cannot_find_prog_unit THEN
1524       hr_api.cannot_find_prog_unit_error
1525         (p_module_name => 'update_location_legal_adr'
1526         ,p_hook_type   => 'BP'
1527         );
1528     --
1529     -- End of API User Hook for the before hook of update_location_legal_adr
1530     --
1531   END;
1532   --
1533   -- Call the internal API
1534   --
1535   hr_location_internal.update_generic_location
1536     ( p_effective_date                => p_effective_date
1537      ,p_location_id                   => p_location_id
1538      ,p_object_version_number         => l_object_version_number
1539      ,p_description                   => p_description
1540      ,p_address_line_1                => p_address_line_1
1541      ,p_address_line_2                => p_address_line_2
1542      ,p_address_line_3                => p_address_line_3
1543      ,p_inactive_date                 => p_inactive_date
1544      ,p_postal_code                   => p_postal_code
1545      ,p_region_1                      => p_region_1
1546      ,p_region_2                      => p_region_2
1547      ,p_region_3                      => p_region_3
1548      ,p_style                         => p_style
1549      ,p_town_or_city                  => p_town_or_city
1550      ,p_attribute_category            => p_attribute_category
1551      ,p_attribute1                    => p_attribute1
1552      ,p_attribute2                    => p_attribute2
1553      ,p_attribute3                    => p_attribute3
1554      ,p_attribute4                    => p_attribute4
1555      ,p_attribute5                    => p_attribute5
1556      ,p_attribute6                    => p_attribute6
1557      ,p_attribute7                    => p_attribute7
1558      ,p_attribute8                    => p_attribute8
1559      ,p_attribute9                    => p_attribute9
1560      ,p_attribute10                   => p_attribute10
1561      ,p_attribute11                   => p_attribute11
1562      ,p_attribute12                   => p_attribute12
1563      ,p_attribute13                   => p_attribute13
1564      ,p_attribute14                   => p_attribute14
1565      ,p_attribute15                   => p_attribute15
1566      ,p_attribute16                   => p_attribute16
1567      ,p_attribute17                   => p_attribute17
1568      ,p_attribute18                   => p_attribute18
1569      ,p_attribute19                   => p_attribute19
1570      ,p_attribute20                   => p_attribute20
1571     );
1572 
1573 --
1574     BEGIN
1575     --
1576     -- Start of API User Hook for the after hook of update_location_legal_adr
1577     --
1578     hr_location_bk5.update_location_legal_adr_a
1579       (
1580          p_effective_date                => p_effective_date
1581         ,p_location_id                   => p_location_id
1582         ,p_description                   => p_description
1583         ,p_timezone_code                 => p_timezone_code
1584         ,p_address_line_1                => p_address_line_1
1585         ,p_address_line_2                => p_address_line_2
1586         ,p_address_line_3                => p_address_line_3
1587         ,p_inactive_date                 => p_inactive_date
1588         ,p_postal_code                   => p_postal_code
1589         ,p_region_1                      => p_region_1
1590         ,p_region_2                      => p_region_2
1591         ,p_region_3                      => p_region_3
1592         ,p_style                         => p_style
1593         ,p_town_or_city                  => p_town_or_city
1594         ,p_attribute_category            => p_attribute_category
1595    ,p_attribute1                    => p_attribute1
1596    ,p_attribute2                    => p_attribute2
1597    ,p_attribute3                    => p_attribute3
1598    ,p_attribute4                    => p_attribute4
1599    ,p_attribute5                    => p_attribute5
1600    ,p_attribute6                    => p_attribute6
1601    ,p_attribute7                    => p_attribute7
1602    ,p_attribute8                    => p_attribute8
1603    ,p_attribute9                    => p_attribute9
1604    ,p_attribute10                   => p_attribute10
1605    ,p_attribute11                   => p_attribute11
1606    ,p_attribute12                   => p_attribute12
1607    ,p_attribute13                   => p_attribute13
1608    ,p_attribute14                   => p_attribute14
1609    ,p_attribute15                   => p_attribute15
1610    ,p_attribute16                   => p_attribute16
1611    ,p_attribute17                   => p_attribute17
1612    ,p_attribute18                   => p_attribute18
1613    ,p_attribute19                   => p_attribute19
1614    ,p_attribute20                   => p_attribute20
1615         ,p_object_version_number         => l_object_version_number
1616       );
1617    EXCEPTION
1618     WHEN hr_api.cannot_find_prog_unit THEN
1619       hr_api.cannot_find_prog_unit_error
1620         (p_module_name => 'update_location_legal_adr'
1621         ,p_hook_type   => 'AP'
1622         );
1623     --
1624     -- End of API User Hook for the after hook of update_location_legal_adr
1625     --
1626   END;
1627   --
1628   hr_utility.set_location(l_proc, 60);
1629   --
1630   -- When in validation only mode raise the Validate_Enabled exception
1631   --
1632   IF p_validate THEN
1633     RAISE hr_api.validate_enabled;
1634   END IF;
1635   --
1636   -- Set all output arguments.  If p_validate was TRUE, this bit is
1637   -- never reached, so p_object_version_number is passed back unchanged.
1638   --
1639   p_object_version_number := l_object_version_number;
1640   --
1641   hr_utility.set_location(' Leaving:'||l_proc, 70);
1642   --
1643 EXCEPTION
1644   --
1645   WHEN hr_api.validate_enabled THEN
1646     --
1647     -- As the Validate_Enabled exception has been raised
1648     -- we must rollback to the savepoint
1649     --
1650     ROLLBACK TO update_location_legal_adr;
1651     --
1652     -- Only set output warning arguments
1653     -- (Any key or derived arguments must be set to null
1654     -- when validation only mode is being used.)
1655     -- Reset IN OUT parameters.
1656     p_object_version_number := l_temp_ovn;
1657     hr_utility.set_location(' Leaving:'||l_proc, 80);
1658   WHEN OTHERS THEN
1659     --
1660     -- A validation or unexpected error has occurred
1661     ROLLBACK TO update_location_legal_adr;
1662     -- Reset IN OUT parameters.
1663     p_object_version_number := l_temp_ovn;
1664     hr_utility.set_location(' Leaving:'||l_proc, 90);
1665     RAISE;
1666     --
1667     --
1668 END update_location_legal_adr;
1669 --------------------------------------------------------------------------------
1670 PROCEDURE set_translation_globals(p_business_group_id IN NUMBER,
1671               p_legislation_code IN VARCHAR2) IS
1672 BEGIN
1673    g_business_group_id := p_business_group_id;
1674    g_legislation_code := p_legislation_code;
1675 END;
1676 -- ----------------------------------------------------------------------------
1677 -- |----------------------< disable_location_legal_adr >---------------------|
1678 -- ----------------------------------------------------------------------------
1679 --
1680 PROCEDURE disable_location_legal_adr
1681   (   p_validate                       IN  BOOLEAN   DEFAULT false
1682      ,p_effective_date                 IN  DATE
1683      ,p_location_id                    IN  NUMBER
1684      ,p_object_version_number          IN OUT NOCOPY  NUMBER
1685 
1686   ) IS
1687   --
1688   -- Declare cursors and local variables
1689   --
1690   l_proc                  VARCHAR2(72) := g_package||'disable_location_legal_adr';
1691   l_object_version_number hr_locations_all.object_version_number%TYPE;
1692   l_temp_ovn   number := p_object_version_number;
1693   --
1694 BEGIN
1695   --
1696   hr_utility.set_location('Entering:'|| l_proc, 10);
1697   --
1698   -- Issue a savepoint
1699   --
1700   savepoint disable_location_legal_adr;
1701   --
1702   hr_utility.set_location(l_proc, 20);
1703   --
1704   -- Process Logic
1705   --
1706   l_object_version_number := p_object_version_number;
1707   --
1708   -- Bug fix 3205662.
1709   -- User hook call added.
1710   --
1711   BEGIN
1712       --
1713       -- Start of API User Hook for the before hook of disable_location_legal_adr
1714       --
1715       hr_location_bk7.disable_location_legal_adr_b
1716       (
1717          p_effective_date    => p_effective_date
1718    ,p_location_id            => p_location_id
1719    ,p_object_version_number  => l_object_version_number
1720       );
1721 
1722   EXCEPTION
1723       WHEN hr_api.cannot_find_prog_unit THEN
1724             hr_api.cannot_find_prog_unit_error
1725               (p_module_name => 'disable_location_legal_adr'
1726               ,p_hook_type   => 'BP'
1727               );
1728        --
1729        -- End of API User Hook for the before hook of disable_location_legal_adr
1730        --
1731   END;
1732   --
1733   -- UPDATE ROW IN HR_LOCATIONS_ALL table
1734   --
1735     hr_location_internal.update_generic_location
1736   (   p_effective_date                => p_effective_date
1737      ,p_location_id                   => p_location_id
1738      ,p_object_version_number         => l_object_version_number
1739      ,p_legal_address_flag       => NULL
1740    );
1741 
1742   --
1743   hr_utility.set_location(l_proc, 60);
1744   --
1745   -- Bug fix 3205662.
1746   -- User hook call added.
1747   --
1748   BEGIN
1749      --
1750      -- Start of API User Hook for the after hook of disable_location_legal_adr
1751      --
1752      hr_location_bk7.disable_location_legal_adr_a
1753      (
1754          p_effective_date    => p_effective_date
1755    ,p_location_id            => p_location_id
1756    ,p_object_version_number  => l_object_version_number
1757      );
1758 
1759   EXCEPTION
1760      WHEN hr_api.cannot_find_prog_unit THEN
1761           hr_api.cannot_find_prog_unit_error
1762             (p_module_name => 'disable_location_legal_adr'
1763             ,p_hook_type   => 'AP'
1764             );
1765       --
1766       -- End of API User Hook for the after hook of disable_location_legal_adr
1767       --
1768   END;
1769   --
1770   -- When in validation only mode raise the Validate_Enabled exception
1771   --
1772   IF p_validate THEN
1773     RAISE hr_api.validate_enabled;
1774   END IF;
1775   -- Set all output arguments.  If p_validate was TRUE, this bit is
1776   -- never reached, so p_object_version_number is passed back unchanged.
1777   --
1778   p_object_version_number := l_object_version_number;
1779   --
1780   hr_utility.set_location(' Leaving:'||l_proc, 70);
1781 EXCEPTION
1782   --
1783   WHEN hr_api.validate_enabled THEN
1784     --
1785     -- As the Validate_Enabled exception has been raised
1786     -- we must rollback to the savepoint
1787     --
1788     ROLLBACK TO disable_location_legal_adr;
1789     --
1790     -- Only set output warning arguments
1791     -- (Any key or derived arguments must be set to null
1792     -- when validation only mode is being used.)
1793     -- Reset IN OUT parameters.
1794     p_object_version_number := l_temp_ovn;
1795     hr_utility.set_location(' Leaving:'||l_proc, 80);
1796   WHEN OTHERS THEN
1797     --
1798     -- A validation or unexpected error has occurred
1799     ROLLBACK TO disable_location_legal_adr;
1800     -- Reset IN OUT parameters.
1801     p_object_version_number := l_temp_ovn;
1802     hr_utility.set_location(' Leaving:'||l_proc, 90);
1803     RAISE;
1804    --
1805 END disable_location_legal_adr;
1806 --
1807 -- ----------------------------------------------------------------------------
1808 -- |------------------------< enable_location_legal_adr >---------------------|
1809 -- ----------------------------------------------------------------------------
1810 --
1811 PROCEDURE enable_location_legal_adr
1812   (   p_validate                       IN  BOOLEAN   DEFAULT false
1813      ,p_effective_date                 IN  DATE
1814      ,p_location_id                    IN  NUMBER
1815      ,p_object_version_number          IN OUT NOCOPY  NUMBER
1816   ) IS
1817   --
1818   -- Declare cursors and local variables
1819   --
1820   l_proc                  VARCHAR2(72) := g_package||'enable_location_legal_adr';
1821   l_object_version_number hr_locations_all.object_version_number%TYPE;
1822   l_temp_ovn   number := p_object_version_number;
1823   --
1824 BEGIN
1825   --
1826   hr_utility.set_location('Entering:'|| l_proc, 10);
1827   --
1828   -- Issue a savepoint
1829   --
1830   savepoint enable_location_legal_adr;
1831   --
1832   hr_utility.set_location(l_proc, 20);
1833   --
1834   -- Process Logic
1835   --
1836   l_object_version_number := p_object_version_number;
1837   --
1838   -- Bug fix 3205662.
1839   -- User hook call added.
1840   --
1841   BEGIN
1842         --
1843         -- Start of API User Hook for the before hook of enable_location_legal_adr
1844         --
1845         hr_location_bk6.enable_location_legal_adr_b
1846         (
1847            p_effective_date     => p_effective_date
1848      ,p_location_id            => p_location_id
1849      ,p_object_version_number  => l_object_version_number
1850         );
1851 
1852   EXCEPTION
1853         WHEN hr_api.cannot_find_prog_unit THEN
1854               hr_api.cannot_find_prog_unit_error
1855                 (p_module_name => 'enable_location_legal_adr'
1856                 ,p_hook_type   => 'BP'
1857                 );
1858         --
1859         -- End of API User Hook for the before hook of enable_location_legal_adr
1860         --
1861   END;
1862   --
1863   -- UPDATE ROW IN HR_LOCATIONS_ALL table
1864   --
1865     hr_location_internal.update_generic_location
1866   (   p_effective_date                => p_effective_date
1867      ,p_location_id                   => p_location_id
1868      ,p_object_version_number         => l_object_version_number
1869      ,p_legal_address_flag       => 'Y'
1870    );
1871 
1872   --
1873   hr_utility.set_location(l_proc, 60);
1874   --
1875   -- Bug fix 3205662.
1876   -- User hook call added.
1877   --
1878   BEGIN
1879        --
1880        -- Start of API User Hook for the after hook of enable_location_legal_adr
1881        --
1882        hr_location_bk6.enable_location_legal_adr_a
1883        (
1884            p_effective_date       => p_effective_date
1885      ,p_location_id            => p_location_id
1886      ,p_object_version_number  => l_object_version_number
1887        );
1888   EXCEPTION
1889           WHEN hr_api.cannot_find_prog_unit THEN
1890                 hr_api.cannot_find_prog_unit_error
1891                   (p_module_name => 'enable_location_legal_adr'
1892                   ,p_hook_type   => 'AP'
1893                   );
1894         --
1895         -- End of API User Hook for the after hook of enable_location_legal_adr
1896         --
1897   END;
1898   --
1899   -- When in validation only mode raise the Validate_Enabled exception
1900   --
1901   IF p_validate THEN
1902     RAISE hr_api.validate_enabled;
1903   END IF;
1904   -- Set all output arguments.  If p_validate was TRUE, this bit is
1905   -- never reached, so p_object_version_number is passed back unchanged.
1906   --
1907   p_object_version_number := l_object_version_number;
1908   --
1909   hr_utility.set_location(' Leaving:'||l_proc, 70);
1910 EXCEPTION
1911   --
1912   WHEN hr_api.validate_enabled THEN
1913     --
1914     -- As the Validate_Enabled exception has been raised
1915     -- we must rollback to the savepoint
1916     --
1917     ROLLBACK TO enable_location_legal_adr;
1918     --
1919     -- Only set output warning arguments
1920     -- (Any key or derived arguments must be set to null
1921     -- when validation only mode is being used.)
1922     -- Reset IN OUT parameters.
1923     p_object_version_number := l_temp_ovn;
1924     hr_utility.set_location(' Leaving:'||l_proc, 80);
1925   WHEN OTHERS THEN
1926     --
1927     -- A validation or unexpected error has occurred
1928     ROLLBACK TO enable_location_legal_adr;
1929     -- Reset IN OUT parameters.
1930     p_object_version_number := l_temp_ovn;
1931     hr_utility.set_location(' Leaving:'||l_proc, 90);
1932     RAISE;
1933    --
1934 END enable_location_legal_adr;
1935 --
1936 -----------------------------------------------------------------------------
1937 END hr_location_api;