DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_OSE_BUS

Source


1 Package Body per_ose_bus as
2 /* $Header: peoserhi.pkb 120.2.12000000.1 2007/01/22 00:38:55 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_ose_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_org_structure_element_id    number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_org_structure_element_id             in number
22   ) is
23   --
24   -- Declare cursor
25   --
26   cursor csr_sec_grp is
27     select pbg.security_group_id
28       from per_business_groups pbg
29          , per_org_structure_elements ose
30      where ose.org_structure_element_id = p_org_structure_element_id
31        and pbg.business_group_id = ose.business_group_id;
32   --
33   -- Declare local variables
34   --
35   l_security_group_id number;
36   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
37   --
38 begin
39   --
40   hr_utility.set_location('Entering:'|| l_proc, 10);
41   --
42   -- Ensure that all the mandatory parameter are not null
43   --
44   hr_api.mandatory_arg_error
45     (p_api_name           => l_proc
46     ,p_argument           => 'org_structure_element_id'
47     ,p_argument_value     => p_org_structure_element_id
48     );
49   --
50   open csr_sec_grp;
51   fetch csr_sec_grp into l_security_group_id;
52   --
53   if csr_sec_grp%notfound then
54      --
55      close csr_sec_grp;
56      --
57      -- The primary key is invalid therefore we must error
58      --
59      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
60      fnd_message.raise_error;
61      --
62   end if;
63   close csr_sec_grp;
64   --
65   -- Set the security_group_id in CLIENT_INFO
66   --
67   hr_api.set_security_group_id
68     (p_security_group_id => l_security_group_id
69     );
70   --
71   hr_utility.set_location(' Leaving:'|| l_proc, 20);
72   --
73 end set_security_group_id;
74 --
75 --  ---------------------------------------------------------------------------
76 --  |---------------------< return_legislation_code >-------------------------|
77 --  ---------------------------------------------------------------------------
78 --
79 Function return_legislation_code
80   (p_org_structure_element_id             in     number
81   )
82   Return Varchar2 Is
83   --
84   -- Declare cursor
85   --
86   cursor csr_leg_code is
87     select pbg.legislation_code
88       from per_business_groups pbg
89          , per_org_structure_elements ose
90      where ose.org_structure_element_id = p_org_structure_element_id
91        and pbg.business_group_id (+) = ose.business_group_id;
92   --
93   -- Declare local variables
94   --
95   l_legislation_code  varchar2(150);
96   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
97   --
98 Begin
99   --
100   hr_utility.set_location('Entering:'|| l_proc, 10);
101   --
102   -- Ensure that all the mandatory parameter are not null
103   --
104   hr_api.mandatory_arg_error
105     (p_api_name           => l_proc
106     ,p_argument           => 'org_structure_element_id'
107     ,p_argument_value     => p_org_structure_element_id
108     );
109   --
110   if ( nvl(per_ose_bus.g_org_structure_element_id, hr_api.g_number)
111        = p_org_structure_element_id) then
112     --
113     -- The legislation code has already been found with a previous
114     -- call to this function. Just return the value in the global
115     -- variable.
116     --
117     l_legislation_code := per_ose_bus.g_legislation_code;
118     hr_utility.set_location(l_proc, 20);
119   else
120     --
121     -- The ID is different to the last call to this function
122     -- or this is the first call to this function.
123     --
124     open csr_leg_code;
125     fetch csr_leg_code into l_legislation_code;
126     --
127     if csr_leg_code%notfound then
128       --
129       -- The primary key is invalid therefore we must error
130       --
131       close csr_leg_code;
132       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
133       fnd_message.raise_error;
134     end if;
135     hr_utility.set_location(l_proc,30);
136     --
137     -- Set the global variables so the values are
138     -- available for the next call to this function.
139     --
140     close csr_leg_code;
141     per_ose_bus.g_org_structure_element_id := p_org_structure_element_id;
142     per_ose_bus.g_legislation_code  := l_legislation_code;
143   end if;
144   hr_utility.set_location(' Leaving:'|| l_proc, 40);
145   return l_legislation_code;
146 end return_legislation_code;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |-----------------------< chk_non_updateable_args >------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 --   This procedure is used to ensure that non updateable attributes have
155 --   not been updated. If an attribute has been updated an error is generated.
156 --
157 -- Pre Conditions:
158 --   g_old_rec has been populated with details of the values currently in
159 --   the database.
160 --
161 -- In Arguments:
162 --   p_rec has been populated with the updated values the user would like the
163 --   record set to.
164 --
165 -- Post Success:
166 --   Processing continues if all the non updateable attributes have not
167 --   changed.
168 --
169 -- Post Failure:
170 --   An application error is raised if any of the non updatable attributes
171 --   have been altered.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure chk_non_updateable_args
176   (p_rec in per_ose_shd.g_rec_type
177   ) IS
178 --
179   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
180   l_error    EXCEPTION;
181   l_argument varchar2(30);
182 --
183 Begin
184   --
185   -- Only proceed with the validation if a row exists for the current
186   -- record in the HR Schema.
187   --
188   IF NOT per_ose_shd.api_updating
189       (p_org_structure_element_id             => p_rec.org_structure_element_id
190       ,p_object_version_number                => p_rec.object_version_number
191       ) THEN
192      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
193      fnd_message.set_token('PROCEDURE ', l_proc);
194      fnd_message.set_token('STEP ', '5');
195      fnd_message.raise_error;
196   END IF;
197   --
198   -- EDIT_HERE: Add checks to ensure non-updateable args have
199   --            not been updated.
200   --
201   if nvl(p_rec.business_group_id, hr_api.g_number) <>
202      nvl(per_ose_shd.g_old_rec.business_group_id
203         ,hr_api.g_number
204         ) then
205      l_argument := 'business_group_id';
206      raise l_error;
207   end if;
208   --
209   if nvl(p_rec.org_structure_version_id, hr_api.g_number) <>
210      nvl(per_ose_shd.g_old_rec.org_structure_version_id
211         ,hr_api.g_number
212         ) then
213      l_argument := 'org_structure_version_id';
214      raise l_error;
215   end if;
216   --
217 /* bug no 2720039 starts here
218 
219 Removing following check on oraganization hierarchy so that updation of
220 organization nodes can be done in it.We don't need to put extra check
221 for ensuring not having cycle into organization hierarcy because this
222 task is achieved by a constraint PER_ORG_STRUCTURE_ELEMENTS_UK2 according
223 to which ORG_STRUCTURE_VERSION_ID and ORGANIZATION_ID_CHILD is the unique
224 combination in table PER_ORG_STRUCTURE_ELEMENTS.
225 
226   if nvl(p_rec.organization_id_parent, hr_api.g_number) <>
227      nvl(per_ose_shd.g_old_rec.organization_id_parent
228         ,hr_api.g_number
229         ) then
230      l_argument := 'organization_id_parent';
231      raise l_error;
232   end if;
233 bug no 2720039 ends here
234 */
235   --
236   if nvl(p_rec.organization_id_child, hr_api.g_number) <>
237      nvl(per_ose_shd.g_old_rec.organization_id_child
238         ,hr_api.g_number
239         ) then
240      l_argument := 'organization_id_child';
241      raise l_error;
242   end if;
243   --
244   EXCEPTION
245     WHEN l_error THEN
246        hr_api.argument_changed_error
247          (p_api_name => l_proc
248          ,p_argument => l_argument);
249     WHEN OTHERS THEN
250        RAISE;
251 End chk_non_updateable_args;
252 --
253 -- -------------------------------------------------------------------------------
254 -- |---------------------------< chk_children_exist >----------------------------|
255 -- -------------------------------------------------------------------------------
256 PROCEDURE chk_children_exist
257             (p_org_structure_version_id in
258                      per_org_structure_elements.org_structure_version_id%TYPE
259             ,p_organization_id_child in
260                      per_org_structure_elements.organization_id_child%TYPE
261             ) is
262 --
263 l_temp VARCHAR2(1);
264 --
265 begin
266    --
267    -- Pre-delete checks for subordinate
268    -- organizations in the hierarchy.
269    --
270       select  null
271       into l_temp
272       from sys.dual
273       where exists (select null
274                      from per_org_structure_elements      ose
275                      where   ose.org_structure_version_id    =
276                                           p_org_structure_version_id
277                      and     ose.organization_id_parent      =
278                                           p_organization_id_child);
279       --
280       hr_utility.set_message('801','HR_6190_ORG_CHILDREN_EXIST');
281       hr_utility.raise_error;
282       --
283 exception
284          when no_data_found then
285             null;
286          when others then
287             raise;
288 end chk_children_exist;
289 --
290 -- ------------------------------------------------------------------------
291 -- |---------------------------< chk_top_org >----------------------------|
292 -- ------------------------------------------------------------------------
293 PROCEDURE chk_top_org
294              (p_org_structure_version_id
295                 in per_org_structure_elements.org_structure_version_id%TYPE
296                      ,p_org_structure_element_id
297                 in per_org_structure_elements.org_structure_element_id%TYPE
298                      ,p_organization_id_child
299                 in per_org_structure_elements.organization_id_child%TYPE
300                      ,p_organization_id_parent
301                 in per_org_structure_elements.organization_id_parent%TYPE
302              ) is
303 --
304 l_temp VARCHAR2(1);
305 --
306 begin
307    --
308    --
309    -- If the child org in the element = top org in an
310    -- security_profile and hierarchies are the same
311    -- then cannot delete it.
312    -- similarly if the parent_org in the element = top org in a
313    --security_profile and hierarchies are the same
314    -- then you cannot delete it if it is the parent of no other
315    -- org_structure_element for this version.
316    --
317          select null
318          into l_temp
319          from sys.dual
320          where exists( select null
321                      from per_security_profiles psp
322                      where   psp.include_top_organization_flag = 'Y'
323                      and     psp.organization_structure_id     =
324                            (select osv.organization_structure_id
325                            from    per_org_structure_versions osv
326                            where   osv.org_structure_version_id =
327                                  p_org_structure_version_id)
328                      and   ((psp.organization_id = p_organization_id_child)
329                         or(psp.organization_id = p_organization_id_parent
330                            and not exists (
331                               select  null
332                               from    per_org_structure_elements ose
333                               where   ose.org_structure_version_id  =
334                                        p_org_structure_version_id
335                               and     ose.organization_id_child     =
336                                        p_organization_id_parent
337                               )
338                            and     not exists (
339                               select  null
340                               from    per_org_structure_elements ose
341                               where   ose.org_structure_version_id  =
342                                        p_org_structure_version_id
343                               and     ose.org_structure_element_id  <>
344                                        p_org_structure_element_id
345                               and     ose.organization_id_parent    =
346                                        p_organization_id_parent
347                               )
348                            )
349                         ) );
350       --
351       hr_utility.set_message('801','HR_6753_ORG_HIER_SP_DEL');
352       hr_utility.raise_error;
353       --
354 exception
355          when no_data_found then
356             null;
357          when others then
358             raise;
359 end chk_top_org;
360 -- ------------------------------------------------------------------------
361 -- |---------------------------< chk_pa_org >----------------------------|
362 -- ------------------------------------------------------------------------
363 PROCEDURE chk_pa_org
364              (p_org_structure_element_id
365                 in per_org_structure_elements.org_structure_element_id%TYPE
366              ) is
367 begin
368    --
369    -- Run the validation PROCEDURE writtrn by PA development group.
370    --
371       pa_org.pa_ose_predel_validation(p_org_structure_element_id);
372 end chk_pa_org;
373 --
374 -- ------------------------------------------------------------------------
375 -- |---------------------------< chk_position_control >-------------------|
376 -- ------------------------------------------------------------------------
377 PROCEDURE chk_position_control
378              (p_org_structure_version_id in number
379              ,p_pos_control_enabled_flag in varchar2
380              ) is
381 
382 cursor c1 is
383 select str.position_control_structure_flg
384 from per_organization_structures str,
385      per_org_structure_versions osv
386 where osv.org_structure_version_id = p_org_structure_version_id
387 and osv.organization_structure_id = str.organization_structure_id;
388 
389 l_result varchar2(10);
390 
391 begin
392 --
393   --
394   -- If position control flag is set, ensure it is also
395   -- set for the hierarchy.
396   --
397 
398   if p_pos_control_enabled_flag = 'Y' then
399   --
400     open c1;
401     fetch c1 into l_result;
402 
403     if c1%found then
404     --
405       if l_result <> 'Y' then
406       --
407         close c1;
408         hr_utility.set_message('800','PER_50055_NON_POS_CTRL_STRUCT');
409         hr_utility.raise_error;
410       --
411       end if;
412     --
413     end if;
414 
415     close c1;
416   --
417   end if;
418 --
419 end chk_position_control;
420 
421 -- -----------------------------------------------------------------------------
422 -- |--------------------< chk_org_structure_version_id >------------------------|
423 -- -----------------------------------------------------------------------------
424 --  Description:
425 --    Validates that the mandatory structure version id is supplied and that it
426 --    exists in per_org_structure_versions for the business group on the
427 --    effective date (Insert Only).
428 --
429 --  Pre-conditions:
430 --   Business group is valid
431 --
432 --  In Arguments:
433 --    p_org_structure_element_id
434 --    p_business_group_id
435 --    p_org_structure_version_id
436 --    p_effective_date
437 --
438 --  Post Success:
439 --    If a row does exist in per_org_structure_versions for the given id and
440 --    business group then processing continues.
441 --
442 --  Post Failure:
443 --    Processing stops and an error is raised.
444 --
445 --  Access Status:
446 --    Internal Table Handler Use Only.
447 --
448 PROCEDURE chk_org_structure_version_id(p_org_structure_element_id in NUMBER
449                                       ,p_business_group_id in NUMBER
450                                       ,p_org_structure_version_id in NUMBER
451                                       ,p_effective_date in DATE) IS
452 
453 CURSOR csr_org_structure_versions IS
454   SELECT 'X'
455   from per_org_structure_versions osv
456   where osv.org_structure_version_id = p_org_structure_version_id
457   and (osv.business_group_id = p_business_group_id or p_business_group_id is null)
458   and p_effective_date between osv.DATE_FROM
459                        and nvl(osv.DATE_TO,hr_general.end_of_time);
460 
461  l_dummy varchar2(1);
462  l_proc  varchar2(100) := g_package||'chk_org_structure_version_id';
463 
464 begin
465   hr_utility.set_location('Entering:'||l_proc, 1);
466   --
467   -- Check mandatory parameters have been set
468   --
469  /*  --  Bug fix 3065432
470     Removed the condition which raises an error if business_group_id is
471    null value */
472 
473   hr_api.mandatory_arg_error
474     (p_api_name       => l_proc
475     ,p_argument       => 'p_effective_date'
476     ,p_argument_value => p_effective_date
477     );
478   --
479   --
480   if p_org_structure_version_id is null then
481      hr_utility.set_message(800,'HR_289731_ORG_VER_NULL');
482      hr_utility.raise_error;
483   else
484     --
485     hr_utility.set_location(l_proc, 5);
486     --
487     -- Only proceed with validation if :
488     -- a) Inserting (org_structure_version_id is non updateable)
489     --
490     if (p_org_structure_element_id is null) then
491 
492       open csr_org_structure_versions;
493       fetch csr_org_structure_versions into l_dummy;
494       if csr_org_structure_versions%notfound then
495         close csr_org_structure_versions;
496         hr_utility.set_message(800,'HR_289732_ORG_VER_INV');
497         hr_utility.raise_error;
498       end if;
499       close csr_org_structure_versions;
500 
501     end if;
502   end if;
503   hr_utility.set_location('Leaving:'||l_proc, 10);
504 
505 end chk_org_structure_version_id;
506 
507 -- -----------------------------------------------------------------------------
508 -- |-------------------< chk_parent_child_org_id >------------------------|
509 -- -----------------------------------------------------------------------------
510 --  Description:
511 --    Validates that both the parent and subordinate orgs are supplied and
512 --    exist in hr_all_organization_units for the business group (if not global)
513 --    on the effective_date.
514 --    Also checks that the subordinate org is unique within the structure
515 --    version, to prevent circular hierarchies. (Insert Only).
516 --
517 --  Pre-conditions:
518 --   Business group is valid
519 --   Structure version is valid.
520 --
521 --  In Arguments:
522 --    p_org_structure_element_id
523 --    p_business_group_id
524 --    p_effective_date
525 --    p_org_structure_version_id
526 --    p_organization_id_parent
527 --    p_organization_id_child
528 --
529 --  Post Success:
530 --    Processing continues
531 --
532 --  Post Failure:
533 --    Processing stops and an error is raised.
534 --
535 --  Access Status:
536 --    Internal Table Handler Use Only.
537 --
538 PROCEDURE chk_parent_child_org_id(p_org_structure_element_id in NUMBER
539                                  ,p_business_group_id in NUMBER
540                                  ,p_effective_date in DATE
541                                  ,p_org_structure_version_id in NUMBER
542                                  ,p_organization_id_parent in NUMBER
543                                  ,p_organization_id_child in NUMBER) IS
544 
545  CURSOR csr_org (p_org_id in NUMBER) IS
546   SELECT 'X'
547   from hr_all_organization_units org
548   where org.organization_id = p_org_id
549   and (org.business_group_id = p_business_group_id
550        or p_business_group_id is null)
551   and p_effective_date between org.DATE_FROM
552                        and nvl(org.DATE_TO,hr_general.end_of_time);
553 
554   CURSOR csr_ele IS
555   SELECT 'X'
556   from per_org_structure_elements ele
557   where ele.org_structure_version_id = p_org_structure_version_id
558   and ele.organization_id_child = p_organization_id_child;
559 
560   --- bug fix 3820767 starts here
561   CURSOR csr_chk_circular IS
562   SELECT organization_id_parent
563     from per_org_structure_elements
564     where org_structure_version_id=p_org_structure_version_id
565     START WITH organization_id_child=p_organization_id_parent
566       and  org_structure_version_id=p_org_structure_version_id
567     CONNECT BY organization_id_child= prior organization_id_parent
568       and org_structure_version_id=p_org_structure_version_id ;
569 ----  bug fix 3820767 ends here
570  l_dummy varchar2(1);
571  l_proc  varchar2(100) := g_package||'chk_parent_child_organization_id';
572 
573 begin
574  hr_utility.set_location('Entering:'||l_proc, 1);
575   --
576   -- Check mandatory parameters have been set
577   --
578 /*  --  Bug fix 3065432
579    Removed the condition which raises an error if business_group_id is
580    null value */
581   hr_api.mandatory_arg_error
582     (p_api_name       => l_proc
583     ,p_argument       => 'p_effective_date'
584     ,p_argument_value => p_effective_date
585     );
586   --
587   --
588   if p_organization_id_parent is null or p_organization_id_child IS null then
589      hr_utility.set_message(800,'HR_289733_ORG_NULL');
590      hr_utility.raise_error;
591   else
592     --
593 --
594     hr_utility.set_location(l_proc, 5);
595     --
596     -- Only proceed with validation if :
597     -- a) Inserting (parent or child org id are non-updateable)
598     --
599     if (p_org_structure_element_id is null) then
600       -- check parent org exists
601       open csr_org(p_org_id => p_organization_id_parent);
602       fetch csr_org into l_dummy;
603       if csr_org%notfound then
604         close csr_org;
605         hr_utility.set_message(800,'HR_289734_PARENT_ORG_INV');
606         hr_utility.raise_error;
607       end if;
608       close csr_org;
609 
610       hr_utility.set_location(l_proc, 20);
611       -- check child org exists
612       open csr_org(p_organization_id_child);
613       fetch csr_org into l_dummy;
614       if csr_org%notfound then
615         close csr_org;
616         hr_utility.set_message(800,'HR_289735_CHILD_ORG_INV');
617         hr_utility.raise_error;
618       end if;
619       close csr_org;
620    ---
621    --- bug fix 3820767 starts here
622    ---
623    -- check if child is the same as parent
624       if p_organization_id_child =p_organization_id_parent then
625                hr_utility.set_message(800,'HR_449550_ORG_PAR_CHILD_EQUAL');
626                hr_utility.raise_error;
627       end if;
628    ---
629     hr_utility.set_location(l_proc, 25);
630      -- check for circular hierarchies
631      for c_rec in csr_chk_circular
632      loop
633        if c_rec.organization_id_parent = p_organization_id_child
634        then
635          -- This will cause circular hierarchies
636         hr_utility.set_message(800,'HR_449549_CIRCULAR_HIER');
637         hr_utility.raise_error;
638      end if;
639     end loop;
640    --
641    -- bug fix 3820767 ends here
642    --
643       hr_utility.set_location(l_proc, 30);
644       -- check child is unique within the structure
645       open csr_ele;
646       fetch csr_ele into l_dummy;
647       if csr_ele%found then
648         close csr_ele;
649         hr_utility.set_message(800,'HR_289736_CHILD_ORG_EXISTS');
650         hr_utility.raise_error;
651       end if;
652       close csr_ele;
653 
654     end if;
655   end if;
656 
657   hr_utility.set_location('Leaving:'||l_proc, 50);
658 --
659 end chk_parent_child_org_id;
660 --
661 --
662 -- ----------------------------------------------------------------------------
663 -- |---------------------------< insert_validate >----------------------------|
664 -- ----------------------------------------------------------------------------
665 Procedure insert_validate
666   (p_rec                          in per_ose_shd.g_rec_type
667   ,p_effective_date               in date
668   ) is
669 --
670   l_proc  varchar2(72) := g_package||'insert_validate';
671   l_exists_in_hierarchy varchar2(1);
672 --
673 Begin
674   hr_utility.set_location('Entering:'||l_proc, 5);
675   --
676   -- Call all supporting business operations
677   --
678   -- EDIT_HERE: The following call to hr_api.validate_bus_grp_id
679   -- will only be valid when the business_group_id is not null.
680   -- As this column is defined as optional on the table then
681   -- different logic will be required to handle the null case.
682   -- If this is a start-up data entity then:
683   --    a) add code to stop null values being processed by this
684   --       row handler
685   -- If this is not a start-up data entity then either:
686   --    b) ignore the security_group_id value held in
687   --       client_info.  This includes performing lookup
691   -- Remove this comment when the edit has been completed.
688   --       validation against the HR_STANDARD_LOOKUPS view.
689   -- or c) (less likely) ensure the correct security_group_id
690   --       value is set in client_info.
692   if p_rec.business_group_id is not null then
693      hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
694   end if;
695   --
696   chk_org_structure_version_id(p_org_structure_element_id => p_rec.org_structure_element_id
697                               ,p_business_group_id        => p_rec.business_group_id
698                               ,p_org_structure_version_id => p_rec.org_structure_version_id
699                               ,p_effective_date           => p_effective_date);
700 
701 
702   chk_parent_child_org_id(p_org_structure_element_id => p_rec.org_structure_element_id
703                          ,p_business_group_id        => p_rec.business_group_id
704                          ,p_effective_date           => p_effective_date
705                          ,p_org_structure_version_id => p_rec.org_structure_version_id
706                          ,p_organization_id_parent   => p_rec.organization_id_parent
707                          ,p_organization_id_child    => p_rec.organization_id_child);
708 
709   chk_position_control
710              (p_org_structure_version_id => p_rec.org_structure_version_id
711              ,p_pos_control_enabled_flag => p_rec.position_control_enabled_flag
712              );
713   per_ose_del.chk_org_in_hierarchy
714              (p_org_structure_version_id => p_rec.org_structure_version_id
715              ,p_organization_id          => p_rec.organization_id_child
716              ,p_exists_in_hierarchy      => l_exists_in_hierarchy
717              );
718 if l_exists_in_hierarchy = 'Y' then
719 fnd_message.set_name('PER', 'HR_289572_EXISTS_IN_HIERARCHY');
720 fnd_message.raise_error;
721 end if;
722   --
723   hr_utility.set_location(' Leaving:'||l_proc, 10);
724 End insert_validate;
725 --
726 -- ----------------------------------------------------------------------------
727 -- |---------------------------< update_validate >----------------------------|
728 -- ----------------------------------------------------------------------------
729 Procedure update_validate
730   (p_rec                          in per_ose_shd.g_rec_type
731   ,p_effective_date               in date
732   ) is
733 --
734   l_proc  varchar2(72) := g_package||'update_validate';
735   l_exists_in_hierarchy varchar2(1);
736 --
737 Begin
738   hr_utility.set_location('Entering:'||l_proc, 5);
739   --
740   -- Call all supporting business operations
741   --
742   -- EDIT_HERE: The following call to hr_api.validate_bus_grp_id
743   -- will only be valid when the business_group_id is not null.
744   -- As this column is defined as optional on the table then
745   -- different logic will be required to handle the null case.
746   -- If this is a start-up data entity then:
747   --    a) add code to stop null values being processed by this
748   --       row handler
749   -- If this is not a start-up data entity then either:
750   --    b) ignore the security_group_id value held in
751   --       client_info.  This includes performing lookup
752   --       validation against the HR_STANDARD_LOOKUPS view.
753   -- or c) (less likely) ensure the correct security_group_id
754   --       value is set in client_info.
755   -- Remove this comment when the edit has been completed.
756   -- commented out pzwalker
757   -- hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
758   --
759   chk_non_updateable_args
760     (p_rec              => p_rec
761     );
762   --
763 
764   chk_position_control
765              (p_org_structure_version_id => p_rec.org_structure_version_id
766              ,p_pos_control_enabled_flag => p_rec.position_control_enabled_flag
767              );
768   --
769 /*
770   -- we should not be updating parent or child ids for the element  - PERWSDPH.fmb does not allow it
771   -- and the form and api behaviour should be consistent.
772 
773   per_ose_del.chk_org_in_hierarchy
774              (p_org_structure_version_id => p_rec.org_structure_version_id
775              ,p_organization_id          => p_rec.organization_id_child
776              ,p_exists_in_hierarchy      => l_exists_in_hierarchy
777              );
778 
779 if l_exists_in_hierarchy = 'Y' then
780 fnd_message.set_name('PER', 'HR_289572_EXISTS_IN_HIERARCHY');
781 fnd_message.raise_error;
782 end if;
783 */
784 
785   hr_utility.set_location(' Leaving:'||l_proc, 10);
786 End update_validate;
787 --
788 -- ----------------------------------------------------------------------------
789 -- |---------------------------< delete_validate >----------------------------|
790 -- ----------------------------------------------------------------------------
791 Procedure delete_validate
792   (p_rec                          in per_ose_shd.g_rec_type
793   ,p_hr_installed                 in VARCHAR2
794   ,p_pa_installed                 in VARCHAR2
795   ,p_chk_children_exist           in VARCHAR2
796   ) is
797 --
798   l_proc  varchar2(72) := g_package||'delete_validate';
799 --
800 Begin
801   hr_utility.set_location('Entering:'||l_proc, 5);
802   --
803   -- Call all supporting business operations
804   --
805   if p_chk_children_exist = 'Y' then
806       per_ose_bus.chk_children_exist
807               (p_org_structure_version_id => p_rec.org_structure_version_id
808               ,p_organization_id_child => p_rec.organization_id_child
809               );
810   end if;
811   --
812   if p_hr_installed = 'I' then
813       per_ose_bus.chk_top_org
814               (p_org_structure_version_id => p_rec.org_structure_version_id
815               ,p_org_structure_element_id => p_rec.org_structure_element_id
816               ,p_organization_id_child    => p_rec.organization_id_child
817               ,p_organization_id_parent   => p_rec.organization_id_parent
818               );
819   end if;
820   --
821   if p_pa_installed = 'I' then
822       per_ose_bus.chk_pa_org
823               (p_org_structure_element_id => p_rec.org_structure_element_id
824               );
825   end if;
826   --
827   hr_utility.set_location(' Leaving:'||l_proc, 10);
828 End delete_validate;
829 --
830 end per_ose_bus;