1 package body ffstup as
2 /* $Header: ffstup.pkb 115.0 99/07/16 02:03:31 porting ship $ */
3 /*
4 Copyright (c) Oracle Corporation (UK) Ltd 1993.
5 All rights reserved
6
7 Name: ffstup
8
9 Description: Handles forms behaviour and validation in various modes such
10 as startup and normal modes
11 Change List
12 -----------
13 P Gowers 10-MAR-1993 Rename package to ffstup
14 P Gowers 03-MAR-1993 Creation
15 A Roussel 27-OCT-1994 Moved header to after create/replace
16 */
17 ------------------------------- PRIVATE GLOBALS -------------------------------
18 --
19 MASTER_MODE CONSTANT varchar2(7) := 'MASTER';
20 SEED_MODE CONSTANT varchar2(5) := 'SEED';
21 NON_SEED_MODE CONSTANT varchar2(9) := 'NON-SEED';
22 --
23 -------------------------------- check_change --------------------------------
24 /*
25 NAME
26 check_change
27 DESCRIPTION
28 Checks startup_mode, business group and legislation and determines
29 whether a change is allowed. Doesn't actually check values of business
30 group or legislation (assumes you can only see legal combinations).
31 If allowed, returns TRUE, otherwise returns FALSE.
32 */
33 function check_change (p_startup_mode in varchar2,
34 p_bus_grp in number,
35 p_leg_code in varchar2) return boolean is
36 begin
37 if (p_startup_mode = NON_SEED_MODE) then
38 -- Can only allow change if record is non-seed (ie both are not null)
39 if (p_bus_grp is null OR p_leg_code is null) then
40 return FALSE;
41 else
42 return TRUE;
43 end if;
44 elsif (p_startup_mode = SEED_MODE) then
45 -- Can only allow change if record is seed (ie legislation is not null)
46 if (p_leg_code is null) then
47 return FALSE;
48 else
49 return TRUE;
50 end if;
51 elsif (p_startup_mode = MASTER_MODE) then
52 -- If in master mode, can only see master records, so delete must be OK
53 return TRUE;
54 else
55 -- Trap logic error
56 hr_utility.raise_error;
57 end if;
58 end check_change;
59 --
60 ---------------------------------- get_mode ----------------------------------
61 /*
62 NAME
63 get_mode
64 DESCRIPTION
65 Returns mode based on business group and legislation.
66 */
67 function get_mode(p_bus_grp in number,
68 p_leg_code in varchar2) return varchar2 is
69 begin
70 if (p_bus_grp is not null) then
71 return NON_SEED_MODE;
72 elsif (p_bus_grp is null and p_leg_code is not null) then
73 return SEED_MODE;
74 else
75 return MASTER_MODE;
76 end if;
77 end get_mode;
78 --
79 end ffstup;