DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_LOC_BUS

Source


1 PACKAGE BODY hr_loc_bus AS
2   /* $Header: hrlocrhi.pkb 120.11.12020000.2 2012/07/04 23:08:51 amnaraya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package           VARCHAR2(33) := '  hr_loc_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code  VARCHAR2(150)       DEFAULT NULL;
14 g_location_id       NUMBER              DEFAULT NULL;
15 --
16 --
17 --
18 -- -----------------------------------------------------------------------
19 -- |----------------------< return_legislation_code >--------------------|
20 -- -----------------------------------------------------------------------
21 --
22 FUNCTION return_legislation_code
23   (p_location_id              IN hr_locations.location_id%TYPE
24   ) RETURN VARCHAR2 IS
25   --
26   -- Declare local variables
27   --
28   l_legislation_code  VARCHAR2(150);
29   l_proc              VARCHAR2(72)  :=  'return_legislation_code';
30   l_business_group_id NUMBER(15);
31   --
32   -- Cursor to find business_group_id.  We need to know
33   -- if this is NULL before attempting to find the
34   -- legislation code.
35   --
36   cursor csr_bus_grp_id IS
37     SELECT business_group_id
38       FROM hr_locations_all
39      WHERE location_id = p_location_id;
40   --
41   -- Cursor to find legislation code.  l_business_group_id
42   -- is set using csr_bus_grp_id (above).
43   --
44   -- Want to use business_group_id as index in this case.
45   --
46   -- Previous cursor technique not helpful here because the
47   -- business_group_id is allowed to be NULL.
48   --
49     cursor csr_leg_code IS
50     SELECT legislation_code
51       FROM per_business_groups
52      WHERE business_group_id = l_business_group_id;
53   --
54 BEGIN
55   --
56   hr_utility.set_location('Entering:'|| l_proc, 10);
57   hr_api.mandatory_arg_error(p_api_name       => l_proc,
58                              p_argument       => 'location_id',
59                              p_argument_value => p_location_id);
60   IF nvl(g_location_id, hr_api.g_number) = p_location_id THEN
61     --
62     -- The legislation code has already been found with a previous
63     -- call to this function. Just return the value in the global
64     -- variable.
65     --
66     l_legislation_code := g_legislation_code;
67     hr_utility.set_location(l_proc, 20);
68   ELSE
69     --
70     -- The ID is different to the last call to this function
71     -- or this is the first call to this function.
72     --
73     OPEN csr_bus_grp_id;
74     FETCH csr_bus_grp_id INTO l_business_group_id;
75     IF csr_bus_grp_id%notfound THEN
76       --
77       -- The primary key is invalid therefore we must error
78       --
79       CLOSE csr_bus_grp_id;
80       fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
81       fnd_message.raise_error;
82     END IF;
83     --
84     IF l_business_group_id IS NULL THEN
85        --
86        --  If the location's business_group is NULL, we return a NULL
87        --  legislation code (This is not standard).
88        --
89        l_legislation_code := NULL;
90     ELSE
91        --
92        --  Otherwise get legislation code from database
93        --
94        OPEN csr_leg_code;
95        FETCH csr_leg_code INTO l_legislation_code;
96        IF csr_leg_code%notfound THEN
97           --
98           -- The business_group_id is invalid therefore we must error
99           --
100           CLOSE csr_leg_code;
101           fnd_message.set_name('PER', 'HR_51395_WEB_BUS_GRP_NOT_FND');
102      fnd_message.raise_error;
103        ELSE
104      CLOSE csr_leg_code;
105        END IF;
106        hr_utility.set_location(l_proc, 30);
107        --
108        --
109     END IF;
110     --
111     -- Set the global variables so the values are
112     -- available for the next call to this function
113     g_location_id      := p_location_id;
114     g_legislation_code := l_legislation_code;
115     --
116   END IF;
117   --
118   hr_utility.set_location(' Leaving:'|| l_proc, 40);
119   RETURN l_legislation_code;
120 END return_legislation_code;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |-------------------< chk_ship_to_loc_id_and_flag>------------------------|
124 -- ----------------------------------------------------------------------------
125 --
126 --  Description:
127 --    Validates SHIP_TO_LOCATION_ID and all YES/NO flags
128 --
129 --  Process Logic:
130 --
131 --      Only perform validation if SHIP_TO_LOCATION_ID is not NULL.
132 --
133 --      i)   Check SHIP_TO_LOCATION_ID is valid within the HR_LOCATIONS_ALL table,
134 --           and its SHIP_TO_SITE_FLAG is 'Y'
135 --
136 --      ii)  If SHIP_TO_LOCATION_ID references a location other LOCATION_ID,
137 --           ensure that the current location's SHIP_TO_SITE_FLAG is 'N'.
138 --
139 --
140 --  Pre-Requisites:
141 --    None.
142 --
143 --  In Arguments:
144 --    p_location_id
145 --    p_ship_to_location_id
146 --    p_ship_to_site_flag
147 --    p_receiving_site_flag
148 --    p_inactive_date            -  required to validate ship_to_location
149 --    p_business_group_id        -  required to validate ship_to_location
150 --    p_effective_date
151 --
152 --  Post Success:
153 --    Processing continues if attributes are valid.  Also, ship_to_site_flag
154 --    and receiving_site flag may have been set.
155 --
156 --  Post Failure:
157 --    An application error is raised and processing is terminated.
158 --
159 --  Developer/Implementation notes:
160 --    Duplicate validation exists on form, so any changes made here or on form
161 --    must be dual-maintained.
162 --
163 --  Access Status:
164 --    Internal Row Handler Use Only.
165 --
166 -- {End Of Comments}
167 --
168 PROCEDURE chk_ship_to_loc_id_and_flag
169   (   p_location_id            IN     hr_locations.location_id%TYPE,
170       p_ship_to_location_id    IN OUT NOCOPY hr_locations.ship_to_location_id%TYPE,
171       p_ship_to_site_flag      IN     hr_locations.ship_to_site_flag%TYPE,
172       p_inactive_date          IN     hr_locations.inactive_date%TYPE,
173       p_business_group_id      IN     hr_locations.business_group_id%TYPE,
174       p_effective_date         IN     DATE )
175 IS
176 --
177    l_exists             VARCHAR2(1);
178    l_proc               VARCHAR2(72)  :=  g_package||'chk_ship_to_loc_id_and_flag';
179 --
180    cursor csr_valid_ship_to_loc IS
181      --
182      SELECT NULL
183      FROM hr_locations_all
184        WHERE location_id = p_ship_to_location_id
185          AND ship_to_site_flag = 'Y'
186          AND nvl(inactive_date, hr_api.g_eot) >= p_effective_date
187          AND (  p_business_group_id IS NULL
188                 OR nvl(business_group_id, p_business_group_id)
189                   = p_business_group_id );
190      --
191 BEGIN
192    hr_utility.set_location('Entering:'|| l_proc, 10);
193 
194    --
195    -- Check that the ship to location ID is linked to a
196    -- valid location on HR_LOCATIONS_ALL
197    --
198    hr_utility.set_location(l_proc, 20);
199    --
200    --
201    -- Only check validity of ship_to_location if inserting or data has changed
202    --
203    IF (p_location_id IS NULL) THEN
204 --
205 -- **************************** Inserting ************************************
206 --
207       IF p_ship_to_location_id IS NOT NULL THEN
208       --
209       -- If p_ship_to_location_id IS null, it defaults to location_id
210       -- once this is known (i.e. in pre_insert() )
211       --
212       --
213            hr_utility.set_location(l_proc, 25);
214            --
215       IF p_ship_to_site_flag = 'Y' THEN
216          --
217          -- Can't be a ship-to-site if p_ship_to_location_id points to another
218          -- location, which it must do if it is not NULL.
219          --
220          hr_utility.set_message(800, 'PER_52537_LOC_INV_SHPTO_FLG');
221          hr_utility.raise_error;
222       ELSE
223          --
224          --  Fetch data from database
225             --
226               OPEN csr_valid_ship_to_loc;
227               FETCH csr_valid_ship_to_loc INTO l_exists;
228               --
229               IF csr_valid_ship_to_loc%notfound THEN
230                CLOSE csr_valid_ship_to_loc;
231             hr_utility.set_message(800, 'PER_52501_INV_SHIP_TO_LOC');
232                hr_utility.raise_error;
233             ELSE
234             CLOSE csr_valid_ship_to_loc;
235          END IF;
236       END IF;
237       --
238       ELSE
239     IF p_ship_to_site_flag = 'N' THEN
240       --
241       --
242       -- Can't be a ship-to-site if p_ship_to_location_id points to another
243       -- location, which it must do if it is not NULL.
244            -- Must be a ship-to-site if p_ship_to_location_id is NULL
245       --
246          hr_utility.set_message(800, 'PER_52386_INVALID_SHIP_TO_LOC');
247          hr_utility.raise_error;
248     END IF;
249       END IF;
250         --
251 
252    ELSE
253       -- Start of fix 3224396
254       IF nvl (p_ship_to_location_id, hr_api.g_number) <>
255          nvl (hr_loc_shd.g_old_rec.ship_to_location_id, hr_api.g_number) OR
256          nvl (p_ship_to_site_flag, hr_api.g_varchar2) <>
257          nvl (hr_loc_shd.g_old_rec.ship_to_site_flag, hr_api.g_varchar2) THEN
258       -- End of 3224396
259 --
260 -- ************************** Updating with new data ***************************
261 --
262     --
263     -- ship_to_location_id defaults to location_id if NULL.  See business rules.
264     --
265     --
266          hr_utility.set_location(l_proc, 30);
267          --
268     p_ship_to_location_id := nvl (p_ship_to_location_id, p_location_id);
269     ---
270          IF p_ship_to_location_id = p_location_id THEN
271        --
272           -- Do not get data from database if we are referencing current location_id
273        --
274        IF (p_ship_to_site_flag = 'N') OR (nvl(p_inactive_date, hr_api.g_eot) <
275                                           p_effective_date) THEN
276           hr_utility.set_message(800, 'PER_52537_LOC_INV_SHPTO_FLG');
277           hr_utility.raise_error;
278        END IF;
279          ELSE
280        --
281        IF (p_ship_to_site_flag = 'Y') THEN
282           hr_utility.set_message(800, 'PER_52537_LOC_INV_SHPTO_FLG');
283           hr_utility.raise_error;
284        END IF;
285        --
286        --  Fetch data from database
287        --
288             OPEN csr_valid_ship_to_loc;
289             FETCH csr_valid_ship_to_loc INTO l_exists;
290             --
291             IF csr_valid_ship_to_loc%notfound THEN
292              CLOSE csr_valid_ship_to_loc;
293           hr_utility.set_message(800, 'PER_52501_INV_SHIP_TO_LOC');
294           hr_utility.raise_error;
295        ELSE
296           CLOSE csr_valid_ship_to_loc;
297        END IF;
298     END IF;
299       END IF;
300    END IF;
301       --
302    hr_utility.set_location('Leaving:'|| l_proc, 80);
303 END chk_ship_to_loc_id_and_flag;
304 --
305 --
306 -- ----------------------------------------------------------------------------
307 -- |-----------------------< chk_receiving_site_flag >------------------------|
308 -- ----------------------------------------------------------------------------
309 --
310 --  Description:
311 --    Validates RECEIVING_SITE_FLAG
312 --
313 --
314 --  Pre-Requisites:
315 --    Ship-to-site flag has been validated
316 --
317 --  In Arguments:
318 
319 --    p_ship_to_site_flag
320 --    p_receiving_site_flag
321 --
322 --  Post Success:
323 --    Processing continues if attributes are valid.  Also, ship_to_site_flag
324 --    and receiving_site flag may have been set.
325 --
326 --  Post Failure:
327 --    An application error is raised and processing is terminated.
328 --
329 --  Developer/Implementation notes:
330 --    Duplicate validation exists on form, so any changes made here or on form
331 --    must be dual-maintained.
332 --
333 --  Access Status:
334 --    Internal Row Handler Use Only.
335 --
336 -- {End Of Comments}
337 --
338 PROCEDURE chk_receiving_site_flag
339   (   p_ship_to_site_flag      IN OUT NOCOPY hr_locations.ship_to_site_flag%TYPE,
340       p_receiving_site_flag    IN OUT NOCOPY hr_locations.receiving_site_flag%TYPE )
341 IS
342 --
343    l_proc               VARCHAR2(72)  :=  g_package||'chk_receiving_site_flag';
344 --
345 BEGIN
346    --
347    --  Test validity of receiving-site flag.
348    --
349    hr_utility.set_location('Entering:'|| l_proc, 10);
350    --
351    IF p_ship_to_site_flag = 'Y' AND p_receiving_site_flag <> 'Y' THEN
352       hr_utility.set_message(800, 'PER_52538_LOC_INV_REC_FLAG');
353       hr_utility.raise_error;
354    END IF;
355    --
356    hr_utility.set_location('Leaving:'|| l_proc, 20);
357 END chk_receiving_site_flag;
358 --
359 --  ---------------------------------------------------------------------------
360 --  |----------------------< chk_designated_receiver_id >---------------------|
361 --  ---------------------------------------------------------------------------
362 --
363 --  Description:
364 --    Validates that a designated_receiver id exists in table per_people_f.
365 --
366 --  Pre-conditions:
367 --    None.
368 --
369 --  In Arguments:
370 --    p_designated_receiver_id
371 --    p_location_id
372 --    p_business_group_id
373 --    p_effective_date
374 --
375 --  Post Success:
376 --    If a row does exist in per_all_people_f for the given designated_receiver id,
377 --    and this person is an active employee then processing continues.
378 --
379 --  Post Failure:
380 --    If a row does not exist in per_people_f for the given designated_receiver id then
381 --    an application error will be raised and processing is terminated.
382 --
383 --  Developer/Implementation Notes:
384 --    Duplicate validation exists on form, so any changes made here
385 --    or on form must be dual-maintained
386 --
387 --  Access Status:
388 --    Internal Row Handler Use Only
389 --
390 -- {End Of Comments}
391 --
392 PROCEDURE chk_designated_receiver_id
393   (  p_designated_receiver_id   IN      hr_locations.designated_receiver_id%TYPE,
394      p_location_id              IN      hr_locations.location_id%TYPE,
395      p_business_group_id        IN      hr_locations.business_group_id%TYPE,
396      p_effective_date           IN      DATE
397   )
398 IS
399 --
400    l_exists             VARCHAR2(1);
401    l_proc               VARCHAR2(72)  :=  g_package||'chk_designated_receiver_id';
402 --
403    cursor csr_valid_pers IS
404      SELECT NULL
405      FROM per_all_people_f
406        WHERE person_id = p_designated_receiver_id
407        AND employee_number IS NOT NULL
408        AND p_effective_date BETWEEN effective_start_date AND effective_end_date
409        AND ( p_business_group_id IS NULL
410              OR p_business_group_id = business_group_id +0);
411 
412 --
413 BEGIN
414    hr_utility.set_location('Entering:'|| l_proc, 10);
415    IF p_designated_receiver_id IS NOT NULL THEN
416       --
417       -- Only perform validation when DESIGNATED_RECEIVER_ID is not null
418       --
419       IF (p_location_id IS NULL) OR
420    (p_designated_receiver_id <> nvl (hr_loc_shd.g_old_rec.designated_receiver_id,
421                  hr_api.g_number) )
422       THEN
423     --
424     -- Check that the Person ID is linked to a
425     -- valid person on PER_PEOPLE_F
426     --
427     hr_utility.set_location(l_proc, 20);
428     OPEN csr_valid_pers;
429     FETCH csr_valid_pers INTO l_exists;
430     IF csr_valid_pers%notfound THEN
431        CLOSE csr_valid_pers;
432        hr_utility.set_message(800, 'PER_52502_INV_DES_REC_LOC');
433        hr_utility.raise_error;
434     ELSE
435        CLOSE csr_valid_pers;
436     END IF;
437     --
438       END IF;
439       --
440    END IF;
441    --
442    hr_utility.set_location('Leaving:'|| l_proc, 30);
443    --
444 
445 END chk_designated_receiver_id;
446 --
447 -- ----------------------------------------------------------------------------
448 -- |--------------------------< chk_inactive_date>----------------------------|
449 -- ----------------------------------------------------------------------------
450 --
451 --  Description:
452 --    Validates that inactive_date is greater than or equal to session_date
453 --
454 --  Pre-conditions:
455 --    None.
456 --
457 --  In Arguments:
458 --    p_inactive_date
459 --    p_effective_date
460 --    p_location_id
461 --
462 --  Post Success:
463 --    If inactive date is greater than or equal to session date then
464 --    normal processing continues
465 --
466 --  Post Failure:
467 --    If the inactive date is less than the session date then an application
468 --    error will be raised and processing is terminated.
469 --
470 --  Developer/Implementation Notes:
471 --    Duplicate validation exists on form, so any changes made here
472 --    or on form must be dual-maintained
473 --
474 --  Access Status:
475 --    Internal Row Handler Use Only
476 --
477 -- {End Of Comments}
478 --
479 PROCEDURE chk_inactive_date
480   (p_inactive_date          IN     hr_locations.inactive_date%TYPE,
481    p_effective_date         IN     DATE,
482    p_location_id            IN     hr_locations.location_id%TYPE)
483 IS
484 --
485    l_proc  VARCHAR2(72) := g_package||'chk_inactive_date';
486 --
487 BEGIN
488    hr_utility.set_location('Entering:'|| l_proc, 10);
489    --
490    --  If set, inactive_date must be greater or equal to session date.
491    --
492    IF nvl (p_inactive_date, hr_api.g_eot) < p_effective_date THEN
493       hr_utility.set_message(800, 'HR_7301_INVALID_INACTIVE_DATE');
494       hr_utility.raise_error;
495    END IF;
496    --
497    hr_utility.set_location('Leaving:'||l_proc, 30);
498 --
499 END chk_inactive_date;
500 --
501 -- ----------------------------------------------------------------------------
502 -- |-------------------< chk_inventory_organization_id >----------------------|
503 -- ----------------------------------------------------------------------------
504 --
505 --  Description:
506 --    Validates the INVENTORY_ORGANIZATION_ID points to a valid inventory
507 --    organization with the use of a select statement.
508 --
509 --  Pre-conditions:
510 --    None.
511 --
512 --  In Arguments:
513 --    p_inventory_organization_id
514 --    p_effective_date
515 --    p_location_id
516 --
517 --  Post Success:
518 --    If the inventory_organization_id is valid then
519 --    normal processing continues
520 --
521 --  Post Failure:
522 --    If the inventory_organization_id is invalid then an application
523 --    error will be raised and processing is terminated.
524 --
525 --  Developer/Implementation Notes:
526 --    Duplicate validation exists on form, so any changes made here
527 --    or on form must be dual-maintained
528 --
529 --  Access Status:
530 --    Internal Row Handler Use Only
531 --
532 -- {End Of Comments}
533 --
534 PROCEDURE chk_inventory_organization_id
535   ( p_inventory_organization_id IN     hr_locations.inventory_organization_id%TYPE,
536     p_effective_date            IN     DATE,
537     p_location_id               IN     hr_locations.location_id%TYPE,
538     p_operating_unit_id         IN     NUMBER)
539 IS
540    l_proc           VARCHAR2(72)  :=  g_package||'chk_inventory_organization_id';
541    l_exists         VARCHAR2(1);
542 
543    dummy            NUMBER := 2;
544    dummy2           NUMBER := 1;
545 --
546 --
547    cur BINARY_INTEGER;
548    res BINARY_INTEGER;
549 --
550 BEGIN
551 --
552    hr_utility.set_location('Entering: id '|| l_proc, 10);
553 --
554 -- Only continue if INVENTORY_ORGANIZTION_ID is not null
555 -- and we are updating with new data, or inserting.
556 --
557    IF  p_inventory_organization_id IS NOT NULL  THEN
558      hr_utility.set_location('Inventory Org id '|| p_inventory_organization_id, 15);
559      IF  ( p_inventory_organization_id <> nvl (hr_loc_shd.g_old_rec.inventory_organization_id, hr_api.g_number) ) OR
560         ( p_location_id IS NULL) THEN
561        hr_utility.set_location('If Condition satisfied, checking inventory org ', 20);
562     --
563     DECLARE
564     INV_VIEW_DOES_NOT_EXIST EXCEPTION;
565     PRAGMA EXCEPTION_INIT(INV_VIEW_DOES_NOT_EXIST, -00942);
566     BEGIN
567     cur := DBMS_SQL.Open_Cursor;
568     --
569     hr_utility.set_location(l_proc||': Before parse', 30);
570     --
571     DBMS_SQL.Parse (cur,
572            ' SELECT NULL
573               FROM INV_ORGANIZATION_NAME_V
574               WHERE organization_id = :pOrgId', DBMS_SQL.Native );
575     DBMS_SQL.Bind_Variable (cur, 'pOrgId',p_inventory_organization_id );
576     hr_utility.set_location(l_proc||': Before Execute', 40);
577     res := DBMS_SQL.Execute(cur);
578 
579     -- Make sure we have a valid inventory organization
580     hr_utility.set_location(l_proc||': Before Fetch', 50);
581     If (DBMS_SQL.FETCH_ROWS (cur) = 0) then
582        hr_utility.set_location(l_proc||': Rasing Error', 60);
583        hr_utility.set_message(800, 'PER_52503_INV_INVENT_ORG_ID');
584        hr_utility.raise_error;
585     End if;
586 
587     hr_utility.set_location(l_proc||': Before close cursor', 70);
588     DBMS_SQL.Close_Cursor (cur);
589     EXCEPTION
590      When INV_VIEW_DOES_NOT_EXIST Then
591        hr_utility.set_location(l_proc||': View INV_ORGANIZATION_NAME_V not found', 99);
592        if DBMS_SQL.Is_Open(cur) then
593           DBMS_SQL.Close_Cursor(cur);
594        end if;
595 
596      When Others then
597        hr_utility.set_location(l_proc||': Other Error found'||sqlerrm, 99);
598        if DBMS_SQL.Is_Open(cur) then
599           DBMS_SQL.Close_Cursor(cur);
600        end if;
601        raise;
602     END;
603 
604    END IF;
605   END IF;
606    --
607    hr_utility.set_location('Leaving:'||l_proc, 40);
608 --
609 END chk_inventory_organization_id;
610 
611 -- ----------------------------------------------------------------------------
612 -- |-------------------------< chk_tax_name >---------------------------------|
613 -- ----------------------------------------------------------------------------
614 --
615 --  Description:
616 --    Validates that TAX_NAME is valid within the active tax codes.
617 --
618 --  Pre-conditions:
619 --    None.
620 --
621 --  In Arguments:
622 --    p_tax_name
623 --    p_effective_date
624 --    p_location_id
625 --
626 --  Post Success:
627 --    If the tax_name attribute is valid then
628 --    normal processing continues
629 --
630 --  Post Failure:
631 --    If the tax_name attribute is invalid then an application
632 --    error will be raised and processing is terminated.
633 --
634 --  Developer/Implementation Notes:
635 --    Duplicate validation exists on form, so any changes made here
636 --    or on form must be dual-maintained.
637 --
638 --  Access Status:
639 --    Internal Row Table Handler Use Only.
640 --
641 -- {End Of Comments}
642 --
643 PROCEDURE chk_tax_name
644   ( p_tax_name                IN     hr_locations.tax_name%TYPE,
645     p_effective_date          IN     DATE,
646     p_location_id             IN     hr_locations.location_id%TYPE)
647 IS
648    l_proc           VARCHAR2(72)  :=  g_package||'chk_tax_name';
649    l_exists         VARCHAR2(1);
650 --
651 
652  /* cursor csr_valid_tax_name IS
653      SELECT NULL
654         FROM ap_tax_codes
655         WHERE nvl(inactive_date, hr_api.g_eot ) >= p_effective_date
656           AND name = p_tax_name;
657 	  */
658 -- Start of the bug#11705804
659 
660 cursor csr_valid_tax_name IS
661      SELECT NULL
662      FROM zx_input_classifications_v
663      WHERE nvl(end_date_active, hr_api.g_eot ) >= p_effective_date
664      AND lookup_type = 'ZX_INPUT_CLASSIFICATIONS'
665      AND lookup_code = p_tax_name ;
666    --  AND tax_class = 'INPUT';
667 
668 -- End of the bug#11705804 fix
669 --
670 BEGIN
671 --
672    hr_utility.set_location('Entering:'|| l_proc, 10);
673 --
674 -- Only continue if tax_name is not null:
675 --
676    IF ( p_tax_name IS NOT NULL ) THEN
677    --
678    -- Only continue if tax_name is not null
679    --p_tax_name
680       IF ( p_tax_name <> nvl (hr_loc_shd.g_old_rec.tax_name, hr_api.g_varchar2) )
681    OR (p_location_id IS NULL)
682       --
683       --  Only validate if inserting, or updating with new value
684       --
685       THEN
686     OPEN csr_valid_tax_name;
687     FETCH csr_valid_tax_name INTO l_exists;
688     --
689     hr_utility.set_location(l_proc, 20);
690     --
691     IF csr_valid_tax_name%notfound THEN
692        CLOSE csr_valid_tax_name;
693        hr_utility.set_message(800, 'PER_52504_INV_TAX_NAME');
694        hr_utility.raise_error;
695     END IF;
696     --
697     CLOSE csr_valid_tax_name;
698       END IF;
699       --
700    END IF;
701 --
702   hr_utility.set_location('Leaving:'||l_proc, 30);
703 --
704 END chk_tax_name;
705 --
706 --
707 --  ---------------------------------------------------------------------------
708 --  |-----------------------------<  chk_style >------------------------------|
709 --  ---------------------------------------------------------------------------
710 --
711 --  Description:
712 --    Validates STYLE column using select statement.
713 --
714 --  Pre-conditions:
715 --    None
716 --
717 --  In Arguments:
718 --    p_style
719 --    p_location_id
720 --
721 --  Post Success:
722 --    If the style attribute is valid then
723 --    normal processing continues
724 --
725 --  Post Failure:
726 --    If the style attribute is invalid then an application
727 --    error will be raised and processing is terminated.
728 --
729 --  Developer/Implementation Notes:
730 --    Duplicate validation exists on form, so any changes made here
731 --    or on form must be dual-maintained.
732 --
733 --  Access Status:
734 --    Internal Row Handler Use Only.
735 --
736 -- {End Of Comments}
737 --
738 PROCEDURE chk_style
739   (p_style                  IN     hr_locations.style%TYPE,
740    p_location_id            IN     hr_locations.location_id%TYPE )
741 IS
742 --
743    l_proc           VARCHAR2(72)  :=  g_package||'chk_style';
744    l_exists         VARCHAR2(1);
745 --
746    -- Bug fix 3649137.
747    -- cursor modified to improve performance.
748 
749    cursor csr_valid_style IS
750      SELECT NULL
751         FROM fnd_descr_flex_contexts_vl vl
752         WHERE vl.descriptive_flexfield_name ='Address Location'
753            AND vl.enabled_flag = 'Y'
754 	   AND vl.application_id = 800
755            AND vl.descriptive_flex_context_code = p_style;
756 --
757 --
758 BEGIN
759   hr_utility.set_location('Entering:'|| l_proc, 10);
760 --
761 -- Only continue if STYLE is not null
762 --
763    IF ( p_style IS NOT NULL ) THEN
764       --
765       --  Only continue if STYLE is not null
766       --
767       IF ( nvl(hr_loc_shd.g_old_rec.style, hr_api.g_varchar2) <> p_style)
768    OR (p_location_id IS NULL ) THEN
769     --
770     -- Only validate if inserting, or updating with new value
771     --
772     OPEN csr_valid_style;
773     FETCH csr_valid_style INTO l_exists;
774     --
775     hr_utility.set_location(l_proc, 20);
776     --
777     IF csr_valid_style%notfound THEN
778        CLOSE csr_valid_style;
779        hr_utility.set_message(800, 'PER_52505_INV_ADDRESS_STYLE');
780        hr_utility.raise_error;
781     END IF;
782     CLOSE csr_valid_style;
783       END IF;
784    END IF;
785 --
786    hr_utility.set_location(' Leaving:'|| l_proc, 30);
787 END chk_style;
788 --
789 --
790 --  ---------------------------------------------------------------------------
791 --  |--------------------------<  chk_timezone >------------------------------|
792 --  ---------------------------------------------------------------------------
793 --
794 --  Description:
795 --    Validates TIMEZONE_CODE column using select statement.
796 --
797 --  Pre-conditions:
798 --    None
799 --
800 --  In Arguments:
801 --    p_timezone
802 --
803 --  Post Success:
804 --    If the timezone_code attribute is valid then
805 --    normal processing continues
806 --
807 --  Post Failure:
808 --    If the timezone_code attribute is invalid then an application
809 --    error will be raised and processing is terminated.
810 --
811 --  Developer/Implementation Notes:
812 --    Duplicate validation exists on Location form, so any changes
813 --    made here or on form must be dual-maintained.
814 --
815 --  Access Status:
816 --    Internal Row Handler Use Only.
817 --
818 -- {End Of Comments}
819 --
820 PROCEDURE chk_timezone
821   (p_timezone_code          IN     hr_locations.timezone_code%TYPE)
822 IS
823 --
824    l_proc           VARCHAR2(72)  :=  g_package||'chk_timezone';
825    l_exists         VARCHAR2(1);
826 --
827    cursor csr_valid_timezone IS
828      SELECT NULL
829         FROM fnd_timezones_vl vl
830         WHERE vl.timezone_code = p_timezone_code
831           AND vl.enabled_flag = 'Y';
832 --
833 --
834 BEGIN
835   hr_utility.set_location('Entering:'|| l_proc, 10);
836 --
837 -- Only continue if TIMEZONE_CODE is not null
838 --
839    IF ( p_timezone_code IS NOT NULL ) THEN
840       --
841       --  Only continue if TIMEZONE_CODE is not null
842       --
843       IF ( nvl(hr_loc_shd.g_old_rec.timezone_code, hr_api.g_varchar2)
844                    <> p_timezone_code) THEN
845     --
846     -- Only validate if inserting, or updating with new value
847     --
848     OPEN csr_valid_timezone;
849     FETCH csr_valid_timezone INTO l_exists;
850     --
851     hr_utility.set_location(l_proc, 20);
852     --
853     IF csr_valid_timezone%notfound THEN
854        CLOSE csr_valid_timezone;
855        hr_utility.set_message(800, 'PER_51983_INV_TZ_CODE');
856        hr_utility.raise_error;
857     END IF;
858     CLOSE csr_valid_timezone;
859       END IF;
860    END IF;
861 --
862    hr_utility.set_location(' Leaving:'|| l_proc, 30);
863 END chk_timezone;
864 --
865 --
866 --------------------------------------------------------------------------------
867 --------------------------------------------------------------------------------
868 --|-------------------------< chk_del_location >-------------------------------|
869 --------------------------------------------------------------------------------
870 --
871 --
872 --  Description
873 --    - Checks that the following tables do not reference the hr_locations_all
874 --      row
875 --
876 --           per_all_assigments_f
877 --           pay_wc_funds
878 --           per_events
879 --           per_all_vacancies
880 --           hr_all_organization_units
881 --           hr_all_positions_f (date tracked position table)
882 --           pay_element_links_f
883 --           per_salary_survey_mappings
884 --           hr_location_extra_info
885 --           per_us_inval_locations
886 --
887 --
888 --  Pre-conditions:
889 --    None
890 --
891 --  In Arguments:
892 --     p_location_id
893 --
894 --  Post Success:
895 --    The record is deleted from the database.
896 --
897 --  Post Failure:
898 --    An application error will be raised and processing is terminated.
899 --
900 --  Access Status:
901 --    Internal Development Use Only.
902 --
903 --
904 PROCEDURE chk_del_location
905   ( p_location_id           IN      hr_locations.location_id%TYPE ) IS
906 --
907    l_proc               VARCHAR2(72):= g_package||'chk_del_location';
908    l_exists             VARCHAR2(1);
909    l_location_id     hr_locations.location_id%TYPE;
910    l_location_code      hr_locations.location_code%TYPE;
911 --
912    --
913    -- Define a cursor for each table in HRMS that contains a location id column.
914    --
915    cursor csr_per_all_assignments_f IS
916    SELECT NULL
917      FROM  per_all_assignments_f
918      WHERE location_id = p_location_id;
919 --
920    cursor csr_pay_wc_funds IS
921    SELECT NULL
922      FROM  pay_wc_funds
923      WHERE location_id = p_location_id;
924 --
925    cursor csr_per_events IS
926    SELECT NULL
927      FROM  per_events
928      WHERE location_id = p_location_id;
929  --
930    cursor csr_per_all_vacancies IS
931    SELECT NULL
932      FROM  per_all_vacancies
933      WHERE location_id = p_location_id;
934  --
935    cursor csr_hr_all_organization_units IS
936    SELECT NULL
937      FROM  hr_all_organization_units
938      WHERE location_id = p_location_id;
939 --
940    cursor csr_hr_all_positions_f IS
941    SELECT NULL
942      FROM  hr_all_positions_f
943      WHERE location_id = p_location_id;
944 --
945    cursor csr_pay_element_links_f IS
946    SELECT NULL
947      FROM  pay_element_links_f
948      WHERE location_id = p_location_id;
949  --
950    cursor csr_per_salary_survey_mappings IS
951    SELECT NULL
952      FROM  per_salary_survey_mappings
953      WHERE location_id = p_location_id;
954 
955    cursor csr_hr_location_extra_info IS
956    SELECT NULL
957      FROM  hr_location_extra_info
958      WHERE location_id = p_location_id;
959 --
960    cursor csr_per_us_inval_locations IS
961    SELECT NULL
962      FROM  per_us_inval_locations
963      WHERE location_id = p_location_id;
964 
965 --- Fix For Bug 7644045 Starts ---
966 cursor csr_legal_location_flag is
967      select NULL
968      from HR_LOCATIONS_ALL
969      where location_id = p_location_id
970      and LEGAL_ADDRESS_FLAG ='Y';
971 --- Fix For Bug 7644045 Ends ---
972 
973 --
974 BEGIN
975   hr_utility.set_location('Entering:'|| l_proc, 10);
976   -- get the proposal details first.
977   --
978   OPEN csr_per_all_assignments_f;
979   FETCH csr_per_all_assignments_f INTO l_exists;
980   IF csr_per_all_assignments_f%found THEN
981      CLOSE csr_per_all_assignments_f;
982      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
983      hr_utility.raise_error;
984   END IF;
985   CLOSE csr_per_all_assignments_f;
986   --
987   --
988   hr_utility.set_location(l_proc, 15);
989   OPEN csr_pay_wc_funds;
990   FETCH csr_pay_wc_funds INTO l_exists;
991   IF csr_pay_wc_funds%found THEN
992      CLOSE csr_pay_wc_funds ;
993      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
994      hr_utility.raise_error;
995   END IF;
996   CLOSE csr_pay_wc_funds ;
997   --
998   --
999   hr_utility.set_location(l_proc, 20);
1000   OPEN csr_per_events;
1001   FETCH csr_per_events INTO l_exists;
1002   IF csr_per_events%found THEN
1003      CLOSE csr_per_events;
1004      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1005      hr_utility.raise_error;
1006   END IF;
1007   CLOSE csr_per_events;
1008   --
1009   --
1010   hr_utility.set_location(l_proc, 25);
1011   OPEN csr_per_all_vacancies;
1012   FETCH csr_per_all_vacancies INTO l_exists;
1013   IF csr_per_all_vacancies%found THEN
1014      CLOSE csr_per_all_vacancies;
1015      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1016      hr_utility.raise_error;
1017   END IF;
1018   CLOSE csr_per_all_vacancies;
1019   --
1020   --
1021   hr_utility.set_location(l_proc, 30);
1022   OPEN csr_hr_all_organization_units;
1023   FETCH csr_hr_all_organization_units INTO l_exists;
1024   IF csr_hr_all_organization_units%found THEN
1025      CLOSE csr_hr_all_organization_units;
1026      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1027      hr_utility.raise_error;
1028   END IF;
1029   CLOSE csr_hr_all_organization_units;
1030   --
1031   -- Added by SCNair on 30-SEP-99 (position date tracked table)
1032   --
1033   hr_utility.set_location(l_proc, 35);
1034   OPEN csr_hr_all_positions_f;
1035   FETCH csr_hr_all_positions_f INTO l_exists;
1036   IF csr_hr_all_positions_f%found THEN
1037      CLOSE csr_hr_all_positions_f;
1038      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1039      hr_utility.raise_error;
1040   END IF;
1041   CLOSE csr_hr_all_positions_f;
1042   --
1043   --
1044   hr_utility.set_location(l_proc, 40);
1045   OPEN csr_pay_element_links_f;
1046   FETCH csr_pay_element_links_f INTO l_exists;
1047   IF csr_pay_element_links_f%found THEN
1048      CLOSE csr_pay_element_links_f;
1049      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1050      hr_utility.raise_error;
1051   END IF;
1052   CLOSE csr_pay_element_links_f;
1053   --
1054   --
1055   hr_utility.set_location(l_proc, 45);
1056   OPEN csr_per_salary_survey_mappings;
1057   FETCH csr_per_salary_survey_mappings INTO l_exists;
1058   IF csr_per_salary_survey_mappings%found THEN
1059      CLOSE csr_per_salary_survey_mappings;
1060      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1061      hr_utility.raise_error;
1062   END IF;
1063   CLOSE csr_per_salary_survey_mappings;
1064   --
1065   --
1066   hr_utility.set_location(l_proc, 50);
1067   OPEN csr_hr_location_extra_info;
1068   FETCH csr_hr_location_extra_info INTO l_exists;
1069   IF csr_hr_location_extra_info%found THEN
1070      CLOSE csr_hr_location_extra_info;
1071      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1072      hr_utility.raise_error;
1073   END IF;
1074   CLOSE csr_hr_location_extra_info;
1075   --
1076   --
1077   hr_utility.set_location(l_proc, 55);
1078   OPEN csr_per_us_inval_locations;
1079   FETCH csr_per_us_inval_locations INTO l_exists;
1080   IF csr_per_us_inval_locations%found THEN
1081      CLOSE csr_per_us_inval_locations;
1082      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1083      hr_utility.raise_error;
1084   END IF;
1085   CLOSE csr_per_us_inval_locations;
1086   --
1087 --- Fix For Bug 7644045 Starts ---
1088   OPEN csr_legal_location_flag ;
1089   FETCH csr_legal_location_flag INTO l_exists;
1090   IF csr_legal_location_flag%found THEN
1091   hr_utility.set_location(l_proc, 60);
1092      CLOSE csr_legal_location_flag;
1093      hr_utility.set_message(800, 'PER_52506_CHK_DEL_LOCATION');
1094      hr_utility.raise_error;
1095   END IF;
1096   CLOSE csr_legal_location_flag;
1097 --- Fix For Bug 7644045 Ends ---
1098 
1099 
1100   --
1101   -- Call pre-delete validation provided by other Apps
1102   --
1103   inv_location.inv_predel_validation  ( p_location_id => p_location_id);
1104   po_locations_s.po_predel_validation ( p_location_id => p_location_id);
1105   oe_location.oe_predel_validation    ( p_location_id => p_location_id);
1106   qa_location.qa_predel_validation    ( p_location_id => p_location_id);
1107   --
1108   hr_utility.set_location('Leaving: ' ||l_proc, 80);
1109 END chk_del_location;
1110 --
1111 --
1112 -- ----------------------------------------------------------------------------
1113 -- |-----------------------< chk_non_updateable_args >------------------------|
1114 -- ----------------------------------------------------------------------------
1115 -- {Start Of Comments}
1116 --
1117 -- Description:
1118 --   This procedure is used to ensure that non updateable attributes have
1119 --   not been updated. If an attribute has been updated an error is generated.
1120 --
1121 -- Pre Conditions:
1122 --   g_old_rec has been populated with details of the values currently in
1123 --   the database.
1124 --
1125 -- In Arguments:
1126 --   p_rec has been populated with the updated values the user would like the
1127 --   record set to.
1128 --
1129 -- Post Success:
1130 --   Processing continues if all the non updateable attributes have not
1131 --   changed.
1132 --
1133 -- Post Failure:
1134 --   An application error is raised if any of the non updatable attributes
1135 --   (business_group_id, person_id, location_id, primary_flag or style)
1136 --   have been altered.
1137 --
1138 -- Access Status:
1139 --    Internal Row Handler Use Only
1140 --
1141 -- {End Of Comments}
1142 -- ---------------------------------------------------------------------------
1143 --
1144 PROCEDURE chk_non_updateable_args(p_rec IN hr_loc_shd.g_rec_type) IS
1145 --
1146   l_proc     VARCHAR2(72) := g_package||'chk_non_updateable_args';
1147   l_error    EXCEPTION;
1148   l_argument VARCHAR2(30);
1149 --
1150 BEGIN
1151    hr_utility.set_location('Entering:'||l_proc, 5);
1152 --
1153 -- Only proceed with validation if a row exists for
1154 -- the current record in the HR Schema
1155 --
1156   IF NOT hr_loc_shd.api_updating
1157                 (p_location_id           => p_rec.location_id,
1158                  p_object_version_number => p_rec.object_version_number)
1159   THEN
1160     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
1161     hr_utility.set_message_token('PROCEDURE ', l_proc);
1162     hr_utility.set_message_token('STEP ', '5');
1163   END IF;
1164   --
1165   hr_utility.set_location(l_proc, 10);
1166   --
1167   IF nvl(p_rec.business_group_id, hr_api.g_number) <>
1168        nvl (hr_loc_shd.g_old_rec.business_group_id, hr_api.g_number) THEN
1169      l_argument := 'business_group_id';
1170      RAISE l_error;
1171   END IF;
1172   --
1173   EXCEPTION
1174     WHEN l_error THEN
1175        hr_api.argument_changed_error
1176          (p_api_name => l_proc
1177          ,p_argument => l_argument);
1178     WHEN OTHERS THEN
1179        RAISE;
1180   hr_utility.set_location(' Leaving:'||l_proc, 12);
1181 END chk_non_updateable_args;
1182 --
1183 -- ---------------------------------------------------------------------------
1184 -- |-----------------------------<  chk_df  >--------------------------------|
1185 -- ---------------------------------------------------------------------------
1186 --
1187 -- Description:
1188 --   Validates the all Descriptive Flexfield values.
1189 --
1190 -- Pre-conditions:
1191 --   All other columns have been validated. Must be called as the
1192 --   last step from insert_validate and update_validate.
1193 --
1194 -- In Arguments:
1195 --   p_rec
1196 --
1197 -- Post Success:
1198 --   If the Descriptive Flexfield structure column and data values are
1199 --   all valid this procedure will end normally and processing will
1200 --   continue.
1201 --
1202 -- Post Failure:
1203 --   If the Descriptive Flexfield structure column value or any of
1204 --   the data values are invalid then an application error is raised as
1205 --   a PL/SQL exception.
1206 --
1207 -- Access Status:
1208 --   Internal Row Handler Use Only.
1209 --
1210 -- ---------------------------------------------------------------------------
1211 PROCEDURE chk_df
1212   (p_rec IN hr_loc_shd.g_rec_type) IS
1213 --
1214   l_proc    VARCHAR2(72) := g_package||'chk_df';
1215 --
1216 BEGIN
1217    hr_utility.set_location('Entering:'||l_proc, 10);
1218    hr_utility.set_location('Style is: '||p_rec.style ||  ',  Address 1 is: ' || p_rec.address_line_1, 10);
1219   --
1220   -- Address location - regular DF
1221   -- =============================
1222   --
1223   IF nvl(hr_loc_shd.g_old_rec.style, hr_api.g_varchar2) <>
1224      nvl(p_rec.style, hr_api.g_varchar2) OR
1225      nvl(hr_loc_shd.g_old_rec.address_line_1, hr_api.g_varchar2) <>
1226      nvl(p_rec.address_line_1, hr_api.g_varchar2) OR
1227      nvl(hr_loc_shd.g_old_rec.address_line_2, hr_api.g_varchar2) <>
1228      nvl(p_rec.address_line_2, hr_api.g_varchar2) OR
1229      nvl(hr_loc_shd.g_old_rec.address_line_3, hr_api.g_varchar2) <>
1230      nvl(p_rec.address_line_3, hr_api.g_varchar2) OR
1231      nvl(hr_loc_shd.g_old_rec.country, hr_api.g_varchar2) <>
1232      nvl(p_rec.country, hr_api.g_varchar2) OR
1233      nvl(hr_loc_shd.g_old_rec.postal_code, hr_api.g_varchar2) <>
1234      nvl(p_rec.postal_code, hr_api.g_varchar2) OR
1235      nvl(hr_loc_shd.g_old_rec.region_1, hr_api.g_varchar2) <>
1236      nvl(p_rec.region_1, hr_api.g_varchar2) OR
1237      nvl(hr_loc_shd.g_old_rec.region_2, hr_api.g_varchar2) <>
1238      nvl(p_rec.region_2, hr_api.g_varchar2) OR
1239      nvl(hr_loc_shd.g_old_rec.region_3, hr_api.g_varchar2) <>
1240      nvl(p_rec.region_3, hr_api.g_varchar2) OR
1241      nvl(hr_loc_shd.g_old_rec.telephone_number_1, hr_api.g_varchar2) <>
1242      nvl(p_rec.telephone_number_1, hr_api.g_varchar2) OR
1243      nvl(hr_loc_shd.g_old_rec.telephone_number_2, hr_api.g_varchar2) <>
1244      nvl(p_rec.telephone_number_2, hr_api.g_varchar2) OR
1245      nvl(hr_loc_shd.g_old_rec.telephone_number_3, hr_api.g_varchar2) <>
1246      nvl(p_rec.telephone_number_3, hr_api.g_varchar2) OR
1247      nvl(hr_loc_shd.g_old_rec.town_or_city, hr_api.g_varchar2) <>
1248      nvl(p_rec.town_or_city, hr_api.g_varchar2) OR
1249      nvl(hr_loc_shd.g_old_rec.loc_information13, hr_api.g_varchar2) <>
1250      nvl(p_rec.loc_information13, hr_api.g_varchar2) OR
1251      nvl(hr_loc_shd.g_old_rec.loc_information14, hr_api.g_varchar2) <>
1252      nvl(p_rec.loc_information14, hr_api.g_varchar2) OR
1253      nvl(hr_loc_shd.g_old_rec.loc_information15, hr_api.g_varchar2) <>
1254      nvl(p_rec.loc_information15, hr_api.g_varchar2) OR
1255      nvl(hr_loc_shd.g_old_rec.loc_information16, hr_api.g_varchar2) <>
1256      nvl(p_rec.loc_information16, hr_api.g_varchar2) OR
1257      nvl(hr_loc_shd.g_old_rec.loc_information17, hr_api.g_varchar2) <>
1258      nvl(p_rec.loc_information17, hr_api.g_varchar2) OR
1259      nvl(hr_loc_shd.g_old_rec.loc_information18, hr_api.g_varchar2) <>
1260      nvl(p_rec.loc_information18, hr_api.g_varchar2) OR
1261      nvl(hr_loc_shd.g_old_rec.loc_information19, hr_api.g_varchar2) <>
1262      nvl(p_rec.loc_information19, hr_api.g_varchar2) OR
1263      nvl(hr_loc_shd.g_old_rec.loc_information20, hr_api.g_varchar2) <>
1264      nvl(p_rec.loc_information20, hr_api.g_varchar2) OR
1265     (p_rec.location_id IS NULL)
1266   THEN
1267     -- Only execute the validation if absolutely necessary:
1268     -- a) During update, the structure column value or any
1269     --    of the attribute values have actually changed.
1270     -- b) During insert.
1271     --
1272     hr_dflex_utility.ins_or_upd_descflex_attribs
1273       (p_appl_short_name    => 'PER'
1274       ,p_descflex_name      => 'Address Location'
1275       ,p_attribute_category => p_rec.style
1276       ,p_attribute1_name    => 'ADDRESS_LINE_1'
1277       ,p_attribute1_value   => p_rec.address_line_1
1278       ,p_attribute2_name    => 'ADDRESS_LINE_2'
1279       ,p_attribute2_value   => p_rec.address_line_2
1280       ,p_attribute3_name    => 'ADDRESS_LINE_3'
1281       ,p_attribute3_value   => p_rec.address_line_3
1282       ,p_attribute4_name    => 'COUNTRY'
1283       ,p_attribute4_value   => p_rec.country
1284       ,p_attribute5_name    => 'POSTAL_CODE'
1285       ,p_attribute5_value   => p_rec.postal_code
1286       ,p_attribute6_name    => 'REGION_1'
1287       ,p_attribute6_value   => p_rec.region_1
1288       ,p_attribute7_name    => 'REGION_2'
1289       ,p_attribute7_value   => p_rec.region_2
1290       ,p_attribute8_name    => 'REGION_3'
1291       ,p_attribute8_value   => p_rec.region_3
1292       ,p_attribute9_name    => 'TELEPHONE_NUMBER_1'
1293       ,p_attribute9_value   => p_rec.telephone_number_1
1294       ,p_attribute10_name   => 'TELEPHONE_NUMBER_2'
1295       ,p_attribute10_value  => p_rec.telephone_number_2
1296       ,p_attribute11_name   => 'TELEPHONE_NUMBER_3'
1297       ,p_attribute11_value  => p_rec.telephone_number_3
1298       ,p_attribute12_name   => 'TOWN_OR_CITY'
1299       ,p_attribute12_value  => p_rec.town_or_city
1300       ,p_attribute13_name   => 'LOC_INFORMATION13'
1301       ,p_attribute13_value  => p_rec.loc_information13
1302       ,p_attribute14_name   => 'LOC_INFORMATION14'
1303       ,p_attribute14_value  => p_rec.loc_information14
1304       ,p_attribute15_name   => 'LOC_INFORMATION15'
1305       ,p_attribute15_value  => p_rec.loc_information15
1306       ,p_attribute16_name   => 'LOC_INFORMATION16'
1307       ,p_attribute16_value  => p_rec.loc_information16
1308       ,p_attribute17_name   => 'LOC_INFORMATION17'
1309       ,p_attribute17_value  => p_rec.loc_information17
1310       ,p_attribute18_name   => 'LOC_INFORMATION18'
1311       ,p_attribute18_value  => p_rec.loc_information18
1312       ,p_attribute19_name   => 'LOC_INFORMATION19'
1313       ,p_attribute19_value  => p_rec.loc_information19
1314       ,p_attribute20_name   => 'LOC_INFORMATION20'
1315       ,p_attribute20_value  => p_rec.loc_information20
1316       );
1317   END IF;
1318 --
1319   hr_utility.set_location(l_proc, 20);
1320   --
1321   --  HR_LOCATIONS - flexible address DDF
1322   --  ===================================
1323   --
1324   IF nvl(hr_loc_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
1325      nvl(p_rec.attribute_category, hr_api.g_varchar2) OR
1326      nvl(hr_loc_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
1327      nvl(p_rec.attribute1, hr_api.g_varchar2) OR
1328      nvl(hr_loc_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
1329      nvl(p_rec.attribute2, hr_api.g_varchar2) OR
1330      nvl(hr_loc_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
1331      nvl(p_rec.attribute3, hr_api.g_varchar2) OR
1332      nvl(hr_loc_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
1333      nvl(p_rec.attribute4, hr_api.g_varchar2) OR
1334      nvl(hr_loc_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
1335      nvl(p_rec.attribute5, hr_api.g_varchar2) OR
1336      nvl(hr_loc_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
1337      nvl(p_rec.attribute6, hr_api.g_varchar2) OR
1338      nvl(hr_loc_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
1339      nvl(p_rec.attribute7, hr_api.g_varchar2) OR
1340      nvl(hr_loc_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
1341      nvl(p_rec.attribute8, hr_api.g_varchar2) OR
1342      nvl(hr_loc_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
1343      nvl(p_rec.attribute9, hr_api.g_varchar2) OR
1344      nvl(hr_loc_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
1345      nvl(p_rec.attribute10, hr_api.g_varchar2) OR
1346      nvl(hr_loc_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
1347      nvl(p_rec.attribute11, hr_api.g_varchar2) OR
1348      nvl(hr_loc_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
1349      nvl(p_rec.attribute12, hr_api.g_varchar2) OR
1350      nvl(hr_loc_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
1351      nvl(p_rec.attribute13, hr_api.g_varchar2) OR
1352      nvl(hr_loc_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
1353      nvl(p_rec.attribute14, hr_api.g_varchar2) OR
1354      nvl(hr_loc_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
1355      nvl(p_rec.attribute15, hr_api.g_varchar2) OR
1356      nvl(hr_loc_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
1357      nvl(p_rec.attribute16, hr_api.g_varchar2) OR
1358      nvl(hr_loc_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
1359      nvl(p_rec.attribute17, hr_api.g_varchar2) OR
1360      nvl(hr_loc_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
1361      nvl(p_rec.attribute18, hr_api.g_varchar2) OR
1362      nvl(hr_loc_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
1363      nvl(p_rec.attribute19, hr_api.g_varchar2) OR
1364      nvl(hr_loc_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
1365      nvl(p_rec.attribute20, hr_api.g_varchar2)
1366   OR
1367      (p_rec.location_id IS NULL)
1368   THEN
1369     -- Only execute the validation if absolutely necessary:
1370     -- a) During update, the structure column value or any
1371     --    of the attribute values have actually changed.
1372     -- b) During insert.
1373 --
1374     hr_dflex_utility.ins_or_upd_descflex_attribs
1375       (p_appl_short_name    => 'PER'
1376       ,p_descflex_name      => 'HR_LOCATIONS'
1377       ,p_attribute_category => p_rec.attribute_category
1378       ,p_attribute1_name    => 'ATTRIBUTE1'
1379       ,p_attribute1_value   => p_rec.attribute1
1380       ,p_attribute2_name    => 'ATTRIBUTE2'
1381       ,p_attribute2_value   => p_rec.attribute2
1382       ,p_attribute3_name    => 'ATTRIBUTE3'
1383       ,p_attribute3_value   => p_rec.attribute3
1384       ,p_attribute4_name    => 'ATTRIBUTE4'
1385       ,p_attribute4_value   => p_rec.attribute4
1386       ,p_attribute5_name    => 'ATTRIBUTE5'
1387       ,p_attribute5_value   => p_rec.attribute5
1388       ,p_attribute6_name    => 'ATTRIBUTE6'
1389       ,p_attribute6_value   => p_rec.attribute6
1390       ,p_attribute7_name    => 'ATTRIBUTE7'
1391       ,p_attribute7_value   => p_rec.attribute7
1392       ,p_attribute8_name    => 'ATTRIBUTE8'
1393       ,p_attribute8_value   => p_rec.attribute8
1394       ,p_attribute9_name    => 'ATTRIBUTE9'
1395       ,p_attribute9_value   => p_rec.attribute9
1396       ,p_attribute10_name   => 'ATTRIBUTE10'
1397       ,p_attribute10_value  => p_rec.attribute10
1398       ,p_attribute11_name   => 'ATTRIBUTE11'
1399       ,p_attribute11_value  => p_rec.attribute11
1400       ,p_attribute12_name   => 'ATTRIBUTE12'
1401       ,p_attribute12_value  => p_rec.attribute12
1402       ,p_attribute13_name   => 'ATTRIBUTE13'
1403       ,p_attribute13_value  => p_rec.attribute13
1404       ,p_attribute14_name   => 'ATTRIBUTE14'
1405       ,p_attribute14_value  => p_rec.attribute14
1406       ,p_attribute15_name   => 'ATTRIBUTE15'
1407       ,p_attribute15_value  => p_rec.attribute15
1408       ,p_attribute16_name   => 'ATTRIBUTE16'
1409       ,p_attribute16_value  => p_rec.attribute16
1410       ,p_attribute17_name   => 'ATTRIBUTE17'
1411       ,p_attribute17_value  => p_rec.attribute17
1412       ,p_attribute18_name   => 'ATTRIBUTE18'
1413       ,p_attribute18_value  => p_rec.attribute18
1414       ,p_attribute19_name   => 'ATTRIBUTE19'
1415       ,p_attribute19_value  => p_rec.attribute19
1416       ,p_attribute20_name   => 'ATTRIBUTE20'
1417       ,p_attribute20_value  => p_rec.attribute20
1418       );
1419   END IF;
1420   --
1421   hr_utility.set_location(l_proc, 30);
1422   --
1423   -- JG_HR_LOCATIONS - global localizations DDF
1424   -- ==========================================
1425   --
1426   IF nvl(hr_loc_shd.g_old_rec.global_attribute_category, hr_api.g_varchar2) <>
1427      nvl(p_rec.global_attribute_category, hr_api.g_varchar2) OR
1428      nvl(hr_loc_shd.g_old_rec.global_attribute1, hr_api.g_varchar2) <>
1429      nvl(p_rec.global_attribute1, hr_api.g_varchar2) OR
1430      nvl(hr_loc_shd.g_old_rec.global_attribute2, hr_api.g_varchar2) <>
1431      nvl(p_rec.global_attribute2, hr_api.g_varchar2) OR
1432      nvl(hr_loc_shd.g_old_rec.global_attribute3, hr_api.g_varchar2) <>
1433      nvl(p_rec.global_attribute3, hr_api.g_varchar2) OR
1434      nvl(hr_loc_shd.g_old_rec.global_attribute4, hr_api.g_varchar2) <>
1435      nvl(p_rec.global_attribute4, hr_api.g_varchar2) OR
1436      nvl(hr_loc_shd.g_old_rec.global_attribute5, hr_api.g_varchar2) <>
1437      nvl(p_rec.global_attribute5, hr_api.g_varchar2) OR
1438      nvl(hr_loc_shd.g_old_rec.global_attribute6, hr_api.g_varchar2) <>
1439      nvl(p_rec.global_attribute6, hr_api.g_varchar2) OR
1440      nvl(hr_loc_shd.g_old_rec.global_attribute7, hr_api.g_varchar2) <>
1441      nvl(p_rec.global_attribute7, hr_api.g_varchar2) OR
1442      nvl(hr_loc_shd.g_old_rec.global_attribute8, hr_api.g_varchar2) <>
1443      nvl(p_rec.global_attribute8, hr_api.g_varchar2) OR
1444      nvl(hr_loc_shd.g_old_rec.global_attribute9, hr_api.g_varchar2) <>
1445      nvl(p_rec.global_attribute9, hr_api.g_varchar2) OR
1446      nvl(hr_loc_shd.g_old_rec.global_attribute10, hr_api.g_varchar2) <>
1447      nvl(p_rec.global_attribute10, hr_api.g_varchar2) OR
1448      nvl(hr_loc_shd.g_old_rec.global_attribute11, hr_api.g_varchar2) <>
1449      nvl(p_rec.global_attribute11, hr_api.g_varchar2) OR
1450      nvl(hr_loc_shd.g_old_rec.global_attribute12, hr_api.g_varchar2) <>
1451      nvl(p_rec.global_attribute12, hr_api.g_varchar2) OR
1452      nvl(hr_loc_shd.g_old_rec.global_attribute13, hr_api.g_varchar2) <>
1453      nvl(p_rec.global_attribute13, hr_api.g_varchar2) OR
1454      nvl(hr_loc_shd.g_old_rec.global_attribute14, hr_api.g_varchar2) <>
1455      nvl(p_rec.global_attribute14, hr_api.g_varchar2) OR
1456      nvl(hr_loc_shd.g_old_rec.global_attribute15, hr_api.g_varchar2) <>
1457      nvl(p_rec.global_attribute15, hr_api.g_varchar2) OR
1458      nvl(hr_loc_shd.g_old_rec.global_attribute16, hr_api.g_varchar2) <>
1459      nvl(p_rec.global_attribute16, hr_api.g_varchar2) OR
1460      nvl(hr_loc_shd.g_old_rec.global_attribute17, hr_api.g_varchar2) <>
1461      nvl(p_rec.global_attribute17, hr_api.g_varchar2) OR
1462      nvl(hr_loc_shd.g_old_rec.global_attribute18, hr_api.g_varchar2) <>
1463      nvl(p_rec.global_attribute18, hr_api.g_varchar2) OR
1464      nvl(hr_loc_shd.g_old_rec.global_attribute19, hr_api.g_varchar2) <>
1465      nvl(p_rec.global_attribute19, hr_api.g_varchar2) OR
1466      nvl(hr_loc_shd.g_old_rec.global_attribute20, hr_api.g_varchar2) <>
1467      nvl(p_rec.global_attribute20, hr_api.g_varchar2)
1468   OR
1469      (p_rec.location_id IS NULL)
1470   THEN
1471     -- Only execute the validation if absolutely necessary:
1472     -- a) During update, the structure column value or any
1473     --    of the attribute values have actually changed.
1474     -- b) During insert.
1475     --
1476     hr_dflex_utility.ins_or_upd_descflex_attribs
1477       (p_appl_short_name    => 'JG'
1478       ,p_descflex_name      => 'JG_HR_LOCATIONS'
1479       ,p_attribute_category => p_rec.global_attribute_category
1480       ,p_attribute1_name    => 'GLOBAL_ATTRIBUTE1'
1481       ,p_attribute1_value   => p_rec.global_attribute1
1482       ,p_attribute2_name    => 'GLOBAL_ATTRIBUTE2'
1483       ,p_attribute2_value   => p_rec.global_attribute2
1484       ,p_attribute3_name    => 'GLOBAL_ATTRIBUTE3'
1485       ,p_attribute3_value   => p_rec.global_attribute3
1486       ,p_attribute4_name    => 'GLOBAL_ATTRIBUTE4'
1487       ,p_attribute4_value   => p_rec.global_attribute4
1488       ,p_attribute5_name    => 'GLOBAL_ATTRIBUTE5'
1489       ,p_attribute5_value   => p_rec.global_attribute5
1490       ,p_attribute6_name    => 'GLOBAL_ATTRIBUTE6'
1491       ,p_attribute6_value   => p_rec.global_attribute6
1492       ,p_attribute7_name    => 'GLOBAL_ATTRIBUTE7'
1493       ,p_attribute7_value   => p_rec.global_attribute7
1494       ,p_attribute8_name    => 'GLOBAL_ATTRIBUTE8'
1495       ,p_attribute8_value   => p_rec.global_attribute8
1496       ,p_attribute9_name    => 'GLOBAL_ATTRIBUTE9'
1497       ,p_attribute9_value   => p_rec.global_attribute9
1498       ,p_attribute10_name   => 'GLOBAL_ATTRIBUTE10'
1499       ,p_attribute10_value  => p_rec.global_attribute10
1500       ,p_attribute11_name   => 'GLOBAL_ATTRIBUTE11'
1501       ,p_attribute11_value  => p_rec.global_attribute11
1502       ,p_attribute12_name   => 'GLOBAL_ATTRIBUTE12'
1503       ,p_attribute12_value  => p_rec.global_attribute12
1504       ,p_attribute13_name   => 'GLOBAL_ATTRIBUTE13'
1505       ,p_attribute13_value  => p_rec.global_attribute13
1506       ,p_attribute14_name   => 'GLOBAL_ATTRIBUTE14'
1507       ,p_attribute14_value  => p_rec.global_attribute14
1508       ,p_attribute15_name   => 'GLOBAL_ATTRIBUTE15'
1509       ,p_attribute15_value  => p_rec.global_attribute15
1510       ,p_attribute16_name   => 'GLOBAL_ATTRIBUTE16'
1511       ,p_attribute16_value  => p_rec.global_attribute16
1512       ,p_attribute17_name   => 'GLOBAL_ATTRIBUTE17'
1513       ,p_attribute17_value  => p_rec.global_attribute17
1514       ,p_attribute18_name   => 'GLOBAL_ATTRIBUTE18'
1515       ,p_attribute18_value  => p_rec.global_attribute18
1516       ,p_attribute19_name   => 'GLOBAL_ATTRIBUTE19'
1517       ,p_attribute19_value  => p_rec.global_attribute19
1518       ,p_attribute20_name   => 'GLOBAL_ATTRIBUTE20'
1519       ,p_attribute20_value  => p_rec.global_attribute20
1520       );
1521   END IF;
1522 --
1523 --
1524   hr_utility.set_location(' Leaving:'||l_proc, 40);
1525 END chk_df;
1526 --
1527 -- ----------------------------------------------------------------------------
1528 -- |---------------------------< insert_validate >----------------------------|
1529 -- ----------------------------------------------------------------------------
1530 PROCEDURE insert_validate
1531   (  p_rec IN OUT NOCOPY hr_loc_shd.g_rec_type,
1532      p_effective_date IN DATE,
1533      p_operating_unit_id IN NUMBER)
1534 IS
1535 --
1536    l_proc  VARCHAR2(72) := g_package||'insert_validate';
1537    l_constraint_name VARCHAR2(30);
1538 --
1539 BEGIN
1540   hr_utility.set_location('Entering:'||l_proc, 5);
1541   --
1542   -- Call all supporting business operations. Mapping to the
1543   -- appropriate Business Rules in hrloc.bru is provided (where
1544   -- relevant)
1545   --
1546   -- Validate business_group_id (only if set)
1547   -- ==========================
1548   --
1549   -- Note:  There are no calls to lookup validation procedures in this row handler
1550   --        at present.  If this changes, "CLIENT_INFO" may require setting - see
1551   --        API strategy page 12-29 onwards.
1552   --
1553   IF p_rec.business_group_id IS NOT NULL THEN
1554      hr_api.validate_bus_grp_id(p_rec.business_group_id);
1555   END IF;
1556   --
1557   --
1558   hr_utility.set_location(l_proc, 10);
1559   --
1560   -- Validate inactive_date
1561   -- ======================
1562   chk_inactive_date
1563     (p_inactive_date              =>    p_rec.inactive_date,
1564      p_effective_date             =>    p_effective_date,
1565      p_location_id                =>    p_rec.location_id
1566     );
1567   --
1568   --
1569   hr_utility.set_location(l_proc, 15);
1570   --
1571   -- Validate ship_to_loc_id_and_flags
1572   -- =================================
1573   --
1574   chk_ship_to_loc_id_and_flag (
1575     p_location_id                 =>   p_rec.location_id,
1576     p_ship_to_location_id         =>   p_rec.ship_to_location_id,
1577     p_ship_to_site_flag           =>   p_rec.ship_to_site_flag,
1578     p_inactive_date               =>   p_rec.inactive_date,
1579     p_business_group_id           =>   p_rec.business_group_id,
1580     p_effective_date              =>   p_effective_date );
1581   --
1582   hr_utility.set_location(l_proc, 35);
1583   --
1584   -- Validate receiving_site_flag
1585   -- ===============================
1586   chk_receiving_site_flag
1587     ( p_ship_to_site_flag           =>   p_rec.ship_to_site_flag,
1588       p_receiving_site_flag         =>   p_rec.receiving_site_flag
1589     );
1590   --
1591   hr_utility.set_location(l_proc, 40);
1592   --
1593   -- Validate designated_receiver_id
1594   -- ===============================
1595   chk_designated_receiver_id
1596     (p_designated_receiver_id     =>    p_rec.designated_receiver_id,
1597      p_location_id                =>    p_rec.location_id,
1598      p_business_group_id          =>    p_rec.business_group_id,
1599      p_effective_date             =>    p_effective_date
1600     );
1601   hr_utility.set_location(l_proc, 45);
1602   --
1603   -- Validate inventory_organization_id
1604   -- ==================================
1605   chk_inventory_organization_id
1606     (p_inventory_organization_id    =>    p_rec.inventory_organization_id,
1607      p_effective_date               =>    p_effective_date,
1608      p_location_id                  =>    p_rec.location_id,
1609      p_operating_unit_id            =>    p_operating_unit_id
1610     );
1611   --
1612   hr_utility.set_location(l_proc, 50);
1613   --
1614   -- Validate tax_name
1615   -- =================
1616   --
1617   chk_tax_name
1618     (p_tax_name                 =>    p_rec.tax_name,
1619      p_effective_date           =>    p_effective_date,
1620      p_location_id              =>    p_rec.location_id
1621     );
1622   --
1623   --
1624 
1625   hr_utility.set_location(l_proc, 58);
1626   --
1627   -- Validate style
1628   -- ==============
1629   chk_style
1630     (p_style                    =>    p_rec.style,
1631      p_location_id              =>    p_rec.location_id
1632     );
1633   --
1634   --
1635   hr_utility.set_location(l_proc, 59);
1636   --
1637   -- Validate timezone_code
1638   -- ======================
1639   chk_timezone
1640     (p_timezone_code            =>    p_rec.timezone_code
1641     );
1642   --
1643   --
1644   hr_utility.set_location(l_proc, 60);
1645   --
1646   -- Validate flexfields
1647   -- ===================
1648      chk_df(p_rec => p_rec);
1649   --
1650   --
1651   hr_utility.set_location(' Leaving:'||l_proc, 65);
1652   --
1653 END insert_validate;
1654 --
1655 -- ----------------------------------------------------------------------------
1656 -- |---------------------------< update_validate >----------------------------|
1657 -- ----------------------------------------------------------------------------
1658 PROCEDURE update_validate
1659  (  p_rec IN OUT NOCOPY hr_loc_shd.g_rec_type,
1660     p_effective_date IN DATE,
1661     p_operating_unit_id IN NUMBER)
1662 IS
1663 --
1664    l_proc  VARCHAR2(72) := g_package||'update_validate';
1665    l_constraint_name VARCHAR2(30);
1666 --
1667 BEGIN
1668   hr_utility.set_location('Entering:'||l_proc, 5);
1669   --
1670   -- Call all supporting business operations. Mapping to the
1671   -- appropriate Business Rules in hrloc.bru is provided.
1672   --
1673   -- Note:  There are no calls to lookup validation procedures in this row handler
1674   --        at present.  If this changes, "CLIENT_INFO" may require setting - see
1675   --        API strategy page 12-29 onwards.
1676   --
1677   -- Check that the columns which cannot
1678   -- be updated have not changed
1679   --
1680   chk_non_updateable_args(p_rec => p_rec);
1681   --
1682   hr_utility.set_location(l_proc, 15);
1683   --
1684   -- Validate inactive_date
1685   -- ======================
1686   chk_inactive_date
1687     (p_inactive_date              =>    p_rec.inactive_date,
1688      p_effective_date             =>    p_effective_date,
1689      p_location_id                =>    p_rec.location_id
1690     );
1691   --
1692   hr_utility.set_location(l_proc, 20);
1693   --
1694   -- Validate ship_to_loc_id_and_flag
1695   -- ======================================
1696   chk_ship_to_loc_id_and_flag (
1697     p_location_id                 =>   p_rec.location_id,
1698     p_ship_to_location_id         =>   p_rec.ship_to_location_id,
1699     p_ship_to_site_flag           =>   p_rec.ship_to_site_flag,
1700     p_inactive_date               =>   p_rec.inactive_date,
1701     p_business_group_id           =>   p_rec.business_group_id,
1702     p_effective_date              =>   p_effective_date );
1703   --
1704   hr_utility.set_location(l_proc, 25);
1705   --
1706   -- Validate receiving_site_flag
1707   -- ===============================
1708   chk_receiving_site_flag
1709     ( p_ship_to_site_flag           =>   p_rec.ship_to_site_flag,
1710       p_receiving_site_flag         =>   p_rec.receiving_site_flag
1711     );
1712   --
1713   hr_utility.set_location(l_proc, 35);
1714   --
1715   -- Validate designated_receiver_id
1716   -- ===============================
1717   chk_designated_receiver_id
1718     (p_designated_receiver_id     =>    p_rec.designated_receiver_id,
1719      p_location_id                =>    p_rec.location_id,
1720      p_business_group_id          =>    p_rec.business_group_id,
1721      p_effective_date             =>    p_effective_date
1722     );
1723   --
1724   hr_utility.set_location(l_proc, 45);
1725   --
1726   -- Validate inventory_organization_id
1727   -- ==================================
1728   chk_inventory_organization_id
1729     (p_inventory_organization_id    =>    p_rec.inventory_organization_id,
1730      p_effective_date               =>    p_effective_date,
1731      p_location_id                  =>    p_rec.location_id,
1732      p_operating_unit_id            =>    p_operating_unit_id
1733     );
1734   --
1735   hr_utility.set_location(l_proc, 50);
1736 
1737   --
1738   -- Validate tax_name
1739   -- =================
1740   --
1741   chk_tax_name
1742     (p_tax_name                 =>    p_rec.tax_name,
1743      p_effective_date           =>    p_effective_date,
1744      p_location_id              =>    p_rec.location_id
1745     );
1746   --
1747   --
1748 
1749   hr_utility.set_location(l_proc, 58);
1750   --
1751   -- Validate style
1752   -- ==============
1753   chk_style
1754     (p_style                    =>    p_rec.style,
1755      p_location_id              =>    p_rec.location_id
1756     );
1757   --
1758   --
1759   hr_utility.set_location(l_proc, 59);
1760   --
1761   --
1762   -- Validate timezone_code
1763   -- ======================
1764   chk_timezone
1765     (p_timezone_code            =>    p_rec.timezone_code
1766     );
1767   --
1768   hr_utility.set_location(l_proc, 60);
1769   --
1770   -- Validate flexfields
1771   -- ===================
1772   chk_df(p_rec => p_rec);
1773   --
1774   --
1775   hr_utility.set_location(' Leaving:'||l_proc, 65);
1776   --
1777 END update_validate;
1778 
1779 --
1780 -- ----------------------------------------------------------------------------
1781 -- |---------------------------< delete_validate >----------------------------|
1782 -- ----------------------------------------------------------------------------
1783 PROCEDURE delete_validate
1784   (p_rec          IN    hr_loc_shd.g_rec_type
1785  ) IS
1786 
1787 --
1788   l_proc  VARCHAR2(72) := g_package||'delete_validate';
1789 --
1790 BEGIN
1791   hr_utility.set_location('Entering:'||l_proc, 5);
1792   --
1793   -- Call all supporting business operations
1794   --
1795   -- Validate delete
1796   --
1797   -- Business Rule Mapping
1798   -- =====================
1799   -- Rule chk_del_location
1800   --
1801   chk_del_location
1802     (p_location_id              => p_rec.location_id);
1803   --
1804   hr_utility.set_location(' Leaving:'||l_proc, 10);
1805 END delete_validate;
1806 --
1807 --
1808 END hr_loc_bus;